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>
63 virtual std::string getClassName()
const;
68 bool addComponent(std::shared_ptr<Component> component);
73 bool removeComponent(std::shared_ptr<Component> component);
78 bool removeComponent(
const std::string& name);
81 void removeComponents();
86 std::shared_ptr<Component> getComponent(
const std::string& name)
const;
90 std::vector<std::shared_ptr<Component>> getComponents()
const;
95 std::vector<std::shared_ptr<T>> getComponents()
const;
104 T getValue(
const std::string& component,
const std::string& property)
const;
111 boost::any getValue(
const std::string& component,
const std::string& property)
const;
121 bool getValue(
const std::string& component,
const std::string& property, T* value)
const;
128 void setValue(
const std::string& component,
const std::string& property,
const boost::any& value);
132 void addToGroup(
const std::string& group);
136 void removeFromGroup(
const std::string& group);
140 void setGroups(
const std::vector<std::string>& groups);
143 std::vector<std::string> getGroups()
const;
148 bool inGroup(
const std::string& name);
156 std::string getName()
const;
169 std::shared_ptr<PoseComponent> getPoseComponent();
173 void setScene(std::weak_ptr<Scene> scene);
177 std::shared_ptr<Scene> getScene();
181 void setRuntime(std::weak_ptr<Runtime> runtime);
184 std::shared_ptr<Runtime> getRuntime();
188 bool isInitialized()
const;
196 void setActive(
bool val);
199 bool isActive()
const;
203 std::shared_ptr<SceneElement> getSharedPtr();
209 virtual YAML::Node encode(
bool standalone)
const;
215 virtual bool decode(
const YAML::Node& node);
221 bool initializeComponent(std::shared_ptr<SurgSim::Framework::Component> component);
226 std::shared_ptr<SurgSim::Framework::PoseComponent>
m_pose;
229 std::unordered_map<std::string, std::shared_ptr<Component>>
m_components;
242 virtual bool doInitialize() = 0;
246 void setName(
const std::string& name);
260 #endif // SURGSIM_FRAMEWORK_SCENEELEMENT_H Definition: CompoundShapeToGraphics.cpp:29
bool m_isInitialized
Indicates if this SceneElement has been initialized or not.
Definition: SceneElement.h:249
std::weak_ptr< Runtime > m_runtime
A (weak) back pointer to the Runtime containing this SceneElement.
Definition: SceneElement.h:235
std::string m_name
Name of this SceneElement.
Definition: SceneElement.h:224
std::shared_ptr< SurgSim::Framework::PoseComponent > m_pose
Definition: SceneElement.h:226
bool m_isActive
Indicates if this SceneElement is active or not.
Definition: SceneElement.h:252
Eigen::Transform< double, 3, Eigen::Isometry > RigidTransform3d
A 3D rigid (isometric) transform, represented as doubles.
Definition: RigidTransform.h:46
Definition: DataStructuresConvert.h:28
std::weak_ptr< Scene > m_scene
A (weak) back pointer to the Scene containing this SceneElement.
Definition: SceneElement.h:232
SceneElement is the basic part of a scene, it is a container of components.
Definition: SceneElement.h:51
std::unordered_map< std::string, std::shared_ptr< Component > > m_components
A collection of Components.
Definition: SceneElement.h:229
std::unordered_set< std::string > m_groups
Local groups for serialization local handling.
Definition: SceneElement.h:238