Public Member Functions | Private Attributes | List of all members
SurgSim::Graphics::OsgViewElement Class Reference

OSG-based implementation of graphics view element. More...

#include <SurgSim/Graphics/OsgViewElement.h>

Inheritance diagram for SurgSim::Graphics::OsgViewElement:
SurgSim::Graphics::ViewElement SurgSim::Framework::BasicSceneElement SurgSim::Framework::SceneElement

Public Member Functions

 OsgViewElement (const std::string &name)
 Constructor. More...
 
virtual ~OsgViewElement ()
 Destructor. More...
 
virtual bool setView (std::shared_ptr< View > view) override
 Sets the view component that provides the visualization of the graphics representations Only allows OsgView components, any other will not be set and it will return false. More...
 
void enableManipulator (bool val)
 Enables a camera manipulator, implemented via a trackball, this is a temporary solution as it uses the OSG input events rather than reading from the OpenSurgSim input. More...
 
void setManipulatorParameters (const SurgSim::Math::Vector3d &position, const SurgSim::Math::Vector3d &lookat)
 As the camera is not accessible from here and as it cannot be controlled from the outside any more we let the user set the parameters from here. More...
 
virtual std::shared_ptr< SurgSim::Input::CommonDevicegetKeyboardDevice () override
 Return the keyboard to be used with this view. More...
 
virtual void enableKeyboardDevice (bool val) override
 Turn on/off the keyboard device to be used. More...
 
virtual std::shared_ptr< SurgSim::Input::CommonDevicegetMouseDevice () override
 Return the mouse to be used with this view. More...
 
virtual void enableMouseDevice (bool val) override
 Turn on/off the mouse device to be used. More...
 
- Public Member Functions inherited from SurgSim::Graphics::ViewElement
 ViewElement (const std::string &name)
 Constructor. More...
 
virtual ~ViewElement ()
 Destructor. More...
 
std::shared_ptr< ViewgetView ()
 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< CameragetCamera ()
 Get the camera for the view in this sceneelement. 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...
 
std::shared_ptr< ComponentgetComponent (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...
 
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::RigidTransform3dgetPose () const
 Get the pose of this SceneElement. More...
 
std::shared_ptr< PoseComponentgetPoseComponent ()
 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< ScenegetScene ()
 Gets the Scene. More...
 
void setRuntime (std::weak_ptr< Runtime > runtime)
 Sets the Runtime. More...
 
std::shared_ptr< RuntimegetRuntime ()
 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< SceneElementgetSharedPtr ()
 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...
 

Private Attributes

bool m_keyboardEnabled
 Indicate if a keyboard device is enabled. More...
 
bool m_mouseEnabled
 Indicate if a mouse device is enabled. More...
 

Additional Inherited Members

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

Detailed Description

OSG-based implementation of graphics view element.

A Graphics::OsgViewElement creates and wraps a Graphics::OsgView 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.

Constructor & Destructor Documentation

OsgViewElement::OsgViewElement ( const std::string &  name)
explicit

Constructor.

Parameters
nameName of the scene element
OsgViewElement::~OsgViewElement ( )
virtual

Destructor.

Member Function Documentation

void SurgSim::Graphics::OsgViewElement::enableKeyboardDevice ( bool  val)
overridevirtual

Turn on/off the keyboard device to be used.

Parameters
valIndicate whether or not to use keyboard device

Implements SurgSim::Graphics::ViewElement.

void SurgSim::Graphics::OsgViewElement::enableManipulator ( bool  val)

Enables a camera manipulator, implemented via a trackball, this is a temporary solution as it uses the OSG input events rather than reading from the OpenSurgSim input.

Parameters
valwhether to enable the manipulator or not.
void SurgSim::Graphics::OsgViewElement::enableMouseDevice ( bool  val)
overridevirtual

Turn on/off the mouse device to be used.

Parameters
valIndicate whether or not to use mouse device

Implements SurgSim::Graphics::ViewElement.

std::shared_ptr< SurgSim::Input::CommonDevice > SurgSim::Graphics::OsgViewElement::getKeyboardDevice ( )
overridevirtual

Return the keyboard to be used with this view.

Returns
A keyboard device

Implements SurgSim::Graphics::ViewElement.

std::shared_ptr< SurgSim::Input::CommonDevice > SurgSim::Graphics::OsgViewElement::getMouseDevice ( )
overridevirtual

Return the mouse to be used with this view.

Returns
A mouse device

Implements SurgSim::Graphics::ViewElement.

void SurgSim::Graphics::OsgViewElement::setManipulatorParameters ( const SurgSim::Math::Vector3d position,
const SurgSim::Math::Vector3d lookat 
)

As the camera is not accessible from here and as it cannot be controlled from the outside any more we let the user set the parameters from here.

Parameters
positionThe position of the camera.
lookatThe location the camera looks at.
bool OsgViewElement::setView ( std::shared_ptr< View view)
overridevirtual

Sets the view component that provides the visualization of the graphics representations Only allows OsgView components, any other will not be set and it will return false.

Parameters
viewThe view that should be used.
Returns
True if it succeeds, false if it fails.

Reimplemented from SurgSim::Graphics::ViewElement.

Member Data Documentation

bool SurgSim::Graphics::OsgViewElement::m_keyboardEnabled
private

Indicate if a keyboard device is enabled.

bool SurgSim::Graphics::OsgViewElement::m_mouseEnabled
private

Indicate if a mouse device is enabled.


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