Documentation


X3DTK::Qt::Viewer Class Reference

#include <viewer.h>

Inheritance diagram for X3DTK::Qt::Viewer:

QGLViewer List of all members.

Detailed Description

Class providing an X3D Viewer by implementing QGLViewer.

Definition at line 20 of file viewer.h.

Public Types

enum  video_mode { ANIMATION = 0, DISPLAY = 1, SCREEN = 2 }
 The video modes set. More...


Public Member Functions

 Viewer ()
 Constructor.

 Viewer (QWidget *q, const char *c)
 Constructor.

 ~Viewer ()
 Destructor.

void viewAll ()
 Upadte the GL frustrum and move the camera to show entire scene.

void updateFrustum ()
 Compute the X3DTK::X3D::Scene bounding box and the GL frustum.

void init ()
 Init openGL states, lights and camera.

bool viewCapture ()
 if snapshot is false and getVideoName() is not empty, xine is launched to view the encoded video getVideoName() and return value is true.

void drawAfterAnimation ()
 Update the display after the X3DTK::mainScene being animated.

bool mpeg2encode ()
 Encode MPEG-2 video with mpeg2encode.

bool xvidcap ()
 Capture frames displayed on the screen with xvidcap.

void setMainController (::MainController *mainController)
 Set the main GUI.

bool setSnapshot (bool b)
 Set snapshot.

void setSnapshotFilename (QString s)
 Set snapshotFilename Verify if the extension is an available format and if it is handled by Qt.

void setVideoName (QString)
 Set video name, i.e. snapshotFilename.

void setVideoMode (video_mode mode)
 Set videoMode.

::MainControllergetMainController ()
 Get the main GUI.

ViewerQtgetViewerGUI ()
 Get the viewer GUI.

bool getSnapshot ()
 Get snapshot.

QString getVideoName ()
 Get the video name.

video_mode getVideoMode ()
 Get the videoMode.


Protected Types

typedef std::list< animal::ConstrainedItem * > ItemList
 a list of manipulated objects

enum  InteractionMode { MOVE_CAMERA, SELECT_OBJECT }
 User interaction modes. More...


Protected Member Functions

virtual void draw ()
 Draw the X3DTK::GL::Scene and other things in the X3DTK::mainScene.

virtual void postDraw ()
 Call after draw().

QString helpString () const
 Method call when the help() method is called (keyboard shortcut: Key_H).

virtual void keyPressEvent (QKeyEvent *e)
 Deal with key press event.

virtual void keyReleaseEvent (QKeyEvent *e)
 Deal with key release event.

virtual void mouseDoubleClickEvent (QMouseEvent *e)
 Deal with mouse double-click event.

virtual void mouseMoveEvent (QMouseEvent *e)
 Deal with mouse move event.

virtual void mousePressEvent (QMouseEvent *e)
 Deal with mouse press event.

virtual void mouseReleaseEvent (QMouseEvent *e)
 Deal with mouse release event.


Protected Attributes

::MainControllermainController
 The main GUI.

ViewerQtviewerGUI
 Viewer GUI.

bool snapshot
 True when a snapshot is processed every draw(). Warning, overwrite mode.

QString snapshotFilename
 The snapshot file names For example: if snapshotFilename = "my_directory_path/my_name%03d.ppm" the snapshot files names will be my_directory_path/my_name000.ppm, my_directory_path/my_name001.ppm...

int snapshotCounter
 The counter for the snapshot file names.

QString snapshotFormat
 The format to save the snapshot file.

video_mode videoMode
 The tree available video modes are: ANIMATION: snapshots are done when the scene is animated, DISPLAY: snapshots are done when the scene is drawn, and SCREEN: snapshots are done on the screen with xvidcap.

InteractionMode interactionMode
 The interaction mode.

ItemList manipulatedObjects
 the list of manipulated objects

animal::ConstrainedItemselectedPoint
 the selected object


Member Typedef Documentation

typedef std::list<animal::ConstrainedItem*> X3DTK::Qt::Viewer::ItemList [protected]
 

