16 #ifndef SURGSIM_FRAMEWORK_SCENEELEMENT_H
17 #define SURGSIM_FRAMEWORK_SCENEELEMENT_H
22 #include <unordered_map>
48 class SceneElement :
public std::enable_shared_from_this<SceneElement>
80 std::shared_ptr<Component>
getComponent(
const std::string& name)
const;
84 std::vector<std::shared_ptr<Component> >
getComponents()
const;
114 void setScene(std::weak_ptr<Scene> scene);
122 void setRuntime(std::weak_ptr<Runtime> runtime);
150 virtual YAML::Node
encode(
bool standalone)
const;
156 virtual bool decode(
const YAML::Node& node);
167 std::shared_ptr<SurgSim::Framework::PoseComponent>
m_pose;
170 std::unordered_map<std::string, std::shared_ptr<Component>>
m_components;
184 void setName(
const std::string& name);
198 #endif // SURGSIM_FRAMEWORK_SCENEELEMENT_H
Definition: DriveElementFromInputBehavior.cpp:27
bool m_isInitialized
Indicates if this SceneElement has been initialized or not.
Definition: SceneElement.h:187
std::shared_ptr< PoseComponent > getPoseComponent()
Get the PoseComponent that controls the pose all Representations in this SceneElement.
Definition: SceneElement.cpp:151
void setRuntime(std::weak_ptr< Runtime > runtime)
Sets the Runtime.
Definition: SceneElement.cpp:181
std::shared_ptr< Runtime > getRuntime()
Gets the runtime.
Definition: SceneElement.cpp:186
bool initializeComponent(std::shared_ptr< SurgSim::Framework::Component > component)
Initialize the given component.
Definition: SceneElement.cpp:130
virtual bool decode(const YAML::Node &node)
Pull data from a YAML::Node.
Definition: SceneElement.cpp:237
virtual std::string getClassName() const
Definition: SceneElement.cpp:278
const SurgSim::Math::RigidTransform3d & getPose() const
Get the pose of this SceneElement.
Definition: SceneElement.cpp:146
std::string getName() const
Return the name of this SceneElement.
Definition: SceneElement.cpp:136
void setPose(const SurgSim::Math::RigidTransform3d &pose)
Set the pose of this SceneElement.
Definition: SceneElement.cpp:141
std::shared_ptr< Component > getComponent(const std::string &name) const
Gets the component identified by name.
Definition: SceneElement.cpp:98
std::weak_ptr< Runtime > m_runtime
A (weak) back pointer to the Runtime containing this SceneElement.
Definition: SceneElement.h:176
std::string m_name
Name of this SceneElement.
Definition: SceneElement.h:165
std::shared_ptr< SceneElement > getSharedPtr()
Gets a shared pointer to this SceneElement.
Definition: SceneElement.cpp:196
std::shared_ptr< SurgSim::Framework::PoseComponent > m_pose
Definition: SceneElement.h:167
virtual YAML::Node encode(bool standalone) const
Convert to a YAML::Node.
Definition: SceneElement.cpp:215
virtual bool doInitialize()=0
Method to initialize this SceneElement.
void setName(const std::string &name)
Sets the name of this SceneElement.
Definition: SceneElement.cpp:210
bool m_isActive
Indicates if this SceneElement is active or not.
Definition: SceneElement.h:190
bool isActive() const
Definition: SceneElement.cpp:289
Eigen::Transform< double, 3, Eigen::Isometry > RigidTransform3d
A 3D rigid (isometric) transform, represented as doubles.
Definition: RigidTransform.h:46
bool isInitialized() const
Return if this SceneElement is initialized.
Definition: SceneElement.cpp:191
bool addComponent(std::shared_ptr< Component > component)
Adds a component, calls initialize() on the component, if SceneElement::isInitialized() is true...
Definition: SceneElement.cpp:46
bool removeComponent(std::shared_ptr< Component > component)
Removes a given component.
Definition: SceneElement.cpp:82
std::vector< std::shared_ptr< Component > > getComponents() const
Gets all the components of this SceneElement.
Definition: SceneElement.cpp:156
Definition: DataStructuresConvert.h:28
virtual ~SceneElement()
Destructor.
Definition: SceneElement.cpp:41
std::weak_ptr< Scene > m_scene
A (weak) back pointer to the Scene containing this SceneElement.
Definition: SceneElement.h:173
SceneElement is the basic part of a scene, it is a container of components.
Definition: SceneElement.h:48
void setActive(bool val)
Set this SceneElement's status (active/inactive)
Definition: SceneElement.cpp:284
std::unordered_map< std::string, std::shared_ptr< Component > > m_components
A collection of Components.
Definition: SceneElement.h:170
std::shared_ptr< Scene > getScene()
Gets the Scene.
Definition: SceneElement.cpp:176
bool initialize()
Executes the initialize operation.
Definition: SceneElement.cpp:110
SceneElement(const std::string &name)
Constructor.
Definition: SceneElement.cpp:31
void setScene(std::weak_ptr< Scene > scene)
Sets the Scene.
Definition: SceneElement.cpp:167