opensurgsim
OsgGroup.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_OSGGROUP_H
17 #define SURGSIM_GRAPHICS_OSGGROUP_H
18 
19 #include "SurgSim/Graphics/Group.h"
20 
21 #include <osg/Group>
22 #include <osg/Switch>
23 
24 namespace SurgSim
25 {
26 
27 namespace Graphics
28 {
29 
33 class OsgGroup : public Group
34 {
35 public:
38  explicit OsgGroup(const std::string& name);
39 
42  void setVisible(bool visible) override;
43 
46  bool isVisible() const override;
47 
52  bool add(std::shared_ptr<Representation> representation) override;
53 
58  bool append(std::shared_ptr<Group> group) override;
59 
64  bool remove(std::shared_ptr<Representation> representation) override;
65 
67  void clear() override;
68 
70  osg::ref_ptr<osg::Group> getOsgGroup() const;
71 
72 private:
75  bool m_isVisible;
76 
79  osg::ref_ptr<osg::Switch> m_switch;
80 };
81 
82 }; // namespace Graphics
83 
84 }; // namespace SurgSim
85 
86 #endif // SURGSIM_GRAPHICS_OSGGROUP_H
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
bool append(std::shared_ptr< Group > group) override
Adds all representations in another group to this group.
Definition: OsgGroup.cpp:67
bool add(std::shared_ptr< Representation > representation) override
Adds an representation.
Definition: OsgGroup.cpp:51
bool isVisible() const override
Gets whether this group is currently visible.
Definition: OsgGroup.cpp:46
OSG implementation of a graphics group.
Definition: OsgGroup.h:33
void setVisible(bool visible) override
Sets whether this group is currently visible.
Definition: OsgGroup.cpp:32
osg::ref_ptr< osg::Group > getOsgGroup() const
Returns the root OSG group node.
Definition: OsgGroup.cpp:106
Base graphics group class, which defines the interface that all graphics groups must implement...
Definition: Group.h:36
void clear() override
Removes all representations.
Definition: OsgGroup.cpp:96
OsgGroup(const std::string &name)
Constructor.
Definition: OsgGroup.cpp:24