RobWorkProject  23.9.11-
Classes | Public Types | Public Member Functions | List of all members
SceneDescriptor Class Reference

The scene descriptor describe any visualization related details of a workcell. This is typically models, visual state, highlighted state and lighting details. All information is related to frames and objects. More...

#include <SceneDescriptor.hpp>

Classes

struct  DrawableProxy
 a proxy class to represent some type of loadable and drawable entity More...
 
struct  VisualState
 struct for keeping track of the visual state of each frame More...
 

Public Types

typedef rw::core::Ptr< SceneDescriptorPtr
 smart pointer to this class
 

Public Member Functions

 SceneDescriptor ()
 constructor
 
virtual ~SceneDescriptor ()
 destructor
 
void setVisible (bool visible, rw::core::Ptr< rw::kinematics::Frame > f)
 sets the visibility of a frame and its drawables. More...
 
bool isVisible (rw::core::Ptr< rw::kinematics::Frame > f)
 test if a frame is visible or not More...
 
void setHighlighted (bool highlighted, rw::core::Ptr< rw::kinematics::Frame > f)
 sets a frame to be highlighted or not. More...
 
bool isHighlighted (rw::core::Ptr< rw::kinematics::Frame > f)
 test if a frame is highlighted or not More...
 
void setFrameAxisVisible (bool visible, rw::core::Ptr< rw::kinematics::Frame > f)
 enables the drawing of the frame-axis of a frame. More...
 
bool isFrameAxisVisible (rw::core::Ptr< rw::kinematics::Frame > f)
 test if frame-axis is visible More...
 
void setDrawType (DrawableNode::DrawType type, rw::core::Ptr< rw::kinematics::Frame > f)
 set how drawables of a specific frame should be rendered More...
 
DrawableNode::DrawType getDrawType (rw::core::Ptr< rw::kinematics::Frame > f)
 get how drawables of a specific frame is to be rendered More...
 
void setDrawMask (unsigned int mask, rw::core::Ptr< rw::kinematics::Frame > f)
 set the draw mask of the drawables of a specific frame More...
 
unsigned int getDrawMask (rw::core::Ptr< rw::kinematics::Frame > f)
 get the draw mask of the drawables of a specific frame More...
 
void setTransparency (double alpha, rw::core::Ptr< rw::kinematics::Frame > f)
 set drawables of a frame to be translusent More...
 
DrawableProxy::Ptr addGeometry (const std::string &name, rw::core::Ptr< class rw::geometry::Geometry > geom, rw::core::Ptr< rw::kinematics::Frame > frame, int dmask=DrawableNode::Physical)
 create and add a drawable geometry node of any type of geometry to the scene More...
 
DrawableProxy::Ptr addFrameAxis (const std::string &name, double size, rw::core::Ptr< rw::kinematics::Frame > frame, int dmask=DrawableNode::Virtual)
 create and add a drawable node of a frame axis to the scene More...
 
DrawableProxy::Ptr addModel3D (const std::string &name, Model3D::Ptr model, rw::core::Ptr< rw::kinematics::Frame > frame, int dmask=DrawableNode::Physical)
 create and add a drawable node of a model3d to the scene More...
 
DrawableProxy::Ptr addImage (const std::string &name, rw::sensor::Image::Ptr img, rw::core::Ptr< rw::kinematics::Frame > frame, int dmask=DrawableNode::Virtual)
 create and add a drawable node of an image to the scene More...
 
DrawableProxy::Ptr addScan (const std::string &name, rw::geometry::PointCloud::Ptr scan, rw::core::Ptr< rw::kinematics::Frame > frame, int dmask=DrawableNode::Virtual)
 create and add a drawable node of a scan to the scene More...
 
DrawableProxy::Ptr addRender (const std::string &name, rw::graphics::Render::Ptr render, rw::core::Ptr< rw::kinematics::Frame > frame, int dmask=DrawableNode::Physical)
 create and add a drawable node of a render, to the scene More...
 
