SurgSim::Graphics::ViewElement Class Referenceabstract

Basic SceneElement that wraps a View so that it can be added to the Scene. More...

`#include <SurgSim/Graphics/ViewElement.h>`

Inheritance diagram for SurgSim::Graphics::ViewElement:

## Public Member Functions

| ViewElement (const std::string &name)
| Constructor. More...
virtual | ~ViewElement ()
| Destructor. More...
virtual bool | setView (std::shared_ptr< View > view)
| Sets the view component that provides the visualization of the graphics representations. More...
std::shared_ptr< View > | getView ()
| Returns the view component that provides the visualization of the graphics representations. More...
void | setCamera (std::shared_ptr< Camera > camera)
| Sets the camera for the view in this sceneelement. More...
std::shared_ptr< Camera > | getCamera ()
| Get the camera for the view in this sceneelement. More...
virtual std::shared_ptr< SurgSim::Input::CommonDevice > | getKeyboardDevice ()=0
| Return the keyboard to be used with this view. More...
virtual void | enableKeyboardDevice (bool val)=0
| Turn on/off the keyboard device to be used. More...
virtual std::shared_ptr< SurgSim::Input::CommonDevice > | getMouseDevice ()=0
| Return the mouse to be used with this view. More...
virtual void | enableMouseDevice (bool val)=0
| Turn on/off the mouse device to be used. More...
Public Member Functions inherited from SurgSim::Framework::BasicSceneElement
| BasicSceneElement (const std::string &name)
| Destructor. More...
virtual | ~BasicSceneElement ()
| Destructor. More...
| SURGSIM_CLASSNAME (SurgSim::Framework::BasicSceneElement)
| Destructor. More...
Public Member Functions inherited from SurgSim::Framework::SceneElement
| SceneElement (const std::string &name)
| Constructor. More...
virtual | ~SceneElement ()
| Destructor. More...
virtual std::string | getClassName () const
bool | addComponent (std::shared_ptr< Component > component)
| Adds a component, calls initialize() on the component, if SceneElement::isInitialized() is true. More...
bool | removeComponent (std::shared_ptr< Component > component)
| Removes a given component. More...
bool | removeComponent (const std::string &name)
| Removes the component described by name. More...
void | removeComponents ()
| Removes all components. More...
std::shared_ptr< Component > | getComponent (const std::string &name) const
| Gets the component identified by name. More...
std::vector< std::shared_ptr< Component > > | getComponents () const
| Gets all the components of this SceneElement. More...
template<class T >
std::vector< std::shared_ptr< T > > | getComponents () const
| Template version of getComponents method to get all the components with type T. More...
template<class T >
T | getValue (const std::string &component, const std::string &property) const
| Retrieves the property value from a component. More...
boost::any | getValue (const std::string &component, const std::string &property) const
| Retrieves the property value from a component. More...
template<class T >
bool | getValue (const std::string &component, const std::string &property, T *value) const
| Retrieves the property value from a component, and convertis it to the type of the output parameter. More...
void | setValue (const std::string &component, const std::string &property, const boost::any &value)
| Sets the property value of a component. More...
void | addToGroup (const std::string &group)
| Add this scene element to the given group. More...
void | removeFromGroup (const std::string &group)
| Remove this scene element from the given group. More...
void | setGroups (const std::vector< std::string > &groups)
| Set the groups of this scene element. More...
std::vector< std::string > | getGroups () const
bool | inGroup (const std::string &name)
| Test whether this SceneElement is in a specific group. More...
bool | initialize ()
| Executes the initialize operation. More...
std::string | getName () const
| Return the name of this SceneElement. More...
void | setPose (const SurgSim::Math::RigidTransform3d &pose)
| Set the pose of this SceneElement. More...
const SurgSim::Math::RigidTransform3d & | getPose () const
| Get the pose of this SceneElement. More...
std::shared_ptr< PoseComponent > | getPoseComponent ()
| Get the PoseComponent that controls the pose all Representations in this SceneElement. More...
void | setScene (std::weak_ptr< Scene > scene)
| Sets the Scene. More...
std::shared_ptr< Scene > | getScene ()
| Gets the Scene. More...
void | setRuntime (std::weak_ptr< Runtime > runtime)
| Sets the Runtime. More...
std::shared_ptr< Runtime > | getRuntime ()
| Gets the runtime. More...
bool | isInitialized () const
| Return if this SceneElement is initialized. More...
void | setActive (bool val)
| Set this SceneElement's status (active/inactive) More...
bool | isActive () const
std::shared_ptr< SceneElement > | getSharedPtr ()
| Gets a shared pointer to this SceneElement. More...
virtual YAML::Node | encode (bool standalone) const
| Convert to a YAML::Node. More...
virtual bool | decode (const YAML::Node &node)
| Pull data from a YAML::Node. More...

