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

This class adds RobWorkStudio specific functionality to a WorkCellViewer. More...

#include <RWStudioView3D.hpp>

Inherits QWidget.

Public Types

typedef rw::core::Ptr< RWStudioView3DPtr
 Smart pointer type for RWStudioView3D.
 

Public Member Functions

 RWStudioView3D (RobWorkStudio *rwStudio, QWidget *parent)
 Constructs an OpenGL based QT Widget. More...
 
virtual ~RWStudioView3D ()
 Destructor.
 
void setSceneViewerWidget (SceneViewerWidget *viewer)
 Set the widget used for visualization of the scene. More...
 
void showPivotPoint (bool visible)
 Specified whether to visualize the pivot point. More...
 
void setDrawType (rw::graphics::DrawableNode::DrawType drawType)
 Sets whether to visualize as SOLID, WIRE or BOTH. More...
 
void setupGUI (QMainWindow *mainwindow)
 sets up the More...
 
rw::kinematics::FramepickFrame (int x, int y)
 picks the frame that has drawables that intersect the ray cast into the screen from the screen coordinates x and y. More...
 
rw::graphics::DrawableNode::Ptr pick (int x, int y)
 picks a drawable in the scene. More...
 
void update ()
 updates the 3d view
 
void setState (const rw::kinematics::State &state)
 set the state of the view More...
 
rw::core::PropertyMapgetPropertyMap ()
 get propertymap More...
 
rw::graphics::WorkCellScene::Ptr getWorkCellScene ()
 Get the scene. More...
 
rw::graphics::SceneViewer::Ptr getSceneViewer ()
 Get the scene viewer. More...
 
void setWorkCell (rw::core::Ptr< rw::models::WorkCell > workcell)
 Set the workcell. More...
 
void clear ()
 Clear the view.
 
void saveBufferToFile (const QString &filename, const int fillR=0, const int fillG=0, const int fillB=0)
 Saves the current 3D view to disk as either jpg, bmp or png. More...
 
void keyPressEvent (QKeyEvent *e)
 Handle key press events. More...
 
void mouseDoubleClickEvent (QMouseEvent *event)
 Handle double mouse click events. More...
 
int getDrawMask ()
 get current draw mask
 

Detailed Description

This class adds RobWorkStudio specific functionality to a WorkCellViewer.

specifically:

Constructor & Destructor Documentation

◆ RWStudioView3D()

RWStudioView3D ( RobWorkStudio rwStudio,
QWidget *  parent 
)

Constructs an OpenGL based QT Widget.

Parameters
rwStudio[in] RobWorkStudio
parent[in] Parent widget

Member Function Documentation

◆ getPropertyMap()

rw::core::PropertyMap& getPropertyMap ( )
inline

get propertymap

Returns
propertymap

◆ getSceneViewer()

rw::graphics::SceneViewer::Ptr getSceneViewer ( )
inline

Get the scene viewer.

Returns
the scene viewer.

◆ getWorkCellScene()

rw::graphics::WorkCellScene::Ptr getWorkCellScene ( )
inline

Get the scene.

Returns
the scene.

◆ keyPressEvent()

void keyPressEvent ( QKeyEvent *  e)

Handle key press events.

The following is supported:

Keys Function
CTRL+G Save current view to file (file dialog is opened)
CTRL+Left Switch to previous scene camera
CTRL+Right Switch to next scene camera
CTRL+1...9 Switch to scene camera number n
Parameters
e[in] the event.

◆ mouseDoubleClickEvent()

void mouseDoubleClickEvent ( QMouseEvent *  event)

Handle double mouse click events.

If CTRL key is pressed while double clicking the left mouse button, a frame can be selected.

Parameters
event[in] the event.

◆ pick()

rw::graphics::DrawableNode::Ptr pick ( int  x,
int  y 
)

picks a drawable in the scene.

Parameters
x[in] x coordinate
y[in] y coordinate
Returns
the drawable that was selected, Null if no frames where selected.

◆ pickFrame()

rw::kinematics::Frame* pickFrame ( int  x,
int  y 
)

picks the frame that has drawables that intersect the ray cast into the screen from the screen coordinates x and y.

Parameters
x[in] x coordinate
y[in] y coordinate
Returns
the frame that was selected, Null if no frames where selected.

◆ saveBufferToFile()

void saveBufferToFile ( const QString &  filename,
const int  fillR = 0,
const int  fillG = 0,
const int  fillB = 0 
)
inline

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]

◆ setDrawType()

void setDrawType ( rw::graphics::DrawableNode::DrawType  drawType)

Sets whether to visualize as SOLID, WIRE or BOTH.

Parameters
drawType[in] The drawtype to use

◆ setSceneViewerWidget()

void setSceneViewerWidget ( SceneViewerWidget viewer)

Set the widget used for visualization of the scene.

Parameters
viewer[in] the widget for visualization of the scene.

◆ setState()

void setState ( const rw::kinematics::State state)

set the state of the view

Parameters
state[in] new state to be rendered

◆ setupGUI()

void setupGUI ( QMainWindow *  mainwindow)

sets up the

Parameters
mainwindow

◆ setWorkCell()

void setWorkCell ( rw::core::Ptr< rw::models::WorkCell workcell)

Set the workcell.

Parameters
workcell[in] the workcell.

◆ showPivotPoint()

void showPivotPoint ( bool  visible)

Specified whether to visualize the pivot point.

Parameters
visible[in] True for showing pivot point, false otherwise.

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