DrawableProxy::Ptr addDrawable (const std::string &filename, rw::core::Ptr< rw::kinematics::Frame > frame, int dmask=DrawableNode::Physical)
 create and add a drawable node from a filename to the scene More...
 
DrawableProxy::Ptr addDrawable (DrawableNode::Ptr drawable, rw::core::Ptr< rw::kinematics::Frame > frame)
 add a drawable node to the scene More...
 
std::vector< DrawableProxy::PtrgetDrawables (rw::core::Ptr< rw::kinematics::Frame > f)
 get all drawables of a specific frame in the WorkCellScene More...
 
rw::kinematics::FramegetFrame (DrawableProxy::Ptr d)
 get the frame that a specific drawable d is associated to More...
 
std::map< rw::kinematics::Frame *, VisualState > & getStateMap ()
 Get the visual state of all frames. More...
 

Detailed Description

The scene descriptor describe any visualization related details of a workcell. This is typically models, visual state, highlighted state and lighting details. All information is related to frames and objects.

Member Function Documentation

◆ addDrawable() [1/2]

DrawableProxy::Ptr addDrawable ( const std::string &  filename,
rw::core::Ptr< rw::kinematics::Frame frame,
int  dmask = DrawableNode::Physical 
)

create and add a drawable node from a filename to the scene

Parameters
filename[in] name of drawable node
frame[in] the frame where the drawable is to be placed
dmask[in] the drawable mask
Returns
the drawable node

◆ addDrawable() [2/2]

DrawableProxy::Ptr addDrawable ( DrawableNode::Ptr  drawable,
rw::core::Ptr< rw::kinematics::Frame frame 
)

add a drawable node to the scene

Parameters
drawable[in] the drawable
frame[in] the frame where the drawable is to be placed

◆ addFrameAxis()

DrawableProxy::Ptr addFrameAxis ( const std::string &  name,
double  size,
rw::core::Ptr< rw::kinematics::Frame frame,
int  dmask = DrawableNode::Virtual 
)

create and add a drawable node of a frame axis to the scene

Parameters
name[in] name of drawable node
size[in] the length of the axis arrows in meters
frame[in] the frame where the drawable is to be placed
dmask[in] the drawable mask
Returns
the drawable node geometry

◆ addGeometry()

DrawableProxy::Ptr addGeometry ( const std::string &  name,
rw::core::Ptr< class rw::geometry::Geometry geom,
rw::core::Ptr< rw::kinematics::Frame frame,
int  dmask = DrawableNode::Physical 
)

create and add a drawable geometry node of any type of geometry to the scene

Parameters
name[in] name of drawable node
geom[in] the geometry
frame[in] the frame where the drawable is to be placed
dmask[in] the drawable mask
Returns
the drawable node geometry

◆ addImage()

DrawableProxy::Ptr addImage ( const std::string &  name,
rw::sensor::Image::Ptr  img,
rw::core::Ptr< rw::kinematics::Frame frame,
int  dmask = DrawableNode::Virtual 
)

create and add a drawable node of an image to the scene

Parameters
name[in] name of drawable node
img[in] the image
frame[in] the frame where the drawable is to be placed
dmask[in] the drawable mask
Returns
the drawable node geometry
Note
the size of the image in the scene will be pixel/cm. To change this please use scale.

◆ addModel3D()

DrawableProxy::Ptr addModel3D ( const std::string &  name,
Model3D::Ptr  model,
rw::core::Ptr< rw::kinematics::Frame frame,
int  dmask = DrawableNode::Physical 
)

create and add a drawable node of a model3d to the scene

Parameters
name[in] name of drawable node
model[in] the model3d
frame[in] the frame where the drawable is to be placed
dmask[in] the drawable mask
Returns
the drawable node geometry

◆ addRender()

DrawableProxy::Ptr addRender ( const std::string &  name,
rw::graphics::Render::Ptr  render,
rw::core::Ptr< rw::kinematics::Frame frame,
int  dmask = DrawableNode::Physical 
)