a list of manipulated objects

Definition at line 181 of file viewer.h.


Member Enumeration Documentation

enum X3DTK::Qt::Viewer::InteractionMode [protected]
 

User interaction modes.

Enumeration values:
MOVE_CAMERA 
SELECT_OBJECT 

Definition at line 175 of file viewer.h.

enum X3DTK::Qt::Viewer::video_mode
 

The video modes set.

Enumeration values:
ANIMATION  : snapshots are done when the scene is animated.
DISPLAY  : snapshots are done when the scene is drawn.
SCREEN  : snapshots are done with xvidcap.

Definition at line 79 of file viewer.h.

Referenced by getVideoMode().


Constructor & Destructor Documentation

X3DTK::Qt::Viewer::Viewer  ) 
 

Constructor.

Definition at line 18 of file viewer.cpp.

References viewerGUI.

X3DTK::Qt::Viewer::Viewer QWidget q,
const char *  c
 

Constructor.

Definition at line 32 of file viewer.cpp.

References viewerGUI.

X3DTK::Qt::Viewer::~Viewer  ) 
 

Destructor.

Definition at line 46 of file viewer.cpp.

References viewerGUI.


Member Function Documentation

void X3DTK::Qt::Viewer::draw  )  [protected, virtual]
 

Draw the X3DTK::GL::Scene and other things in the X3DTK::mainScene.

Definition at line 307 of file viewer.cpp.

References animal::ConstrainedItem::draw(), MainController::getMainScene(), and selectedPoint.

void X3DTK::Qt::Viewer::drawAfterAnimation  ) 
 

Update the display after the X3DTK::mainScene being animated.

Definition at line 146 of file viewer.cpp.

References ANIMATION, snapshot, snapshotCounter, snapshotFilename, snapshotFormat, and videoMode.

::MainController* X3DTK::Qt::Viewer::getMainController  )  [inline]
 

Get the main GUI.

Definition at line 96 of file viewer.h.

Referenced by X3DTK::Qt::ViewerQt::startCapture().

bool X3DTK::Qt::Viewer::getSnapshot  )  [inline]
 

Get snapshot.

Definition at line 102 of file viewer.h.

References snapshot.

video_mode X3DTK::Qt::Viewer::getVideoMode  )  [inline]
 

Get the videoMode.

Definition at line 108 of file viewer.h.

References video_mode, and videoMode.

Referenced by X3DTK::Qt::ViewerQt::ViewerQt().

QString X3DTK::Qt::Viewer::getVideoName  ) 
 

Get the video name.

Definition at line 550 of file viewer.cpp.

References snapshotFilename.

Referenced by X3DTK::Qt::ViewerQt::chooseVideoName(), mpeg2encode(), X3DTK::Qt::ViewerQt::setTextLabelVideoName(), viewCapture(), and X3DTK::Qt::ViewerQt::ViewerQt().

ViewerQt* X3DTK::Qt::Viewer::getViewerGUI  )  [inline]
 

Get the viewer GUI.

Definition at line 99 of file viewer.h.

References viewerGUI.

QString X3DTK::Qt::Viewer::helpString  )  const [protected]
 

Method call when the help() method is called (keyboard shortcut: Key_H).

Definition at line 360 of file viewer.cpp.

void X3DTK::Qt::Viewer::init  ) 
 

Init openGL states, lights and camera.

Definition at line 55 of file viewer.cpp.

References viewAll().

void X3DTK::Qt::Viewer::keyPressEvent QKeyEvent *  e  )  [protected, virtual]
 

Deal with key press event.

Definition at line 387 of file viewer.cpp.

References interactionMode, SELECT_OBJECT, and viewAll().

void X3DTK::Qt::Viewer::keyReleaseEvent QKeyEvent *  e  )  [protected, virtual]
 

Deal with key release event.

Definition at line 405 of file viewer.cpp.

References interactionMode, and MOVE_CAMERA.

