IpsaViewerWidget Class Reference
[libipsaViewer classes]

Basic viewer widget for loading and simulating IPSA scenes. More...

#include <IpsaViewerWidget.h>

Inheritance diagram for IpsaViewerWidget:

Inheritance graph
[legend]
Collaboration diagram for IpsaViewerWidget:

Collaboration graph
[legend]

List of all members.

Public Slots

void reload ()
void reset ()
void save ()
void schedule ()
void showDialog ()

Public Member Functions

bool getVerbosity ()
 IpsaViewerWidget (QWidget *parent, SbBool embed=TRUE)
bool isScheduled ()
void setSceneryFilename (const std::string &newFile)
void setVerbosity (bool verbosityOn=true)
virtual ~IpsaViewerWidget ()

Protected Attributes

IpsaDialogdialog
SoQtExaminerViewer * examinerViewer
IpsaSimulatoripsaSimulator
std::string saveFile


Detailed Description

Basic viewer widget for loading and simulating IPSA scenes.

Create an instance of this class to use it for simulating IPSA scenes (Note that you have to call SO_PLATFORM::init() before instantiating an IpsaViewer): The code usually looks like the following example (also see the QtEmbedding executable):

 #include "IpsaViewerWidget.h"
 #include <Inventor/Qt/SoQt.h>
 #include <QtGui/QApplication>

 int main (int argc, char ** argv)
 {
     QApplication qApplication(argc, argv);
     SO_WINDOW parentWidget = SO_PLATFORM::init(argc, argv, argv[0]);
     IpsaViewerWidget viewer(parentWidget); // create an instance of the IpsaViewerWidget
     viewer.show();
     viewer.raise();
     return qApplication.exec();
 }

The simulation behaviour can be changed by creating a subclass of IpsaSimulator and using this instead of the default IpsaSimulator instance.

Definition at line 46 of file IpsaViewerWidget.h.


Constructor & Destructor Documentation

IpsaViewerWidget::IpsaViewerWidget ( QWidget *  parent,
SbBool  embed = TRUE 
)

The constructor of the IpsaViewerWidget class.
It runs the gui setup and creates a new IpsaSimulator instance in IpsaViewerWidget::ipsaSimulator

Parameters:
parent the parent widget of the viewer (default = NULL)
embed tells if viewer should be embedded (default TRUE)

Definition at line 128 of file IpsaViewerWidget.cpp.

References dialog, examinerViewer, IpsaViewerWidgetUi::examinerViewerWidget, ipsaSimulator, and IpsaViewerWidgetUi::setupUi().

IpsaViewerWidget::~IpsaViewerWidget (  )  [virtual]

The virtual destructor of the IpsaViewerWidget class. It deletes IpsaViewer::ipsaSimulator.

Definition at line 153 of file IpsaViewerWidget.cpp.

References ipsaSimulator.


Member Function Documentation

bool IpsaViewerWidget::getVerbosity (  ) 

Returns:
true if verbosity of IpsaViewerWidget::ipsasimulator is on, false otherwise

Definition at line 242 of file IpsaViewerWidget.cpp.

References IpsaSimulator::getVerbosity(), and ipsaSimulator.

bool IpsaViewerWidget::isScheduled (  ) 

Returns:
true if the current SoWorldPhysics instances are schedule, false otherwise.

Definition at line 222 of file IpsaViewerWidget.cpp.

References ipsaSimulator, and IpsaSimulator::isScheduled().

void IpsaViewerWidget::reload (  )  [slot]

This method creates a new scenegraph by calling IpsaSimulator::reload() on IpsaViewerWidget::ipsaSimulator and afterwards sets it on IpsaViewerWidget::examinerViewer.

Definition at line 176 of file IpsaViewerWidget.cpp.

References examinerViewer, IpsaSimulator::getSceneGraph(), ipsaSimulator, and IpsaSimulator::reload().

void IpsaViewerWidget::reset (  )  [slot]

Resets the simulation by calling IpsaSimulator::reset() in IpsaViewerWidget::ipsaSimulator.

Definition at line 186 of file IpsaViewerWidget.cpp.

References ipsaSimulator, and IpsaSimulator::reset().

void IpsaViewerWidget::save (  )  [slot]

Save current inventor scenegraph to file at location IpsaViewerWidget::saveFile. Do nothing if IpsaViewerWidget::saveFile is empty.

Definition at line 196 of file IpsaViewerWidget.cpp.

References ipsaSimulator, IpsaSimulator::save(), and saveFile.

void IpsaViewerWidget::schedule (  )  [slot]

void IpsaViewerWidget::setSceneryFilename ( const std::string &  newFile  ) 

This method sets newFile as the new filename on IpsaViewerWidget::ipsaSimulator. After calling IpsaViewer::reload() the new file is read.

Definition at line 252 of file IpsaViewerWidget.cpp.

References ipsaSimulator, and IpsaSimulator::setSceneryFilename().

void IpsaViewerWidget::setVerbosity ( bool  verbosityOn = true  ) 

Sets the verbosity flag on IpsaViewerWidget::ipsaSimulator.

Parameters:
verbosityOn true for turning verbosity on, false for turning it of (default = true)

Definition at line 233 of file IpsaViewerWidget.cpp.

References ipsaSimulator, and IpsaSimulator::setVerbosity().

void IpsaViewerWidget::showDialog (  )  [slot]

Shows the IpsaViewerWidget::dialog if it isn't on screen or raises it otherwise.

Definition at line 162 of file IpsaViewerWidget.cpp.

References dialog, and IpsaDialog::reloadData().


Member Data Documentation

An instance of IpsaDialog.

Definition at line 74 of file IpsaViewerWidget.h.

Referenced by IpsaViewerWidget(), and showDialog().

This is a reference to the SoQtExaminerViewer instance which is displayed in the widget.

Definition at line 73 of file IpsaViewerWidget.h.

Referenced by IpsaViewerWidget(), and reload().

An instance of IpsaSimulator which takes care of the simulation.

Definition at line 72 of file IpsaViewerWidget.h.

Referenced by getVerbosity(), IpsaViewerWidget(), isScheduled(), reload(), reset(), save(), schedule(), setSceneryFilename(), setVerbosity(), and ~IpsaViewerWidget().

This filename is used to write the current inventor scenegraph to disk.

Definition at line 70 of file IpsaViewerWidget.h.

Referenced by save().


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

Get IPSA - Inventor Physics Simulation API at SourceForge.net. Fast, secure and Free Open Source software downloads
Generated on Sat Mar 10 20:00:19 2012 for IPSA by  doxygen 1.5.8