RobWorkProject
24.12.4-
|
class for wrapping the SceneGraph interface such that it extends the scene-graph functionality to work on frames and workcells. More...
#include <WorkCellScene.hpp>
Public Types | |
typedef rw::core::Ptr< WorkCellScene > | Ptr |
smart pointer to this class | |
Public Member Functions | |
WorkCellScene (SceneGraph::Ptr scene) | |
constructor - creates a workcell with a current SceneGraph More... | |
virtual | ~WorkCellScene () |
destructor | |
void | draw (SceneGraph::RenderInfo &info) |
renders the complete scene using the settings in info. More... | |
void | setWorkCell (rw::core::Ptr< rw::models::WorkCell > wc) |
set the workcell to render More... | |
rw::core::Ptr< rw::models::WorkCell > | getWorkCell () |
get the workcell that is currently being rendered. | |
void | setState (const rw::kinematics::State &state) |
state changes are updated by calling this method. That includes transformations between frames, joints and stuff. More... | |
rw::graphics::GroupNode::Ptr | getWorldNode () |
gets the node of the scene graph that maps to the world frame of the workcell. More... | |
void | updateSceneGraph (const rw::kinematics::State &state) |
updates the state of the scenegraph to that of state More... | |
void | clearCache () |
any cached drawables or scene nodes are deleted | |
void | setVisible (bool visible, const rw::core::Ptr< rw::kinematics::Frame > f) |
sets the visibility of a frame and its drawables. More... | |
bool | isVisible (const rw::core::Ptr< rw::kinematics::Frame > f) const |
test if a frame is visible or not More... | |
void | setHighlighted (bool highlighted, const rw::core::Ptr< rw::kinematics::Frame > f) |
sets a frame to be highlighted or not. More... | |
bool | isHighlighted (const rw::core::Ptr< rw::kinematics::Frame > f) const |
test if a frame is highlighted or not More... | |
void | setFrameAxisVisible (bool visible, rw::core::Ptr< rw::kinematics::Frame > f, double size=0.25) |
enables the drawing of the frame-axis of a frame. More... | |
bool | isFrameAxisVisible (const rw::core::Ptr< rw::kinematics::Frame > f) const |
test if frame-axis is visible More... | |
void | setFrameLabelVisible (bool visible, rw::kinematics::Frame::Ptr f) |
enables the drawing of the frame label of a frame. More... | |
bool | isFrameLabelVisible (const rw::kinematics::Frame::Ptr f) const |
test if frame-label is visible More... | |
void | setDrawType (DrawableNode::DrawType type, const rw::core::Ptr< rw::kinematics::Frame > f) |
set how drawables of a specific frame should be rendered More... | |
DrawableNode::DrawType | getDrawType (const rw::core::Ptr< rw::kinematics::Frame > f) const |
get how drawables of a specific frame is to be rendered More... | |
void | setDrawMask (unsigned int mask, const rw::core::Ptr< rw::kinematics::Frame > f) |
set the draw mask of the drawables of a specific frame More... | |
unsigned int | getDrawMask (const rw::core::Ptr< rw::kinematics::Frame > f) const |
get the draw mask of the drawables of a specific frame More... | |
void | setTransparency (double alpha, const rw::core::Ptr< rw::kinematics::Frame > f) |
set drawables of a frame to be translusent More... | |
rw::core::Ptr< rw::graphics::DrawableGeometryNode > | addLines (const std::string &name, const std::vector< rw::geometry::Line > &lines, rw::core::Ptr< rw::kinematics::Frame > frame, int dmask=DrawableNode::Physical) |
create and add a drawable geometry node of line geometry to the scene More... | |
rw::core::Ptr< rw::graphics::DrawableGeometryNode > | addGeometry (const std::string &name, rw::core::Ptr< 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... | |
DrawableNode::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... | |
DrawableNode::Ptr | addModel3D (const std::string &name, rw::core::Ptr< rw::geometry::Model3D > 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... | |
DrawableNode::Ptr | addImage (const std::string &name, const rw::sensor::Image &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... | |
DrawableNode::Ptr | addScan (const std::string &name, const rw::geometry::PointCloud &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... | |
DrawableNode::Ptr | addText (const std::string &name, const std::string &text, rw::core::Ptr< rw::kinematics::Frame > frame, int dmask=DrawableNode::Virtual) |
create and add a drawable node of a textlabel More... | |
DrawableNode::Ptr | addRender (const std::string &name, rw::core::Ptr< rw::graphics::Render > 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... | |
DrawableNode::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... | |
void | addDrawable (DrawableNode::Ptr drawable, rw::core::Ptr< rw::kinematics::Frame > frame) |
add a drawable node to the scene More... | |
std::vector< DrawableNode::Ptr > | getDrawables () |
get all drawables of the WorkCellScene More... | |
std::vector< DrawableNode::Ptr > | getDrawables (const rw::core::Ptr< rw::kinematics::Frame > f) const |
get all drawables of a specific frame in the WorkCellScene More... | |
std::vector< DrawableNode::Ptr > | getDrawablesRec (rw::core::Ptr< rw::kinematics::Frame > f, rw::kinematics::State &state) |
get all drawables of a frame and all frames that kinematicly is connected to the sub-tree of f. More... | |
DrawableNode::Ptr | findDrawable (const std::string &name) |
find a drawable by name name. More... | |
DrawableNode::Ptr | findDrawable (const std::string &name, const rw::core::Ptr< rw::kinematics::Frame > frame) |
find a drawable by name name that is attached to frame frame More... | |
std::vector< DrawableNode::Ptr > | findDrawables (const std::string &name) |
find all drawables by name name. More... | |
bool | removeDrawables (const rw::core::Ptr< rw::kinematics::Frame > f) |
remove all drawables on a frame More... | |
bool | removeDrawables (const std::string &name) |
remove all drawables with name name More... | |
bool | removeDrawable (DrawableNode::Ptr drawable) |
remove a drawable from the scene More... | |
bool | removeDrawable (DrawableNode::Ptr drawable, const rw::core::Ptr< rw::kinematics::Frame > f) |
remove a drawable from a specific frame More... | |
bool | removeDrawable (const std::string &name) |
remove first drawable by name name More... | |
bool | removeDrawable (const std::string &name, const rw::core::Ptr< rw::kinematics::Frame > f) |
remove drawable by name and which is attached to frame f More... | |
rw::kinematics::Frame * | getFrame (DrawableNode::Ptr d) const |
get the frame that a specific drawable d is associated to More... | |
rw::graphics::GroupNode::Ptr | getNode (const rw::core::Ptr< rw::kinematics::Frame > frame) const |
Get the GroupNode corresponding to the given frame. More... | |
class for wrapping the SceneGraph interface such that it extends the scene-graph functionality to work on frames and workcells.
The scene graph is composed of nodes which are related to Frames. Each frame can have several Drawables attached which can be considered as leafs. Beside keeping track of the mapping from frames to scenenodes, this class also adds settings such as highlighted, adding of frameaxis(per Frame), visibility and so on.
WorkCellScene | ( | SceneGraph::Ptr | scene | ) |
constructor - creates a workcell with a current SceneGraph
scene | [in] scene graph to use. |
DrawableNode::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
filename | [in] name of drawable node |
frame | [in] the frame where the drawable is to be placed |
dmask | [in] the drawable mask |
void addDrawable | ( | DrawableNode::Ptr | drawable, |
rw::core::Ptr< rw::kinematics::Frame > | frame | ||
) |
add a drawable node to the scene
drawable | [in] the drawable |
frame | [in] the frame where the drawable is to be placed |
DrawableNode::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
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 |
rw::core::Ptr<rw::graphics::DrawableGeometryNode> addGeometry | ( | const std::string & | name, |
rw::core::Ptr< 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
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 |
DrawableNode::Ptr addImage | ( | const std::string & | name, |
const rw::sensor::Image & | img, | ||
rw::core::Ptr< rw::kinematics::Frame > | frame, | ||
int | dmask = DrawableNode::Virtual |
||
) |
create and add a drawable node of an image to the scene
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 |
rw::core::Ptr<rw::graphics::DrawableGeometryNode> addLines | ( | const std::string & | name, |
const std::vector< rw::geometry::Line > & | lines, | ||
rw::core::Ptr< rw::kinematics::Frame > | frame, | ||
int | dmask = DrawableNode::Physical |
||
) |
create and add a drawable geometry node of line geometry to the scene
name | [in] name of drawable node |
lines | [in] the line geometry |
frame | [in] the frame where the drawable is to be placed |
dmask | [in] the drawable mask |
DrawableNode::Ptr addModel3D | ( | const std::string & | name, |
rw::core::Ptr< rw::geometry::Model3D > | model, | ||
rw::core::Ptr< rw::kinematics::Frame > | frame, | ||
int | dmask = DrawableNode::Physical |
||
) |
create and add a drawable node of a model3d to the scene
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 |
DrawableNode::Ptr addRender | ( | const std::string & | name, |
rw::core::Ptr< rw::graphics::Render > | render, | ||
rw::core::Ptr< rw::kinematics::Frame > | frame, | ||
int | dmask = DrawableNode::Physical |
||
) |
create and add a drawable node of a render, to the scene
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 |
DrawableNode::Ptr addScan | ( | const std::string & | name, |
const rw::geometry::PointCloud & | scan, | ||
rw::core::Ptr< rw::kinematics::Frame > | frame, | ||
int | dmask = DrawableNode::Virtual |
||
) |
create and add a drawable node of a scan to the scene
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 |
DrawableNode::Ptr addText | ( | const std::string & | name, |
const std::string & | text, | ||
rw::core::Ptr< rw::kinematics::Frame > | frame, | ||
int | dmask = DrawableNode::Virtual |
||
) |
create and add a drawable node of a textlabel
name | [in] name of drawable node |
text | [in] the label text |
frame | [in] the frame where the drawable is to be placed |
dmask | [in] the drawable mask |
void draw | ( | SceneGraph::RenderInfo & | info | ) |
renders the complete scene using the settings in info.
This basically forwards the call to SceneGraph::draw
info | [in] render settings |
DrawableNode::Ptr findDrawable | ( | const std::string & | name | ) |
find a drawable by name name.
name | [in] the name of the drawable |
DrawableNode::Ptr findDrawable | ( | const std::string & | name, |
const rw::core::Ptr< rw::kinematics::Frame > | frame | ||
) |
find a drawable by name name that is attached to frame frame
name | [in] the name of the drawable |
frame | [in] search only the subtree beginning from this frame. |
std::vector<DrawableNode::Ptr> findDrawables | ( | const std::string & | name | ) |
find all drawables by name name.
name | [in] the name of the drawable |
std::vector<DrawableNode::Ptr> getDrawables | ( | ) |
get all drawables of the WorkCellScene
std::vector<DrawableNode::Ptr> getDrawables | ( | const rw::core::Ptr< rw::kinematics::Frame > | f | ) | const |
get all drawables of a specific frame in the WorkCellScene
f | [in] the frame |
std::vector<DrawableNode::Ptr> getDrawablesRec | ( | rw::core::Ptr< rw::kinematics::Frame > | f, |
rw::kinematics::State & | state | ||
) |
get all drawables of a frame and all frames that kinematicly is connected to the sub-tree of f.
f | [in] the frame |
state | [in] the current state |
unsigned int getDrawMask | ( | const rw::core::Ptr< rw::kinematics::Frame > | f | ) | const |
get the draw mask of the drawables of a specific frame
f | [in] the frame |
DrawableNode::DrawType getDrawType | ( | const rw::core::Ptr< rw::kinematics::Frame > | f | ) | const |
get how drawables of a specific frame is to be rendered
f | [in] the Frame |
rw::kinematics::Frame* getFrame | ( | DrawableNode::Ptr | d | ) | const |
get the frame that a specific drawable d is associated to
d | [in] the drawable |
rw::graphics::GroupNode::Ptr getNode | ( | const rw::core::Ptr< rw::kinematics::Frame > | frame | ) | const |
Get the GroupNode corresponding to the given frame.
frame | [in] the frame. |
rw::graphics::GroupNode::Ptr getWorldNode | ( | ) |
gets the node of the scene graph that maps to the world frame of the workcell.
bool isFrameAxisVisible | ( | const rw::core::Ptr< rw::kinematics::Frame > | f | ) | const |
test if frame-axis is visible
f | [in] the frame |
bool isFrameLabelVisible | ( | const rw::kinematics::Frame::Ptr | f | ) | const |
test if frame-label is visible
f | [in] the frame |
bool isHighlighted | ( | const rw::core::Ptr< rw::kinematics::Frame > | f | ) | const |
test if a frame is highlighted or not
f | [in] the frame |
bool isVisible | ( | const rw::core::Ptr< rw::kinematics::Frame > | f | ) | const |
test if a frame is visible or not
f | [in] the frame |
bool removeDrawable | ( | const std::string & | name | ) |
remove first drawable by name name
name | [in] the name |
bool removeDrawable | ( | const std::string & | name, |
const rw::core::Ptr< rw::kinematics::Frame > | f | ||
) |
remove drawable by name
and which is attached to frame f
name | [in] name of drawable |
f | [in] the frame |
bool removeDrawable | ( | DrawableNode::Ptr | drawable | ) |
remove a drawable from the scene
drawable | [in] the drawable |
bool removeDrawable | ( | DrawableNode::Ptr | drawable, |
const rw::core::Ptr< rw::kinematics::Frame > | f | ||
) |
remove a drawable from a specific frame
drawable | [in] the drawable |
f | [in] the frame |
bool removeDrawables | ( | const rw::core::Ptr< rw::kinematics::Frame > | f | ) |
remove all drawables on a frame
f | [in] the frame |
bool removeDrawables | ( | const std::string & | name | ) |
remove all drawables with name
name
name | [in] the name |
void setDrawMask | ( | unsigned int | mask, |
const rw::core::Ptr< rw::kinematics::Frame > | f | ||
) |
set the draw mask of the drawables of a specific frame
mask | [in] draw mask |
f | [in] the frame |
void setDrawType | ( | DrawableNode::DrawType | type, |
const rw::core::Ptr< rw::kinematics::Frame > | f | ||
) |
set how drawables of a specific frame should be rendered
type | [in] the drawtype |
f | [in] the Frame |
void setFrameAxisVisible | ( | bool | visible, |
rw::core::Ptr< rw::kinematics::Frame > | f, | ||
double | size = 0.25 |
||
) |
enables the drawing of the frame-axis of a frame.
visible | [in] true if frame axis should be drawn, false otherwise |
f | [in] the frame |
size | [in] size of the frame-axis (default = 0.25) |
void setFrameLabelVisible | ( | bool | visible, |
rw::kinematics::Frame::Ptr | f | ||
) |
enables the drawing of the frame label of a frame.
visible | [in] true if frame label should be drawn, false otherwise |
f | [in] the frame |
void setHighlighted | ( | bool | highlighted, |
const rw::core::Ptr< rw::kinematics::Frame > | f | ||
) |
sets a frame to be highlighted or not.
f | [in] the frame. |
highlighted | [in] true if frame should be highlighted, false otherwise |
void setState | ( | const rw::kinematics::State & | state | ) |
state changes are updated by calling this method. That includes transformations between frames, joints and stuff.
state | [in] the new state that is to be rendered |
void setTransparency | ( | double | alpha, |
const rw::core::Ptr< rw::kinematics::Frame > | f | ||
) |
set drawables of a frame to be translusent
alpha | [in] range [0-1] where 1 is fully opaque and 0 is folly transparent |
f | [in] frame |
void setVisible | ( | bool | visible, |
const rw::core::Ptr< rw::kinematics::Frame > | f | ||
) |
sets the visibility of a frame and its drawables.
f | [in] the frame. |
visible | [in] true if frame should be visible, false otherwise |
void setWorkCell | ( | rw::core::Ptr< rw::models::WorkCell > | wc | ) |
set the workcell to render
wc | [in] the workcell that is to be rendered |
void updateSceneGraph | ( | const rw::kinematics::State & | state | ) |
updates the state of the scenegraph to that of state
state |