![]() |
RobWorkProject
23.9.11-
|
Class representing an OpenGL based QT Widget for 3D visualization of the SceneGraph SceneOpenGL. More...
#include <SceneOpenGLViewer.hpp>
Inherits QOpenGLWidget, and SceneViewerWidget.
Public Types | |
typedef rw::core::Ptr< SceneOpenGLViewer > | Ptr |
Smart pointer type for SceneOpenGLViewer. | |
![]() | |
typedef rw::core::Ptr< SceneViewerWidget > | Ptr |
Smart pointer type for a SceneViewerWidget. | |
![]() | |
typedef rw::core::Ptr< SceneViewer > | Ptr |
smart pointer type to this class | |
typedef boost::function< void(const rw::math::Vector3D<> &)> | PositionSelectedListener |
Defines a listener for position change events. More... | |
typedef rw::core::Event< PositionSelectedListener, const rw::math::Vector3D<> & > | PositionSelectedEvent |
Defines event for PositionChanged. | |
Public Member Functions | |
SceneOpenGLViewer (QWidget *parent=0) | |
Constructor. More... | |
SceneOpenGLViewer (rw::core::PropertyMap &pmap, QWidget *parent=0) | |
Constructs an OpenGL based QT Widget. More... | |
virtual | ~SceneOpenGLViewer () |
Destructor. | |
rw::graphics::SceneGraph::RenderInfo & | getRenderInfo () |
Get rendering info for the scene. More... | |
rw::graphics::DrawableNode::Ptr | getPivotDrawable () |
Get the drawable used for pivoting. More... | |
QWidget * | getWidget () |
Get the Qt widget for visualization of the scene. More... | |
rw::graphics::SceneGraph::Ptr | getScene () |
get the current scene graph More... | |
rw::core::PropertyMap & | getPropertyMap () |
get propertymap More... | |
virtual rw::graphics::SceneCamera::Ptr | getViewCamera () |
Get the view camera. More... | |
void | setWorldNode (rw::graphics::GroupNode::Ptr wnode) |
Set the world group node. More... | |
rw::graphics::GroupNode::Ptr | getWorldNode () |
Get the world node. More... | |
virtual View::Ptr | createView (const std::string &name, bool enableBackground=false) |
Create a new view. More... | |
virtual View::Ptr | getMainView () |
Get the main view. More... | |
virtual void | destroyView (View::Ptr view) |
Destroy view. More... | |
virtual void | selectView (View::Ptr view) |
Select a view. More... | |
virtual View::Ptr | getCurrentView () |
Get the currently selected view. More... | |
virtual std::vector< View::Ptr > | getViews () |
Get all views. More... | |
void | updateState (const rw::kinematics::State &state) |
Set a new state. More... | |
void | updateView () |
Update the view. More... | |
rw::math::Vector3D | getViewCenter () |
Get the view center. More... | |
void | setLogo (const std::string &string) |
set the logo that is displayed in the 3d scene More... | |
const std::string & | getLogo () const |
get the logo that is displayed in the 3d scene 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... | |
rw::graphics::DrawableNode::Ptr | pickDrawable (int x, int y) |
picks the drawable in the scene that intersects with the ray (x,y,-1) in camera coordinates. More... | |
rw::graphics::DrawableNode::Ptr | pickDrawable (rw::graphics::SceneGraph::RenderInfo &info, int x, int y) |
void | saveBufferToFile (const std::string &filename, const int fillR, const int fillG, const int fillB) |
Saves the current 3D view to disk as either jpg, bmp or png. More... | |
void | clear () |
Clears the list of Drawables and WorkCells. | |
void | keyPressEvent (QKeyEvent *e) |
key pressed listener function. Key events in the opengl view will trigger this method. More... | |
void | setCameraController (CameraController::Ptr camController) |
set the camera view controller. More... | |
CameraController::Ptr | getCameraController () |
Returns the camera controller. More... | |
void | propertyChangedListener (rw::core::PropertyBase *base) |
listener callback for property changed in getPropertyMap More... | |
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. More... | |
void | renderView (View::Ptr view) |
Render a view. More... | |
![]() | |
SceneViewer () | |
Constructor. | |
virtual | ~SceneViewer () |
Destructor. | |
virtual void | destroyView (View::Ptr view)=0 |
Destroy view. More... | |
virtual void | selectView (View::Ptr view)=0 |
Select a view. More... | |
virtual void | renderView (View::Ptr view)=0 |
Render a view. More... | |
PositionSelectedEvent & | positionSelectedEvent () |
Returns PositionChangedEvent object needed for subscription to and firing of event. More... | |
virtual rw::math::Transform3D | getTransform () |
get the current rotation of the view More... | |
Protected Member Functions | |
void | initializeGL () |
Overridden from QOpenGLWidget. | |
void | paintGL () |
Overridden from QOpenGLWidget. | |
void | resizeGL (int width, int height) |
Overridden from QOpenGLWidget. | |
void | mouseDoubleClickEvent (QMouseEvent *event) |
Overridden from QOpenGLWidget. | |
void | mousePressEvent (QMouseEvent *event) |
Overridden from QOpenlGLWidget. | |
void | mouseMoveEvent (QMouseEvent *event) |
Overridden from QOpenGLWidget. | |
void | wheelEvent (QWheelEvent *event) |
Overridden from QOpenGLWidget. | |
void | setWorkCellScene (rw::core::Ptr< rw::graphics::WorkCellScene > wcscene) |
Set the WorkCell scene. More... | |
void | zoom (double amount) |
Move the camera along its z-axis. More... | |
void | autoZoom () |
Automatically fits all frames inside the viewport by moving camera in its z-axis. More... | |
Additional Inherited Members | |
![]() | |
PositionSelectedEvent | _positionSelectedEvent |
Event for selection of a position. | |
rw::core::Ptr< class WorkCellScene > | _wcscene |
The WorkCell scene. | |
Class representing an OpenGL based QT Widget for 3D visualization of the SceneGraph SceneOpenGL.
One of the main responsibilities of the view is to define an opengl context in which the scenegraph can operate and render.
The view will add a "view" camera group and a "view" camera to the scene which it will control through its gui events (mouse and keyboard).
Multiple camera
SceneOpenGLViewer | ( | QWidget * | parent = 0 | ) |
Constructor.
parent | [in] the parent widget (the owner of this widget). |
SceneOpenGLViewer | ( | rw::core::PropertyMap & | pmap, |
QWidget * | parent = 0 |
||
) |
Constructs an OpenGL based QT Widget.
pmap | [in] propertyies for the viewer. |
parent | [in] the parent widget (the owner of this widget). |
|
protectedvirtual |
Automatically fits all frames inside the viewport by moving camera in its z-axis.
Implements SceneViewer.
|
virtual |
Create a new view.
name | [in] name of view. |
enableBackground | [in] (optional) enable the background. Default is false. |
Implements SceneViewer.
|
virtual |
Destroy view.
view | [in] the view to destroy. |
|
inline |
Returns the camera controller.
Camera controller
|
inlinevirtual |
|
inlinevirtual |
get the logo that is displayed in the 3d scene
Implements SceneViewer.
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
get propertymap
Implements SceneViewer.
|
inlinevirtual |
|
inlinevirtual |
get the current scene graph
Implements SceneViewer.
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
Get the Qt widget for visualization of the scene.
Implements SceneViewerWidget.
|
inlinevirtual |
void keyPressEvent | ( | QKeyEvent * | e | ) |
key pressed listener function. Key events in the opengl view will trigger this method.
e | [in] the event. |
|
virtual |
picks the drawable in the scene that intersects with the ray (x,y,-1) in camera coordinates.
x | [in] first camera coordinate. |
y | [in] second camera coordinate. |
Implements SceneViewer.
|
virtual |
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.
x | [in] x coordinate |
y | [in] y coordinate |
void propertyChangedListener | ( | rw::core::PropertyBase * | base | ) |
listener callback for property changed in getPropertyMap
base |
void renderView | ( | View::Ptr | view | ) |
Render a view.
view | [in] the view to render |
|
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.
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] |
Implements SceneViewer.
|
virtual |
Select a view.
view | [in] the view to select. |
|
inline |
set the camera view controller.
camController |
|
inlinevirtual |
set the logo that is displayed in the 3d scene
Implements SceneViewer.
|
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.
t3d | [in] transform relative to world |
Reimplemented from SceneViewer.
|
inlineprotectedvirtual |
|
virtual |
|
virtual |
|
inlinevirtual |
Update the view.
Implements SceneViewer.
|
protectedvirtual |