void X3DTK::Qt::Viewer::mouseDoubleClickEvent QMouseEvent *  e  )  [protected, virtual]
 

Deal with mouse double-click event.

Definition at line 418 of file viewer.cpp.

void X3DTK::Qt::Viewer::mouseMoveEvent QMouseEvent *  e  )  [protected, virtual]
 

Deal with mouse move event.

Definition at line 425 of file viewer.cpp.

References interactionMode, animal::ConstrainedItem::moveTo(), SELECT_OBJECT, and selectedPoint.

void X3DTK::Qt::Viewer::mousePressEvent QMouseEvent *  e  )  [protected, virtual]
 

Deal with mouse press event.

Definition at line 444 of file viewer.cpp.

References animal::ConstrainedItem::getPoint(), interactionMode, manipulatedObjects, animal::ConstrainedItem::moveTo(), MainController::pickPoint(), animal::ConstrainedItem::print(), SELECT_OBJECT, and selectedPoint.

void X3DTK::Qt::Viewer::mouseReleaseEvent QMouseEvent *  e  )  [protected, virtual]
 

Deal with mouse release event.

Definition at line 486 of file viewer.cpp.

References interactionMode, manipulatedObjects, SELECT_OBJECT, and selectedPoint.

bool X3DTK::Qt::Viewer::mpeg2encode  ) 
 

Encode MPEG-2 video with mpeg2encode.

if snapshotFilename = "my_directory_path/my_name%03d.ppm", the snapshot files names will be my_directory_path/my_name000.ppm, my_directory_path/my_name001.ppm... and the name of the MPEG2 movi will be "my_directory_path/my_name.mpg". Return true if the encode is launched.

Definition at line 172 of file viewer.cpp.

References getVideoName(), snapshotFilename, and snapshotFormat.

Referenced by X3DTK::Qt::ViewerQt::mpeg2encode().

void X3DTK::Qt::Viewer::postDraw  )  [protected, virtual]
 

Call after draw().

Call QGLViewer::postDraw() which behavior displays axis, grid, FPS... If snapshot is true and videoMode==DISPLAY, save the current frame.

Definition at line 342 of file viewer.cpp.

References DISPLAY, snapshot, snapshotCounter, snapshotFilename, snapshotFormat, and videoMode.

void X3DTK::Qt::Viewer::setMainController ::MainController mainController  ) 
 

Set the main GUI.

Definition at line 301 of file viewer.cpp.

References viewerGUI.

bool X3DTK::Qt::Viewer::setSnapshot bool  b  ) 
 

Set snapshot.

Parameters:
b true if the snapshot has to be launched
Returns:
true if the animation recording is launched

Definition at line 502 of file viewer.cpp.

References snapshot, snapshotCounter, snapshotFilename, and snapshotFormat.

void X3DTK::Qt::Viewer::setSnapshotFilename QString  s  ) 
 

Set snapshotFilename Verify if the extension is an available format and if it is handled by Qt.

Definition at line 525 of file viewer.cpp.

References snapshotFilename, and snapshotFormat.

Referenced by setVideoName().

void X3DTK::Qt::Viewer::setVideoMode video_mode  mode  )  [inline]
 

Set videoMode.

Definition at line 87 of file viewer.h.

References videoMode.

Referenced by X3DTK::Qt::ViewerQt::toggleVideoAnimation(), X3DTK::Qt::ViewerQt::toggleVideoDisplay(), and X3DTK::Qt::ViewerQt::toggleVideoScreen().

void X3DTK::Qt::Viewer::setVideoName QString   ) 
 

Set video name, i.e. snapshotFilename.

Definition at line 560 of file viewer.cpp.

References setSnapshotFilename().

Referenced by X3DTK::Qt::ViewerQt::chooseVideoName().

void X3DTK::Qt::Viewer::updateFrustum  ) 
 

Compute the X3DTK::X3D::Scene bounding box and the GL frustum.

Definition at line 109 of file viewer.cpp.

References MainController::getMainScene().