create and add a drawable node of a render, to the scene

Parameters
name[in] name of drawable node
render[in] the render
frame[in] the frame where the drawable is to be placed
dmask[in] the drawable mask
Returns
the drawable node

◆ addScan()

DrawableProxy::Ptr addScan ( const std::string &  name,
rw::geometry::PointCloud::Ptr  scan,
rw::core::Ptr< rw::kinematics::Frame frame,
int  dmask = DrawableNode::Virtual 
)

create and add a drawable node of a scan to the scene

Parameters
name[in] name of drawable node
scan[in] the scan
frame[in] the frame where the drawable is to be placed
dmask[in] the drawable mask
Returns
the drawable node

◆ getDrawables()

std::vector<DrawableProxy::Ptr> getDrawables ( rw::core::Ptr< rw::kinematics::Frame f)

get all drawables of a specific frame in the WorkCellScene

Parameters
f[in] the frame
Returns
a vector of drawable proxies

◆ getDrawMask()

unsigned int getDrawMask ( rw::core::Ptr< rw::kinematics::Frame f)

get the draw mask of the drawables of a specific frame

Parameters
f[in] the frame
Returns
the drawmask

◆ getDrawType()

get how drawables of a specific frame is to be rendered

Parameters
f[in] the Frame
Returns
the drawtype

◆ getFrame()

get the frame that a specific drawable d is associated to

Parameters
d[in] the drawable
Returns
the first frame that the drawable is associated to, or NULL if there are no associations

◆ getStateMap()

std::map<rw::kinematics::Frame*, VisualState>& getStateMap ( )
inline

Get the visual state of all frames.

Returns
a map from Frame to visual state.

◆ isFrameAxisVisible()

bool isFrameAxisVisible ( rw::core::Ptr< rw::kinematics::Frame f)

test if frame-axis is visible

Parameters
f[in] the frame
Returns
true if frame axis of frame is set to be drawn, false otherwise

◆ isHighlighted()

bool isHighlighted ( rw::core::Ptr< rw::kinematics::Frame f)

test if a frame is highlighted or not

Parameters
f[in] the frame
Returns
true if frame is highlighted, false if not

◆ isVisible()

bool isVisible ( rw::core::Ptr< rw::kinematics::Frame f)

test if a frame is visible or not

Parameters
f[in] the frame
Returns
true if frame is visible, false if not

◆ setDrawMask()

void setDrawMask ( unsigned int  mask,
rw::core::Ptr< rw::kinematics::Frame f 
)

set the draw mask of the drawables of a specific frame

Parameters
mask[in] draw mask
f[in] the frame

◆ setDrawType()

void setDrawType ( DrawableNode::DrawType  type,
rw::core::Ptr< rw::kinematics::Frame f 
)

set how drawables of a specific frame should be rendered

Parameters
type[in] the drawtype
f[in] the Frame

◆ setFrameAxisVisible()

void setFrameAxisVisible ( bool  visible,
rw::core::Ptr< rw::kinematics::Frame f 
)

enables the drawing of the frame-axis of a frame.

Parameters
visible[in] true if frame axis should be drawn, false otherwise
f[in] the frame

◆ setHighlighted()

void setHighlighted ( bool  highlighted,
rw::core::Ptr< rw::kinematics::Frame f 
)

sets a frame to be highlighted or not.

Parameters
f[in] the frame.
highlighted[in] true if frame should be highlighted, false otherwise

◆ setTransparency()

void setTransparency ( double  alpha,
rw::core::Ptr< rw::kinematics::Frame f 
)

set drawables of a frame to be translusent

Parameters
alpha[in] range [0-1] where 1 is fully opaque and 0 is folly transparent
f[in] frame

◆ setVisible()

void setVisible ( bool  visible,
rw::core::Ptr< rw::kinematics::Frame f 
)

sets the visibility of a frame and its drawables.

Parameters
f[in] the frame.
visible[in] true if frame should be visible, false otherwise

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