Group.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_GROUP_H
#define SURGSIM_GRAPHICS_GROUP_H
#include "SurgSim/Framework/Component.h"
#include <memory>
#include <vector>
namespace SurgSim
{
namespace Graphics
{
class Representation;
class Group
{
public:
explicit Group(const std::string& name);
virtual ~Group();
virtual void setVisible(bool visible) = 0;
virtual bool isVisible() const = 0;
virtual bool add(std::shared_ptr<Representation> representation);
virtual bool append(std::shared_ptr<Group> group);
virtual bool remove(std::shared_ptr<Representation> representation);
const std::vector<std::shared_ptr<Representation>>& getMembers() const;
virtual void clear();
std::string getName() const;
private:
std::string m_name;
std::vector<std::shared_ptr<Representation>> m_representations;
};
}; // namespace Graphics
}; // namespace SurgSim
#endif // SURGSIM_GRAPHICS_GROUP_H
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Graphics::Group::m_name
std::string m_name
Definition: Group.h:82
SurgSim::Graphics::Group::isVisible
virtual bool isVisible() const =0
Gets whether the group is currently visible.
Component.h
SurgSim::Graphics::Group::clear
virtual void clear()
Removes all representations.
Definition: Group.cpp:76
SurgSim::Graphics::Group::getMembers
const std::vector< std::shared_ptr< Representation > > & getMembers() const
Definition: Group.cpp:71
SurgSim::Graphics::Group::setVisible
virtual void setVisible(bool visible)=0
Sets whether the group is currently visible.
SurgSim::Graphics::Group::~Group
virtual ~Group()
Destructor.
Definition: Group.cpp:30
SurgSim::Graphics::Group
Base graphics group class, which defines the interface that all graphics groups must implement...
Definition: Group.h:36
SurgSim::Graphics::Group::m_representations
std::vector< std::shared_ptr< Representation > > m_representations
Representations in this group.
Definition: Group.h:85
SurgSim::Graphics::Group::Group
Group(const std::string &name)
Constructor.
Definition: Group.cpp:25
SurgSim::Graphics::Group::append
virtual bool append(std::shared_ptr< Group > group)
Adds all representations in another group to this group.
Definition: Group.cpp:45
SurgSim::Graphics::Group::add
virtual bool add(std::shared_ptr< Representation > representation)
Adds an representation.
Definition: Group.cpp:34
SurgSim::Graphics::Group::getName
std::string getName() const
Definition: Group.cpp:81