Grip-Reloaded
Grip version visualizaiton interface for DART (DynamicAnimationandRoboticsToolkits)
Public Member Functions | Protected Member Functions | Protected Attributes
ViewerWidget Class Reference

Class which inherits from QWidget and osgViewer::CompositeViewer. This class creates a osgQt::GraphicsWindowQt and puts it inside a composite viewer. More...

#include <ViewerWidget.h>

List of all members.

Public Member Functions

 ViewerWidget (osgViewer::ViewerBase::ThreadingModel threadingModel=osgViewer::CompositeViewer::AutomaticSelection)
 Constructor for ViewerWidget class.
QWidget * addViewWidget (osg::Camera *camera, osg::Node *scene)
 Add a osgQt::GraphicsWindowQt widget to the ViewerWidget.
osg::Camera * createCamera (int x, int y, int w, int h, const std::string &name="", bool windowDecoration=false)
 Creates a camera for the viewer.
osg::Matrixd getViewMatrix ()
 Gets the view matrix.
void setViewMatrix (uint i, osg::Matrixd m)
 Sets the viewMatrix of the specified view.
void setToFrontView ()
 Sets the matrix of the camera manipulator to front view.
void setToTopView ()
 Sets the matrix of the camera manipulator to top view.
void setToSideView ()
 Sets the matrix of the camera manipulator to side view.
void setCameraMatrix (osg::Matrix &newMatrix, uint viewNum=0)
 Sets the matrix of the specified camera.
void addNodeToScene (osg::Node *node, uint viewNum=0)
 Adds an osg node to the scene in the view specified by the user.
void setBackgroundColor (const osg::Vec4 &color, uint viewNum=0)
 Sets background color of the view number "viewNum" with the "color". If an invalid view number is provided an error message is printed and no change occurs to any view.
osgGA::CameraManipulator * getCameraManipulator (uint viewNum=0)
 Gets the camera manipulator for a certain view, specified by it's view number "viewNum".
void setCameraToHomePosition (uint viewNum=0)
 Sets the the camera the in the specified view to its home position.
void addGrid (uint width, uint depth, uint gridSize)
 Adds a grid to the viewer.
virtual void paintEvent (QPaintEvent *event)
 Renders the scene.

Protected Member Functions

bool viewNumIsValid (uint viewNum)
 Determines if the input view number is valid, i.e., Does that view exist in the ViewWidget, since the ViewWidget is a CompositeViewer and therefore can hold more than one view.

Protected Attributes

QTimer _timer

Detailed Description

Class which inherits from QWidget and osgViewer::CompositeViewer. This class creates a osgQt::GraphicsWindowQt and puts it inside a composite viewer.


Member Function Documentation

void ViewerWidget::addGrid ( uint  width,
uint  depth,
uint  gridSize 
)

Adds a grid to the viewer.

Parameters:
widthWidth of the entire grid in meters
depthDepth of the entire grid in meters
gridSizeLength of side of each grid square in meters
Returns:
void
void ViewerWidget::addNodeToScene ( osg::Node *  node,
uint  viewNum = 0 
)

Adds an osg node to the scene in the view specified by the user.

Parameters:
nodeosg::Node pointer to add to the scene
viewNumView of which to add the node to
Returns:
void
QWidget * ViewerWidget::addViewWidget ( osg::Camera *  camera,
osg::Node *  scene 
)

Add a osgQt::GraphicsWindowQt widget to the ViewerWidget.

Parameters:
cameraAn osg::Camera pointer
sceneAn osg::Node pointer which is the scene to display
Returns:
QWidget pointer
osg::Camera * ViewerWidget::createCamera ( int  x,
int  y,
int  w,
int  h,
const std::string &  name = "",
bool  windowDecoration = false 
)

Creates a camera for the viewer.

Parameters:
xx-coordinate of the upper-left corner of the window
yy-coordinate of the upper-left corner of the window
wWidth of the window
hHeight of the window
nameName of the window
windowDecorationWhether or not to add window decoration
Returns:
void
osgGA::CameraManipulator * ViewerWidget::getCameraManipulator ( uint  viewNum = 0)

Gets the camera manipulator for a certain view, specified by it's view number "viewNum".

Parameters:
viewNumNumber of the view of which to get the camera manipulator.
Returns:
osgGA::CameraManipulator pointer.
osg::Matrixd ViewerWidget::getViewMatrix ( )

Gets the view matrix.

Returns:
osg::Matrixd
virtual void ViewerWidget::paintEvent ( QPaintEvent *  event) [inline, virtual]

Renders the scene.

Parameters:
eventQPaint event
Returns:
void
void ViewerWidget::setBackgroundColor ( const osg::Vec4 &  color,
uint  viewNum = 0 
)

Sets background color of the view number "viewNum" with the "color". If an invalid view number is provided an error message is printed and no change occurs to any view.

Parameters:
colorosg::Vec4 RGBA (red, green blue, alpha) color vector.
viewNumView number to change the background color of.
Returns:
void
void ViewerWidget::setCameraMatrix ( osg::Matrix &  newMatrix,
uint  viewNum = 0 
)

Sets the matrix of the specified camera.

Parameters:
newMatrixosg::Matrix reference to set the camera to
viewNumThe view of which to set the camera matrix
Returns:
void
void ViewerWidget::setCameraToHomePosition ( uint  viewNum = 0)

Sets the the camera the in the specified view to its home position.

Parameters:
viewNumView for which to set the camera to home position
Returns:
void

Sets the matrix of the camera manipulator to front view.

Returns:
void

Sets the matrix of the camera manipulator to side view.

Returns:
void

Sets the matrix of the camera manipulator to top view.

Returns:
void
void ViewerWidget::setViewMatrix ( uint  i,
osg::Matrixd  m 
)

Sets the viewMatrix of the specified view.

Parameters:
iView to change the view matrix of
mNew view matrix
Returns:
void
bool ViewerWidget::viewNumIsValid ( uint  viewNum) [protected]

Determines if the input view number is valid, i.e., Does that view exist in the ViewWidget, since the ViewWidget is a CompositeViewer and therefore can hold more than one view.

Parameters:
viewNumNumber of the view to validate
Returns:
bool Whether or not the view number exists

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator