Viewer Class Reference

Viewer widget More...

#include <viewer.h>

Inheritance diagram for Viewer:
Inheritance graph
[legend]

List of all members.

Public Slots

void configOpenGL ()
 Open the dialog box to configure the OpenGL context.
virtual void initFromDOMElement (const QDomElement &element)
 Read a saved state.
virtual void setModel (Model *model)
 This function registers the model creation function to the viewer.
void updateAll ()
 Update first OpenGL, then the view.
Snapshot methods

void blockDraw (bool block=true)

Signals

Internal signals

void cameraRecordingStart ()
 Signal sent to the GUI to start recording animations.
void cameraRecordingStop ()
 Signal sent to the GUI to top recording animations.
void createViewer (QWidget *w, const QGLWidget *shareWidget)
 Signal sent to request a new viewer.
void createViewer (QLayout *l, const QGLWidget *shareWidget)
 Signal sent to request a new viewer.
void createViewer (const QGLWidget *shareWidget)
 Signal sent to request a new viewer.
void modelRecordingStart ()
 Signal sent to the GUI to start recording animations.
void modelRecordingStop ()
 Signal sent to the GUI to top recording animations.
void openOpenGLConfig ()
 Open OpenGL config dialog box.
void stepDrawFinished (bool)
 Signal emitted at the end of each simulation step (including the drawing).

Public Member Functions

void addToolBar (Qt::ToolBarArea area, QToolBar *toolbar)
 Add a toolbar to the main window of the application.
QToolBaraddToolBar (const QString &title)
 Creates a toolbar associated with the main window of the application.
void keyPressEvent (QKeyEvent *e)
 Define a new shortcut .
QMainWindowmainWindow ()
 Returns the main window associated with the application.
Modelmodel ()
 Function returning a pointer onto the current model.
void setStatusMessage (const QString &msg)
 Change the status message.
void showEvent (QShowEvent *event)
 Restore the state (including position) on the show event.
QString statusMessage () const
 Get the current status message.
Internal methods

