opensurgsim
Group.h
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_GRAPHICS_GROUP_H
17 #define SURGSIM_GRAPHICS_GROUP_H
18 
19 #include "SurgSim/Framework/Component.h"
20 
21 #include <memory>
22 #include <vector>
23 
24 namespace SurgSim
25 {
26 
27 namespace Graphics
28 {
29 
30 class Representation;
31 
36 class Group
37 {
38 public:
42  explicit Group(const std::string& name);
43 
45  virtual ~Group();
46 
49  virtual void setVisible(bool visible) = 0;
50 
53  virtual bool isVisible() const = 0;
54 
58  virtual bool add(std::shared_ptr<Representation> representation);
59 
63  virtual bool append(std::shared_ptr<Group> group);
64 
69  virtual bool remove(std::shared_ptr<Representation> representation);
70 
72  const std::vector<std::shared_ptr<Representation>>& getMembers() const;
73 
75  virtual void clear();
76 
78  std::string getName() const;
79 
80 private:
81 
82  std::string m_name;
83 
85  std::vector<std::shared_ptr<Representation>> m_representations;
86 };
87 
88 }; // namespace Graphics
89 
90 }; // namespace SurgSim
91 
92 #endif // SURGSIM_GRAPHICS_GROUP_H
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
virtual bool isVisible() const =0
Gets whether the group is currently visible.
virtual void clear()
Removes all representations.
Definition: Group.cpp:76
const std::vector< std::shared_ptr< Representation > > & getMembers() const
Definition: Group.cpp:71
virtual void setVisible(bool visible)=0
Sets whether the group is currently visible.
virtual ~Group()
Destructor.
Definition: Group.cpp:30
Base graphics group class, which defines the interface that all graphics groups must implement...
Definition: Group.h:36
Group(const std::string &name)
Constructor.
Definition: Group.cpp:25
virtual bool append(std::shared_ptr< Group > group)
Adds all representations in another group to this group.
Definition: Group.cpp:45
virtual bool add(std::shared_ptr< Representation > representation)
Adds an representation.
Definition: Group.cpp:34
std::string getName() const
Definition: Group.cpp:81