SceneElement is the basic part of a scene, it is a container of components.
More...
#include <SurgSim/Framework/SceneElement.h>
SceneElement is the basic part of a scene, it is a container of components.
When a SceneElement is added to a Scene, the Scene will call initialize() on the SceneElement, which in turn will call initialize() on all its components. If a component is added to a SceneElement after the SceneElement was initialized, the component will be initialized immediately.
- Note
- A SceneElement needs to be created as a shared_ptr.
SurgSim::Framework::SceneElement::SceneElement |
( |
const std::string & |
name | ) |
|
|
explicit |
SurgSim::Framework::SceneElement::~SceneElement |
( |
| ) |
|
|
virtual |
bool SurgSim::Framework::SceneElement::addComponent |
( |
std::shared_ptr< Component > |
component | ) |
|
bool SurgSim::Framework::SceneElement::decode |
( |
const YAML::Node & |
node | ) |
|
|
virtual |
Pull data from a YAML::Node.
- Exceptions
-
- Parameters
-
- Returns
- true if the decoding succeeded and the node was formatted correctly, false otherwise
virtual bool SurgSim::Framework::SceneElement::doInitialize |
( |
| ) |
|
|
privatepure virtual |
YAML::Node SurgSim::Framework::SceneElement::encode |
( |
bool |
standalone | ) |
const |
|
virtual |
Convert to a YAML::Node.
- Parameters
-
standalone | when true, all the components will be represented as full component, when false they will be represented as references |
- Returns
- A node with all the public data of this instance
std::string SurgSim::Framework::SceneElement::getClassName |
( |
| ) |
const |
|
virtual |
- Returns
- the class name for this class
std::shared_ptr< Component > SurgSim::Framework::SceneElement::getComponent |
( |
const std::string & |
name | ) |
const |
Gets the component identified by name.
- Parameters
-
- Returns
- The component or nullptr if the component cannot be found.
std::vector< std::shared_ptr< Component > > SurgSim::Framework::SceneElement::getComponents |
( |
| ) |
const |
Gets all the components of this SceneElement.
- Returns
- The components.
template<class T >
std::vector< std::shared_ptr< T > > SurgSim::Framework::SceneElement::getComponents |
( |
| ) |
const |
Template version of getComponents method to get all the components with type T.
Implementation of getComponents method to get all the components with type T.
- Returns
- The type T components
std::string SurgSim::Framework::SceneElement::getName |
( |
| ) |
const |
std::shared_ptr< PoseComponent > SurgSim::Framework::SceneElement::getPoseComponent |
( |
| ) |
|
std::shared_ptr< Runtime > SurgSim::Framework::SceneElement::getRuntime |
( |
| ) |
|
Gets the runtime.
- Returns
- The runtime.
std::shared_ptr< Scene > SurgSim::Framework::SceneElement::getScene |
( |
| ) |
|
Gets the Scene.
- Returns
- The scene.
std::shared_ptr< SceneElement > SurgSim::Framework::SceneElement::getSharedPtr |
( |
| ) |
|
Gets a shared pointer to this SceneElement.
- Returns
- The shared pointer.
bool SurgSim::Framework::SceneElement::initialize |
( |
| ) |
|
Executes the initialize operation.
- Returns
- true if it succeeds, false if it fails.
Initialize the given component.
- Parameters
-
component | The component to be initialized. |
- Returns
- True if initialization succeeded, false otherwise.
bool SurgSim::Framework::SceneElement::isActive |
( |
| ) |
const |
- Returns
- True if this SceneElement is active; Otherwise, false.
bool SurgSim::Framework::SceneElement::isInitialized |
( |
| ) |
const |
bool SurgSim::Framework::SceneElement::removeComponent |
( |
std::shared_ptr< Component > |
component | ) |
|
Removes a given component.
- Parameters
-
- Returns
- true if it succeeds, false if it fails or the component cannot be found.
bool SurgSim::Framework::SceneElement::removeComponent |
( |
const std::string & |
name | ) |
|
Removes the component described by name.
- Parameters
-
- Returns
- true if it succeeds, false if it fails or the component cannot be found.
void SurgSim::Framework::SceneElement::setActive |
( |
bool |
val | ) |
|
Set this SceneElement's status (active/inactive)
- Note
- Set 'inactive' on an active SceneElement will cause all the components it contains to not be processed.
-
Set 'active' on an inactive SceneElement will cause all the components it contains which are active
-
to be processed again.
-
Inactive components will not be processed no matter the SceneElement is active or inactive.
- Parameters
-
val | True to set the SceneElement active, false to set inactive. |
void SurgSim::Framework::SceneElement::setName |
( |
const std::string & |
name | ) |
|
|
private |
void SurgSim::Framework::SceneElement::setRuntime |
( |
std::weak_ptr< Runtime > |
runtime | ) |
|
Sets the Runtime.
- Parameters
-
runtime | Pointer to the runtime. |
void SurgSim::Framework::SceneElement::setScene |
( |
std::weak_ptr< Scene > |
scene | ) |
|
Sets the Scene.
- Parameters
-
scene | Pointer to the scene. |
std::unordered_map<std::string, std::shared_ptr<Component> > SurgSim::Framework::SceneElement::m_components |
|
private |
A collection of Components.
bool SurgSim::Framework::SceneElement::m_isActive |
|
private |
bool SurgSim::Framework::SceneElement::m_isInitialized |
|
private |
std::weak_ptr<Runtime> SurgSim::Framework::SceneElement::m_runtime |
|
private |
std::weak_ptr<Scene> SurgSim::Framework::SceneElement::m_scene |
|
private |
The documentation for this class was generated from the following files: