RobWorkProject
Classes | Public Types | Public Member Functions | Protected Attributes | List of all members
SceneViewer Class Referenceabstract

interface for viewing a scene graph. More...

#include <SceneViewer.hpp>

Inherited by SceneViewerWidget.

Classes

struct  View
 view. More...
 

Public Types

typedef rw::common::Ptr< SceneViewerPtr
 smart pointer type to this class
 
typedef boost::function< void(const rw::math::Vector3D<> &)> PositionSelectedListener
 the current camera can be either the view camera or one of the slave cameras More...
 
typedef rw::common::Event< PositionSelectedListener, const rw::math::Vector3D<> & > PositionSelectedEvent
 Defines event for PositionChanged.
 

Public Member Functions

 SceneViewer ()
 Constructor.
 
virtual ~SceneViewer ()
 Destructor.
 
virtual SceneGraph::Ptr getScene ()=0
 get the current scene graph
 
virtual const std::string & getLogo () const =0
 get the logo that is displayed in the 3d scene
 
virtual void setLogo (const std::string &string)=0
 set the logo that is displayed in the 3d scene
 
virtual rw::common::PropertyMapgetPropertyMap ()=0
 get propertymap
 
virtual void updateView ()=0
 Update the view.
 
virtual void updateState (const rw::kinematics::State &state)=0
 Set a new state. More...
 
virtual void setWorldNode (rw::graphics::GroupNode::Ptr wnode)=0
 Set the world group node. More...
 
virtual void setWorkCellScene (rw::common::Ptr< class WorkCellScene > wcscene)
 Set the WorkCell scene. More...
 
virtual rw::graphics::GroupNode::Ptr getWorldNode ()=0
 Get the world node. More...
 
virtual void saveBufferToFile (const std::string &filename, const int fillR, const int fillG, const int fillB)=0
 Saves the current 3D view to disk as either jpg, bmp or png. More...
 
virtual SceneCamera::Ptr getViewCamera ()=0
 Get the view camera. More...
 
virtual rw::math::Vector3D getViewCenter ()=0
 Get the view center. More...
 
virtual DrawableNode::Ptr pickDrawable (int x, int y)=0
 
virtual DrawableNode::Ptr pickDrawable (SceneGraph::RenderInfo &info, int x, int y)=0
 picks the drawable in the scene that intersects with the ray (x,y,-1) in camera coordinates. More...
 
virtual View::Ptr createView (const std::string &name, bool enableBackground=false)=0
 Create a new view. More...
 
virtual View::Ptr getMainView ()=0
 Get the main view. More...
 
virtual void destroyView (View::Ptr view)=0
 Destroy view. More...
 
virtual void selectView (View::Ptr view)=0
 Select a view. More...
 
virtual View::Ptr getCurrentView ()=0
 Get the currently selected view. More...
 
virtual std::vector< View::PtrgetViews ()=0
 Get all views. More...
 
virtual void renderView (View::Ptr view)=0
 Render a view. More...
 
PositionSelectedEventpositionSelectedEvent ()
 Returns PositionChangedEvent object needed for subscription to and firing of event. More...
 
virtual void setTransform (const rw::math::Transform3D<> &t3d)
 set the orientation of the view. The view will look in the positive direction of the z-axis, with x-axis as the width and the y-axis as the height. Origin of view is in the center of the image. More...
 
virtual rw::math::Transform3D getTransform ()
 get the current rotation of the view More...
 
virtual void zoom (double amount)=0
 Move the camera along its z-axis. More...
 
virtual void autoZoom ()=0
 Automatically fits all frames inside the viewport by moving camera in its z-axis.
 

Protected Attributes

PositionSelectedEvent _positionSelectedEvent
 Event for selection of a position.
 
rw::common::Ptr< class WorkCellScene_wcscene
 The WorkCell scene.
 

Detailed Description

interface for viewing a scene graph.

The scene graph viewer

Member Typedef Documentation

◆ PositionSelectedListener

typedef boost::function<void(const rw::math::Vector3D<>&)> PositionSelectedListener

the current camera can be either the view camera or one of the slave cameras

Returns
Defines a listener for position change events

These listeners are called when user has selected a point in the 3D view.

To send an event double clicking left mouse button on the point of interest while pressing shift.

Example use in a plugin: See RobWorkStudio::StateChangedListener

Member Function Documentation

◆ createView()

virtual View::Ptr createView ( const std::string &  name,
bool  enableBackground = false 
)
pure virtual

Create a new view.

Parameters
name[in] name of view.
enableBackground[in] (optional) enable the background. Default is false.
Returns
the new view.

Implemented in SceneOpenGLViewer.

◆ destroyView()

virtual void destroyView ( View::Ptr  view)
pure virtual

Destroy view.

Parameters
view[in] the view to destroy.

◆ getCurrentView()

virtual View::Ptr getCurrentView ( )
pure virtual

Get the currently selected view.

Returns
the view.

Implemented in SceneOpenGLViewer.

◆ getMainView()

virtual View::Ptr getMainView ( )
pure virtual

Get the main view.

Returns
main view.

Implemented in SceneOpenGLViewer.

◆ getTransform()

virtual rw::math::Transform3D getTransform ( )
inlinevirtual

get the current rotation of the view

Returns
orientation of the view

◆ getViewCamera()

virtual SceneCamera::Ptr getViewCamera ( )
pure virtual

Get the view camera.

Returns
a scene camera.

Implemented in SceneOpenGLViewer.

◆ getViewCenter()

virtual rw::math::Vector3D getViewCenter ( )
pure virtual

Get the view center.

Returns
the center.

Implemented in SceneOpenGLViewer.

◆ getViews()

virtual std::vector<View::Ptr> getViews ( )
pure virtual

Get all views.

Returns
the views.

Implemented in SceneOpenGLViewer.

◆ getWorldNode()

virtual rw::graphics::GroupNode::Ptr getWorldNode ( )
pure virtual

Get the world node.

Returns
the world node.

Implemented in SceneOpenGLViewer.

◆ pickDrawable() [1/2]

virtual DrawableNode::Ptr pickDrawable ( int  x,
int  y 
)
pure virtual

Implemented in SceneOpenGLViewer.

◆ pickDrawable() [2/2]

virtual DrawableNode::Ptr pickDrawable ( SceneGraph::RenderInfo info,
int  x,
int  y 
)
pure virtual

picks the drawable in the scene that intersects with the ray (x,y,-1) in camera coordinates.

Parameters
info[in] rendering information.
x[in] first camera coordinate.
y[in] second camera coordinate.
Returns
the picked drawable.

Implemented in SceneOpenGLViewer.

◆ positionSelectedEvent()

PositionSelectedEvent& positionSelectedEvent ( )
inline

Returns PositionChangedEvent object needed for subscription to and firing of event.

Returns
REference to the PositionSelectedEvent

◆ renderView()

virtual void renderView ( View::Ptr  view)
pure virtual

Render a view.

Parameters
view[in] the view to render

◆ saveBufferToFile()

virtual void saveBufferToFile ( const std::string &  filename,
const int  fillR,
const int  fillG,
const int  fillB 
)
pure virtual

Saves the current 3D view to disk as either jpg, bmp or png.

If failing a std::string is thrown with a detailed description of what when wrong.

Parameters
filename[in] Path and name of the file. The filename extension should be either ".jpg", ".bmp" or ".png" to specify which format to use.
fillR[in] Fill color if viewport is smaller than image, red component [0,255]
fillG[in] Fill color if viewport is smaller than image, green component [0,255]
fillB[in] Fill color if viewport is smaller than image, blue component [0,255]

Implemented in SceneOpenGLViewer.

◆ selectView()

virtual void selectView ( View::Ptr  view)
pure virtual

Select a view.

Parameters
view[in] the view to select.

◆ setTransform()

virtual void setTransform ( const rw::math::Transform3D<> &  t3d)
inlinevirtual

set the orientation of the view. The view will look in the positive direction of the z-axis, with x-axis as the width and the y-axis as the height. Origin of view is in the center of the image.

Parameters
t3d[in] transform relative to world

Reimplemented in SceneOpenGLViewer.

◆ setWorkCellScene()

virtual void setWorkCellScene ( rw::common::Ptr< class WorkCellScene wcscene)
inlinevirtual

Set the WorkCell scene.

Parameters
wcscene[in] the workcell scene.

Reimplemented in SceneOpenGLViewer.

◆ setWorldNode()

virtual void setWorldNode ( rw::graphics::GroupNode::Ptr  wnode)
pure virtual

Set the world group node.

Parameters
wnode[in] the world node.

Implemented in SceneOpenGLViewer.

◆ updateState()

virtual void updateState ( const rw::kinematics::State state)
pure virtual

Set a new state.

Parameters
state[in] new state.

Implemented in SceneOpenGLViewer.

◆ zoom()

virtual void zoom ( double  amount)
pure virtual

Move the camera along its z-axis.

Parameters
amount[in] the amount of zoom.

Implemented in SceneOpenGLViewer.


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