virtual QDomElement domElement (const QString &name, QDomDocument &document) const
 Function used to save the current state of the viewer (i.e.
virtual QString helpString () const
 Returns a description of the model to show on the help screen.
void setIndex (int idx)
 Set the creation index to the position in the viewer list.
Method to redefine to personalize drawing or user interaction

virtual void draw ()
 Redraw the simulation result.
virtual void drawWithNames ()
 Draw with object naming.
virtual void init ()
 Initialize the viewer with a valid OpenGL context.
virtual void postDraw ()
 Restore the original state of the OpenGL context.
virtual void postSelection (const QPoint &pos)
 Handle post selection actions.
virtual void preDraw ()
 Initialize the OpenGL context before drawing.
Constructors/destructors

 Viewer (QWidget *parent, const QGLWidget *shareWidget=0, int idx=-1)
 Creates the object within the parent.
 ~Viewer ()
 Destroy the viewer properly.

Static Public Member Functions

static void initFormat ()

Screenshot methods



void addViewer (QWidget *w, const QGLWidget *shareWidget=0)
 Create a new viewer.
void addViewer (QLayout *l, const QGLWidget *shareWidget=0)
 Create a new viewer.
virtual void drawLight (GLenum light, float scale=1.0f)
 Exposing the drawLight method .
QMenuhelpMenu ()
 Returns a pointer to the help menu.
int index () const
 Return the creation index, or -1 if the viewer is not registered with the main GUI.
QMenuBarmenuBar (bool clear=true)
 Returns a pointer to the menu bar of the application.
void newViewer (const QGLWidget *shareWidget=0)
 Create a new viewer.
int screenshotCounter () const
 Get the current screenshot counter.
const QStringscreenshotFileName () const
 Get the current screenshot file name.
const QStringscreenshotFormat () const
 Get the current screenshot format.
int screenshotQuality ()
 Get the current screenshot quality.
bool wasInitialized () const
 Returns true if this viewer has already been initialized.
bool openScreenshotFormatDialog ()
 Open the screenshot format dialog.
void saveScreenshot (const QString &fileName, bool overwrite=false)
 Save a screenshot.
void saveScreenshot (bool automatic=true, bool overwrite=false)
 Save a screenshot.
void setScreenshotCounter (int counter)
 Set the screenshot counter.
void setScreenshotFileName (const QString &name)
 Set the screenshot file name.
void setScreenshotFormat (const QString &format)
 Set the screenshot format.
void setScreenshotQuality (int quality)
 Set the screenshot quality.
void startRecordingCameraAnimation ()
 Start recording a movie with the various frames.
void startRecordingModelAnimation ()
 Start recording a movie with the various frames.
void stopRecordingCameraAnimation ()
 Start recording a movie with the various frames.
void stopRecordingModelAnimation ()
 Start recording a movie with the various frames.

Detailed Description

Viewer widget

This class handle the simulation window and the life of the simulation object.

You might want to inherit this class to personalize the interactions. You might also want to look at the documentation of its base class.

If you inherit from it, you have to register the derived class using the DEFINE_VIEWER(classname) macro defined in <vvall.h>.

Definition at line 30 of file viewer.h.


Constructor & Destructor Documentation

Viewer::Viewer ( QWidget parent,
const QGLWidget shareWidget = 0,
int  idx = -1 
)

Creates the object within the parent.

Parameters:
parent Enclosing widget.

Definition at line 26 of file viewer.cpp.

00027   : QGLViewer(parent, shareWidget)
00028   , _model(0)
00029   , animation(false)
00030   , initialized(false)
00031   , lastInitCamera(0)
00032   , _index(idx)
00033   , block_draw(0)
00034   , minFrameInterval(0)
00035   , main_window(0)
00036 {
00037   initObject();
00038 }

Viewer::~Viewer (  ) 

Destroy the viewer properly.

Definition at line 86 of file viewer.cpp.

References QGLViewer::saveStateToFile().

00087 {
00088   if(_model)
00089   {
00090     _model->finalizeDraw(this);
00091   }
00092   saveStateToFile();
00093 }


Member Function Documentation

void Viewer::addToolBar ( Qt::ToolBarArea  area,
QToolBar toolbar 
)

Add a toolbar to the main window of the application.

Definition at line 321 of file viewer.cpp.

References QMainWindow::addToolBar(), and mainWindow().

00322 {
00323   mainWindow()->addToolBar(area, toolbar);
00324 }

QToolBar * Viewer::addToolBar ( const QString title  ) 

Creates a toolbar associated with the main window of the application.

Definition at line 316 of file viewer.cpp.

References QMainWindow::addToolBar(), and mainWindow().

00317 {
00318   return mainWindow()->addToolBar(title);
00319 }

void Viewer::addViewer ( QWidget w,
const QGLWidget shareWidget = 0 
)

Create a new viewer.

The viewer created is boxed in a widget for easy replacement.

Definition at line 415 of file viewer.cpp.

References createViewer().

00416 {
00417   emit createViewer(w, shareWidget);
00418 }

void Viewer::addViewer ( QLayout l,
const QGLWidget shareWidget = 0 
)

Create a new viewer.

The viewer created is boxed in a widget for easy replacement.

Definition at line 420 of file viewer.cpp.

References createViewer().

00421 {
00422   emit createViewer(l, shareWidget);
00423 }

void Viewer::cameraRecordingStart (  )  [signal]

Signal sent to the GUI to start recording animations.

Referenced by startRecordingCameraAnimation().

void Viewer::cameraRecordingStop (  )  [signal]

Signal sent to the GUI to top recording animations.

Referenced by stopRecordingCameraAnimation().

void Viewer::configOpenGL (  )  [slot]

Open the dialog box to configure the OpenGL context.

Definition at line 362 of file viewer.cpp.

References openOpenGLConfig().

00363 {
00364   emit openOpenGLConfig();
00365 }

void Viewer::createViewer ( QWidget w,
const QGLWidget shareWidget 
) [signal]

Signal sent to request a new viewer.

void Viewer::createViewer ( QLayout l,
const QGLWidget shareWidget 
) [signal]

Signal sent to request a new viewer.

void Viewer::createViewer ( const QGLWidget shareWidget  )  [signal]

Signal sent to request a new viewer.

Referenced by addViewer(), and newViewer().

QDomElement Viewer::domElement ( const QString name,
QDomDocument document 
) const [virtual]

Function used to save the current state of the viewer (i.e.

camera, ...)

Reimplemented from QGLViewer.

Definition at line 181 of file viewer.cpp.

References QGLFormat::accum(), QGLFormat::accumBufferSize(), QGLFormat::alpha(), QGLFormat::alphaBufferSize(), QGLFormat::blueBufferSize(), QDomDocument::createElement(), QGLFormat::defaultFormat(), QGLFormat::depth(), QGLFormat::depthBufferSize(), QGLFormat::directRendering(), QGLFormat::doubleBuffer(), QGLFormat::greenBufferSize(), QGLFormat::hasOverlay(), QGLFormat::redBufferSize(), QGLFormat::rgba(), QGLFormat::sampleBuffers(), QGLFormat::samples(), QDomElement::setAttribute(), QGLFormat::stencil(), QGLFormat::stencilBufferSize(), and QGLFormat::stereo().

00182 {
00183   // Creates a custom node for a light
00184   QDomElement de = document.createElement("GLFormat");
00185   QGLFormat def = QGLFormat::defaultFormat();
00186   de.setAttribute("accum", (def.accum()?"yes":"no"));
00187   if(def.accum() && def.accumBufferSize() != -1)
00188     de.setAttribute("accumBufferSize", max(0, def.accumBufferSize()));
00189   de.setAttribute("alpha", (def.alpha()?"yes":"no"));
00190   if(def.alpha() && def.alphaBufferSize() != -1)
00191     de.setAttribute("alphaBufferSize", max(0, def.alphaBufferSize()));
00192   de.setAttribute("depth", (def.depth()?"yes":"no"));
00193   if(def.depth() && def.depthBufferSize() != -1)
00194     de.setAttribute("depthBufferSize", max(0, def.depthBufferSize()));
00195   de.setAttribute("doubleBuffer", (def.doubleBuffer()?"yes":"no"));
00196   de.setAttribute("directRendering", (def.directRendering()?"yes":"no"));
00197   de.setAttribute("hasOverlay", (def.hasOverlay()?"yes":"no"));
00198   de.setAttribute("rgba", (def.rgba()?"yes":"no"));
00199   if(def.rgba())
00200   {
00201     if(def.redBufferSize() != -1)
00202       de.setAttribute("redBufferSize", max(0, def.redBufferSize()));
00203     if(def.greenBufferSize() != -1)
00204       de.setAttribute("greenBufferSize", max(0, def.greenBufferSize()));
00205     if(def.blueBufferSize() != -1)
00206       de.setAttribute("blueBufferSize", max(0, def.blueBufferSize()));
00207   }
00208   de.setAttribute("sampleBuffers", (def.sampleBuffers()?"yes":"no"));
00209   if(def.sampleBuffers() && def.samples() != -1)
00210     de.setAttribute("samples", max(0, def.samples()));
00211   de.setAttribute("stereo", (def.stereo()?"yes":"no"));
00212   de.setAttribute("stencil", (def.stencil()?"yes":"no"));
00213   if(def.stencil() && def.stencilBufferSize() != -1)
00214     de.setAttribute("stencilBufferSize", max(0, def.stencilBufferSize()));
00215 
00216   // Get default state domElement and append custom node
00217   QDomElement res = QGLViewer::domElement(name, document);
00218   res.appendChild(de);
00219   return res;
00220 }

virtual void Viewer::draw (  )  [inline, virtual]

Redraw the simulation result.

See also:
Model::draw(Viewer*)

Reimplemented from QGLViewer.

Definition at line 344 of file viewer.h.

00345   { if( _model and !block_draw ) _model->draw(this); }

virtual void Viewer::drawLight ( GLenum  light,
float  scale = 1.0f 
) [inline, virtual]

Exposing the drawLight method .

..

See also:
QGLViewer::drawLight

Definition at line 121 of file viewer.h.

00121 { QGLViewer::drawLight(light, scale); }

virtual void Viewer::drawWithNames (  )  [inline, virtual]

Draw with object naming.

Used for object selection.

See also:
Model::drawWithNames(Viewer*)

Reimplemented from QGLViewer.

Definition at line 365 of file viewer.h.

00366   { if (_model) _model->drawWithNames(this); }

QMenu * Viewer::helpMenu (  ) 

Returns a pointer to the help menu.

This is useful for two purposes: 1 - Adding your own help elements 2 - Placing other menus before the help

Definition at line 351 of file viewer.cpp.

References QVariant::isValid(), mainWindow(), and QVariant::value().

00352 {
00353   QVariant hm = mainWindow()->property("helpMenu");
00354   if(hm.isValid())
00355   {
00356     QMenu* menu = hm.value<QMenu*>();
00357     return menu;
00358   }
00359   return 0;
00360 }

virtual QString Viewer::helpString (  )  const [inline, virtual]

Returns a description of the model to show on the help screen.

See also:
Model::helpString()

Reimplemented from QGLViewer.

Definition at line 69 of file viewer.h.

00070   {
00071     if(_model) return _model->helpString();
00072     else return QString(tr("Generic VV model"));
00073   }

int Viewer::index (  )  const [inline]

Return the creation index, or -1 if the viewer is not registered with the main GUI.

This number can be used to identified what viewer is suppose to do what.

Definition at line 151 of file viewer.h.

Referenced by keyPressEvent().

00151 { return _index; }

void Viewer::init (  )  [virtual]

Initialize the viewer with a valid OpenGL context.

See also:
Model::initDraw(Viewer*)

Reimplemented from QGLViewer.

Definition at line 95 of file viewer.cpp.

Referenced by setModel().

00096 {
00097   QGLViewer::init();
00098   initCamera();
00099   if(_model)
00100   {
00101     _model->initDraw( this );
00102     //showEntireScene();
00103   }
00104 }

void Viewer::initFromDOMElement ( const QDomElement element  )  [virtual, slot]

Read a saved state.

Reimplemented from QGLViewer.

Definition at line 121 of file viewer.cpp.

References QGLFormat::accum(), QGLFormat::alpha(), QDomElement::attribute(), QGLFormat::defaultFormat(), QGLFormat::depth(), QDomElement::hasAttribute(), QGLFormat::rgba(), QGLFormat::sampleBuffers(), QGLFormat::setAccumBufferSize(), QGLFormat::setAlpha(), QGLFormat::setAlphaBufferSize(), QGLFormat::setBlueBufferSize(), QGLFormat::setDefaultFormat(), QGLFormat::setDepth(), QGLFormat::setDepthBufferSize(), QGLFormat::setDirectRendering(), QGLFormat::setDoubleBuffer(), QGLFormat::setGreenBufferSize(), QGLFormat::setOverlay(), QGLFormat::setRedBufferSize(), QGLFormat::setRgba(), QGLFormat::setSampleBuffers(), QGLFormat::setSamples(), QGLFormat::setStencil(), QGLFormat::setStencilBufferSize(), QGLFormat::setStereo(), QGLFormat::stencil(), and QDomElement::tagName().

00122 {
00123   // Restore standard state
00124   QGLViewer::initFromDOMElement(element);
00125 
00126   QGLFormat def = QGLFormat::defaultFormat();
00127 
00128   QDomElement child=element.firstChild().toElement();
00129   while (!child.isNull())
00130   {
00131     if (child.tagName() == "GLFormat")
00132     {
00133       if (child.hasAttribute("alpha"))
00134         def.setAlpha(child.attribute("alpha").toLower() == "yes");
00135       if (child.hasAttribute("depth"))
00136         def.setDepth(child.attribute("depth").toLower() == "yes");
00137       if (child.hasAttribute("rgba"))
00138         def.setRgba(child.attribute("rgba").toLower() == "yes");
00139       if (child.hasAttribute("stereo"))
00140         def.setStereo(child.attribute("stereo").toLower() == "yes");
00141       if (child.hasAttribute("stencil"))
00142         def.setStencil(child.attribute("stencil").toLower() == "yes");
00143       if (child.hasAttribute("doubleBuffer"))
00144         def.setDoubleBuffer(child.attribute("doubleBuffer").toLower() == "yes");
00145       if (child.hasAttribute("sampleBuffers"))
00146         def.setSampleBuffers(child.attribute("sampleBuffers").toLower() == "yes");
00147       if (child.hasAttribute("directRendering"))
00148         def.setDirectRendering(child.attribute("directRendering").toLower() == "yes");
00149       if (child.hasAttribute("hasOverlay"))
00150         def.setOverlay(child.attribute("hasOverlay").toLower() == "yes");
00151       if(def.accum())
00152         if (child.hasAttribute("accumBufferSize"))
00153           def.setAccumBufferSize(child.attribute("accumBufferSize").toInt());
00154       if(def.alpha())
00155         if (child.hasAttribute("alphaBufferSize"))
00156           def.setAlphaBufferSize(child.attribute("alphaBufferSize").toInt());
00157       if(def.depth())
00158         if (child.hasAttribute("depthBufferSize"))
00159           def.setDepthBufferSize(child.attribute("depthBufferSize").toInt());
00160       if(def.sampleBuffers())
00161         if (child.hasAttribute("samples"))
00162           def.setSamples(child.attribute("samples").toInt());
00163       if(def.stencil())
00164         if (child.hasAttribute("stencilBufferSize"))
00165           def.setStencilBufferSize(child.attribute("stencilBufferSize").toInt());
00166       if(def.rgba())
00167       {
00168         if (child.hasAttribute("redBufferSize"))
00169           def.setRedBufferSize(child.attribute("redBufferSize").toInt());
00170         if (child.hasAttribute("greenBufferSize"))
00171           def.setGreenBufferSize(child.attribute("greenBufferSize").toInt());
00172         if (child.hasAttribute("blueBufferSize"))
00173           def.setBlueBufferSize(child.attribute("blueBufferSize").toInt());
00174       }
00175     }
00176     child = child.nextSibling().toElement();
00177   }
00178   QGLFormat::setDefaultFormat(def);
00179 }

void Viewer::keyPressEvent ( QKeyEvent e  ) 

Define a new shortcut .

..

Reimplemented from QGLViewer.

Definition at line 393 of file viewer.cpp.

References index(), QKeyEvent::key(), and QGLViewer::showEntireScene().

00394 {
00395   switch(e->key())
00396   {
00397     case Qt::Key_F:
00398       if(index() < 0 and e->modifiers() == (Qt::AltModifier | Qt::ControlModifier))
00399       {
00400         showEntireScene();
00401         return;
00402       }
00403       break;
00404     default:
00405       break;
00406   }
00407   QGLViewer::keyPressEvent(e);
00408 }

QMainWindow * Viewer::mainWindow (  ) 

Returns the main window associated with the application.

Definition at line 326 of file viewer.cpp.

Referenced by addToolBar(), helpMenu(), and menuBar().

00327 {
00328   return main_window;
00329 }

QMenuBar * Viewer::menuBar ( bool  clear = true  ) 

Returns a pointer to the menu bar of the application.

Parameters:
clear If true, remove any element from the menu bar but the help.

Definition at line 331 of file viewer.cpp.

References QVariant::isValid(), mainWindow(), and QVariant::value().

00332 {
00333   const char* property_name;
00334   if(clear)
00335   {
00336     property_name = "menuBar";
00337   }
00338   else
00339   {
00340     property_name = "existingMenuBar";
00341   }
00342   QVariant mb = mainWindow()->property(property_name);
00343   if(mb.isValid())
00344   {
00345     QMenuBar* bar = mb.value<QMenuBar*>();
00346     return bar;
00347   }
00348   return 0;
00349 }

Model* Viewer::model (  )  [inline]

Function returning a pointer onto the current model.

Definition at line 55 of file viewer.h.

00055 { return _model; }

void Viewer::modelRecordingStart (  )  [signal]

Signal sent to the GUI to start recording animations.

Referenced by startRecordingModelAnimation().

void Viewer::modelRecordingStop (  )  [signal]

Signal sent to the GUI to top recording animations.

Referenced by stopRecordingModelAnimation().

void Viewer::newViewer ( const QGLWidget shareWidget = 0  ) 

Create a new viewer.

The viewer created is boxed in a widget for easy replacement.

Definition at line 410 of file viewer.cpp.

References createViewer().

00411 {
00412   emit createViewer(shareWidget);
00413 }

void Viewer::openOpenGLConfig (  )  [signal]

Open OpenGL config dialog box.

Referenced by configOpenGL().

bool Viewer::openScreenshotFormatDialog (  )  [inline, slot]

Open the screenshot format dialog.

See also:
QGLViewer::openSnapshotFormatDialog

Definition at line 248 of file viewer.h.

References QGLViewer::openSnapshotFormatDialog().

void Viewer::postDraw (  )  [virtual]

Restore the original state of the OpenGL context.

See also:
Model::postDraw(Viewer*)

Reimplemented from QGLViewer.

Definition at line 114 of file viewer.cpp.

00115 {
00116   if(_model and !block_draw)
00117     _model->postDraw(this);
00118   QGLViewer::postDraw();
00119 }

virtual void Viewer::postSelection ( const QPoint pos  )  [inline, virtual]

Handle post selection actions.

Reimplemented from QGLViewer.

Definition at line 371 of file viewer.h.

00372   { if(_model) _model->postSelection(pos, this); }

virtual void Viewer::preDraw (  )  [inline, virtual]

Initialize the OpenGL context before drawing.

See also:
Model::preDraw(Viewer*)

Reimplemented from QGLViewer.

Definition at line 337 of file viewer.h.

00338   { QGLViewer::preDraw(); if( _model and !block_draw ) _model->preDraw(this); }

void Viewer::saveScreenshot ( const QString fileName,
bool  overwrite = false 
) [inline, slot]

Save a screenshot.

See also:
QGLViewer::saveSnapshot(const QString&, bool)

Definition at line 208 of file viewer.h.

References QGLViewer::saveSnapshot().

00209   { QGLViewer::saveSnapshot(fileName, overwrite); }

void Viewer::saveScreenshot ( bool  automatic = true,
bool  overwrite = false 
) [inline, slot]

Save a screenshot.

See also:
QGLViewer::saveSnapshot(bool,bool)

Definition at line 200 of file viewer.h.

References QGLViewer::saveSnapshot().

00201   { QGLViewer::saveSnapshot(automatic, overwrite); }

int Viewer::screenshotCounter (  )  const [inline]

Get the current screenshot counter.

See also:
QGLViewer::snapshotCounter

Definition at line 105 of file viewer.h.

References QGLViewer::snapshotCounter().

00106   { return QGLViewer::snapshotCounter(); }

const QString& Viewer::screenshotFileName (  )  const [inline]

Get the current screenshot file name.

See also:
QGLViewer::snapshotFileName

Definition at line 90 of file viewer.h.

References QGLViewer::snapshotFileName().

00091   { return QGLViewer::snapshotFileName(); }

const QString& Viewer::screenshotFormat (  )  const [inline]

Get the current screenshot format.

See also:
QGLViewer::snapshotFormat

Definition at line 97 of file viewer.h.

References QGLViewer::snapshotFormat().

00098   { return QGLViewer::snapshotFormat (); }

int Viewer::screenshotQuality (  )  [inline]

Get the current screenshot quality.

See also:
QGLViewer::snapshotQuality

Definition at line 113 of file viewer.h.

References QGLViewer::snapshotQuality().

00114   { return QGLViewer::snapshotQuality(); }

void Viewer::setIndex ( int  idx  )  [inline]

Set the creation index to the position in the viewer list.

Definition at line 78 of file viewer.h.

00078 { _index = idx; }

void Viewer::setModel ( Model model  )  [virtual, slot]

This function registers the model creation function to the viewer.

Definition at line 106 of file viewer.cpp.

References init(), and QGLViewer::updateGL().

00107 {
00108   this->_model = m;
00109   if(initialized) this->init();
00110   updateGL();
00111   update();
00112 }

void Viewer::setScreenshotCounter ( int  counter  )  [inline, slot]

Set the screenshot counter.

See also:
QGLViewer::setSnapshotCounter

Definition at line 232 of file viewer.h.

References QGLViewer::setSnapshotCounter().

00233   { QGLViewer::setSnapshotCounter(counter); }

void Viewer::setScreenshotFileName ( const QString name  )  [inline, slot]

Set the screenshot file name.

See also:
QGLViewer::setSnapshotFileName

Definition at line 216 of file viewer.h.

References QGLViewer::setSnapshotFileName().

void Viewer::setScreenshotFormat ( const QString format  )  [inline, slot]

Set the screenshot format.

See also:
QGLViewer::setSnapshotFormat

Definition at line 224 of file viewer.h.

References QGLViewer::setSnapshotFormat().

00225   { QGLViewer::setSnapshotFormat(format); }

void Viewer::setScreenshotQuality ( int  quality  )  [inline, slot]

Set the screenshot quality.

See also:
QGLViewer::setSnapshotQuality

Definition at line 240 of file viewer.h.

References QGLViewer::setSnapshotQuality().

00241   { QGLViewer::setSnapshotQuality(quality); }

void Viewer::setStatusMessage ( const QString msg  ) 

Change the status message.

On the gui, display the message on the status bar. On batch mode, prints the message to the console.

Definition at line 304 of file viewer.cpp.

00305 {
00306   bool success = parent()->setProperty("statusMessage", msg);
00307   assert(success);
00308 }

void Viewer::showEvent ( QShowEvent event  ) 

Restore the state (including position) on the show event.

Definition at line 283 of file viewer.cpp.

References QGLViewer::camera(), and QGLViewer::restoreStateFromFile().

00284 {
00285   QGLViewer::showEvent(event);
00286   if(!initialized)
00287   {
00288     restoreStateFromFile();
00289     lastInitCamera = camera();
00290     initialized = true;
00291   }
00292 }

void Viewer::startRecordingCameraAnimation (  )  [slot]

Start recording a movie with the various frames.

Definition at line 373 of file viewer.cpp.

References cameraRecordingStart().

00374 {
00375   emit cameraRecordingStart();
00376 }

void Viewer::startRecordingModelAnimation (  )  [slot]

Start recording a movie with the various frames.

Definition at line 383 of file viewer.cpp.

References modelRecordingStart().

00384 {
00385   emit modelRecordingStart();
00386 }

QString Viewer::statusMessage (  )  const

Get the current status message.

Definition at line 310 of file viewer.cpp.

00311 {
00312   QString result = parent()->property("statusMessage").toString();
00313   return result;
00314 }

void Viewer::stepDrawFinished ( bool   )  [signal]

Signal emitted at the end of each simulation step (including the drawing).

void Viewer::stopRecordingCameraAnimation (  )  [slot]

Start recording a movie with the various frames.

Definition at line 378 of file viewer.cpp.

References cameraRecordingStop().

00379 {
00380   emit cameraRecordingStop();
00381 }

void Viewer::stopRecordingModelAnimation (  )  [slot]

Start recording a movie with the various frames.

Definition at line 388 of file viewer.cpp.

References modelRecordingStop().

00389 {
00390   emit modelRecordingStop();
00391 }

void Viewer::updateAll (  )  [slot]

Update first OpenGL, then the view.

Definition at line 367 of file viewer.cpp.

References QGLViewer::updateGL().

00368 {
00369   updateGL();
00370   update();
00371 }

bool Viewer::wasInitialized (  )  const [inline]

Returns true if this viewer has already been initialized.

Definition at line 143 of file viewer.h.

00143 { return initialized; }


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Fri May 31 15:38:01 2013 for VVE by  doxygen 1.6.3