OsgGroup.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013, SimQuest Solutions Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SURGSIM_GRAPHICS_OSGGROUP_H
#define SURGSIM_GRAPHICS_OSGGROUP_H
#include "SurgSim/Graphics/Group.h"
#include <osg/Group>
#include <osg/Switch>
namespace SurgSim
{
namespace Graphics
{
class OsgGroup : public Group
{
public:
explicit OsgGroup(const std::string& name);
void setVisible(bool visible) override;
bool isVisible() const override;
bool add(std::shared_ptr<Representation> representation) override;
bool append(std::shared_ptr<Group> group) override;
bool remove(std::shared_ptr<Representation> representation) override;
void clear() override;
osg::ref_ptr<osg::Group> getOsgGroup() const;
private:
bool m_isVisible;
osg::ref_ptr<osg::Switch> m_switch;
};
}; // namespace Graphics
}; // namespace SurgSim
#endif // SURGSIM_GRAPHICS_OSGGROUP_H
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Graphics::OsgGroup::append
bool append(std::shared_ptr< Group > group) override
Adds all representations in another group to this group.
Definition: OsgGroup.cpp:67
Group.h
SurgSim::Graphics::OsgGroup::add
bool add(std::shared_ptr< Representation > representation) override
Adds an representation.
Definition: OsgGroup.cpp:51
SurgSim::Graphics::OsgGroup::isVisible
bool isVisible() const override
Gets whether this group is currently visible.
Definition: OsgGroup.cpp:46
SurgSim::Graphics::OsgGroup
OSG implementation of a graphics group.
Definition: OsgGroup.h:33
SurgSim::Graphics::OsgGroup::setVisible
void setVisible(bool visible) override
Sets whether this group is currently visible.
Definition: OsgGroup.cpp:32
SurgSim::Graphics::OsgGroup::getOsgGroup
osg::ref_ptr< osg::Group > getOsgGroup() const
Returns the root OSG group node.
Definition: OsgGroup.cpp:106
SurgSim::Graphics::OsgGroup::m_isVisible
bool m_isVisible
Whether the group is currently visible or not Newly added representations or groups will have this vi...
Definition: OsgGroup.h:75
SurgSim::Graphics::OsgGroup::m_switch
osg::ref_ptr< osg::Switch > m_switch
OSG group node A switch is used to provide visibility functionality.
Definition: OsgGroup.h:79
SurgSim::Graphics::Group
Base graphics group class, which defines the interface that all graphics groups must implement...
Definition: Group.h:36
SurgSim::Graphics::OsgGroup::clear
void clear() override
Removes all representations.
Definition: OsgGroup.cpp:96
SurgSim::Graphics::OsgGroup::OsgGroup
OsgGroup(const std::string &name)
Constructor.
Definition: OsgGroup.cpp:24