Public Slots | Signals | Public Member Functions | Protected Member Functions | Protected Attributes | Private Slots
octomap::ViewerWidget Class Reference

#include <ViewerWidget.h>

Inheritance diagram for octomap::ViewerWidget:
Inheritance graph
[legend]

List of all members.

Public Slots

void addCurrentToCameraPath (int id, int frame)
void appendCurrentToCameraPath (int id)
void appendToCameraPath (int id, const octomath::Pose6D &pose)
void deleteCameraPath (int id)
void enableHeightColorMode (bool enabled=true)
void enablePrintoutMode (bool enabled=true)
void enableSelectionBox (bool enabled=true)
void enableSemanticColoring (bool enabled=true)
void jumpToCamFrame (int id, int frame)
void playCameraPath (int id, int start_frame)
void removeFromCameraPath (int id, int frame)
void resetView ()
const SelectionBoxselectionBox () const
void setCamPose (const octomath::Pose6D &pose)
void setCamPosition (double x, double y, double z, double lookX, double lookY, double lookZ)
virtual void setSceneBoundingBox (const qglviewer::Vec &min, const qglviewer::Vec &max)
void stopCameraPath (int id)
void updateCameraPath (int id, int frame)

Signals

void cameraPathFrameChanged (int id, int current_camera_frame)
void cameraPathStopped (int id)

Public Member Functions

void addSceneObject (SceneObject *obj)
void clearAll ()
void removeSceneObject (SceneObject *obj)
 ViewerWidget (QWidget *parent=NULL)

Protected Member Functions

virtual void draw ()
virtual void drawWithNames ()
virtual QString helpString () const
virtual void init ()
qglviewer::Quaternion poseToQGLQuaternion (const octomath::Pose6D &pose)
virtual void postDraw ()
virtual void postSelection (const QPoint &)

Protected Attributes

int m_current_camera_frame
int m_current_camera_path
bool m_drawAxis
bool m_drawGrid
bool m_drawSelectionBox
bool m_heightColorMode
bool m_printoutMode
std::vector< SceneObject * > m_sceneObjects
SelectionBox m_selectionBox
bool m_semantic_coloring
double m_zMax
double m_zMin

Private Slots

void cameraPathFinished ()
void cameraPathInterpolated ()

Detailed Description

Definition at line 36 of file ViewerWidget.h.


Constructor & Destructor Documentation

octomap::ViewerWidget::ViewerWidget ( QWidget *  parent = NULL)

Definition at line 36 of file ViewerWidget.cpp.


Member Function Documentation

void octomap::ViewerWidget::addCurrentToCameraPath ( int  id,
int  frame 
) [slot]

Definition at line 222 of file ViewerWidget.cpp.

Adds an object to the scene that can be drawn

Parameters:
objSceneObject to be added

Definition at line 292 of file ViewerWidget.cpp.

Definition at line 216 of file ViewerWidget.cpp.

void octomap::ViewerWidget::appendToCameraPath ( int  id,
const octomath::Pose6D pose 
) [slot]

Definition at line 176 of file ViewerWidget.cpp.

Definition at line 262 of file ViewerWidget.cpp.

void octomap::ViewerWidget::cameraPathFrameChanged ( int  id,
int  current_camera_frame 
) [signal]

Definition at line 271 of file ViewerWidget.cpp.

void octomap::ViewerWidget::cameraPathStopped ( int  id) [signal]

Definition at line 310 of file ViewerWidget.cpp.

void octomap::ViewerWidget::deleteCameraPath ( int  id) [slot]

Definition at line 167 of file ViewerWidget.cpp.

void octomap::ViewerWidget::draw ( ) [protected, virtual]

The core method of the viewer, that draws the scene.

If you build a class that inherits from QGLViewer, this is the method you want to overload. See the simpleViewer example for an illustration.

The camera modelView matrix set in preDraw() converts from the world to the camera coordinate systems. Vertices given in draw() can then be considered as being given in the world coordinate system. The camera is moved in this world using the mouse. This representation is much more intuitive than the default camera-centric OpenGL standard.

Attention:
The GL_PROJECTION matrix should not be modified by this method, to correctly display visual hints (axis, grid, FPS...) in postDraw(). Use push/pop or call camera()->loadProjectionMatrix() at the end of draw() if you need to change the projection matrix (unlikely). On the other hand, the GL_MODELVIEW matrix can be modified and left in a arbitrary state.

Reimplemented from QGLViewer.

Definition at line 317 of file ViewerWidget.cpp.

void octomap::ViewerWidget::drawWithNames ( ) [protected, virtual]

This method is called by select() and should draw selectable entities.

Default implementation is empty. Overload and draw the different elements of your scene you want to be able to select. The default select() implementation relies on the GL_SELECT, and requires that each selectable element is drawn within a glPushName() - glPopName() block. A typical usage would be (see the select example):

void Viewer::drawWithNames() {
   for (int i=0; i<nbObjects; ++i) {
      glPushName(i);
      object(i)->draw();
      glPopName();
   }
}

The resulting selected name is computed by endSelection(), which setSelectedName() to the integer id pushed by this method (a value of -1 means no selection). Use selectedName() to update your selection, probably in the postSelection() method.

Attention:
If your selected objects are points, do not use glBegin(GL_POINTS); and glVertex3fv() in the above draw() method (not compatible with raster mode): use glRasterPos3fv() instead.

Reimplemented from QGLViewer.

Definition at line 349 of file ViewerWidget.cpp.

void octomap::ViewerWidget::enableHeightColorMode ( bool  enabled = true) [slot]

Definition at line 96 of file ViewerWidget.cpp.

void octomap::ViewerWidget::enablePrintoutMode ( bool  enabled = true) [slot]