Referenced by viewAll().

void X3DTK::Qt::Viewer::viewAll  ) 
 

Upadte the GL frustrum and move the camera to show entire scene.

Definition at line 103 of file viewer.cpp.

References updateFrustum().

Referenced by init(), and keyPressEvent().

bool X3DTK::Qt::Viewer::viewCapture  ) 
 

if snapshot is false and getVideoName() is not empty, xine is launched to view the encoded video getVideoName() and return value is true.

Else return false

Definition at line 125 of file viewer.cpp.

References getVideoName(), and snapshot.

Referenced by X3DTK::Qt::ViewerQt::viewCapture().

bool X3DTK::Qt::Viewer::xvidcap  ) 
 

Capture frames displayed on the screen with xvidcap.

Return true if the capture is launched.

Definition at line 274 of file viewer.cpp.

References SCREEN, snapshotFilename, snapshotFormat, and videoMode.

Referenced by X3DTK::Qt::ViewerQt::startCapture().


Member Data Documentation

InteractionMode X3DTK::Qt::Viewer::interactionMode [protected]
 

The interaction mode.

Definition at line 178 of file viewer.h.

Referenced by keyPressEvent(), keyReleaseEvent(), mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().

::MainController* X3DTK::Qt::Viewer::mainController [protected]
 

The main GUI.

Definition at line 143 of file viewer.h.

ItemList X3DTK::Qt::Viewer::manipulatedObjects [protected]
 

the list of manipulated objects

Definition at line 184 of file viewer.h.

Referenced by mousePressEvent(), and mouseReleaseEvent().

animal::ConstrainedItem* X3DTK::Qt::Viewer::selectedPoint [protected]
 

the selected object

Definition at line 187 of file viewer.h.

Referenced by draw(), mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().

bool X3DTK::Qt::Viewer::snapshot [protected]
 

True when a snapshot is processed every draw(). Warning, overwrite mode.

Definition at line 149 of file viewer.h.

Referenced by drawAfterAnimation(), getSnapshot(), postDraw(), setSnapshot(), and viewCapture().

int X3DTK::Qt::Viewer::snapshotCounter [protected]
 

The counter for the snapshot file names.

Definition at line 160 of file viewer.h.

Referenced by drawAfterAnimation(), postDraw(), and setSnapshot().

QString X3DTK::Qt::Viewer::snapshotFilename [protected]
 

The snapshot file names For example: if snapshotFilename = "my_directory_path/my_name%03d.ppm" the snapshot files names will be my_directory_path/my_name000.ppm, my_directory_path/my_name001.ppm...

Definition at line 157 of file viewer.h.

Referenced by drawAfterAnimation(), getVideoName(), mpeg2encode(), postDraw(), setSnapshot(), setSnapshotFilename(), and xvidcap().

QString X3DTK::Qt::Viewer::snapshotFormat [protected]
 

The format to save the snapshot file.

The available formats are those handled by Qt: BMP, JPEG, PBM, PGM, PNG, PPM, XBM, XPM

Definition at line 165 of file viewer.h.

Referenced by drawAfterAnimation(), mpeg2encode(), postDraw(), setSnapshot(), setSnapshotFilename(), and xvidcap().

video_mode X3DTK::Qt::Viewer::videoMode [protected]
 

The tree available video modes are: ANIMATION: snapshots are done when the scene is animated, DISPLAY: snapshots are done when the scene is drawn, and SCREEN: snapshots are done on the screen with xvidcap.

Definition at line 171 of file viewer.h.

Referenced by drawAfterAnimation(), getVideoMode(), postDraw(), setVideoMode(), and xvidcap().

ViewerQt* X3DTK::Qt::Viewer::viewerGUI [protected]
 

Viewer GUI.

Definition at line 146 of file viewer.h.

Referenced by getViewerGUI(), setMainController(), Viewer(), and ~Viewer().


The documentation for this class was generated from the following files:
Generated on Thu Dec 23 13:52:35 2004 by doxygen 1.3.6