Go to the documentation of this file.
16 #ifndef SURGSIM_FRAMEWORK_SCENEELEMENT_H
17 #define SURGSIM_FRAMEWORK_SCENEELEMENT_H
20 #include <boost/any.hpp>
23 #include <unordered_map>
24 #include <unordered_set>
51 class SceneElement :
public std::enable_shared_from_this<SceneElement>
90 std::vector<std::shared_ptr<Component>>
getComponents()
const;
140 void setGroups(
const std::vector<std::string>& groups);
143 std::vector<std::string>
getGroups()
const;
173 void setScene(std::weak_ptr<Scene> scene);
181 void setRuntime(std::weak_ptr<Runtime> runtime);
209 virtual YAML::Node
encode(
bool standalone)
const;
215 virtual bool decode(
const YAML::Node& node);
226 std::shared_ptr<SurgSim::Framework::PoseComponent>
m_pose;
229 std::unordered_map<std::string, std::shared_ptr<Component>>
m_components;
260 #endif // SURGSIM_FRAMEWORK_SCENEELEMENT_H
std::shared_ptr< Scene > getScene()
Gets the Scene.
Definition: SceneElement.cpp:233
std::vector< std::string > getGroups() const
Definition: SceneElement.cpp:407
std::string getName() const
Return the name of this SceneElement.
Definition: SceneElement.cpp:175
void addToGroup(const std::string &group)
Add this scene element to the given group.
Definition: SceneElement.cpp:377
virtual ~SceneElement()
Destructor.
Definition: SceneElement.cpp:44
std::shared_ptr< Component > getComponent(const std::string &name) const
Gets the component identified by name.
Definition: SceneElement.cpp:136
std::shared_ptr< Runtime > getRuntime()
Gets the runtime.
Definition: SceneElement.cpp:243
std::weak_ptr< Runtime > m_runtime
A (weak) back pointer to the Runtime containing this SceneElement.
Definition: SceneElement.h:235
Eigen::Transform< double, 3, Eigen::Isometry > RigidTransform3d
A 3D rigid (isometric) transform, represented as doubles.
Definition: RigidTransform.h:46
bool initializeComponent(std::shared_ptr< SurgSim::Framework::Component > component)
Initialize the given component.
Definition: SceneElement.cpp:168
void setName(const std::string &name)
Sets the name of this SceneElement.
Definition: SceneElement.cpp:267
const SurgSim::Math::RigidTransform3d & getPose() const
Get the pose of this SceneElement.
Definition: SceneElement.cpp:185
bool m_isInitialized
Indicates if this SceneElement has been initialized or not.
Definition: SceneElement.h:249
Definition: DataStructuresConvert.h:28
std::vector< std::shared_ptr< Component > > getComponents() const
Gets all the components of this SceneElement.
Definition: SceneElement.cpp:195
virtual std::string getClassName() const
Definition: SceneElement.cpp:361
Definition: CompoundShapeToGraphics.cpp:29
std::unordered_map< std::string, std::shared_ptr< Component > > m_components
A collection of Components.
Definition: SceneElement.h:229
std::shared_ptr< SceneElement > getSharedPtr()
Gets a shared pointer to this SceneElement.
Definition: SceneElement.cpp:253
std::unordered_set< std::string > m_groups
Local groups for serialization local handling.
Definition: SceneElement.h:238
std::string m_name
Name of this SceneElement.
Definition: SceneElement.h:224
bool addComponent(std::shared_ptr< Component > component)
Adds a component, calls initialize() on the component, if SceneElement::isInitialized() is true.
Definition: SceneElement.cpp:49
void setActive(bool val)
Set this SceneElement's status (active/inactive)
Definition: SceneElement.cpp:367
void removeFromGroup(const std::string &group)
Remove this scene element from the given group.
Definition: SceneElement.cpp:386
bool m_isActive
Indicates if this SceneElement is active or not.
Definition: SceneElement.h:252
void setGroups(const std::vector< std::string > &groups)
Set the groups of this scene element.
Definition: SceneElement.cpp:395
void setScene(std::weak_ptr< Scene > scene)
Sets the Scene.
Definition: SceneElement.cpp:224
bool isActive() const
Definition: SceneElement.cpp:372
T getValue(const std::string &component, const std::string &property) const
Retrieves the property value from a component.
Definition: SceneElement-inl.h:47
virtual bool doInitialize()=0
Method to initialize this SceneElement.
bool removeComponent(std::shared_ptr< Component > component)
Removes a given component.
Definition: SceneElement.cpp:94
virtual YAML::Node encode(bool standalone) const
Convert to a YAML::Node.
Definition: SceneElement.cpp:272
SceneElement is the basic part of a scene, it is a container of components.
Definition: SceneElement.h:51
void removeComponents()
Removes all components.
Definition: SceneElement.cpp:119
void setValue(const std::string &component, const std::string &property, const boost::any &value)
Sets the property value of a component.
Definition: SceneElement.cpp:215
virtual bool decode(const YAML::Node &node)
Pull data from a YAML::Node.
Definition: SceneElement.cpp:301
void setRuntime(std::weak_ptr< Runtime > runtime)
Sets the Runtime.
Definition: SceneElement.cpp:238
SceneElement(const std::string &name)
Constructor.
Definition: SceneElement.cpp:34
bool isInitialized() const
Return if this SceneElement is initialized.
Definition: SceneElement.cpp:248
string(TOUPPER ${DEVICE} DEVICE_UPPER_CASE) option(BUILD_DEVICE_$
Definition: CMakeLists.txt:38
std::shared_ptr< SurgSim::Framework::PoseComponent > m_pose
Definition: SceneElement.h:226
bool inGroup(const std::string &name)
Test whether this SceneElement is in a specific group.
Definition: SceneElement.cpp:412
std::shared_ptr< PoseComponent > getPoseComponent()
Get the PoseComponent that controls the pose all Representations in this SceneElement.
Definition: SceneElement.cpp:190
std::weak_ptr< Scene > m_scene
A (weak) back pointer to the Scene containing this SceneElement.
Definition: SceneElement.h:232
bool initialize()
Executes the initialize operation.
Definition: SceneElement.cpp:148
void setPose(const SurgSim::Math::RigidTransform3d &pose)
Set the pose of this SceneElement.
Definition: SceneElement.cpp:180