Definition at line 104 of file ViewerWidget.cpp.

void octomap::ViewerWidget::enableSelectionBox ( bool  enabled = true) [slot]

Definition at line 120 of file ViewerWidget.cpp.

void octomap::ViewerWidget::enableSemanticColoring ( bool  enabled = true) [slot]

Definition at line 112 of file ViewerWidget.cpp.

QString octomap::ViewerWidget::helpString ( ) const [protected, virtual]

Returns the QString displayed in the help() window main tab.

Overload this method to define your own help string, which should shortly describe your application and explain how it works. Rich-text (HTML) tags can be used (see QStyleSheet() documentation for available tags):

        QString myViewer::helpString() const
        {
        QString text("<h2>M y V i e w e r</h2>");
        text += "Displays a <b>Scene</b> using OpenGL. Move the camera using the mouse.";
        return text;
        }

See also mouseString() and keyboardString().

Reimplemented from QGLViewer.

Definition at line 80 of file ViewerWidget.cpp.

void octomap::ViewerWidget::init ( ) [protected, virtual]

Initializes the viewer OpenGL context.

This method is called before the first drawing and should be overloaded to initialize some of the OpenGL flags. The default implementation is empty. See initializeGL().

Typical usage include camera() initialization (showEntireScene()), previous viewer state restoration (restoreStateFromFile()), OpenGL state modification and display list creation.

Note that initializeGL() modifies the standard OpenGL context. These values can be restored back in this method.

Attention:
You should not call updateGL() (or any method that calls it) in this method, as it will result in an infinite loop. The different QGLViewer set methods (setAxisIsDrawn(), setFPSIsDisplayed()...) are protected against this problem and can safely be called.
Note:
All the OpenGL specific initializations must be done in this method: the OpenGL context is not yet available in your viewer constructor.

Reimplemented from QGLViewer.

Definition at line 45 of file ViewerWidget.cpp.

void octomap::ViewerWidget::jumpToCamFrame ( int  id,
int  frame 
) [slot]

Definition at line 156 of file ViewerWidget.cpp.

void octomap::ViewerWidget::playCameraPath ( int  id,
int  start_frame 
) [slot]

Definition at line 239 of file ViewerWidget.cpp.

Definition at line 126 of file ViewerWidget.cpp.

void octomap::ViewerWidget::postDraw ( ) [protected, virtual]

Overloaded from QGLViewer. Draws own axis and grid in scale, then calls QGLViewer::postDraw().

Reimplemented from QGLViewer.

Definition at line 355 of file ViewerWidget.cpp.

void octomap::ViewerWidget::postSelection ( const QPoint &  point) [protected, virtual]

This method is called at the end of the select() procedure. It should finalize the selection process and update the data structure/interface/computation/display... according to the newly selected entity.

The default implementation is empty. Overload this method if needed, and use selectedName() to retrieve the selected entity name (returns -1 if no object was selected). See the select example for an illustration.

Reimplemented from QGLViewer.

Definition at line 392 of file ViewerWidget.cpp.

void octomap::ViewerWidget::removeFromCameraPath ( int  id,
int  frame 
) [slot]

Definition at line 186 of file ViewerWidget.cpp.

Removes a SceneObject from the list of drawable objects if it has been added previously. Does nothing otherwise.

Parameters:
objSceneObject to be removed

Definition at line 298 of file ViewerWidget.cpp.

Resets the 3D viewpoint to the initial value

Definition at line 73 of file ViewerWidget.cpp.

const SelectionBox& octomap::ViewerWidget::selectionBox ( ) const [inline, slot]

Definition at line 76 of file ViewerWidget.h.

void octomap::ViewerWidget::setCamPose ( const octomath::Pose6D pose) [slot]

Definition at line 151 of file ViewerWidget.cpp.

void octomap::ViewerWidget::setCamPosition ( double  x,
double  y,
double  z,
double  lookX,
double  lookY,
double  lookZ 
) [slot]

Definition at line 143 of file ViewerWidget.cpp.

void octomap::ViewerWidget::setSceneBoundingBox ( const qglviewer::Vec min,
const qglviewer::Vec max 
) [virtual, slot]

Convenient way to call setSceneCenter() and setSceneRadius() from a (world axis aligned) bounding box of the scene.

This is equivalent to:

                setSceneCenter((min+max) / 2.0);
                setSceneRadius((max-min).norm() / 2.0);

Reimplemented from QGLViewer.

Definition at line 286 of file ViewerWidget.cpp.

void octomap::ViewerWidget::stopCameraPath ( int  id) [slot]

Definition at line 253 of file ViewerWidget.cpp.

void octomap::ViewerWidget::updateCameraPath ( int  id,
int  frame 
) [slot]

Definition at line 200 of file ViewerWidget.cpp.


Member Data Documentation

Definition at line 120 of file ViewerWidget.h.

Definition at line 119 of file ViewerWidget.h.

Definition at line 112 of file ViewerWidget.h.

Definition at line 113 of file ViewerWidget.h.

Definition at line 114 of file ViewerWidget.h.

Definition at line 109 of file ViewerWidget.h.

Definition at line 108 of file ViewerWidget.h.

Definition at line 105 of file ViewerWidget.h.

Definition at line 106 of file ViewerWidget.h.

Definition at line 110 of file ViewerWidget.h.

double octomap::ViewerWidget::m_zMax [protected]

Definition at line 117 of file ViewerWidget.h.

double octomap::ViewerWidget::m_zMin [protected]

Definition at line 116 of file ViewerWidget.h.


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


octovis
Author(s): Kai M. Wurm , Armin Hornung
autogenerated on Thu Aug 27 2015 14:13:26