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;
232 std::weak_ptr<Scene> m_scene;
235 std::weak_ptr<Runtime> m_runtime;
238 std::unordered_set<std::string> m_groups;
242 virtual bool doInitialize() = 0;
246 void setName(
const std::string& name);
249 bool m_isInitialized;
258 #include "SurgSim/Framework/SceneElement-inl.h" 260 #endif // SURGSIM_FRAMEWORK_SCENEELEMENT_H Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
Definition: DataStructuresConvert.h:28
SceneElement is the basic part of a scene, it is a container of components.
Definition: SceneElement.h:51