## Protected Member Functions

bool | doInitialize () override
| Initializes the scene element. More...
Protected Member Functions inherited from SurgSim::Framework::BasicSceneElement

## Private Attributes

std::shared_ptr< View > | m_view
| View component that provides the visualization of the graphics representations. More...
std::shared_ptr< Camera > | m_camera
| Camera component connected to the view. More...

## Detailed Description

Basic SceneElement that wraps a View so that it can be added to the Scene.

A Scene needs at least one Graphics::View component for any visualization of Graphics:Representation objects to be shown. A view needs a camera to do its' rendering, this component can connect all the pieces correctly.

## Constructor & Destructor Documentation

## ViewElement()

SurgSim::Graphics::ViewElement::ViewElement | ( | const std::string & | name | ) |

explicit

Constructor.

Parameters

  name | Name of the scene element

## ~ViewElement()

SurgSim::Graphics::ViewElement::~ViewElement | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## doInitialize()

bool SurgSim::Graphics::ViewElement::doInitialize | ( |  | ) |

override protected virtual

Initializes the scene element.

Returns
  True if it succeeds, false if it fails

Reimplemented from SurgSim::Framework::BasicSceneElement.

## enableKeyboardDevice()

virtual void SurgSim::Graphics::ViewElement::enableKeyboardDevice | ( | bool | val | ) |

pure virtual

Turn on/off the keyboard device to be used.

Parameters

  val | Indicate whether or not to use keyboard device

Implemented in SurgSim::Graphics::OsgViewElement.

## enableMouseDevice()

virtual void SurgSim::Graphics::ViewElement::enableMouseDevice | ( | bool | val | ) |

pure virtual

Turn on/off the mouse device to be used.

Parameters

  val | Indicate whether or not to use mouse device

Implemented in SurgSim::Graphics::OsgViewElement.

## getCamera()

std::shared_ptr< Camera > SurgSim::Graphics::ViewElement::getCamera | ( |  | ) |

Get the camera for the view in this sceneelement.

Returns
  The camera used in the view of this sceneelement.

## getKeyboardDevice()

virtual std::shared_ptr<SurgSim::Input::CommonDevice> SurgSim::Graphics::ViewElement::getKeyboardDevice | ( |  | ) |

pure virtual

Return the keyboard to be used with this view.

Returns
  A keyboard device

Implemented in SurgSim::Graphics::OsgViewElement.

## getMouseDevice()

virtual std::shared_ptr<SurgSim::Input::CommonDevice> SurgSim::Graphics::ViewElement::getMouseDevice | ( |  | ) |

pure virtual

Return the mouse to be used with this view.

Returns
  A mouse device

Implemented in SurgSim::Graphics::OsgViewElement.

## getView()

std::shared_ptr< View > SurgSim::Graphics::ViewElement::getView | ( |  | ) |

Returns the view component that provides the visualization of the graphics representations.

Returns
  A shared_ptr pointing to the View component

## setCamera()

void SurgSim::Graphics::ViewElement::setCamera | ( | std::shared_ptr< Camera > | camera | ) |

Sets the camera for the view in this sceneelement.

Parameters

  camera | The camera to be used with the view

## setView()

bool SurgSim::Graphics::ViewElement::setView | ( | std::shared_ptr< View > | view | ) |

virtual

Sets the view component that provides the visualization of the graphics representations.

Returns
  True if setView() succeeds; Otherwise, false.

Reimplemented in SurgSim::Graphics::OsgViewElement.

## Member Data Documentation

## m_camera

std::shared_ptr<Camera> SurgSim::Graphics::ViewElement::m_camera

private

Camera component connected to the view.

## m_view

std::shared_ptr<View> SurgSim::Graphics::ViewElement::m_view

private

View component that provides the visualization of the graphics representations.

The documentation for this class was generated from the following files:

- SurgSim/Graphics/ViewElement.h
- SurgSim/Graphics/ViewElement.cpp