Model Class Reference

Simulation class. More...

#include <model.h>

Inheritance diagram for Model:
Inheritance graph
[legend]

List of all members.

Public Slots

void registerFile (std::string filename)
 This function registers a file to the file alteration monitor.
void setAnimationPeriod (int ms)
 Set the animation period, i.e.
void setExitCode (int code)
 Set the exit code.
void unregisterFile (std::string filename)
 This function unregisters a file from the file alteration monitor.
Snapshots methods

bool loadSnapshot (const QString &filename)
 Load a snapshot.
bool loadSnapshot ()
 Load a snapshot specified by the user of the model.
bool saveNextSnapshot ()
 Save the current model as a snapshot on the current recording.
bool saveSnapshot (const QString &filename)
 Save the current model as a snapshot.
Screenshot methods

void screenshot (const QString &fileName, bool overwrite=false)
 Save a screenshot.

Signals

Signals for internal usage only

void changedExitCode (int)
 Signal emitted when the user changes the exit code.
void fileRegister (std::string)
 Signal emitted anytime the user is registering a file to the file checker.
void fileUnregister (std::string)
 Signal emitted anytime the user is unregistering a file .
void loadingSnapshot (const QString &filename, Model *)
 Signal emitted when the user wants to load a snapshot.
void loadingSnapshot (bool auto_naming, Model *)
 Signal emitted when the user wants to load a snapshot.
void menuActionInserted (QAction *before, QAction *act)
 Signal emitted when an action is inserted.
void menuActionRemoved (QAction *act)
 Signal emitted when an action is removed.
void restartModel ()
 Signal emitted when the model request the end of computations.
void runModel ()
 Signal emitted when the model request the end of computations.
void savingNextSnapshot (bool, Model *)
 Signal emitted when the user want to save the next snapshot.
void savingScreenshot (const QString &filename, bool overwrite)
 Signal emitted when the user request the saving of a snapshot.
void savingSnapshot (const QString &filename, Model *)
 Signal emitted when the user wants to save a snapshot.
void stopModel ()
 Signal emitted when the model request the end of computations.

Public Member Functions

const QStringListarguments () const
 Retrieve the arguments left for the model on the command line (i.e.
QString errorString () const
Drawing and GUI interaction methods

QList< QAction * > actions () const
 Get the list of actions used to create the context menu on the viewer.
void addAction (QAction *action)
 Add an action to the context menu.
void addActions (QList< QAction * > actions)
 Add a list of actions to the context menu.
QActionaddMenuItem (const QString &text)
 Add a menu item, without connecting any signal.
QActionaddMenuItem (const QString &text, const char *slot)
 Add a menu item, the receiver being the model.
QActionaddMenuItem (const QString &text, QObject *receiver, const char *slot)
 Add a menu item to attach to the given slot.
int animationPeriod ()
 Returns the current animation period.
virtual void draw ()
 Convenience function used if the viewer is not necessary.
virtual void draw (Viewer *)
 This function should be redefined to draw the representation.
virtual void drawWithNames ()
 Convenience function used if the viewer is not necessary.
virtual void drawWithNames (Viewer *)
 Draw with object naming.
virtual void finalizeDraw ()
 Convenience function used if the viewer is not necessary.
virtual void finalizeDraw (Viewer *)
 This function is called if the OpenGL environment is destroyed or if the model is detroyed.
virtual void initDraw ()
 Convenience function used if the viewer is not necessary.
virtual void initDraw (Viewer *)
 This function is called everytime a new OpenGL environment is created, before the first preDraw(Viewer*).
void insertAction (QAction *before, QAction *action)
 Insert an action in the context menu.
void insertActions (QAction *before, QList< QAction * > action)
 Insert a list of actions in the context menu.
QActionmenuItem (const QString &text) const
 Returns the action representing the menu item text.
virtual void postDraw ()
 Convenience function used if the viewer is not necessary.
virtual void postDraw (Viewer *)
 This function should be redefined to restore the original OpenGL context.
virtual void postSelection (const QPoint &pos, Viewer *viewer)
 This function is used to resolve a selection event.
virtual void preDraw ()
 Convenience function used if the viewer is not necessary.
virtual void preDraw (Viewer *)
 This function should be redefined to setup the OpenGL context.
void removeAction (QAction *action)
 Remove an action from the context menu.
bool removeMenuItem (const QString &text, const char *slot)
 Disconnect a menu item, the receiver is the current model.
bool removeMenuItem (const QString &text, QObject *receiver, const char *slot)
 Remove the slot from a menu item, if there are more connection, the item is not deleted.
bool removeMenuItem (const QString &text)
 Remove a menu item.
void setStatusMessage (const QString &msg)
 Change the status message.
QString statusMessage () const
 Get the current status message.
Textual output methods

virtual void finalizePrint ()
 This method is called once when the model is about to be destroyed in batch mode.
virtual void initPrint ()
 This method is called once before the model is ran in batch mode.
virtual void print ()
 This function is called after each step of a model launched in batch mode.
Methods to redefine to change the behavior of the model

virtual QString helpString () const
 This function is used to setup the help in the help box.
virtual void modifiedFiles ()
 Convenience function to be used if the list of files is ignored.
virtual void modifiedFiles (const std::set< std::string > &)
 This function is called anytime one or more registered files are modified.
virtual void reread ()
 Reimplement the reread method to allow using the model without a parameter file.
virtual void step ()=0
 A step correspond to all the computations between two drawings.
Constructor/destructor

 Model (QObject *parent)
 Constructor of the object.
virtual ~Model ()
 Virtual destructor ensure the destruction occurring is the one of the leaf class.
Model execution interaction

virtual void restart ()
 This function requests a restart of the simulation.
virtual void run ()
 This function requests the model to run.
virtual void stop ()
 This function requests the end of the simulation.
Snapshot methods

virtual bool serialize (storage::VVEStorage &)
 Reimplement this method to load/save the current state of the model.
virtual QString version () const
virtual int versionNumber (const QString &)
Methods for internal usage only

void setError (bool error, QString err=QString())

Detailed Description

Simulation class.

This class has to be the base class of the main class of the project.

It handles all steps specific to the simulation and the drawing of the result. Initialization of the model should occur in the constructor of the class. And any resource deallocation should occur in the destructor. An object of this class will be created at the beginning of each simulation, and destroyed at the end.

The main Model object has to be registered using the DEFINE_MODEL(classname) macro command defined in <vvall.h>.

Definition at line 44 of file model.h.


Constructor & Destructor Documentation

Model::Model ( QObject parent  ) 

Constructor of the object.

Parameters:
parent is the object handling the life of this object. It is required to handle file registration.

Definition at line 20 of file model_.cpp.

References QObject::connect(), fileRegister(), fileUnregister(), QVariant::isValid(), loadingSnapshot(), loadSnapshot(), menuActionInserted(), menuActionRemoved(), QObject::property(), registerFile(), restartModel(), runModel(), saveSnapshot(), savingNextSnapshot(), savingScreenshot(), savingSnapshot(), screenshot(), stopModel(), QVariant::toStringList(), QVariant::type(), unregisterFile(), and graph::vertex_counter.

00021   : FileObject(parent)
00022 {
00023 #ifndef NO_NUMBER_VERTICES
00024   graph::vertex_counter = 0;
00025 #endif
00026   connect(this, SIGNAL(fileRegister(std::string)), parent, SLOT(registerFile(std::string)));
00027   connect(this, SIGNAL(fileUnregister(std::string)), parent, SLOT(unregisterFile(std::string)));
00028   connect(this, SIGNAL(stopModel()), parent, SLOT(stopModel()));
00029   connect(this, SIGNAL(runModel()), parent, SLOT(runModel()));
00030   connect(this, SIGNAL(restartModel()), parent, SLOT(rewind()));
00031   connect(this, SIGNAL(menuActionInserted(QAction*,QAction*)), parent, SLOT(insertMenuAction(QAction*,QAction*)));
00032   connect(this, SIGNAL(menuActionRemoved(QAction*)), parent, SLOT(removeMenuAction(QAction*)));
00033   connect(this, SIGNAL(savingSnapshot(const QString&, Model*)), parent, SLOT(saveSnapshot(const QString&, Model*)));
00034   connect(this, SIGNAL(savingNextSnapshot(bool, Model*)), parent, SLOT(saveSnapshot(bool, Model*)));
00035   connect(this, SIGNAL(loadingSnapshot(const QString&, Model*)), parent, SLOT(loadSnapshot(const QString&, Model*)));
00036   connect(this, SIGNAL(loadingSnapshot(bool, Model*)), parent, SLOT(loadSnapshot(bool, Model*)));
00037   connect(this, SIGNAL(savingScreenshot(const QString&, bool)), parent, SLOT(screenshot(const QString&, bool)));
00038 
00039   QVariant args = parent->property("modelArguments");
00040   if(args.isValid())
00041   {
00042     if(args.type() == QVariant::StringList)
00043     {
00044       _arguments = args.toStringList();
00045     }
00046   }
00047 }

virtual Model::~Model (  )  [inline, virtual]

Virtual destructor ensure the destruction occurring is the one of the leaf class.

Definition at line 63 of file model.h.

00063 {}


Member Function Documentation

QList< QAction * > Model::actions (  )  const

Get the list of actions used to create the context menu on the viewer.

Definition at line 125 of file model_.cpp.

Referenced by menuItem().

00126 {
00127   return _actions;
00128 }

void Model::addAction ( QAction action  ) 

Add an action to the context menu.

Definition at line 196 of file model_.cpp.

References insertAction().

Referenced by addMenuItem().

00197 {
00198   insertAction(0, action);
00199 }

void Model::addActions ( QList< QAction * >  actions  ) 

Add a list of actions to the context menu.

Definition at line 201 of file model_.cpp.

References insertActions().

00202 {
00203   insertActions(0, actions);
00204 }

QAction * Model::addMenuItem ( const QString text  ) 

Add a menu item, without connecting any signal.

Definition at line 140 of file model_.cpp.

References addAction(), and menuItem().

00141 {
00142   QAction *act = menuItem(text);
00143   if(not act)
00144   {
00145     act = new QAction(text, this);
00146     addAction(act);
00147   }
00148   return act;
00149 }

QAction * Model::addMenuItem ( const QString text,
const char *  slot 
)

Add a menu item, the receiver being the model.

Definition at line 167 of file model_.cpp.

References addMenuItem().

00168 {
00169   return addMenuItem(text, this, slot);
00170 }

QAction * Model::addMenuItem ( const QString text,
QObject receiver,
const char *  slot 
)

Add a menu item to attach to the given slot.

Returns:
the pointer to the action

Definition at line 151 of file model_.cpp.

References addAction(), QObject::connect(), and menuItem().

Referenced by addMenuItem().

00152 {
00153   QAction *act = menuItem(text);
00154   if(act)
00155   {
00156     connect(act, SIGNAL(triggered()), receiver, slot);
00157   }
00158   else
00159   {
00160     act = new QAction(text, this);
00161     connect(act, SIGNAL(triggered()), receiver, slot);
00162     addAction(act);
00163   }
00164   return act;
00165 }

int Model::animationPeriod (  ) 

Returns the current animation period.

Definition at line 116 of file model_.cpp.

References QObject::parent().

00117 {
00118   bool ok;
00119   int period = parent()->property("animationPeriod").toInt(&ok);
00120   if(!ok)
00121     return -1;
00122   return period;
00123 }

const QStringList& Model::arguments (  )  const [inline]

Retrieve the arguments left for the model on the command line (i.e.

arguments after the '--')

Definition at line 399 of file model.h.

00399 { return _arguments; }

void Model::changedExitCode ( int   )  [signal]

Signal emitted when the user changes the exit code.

Referenced by setExitCode().

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

Convenience function used if the viewer is not necessary.

Definition at line 171 of file model.h.

00171 {}

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

This function should be redefined to draw the representation.

Parameters:
viewer Viewer object. Useful to use the capabilities of QGLViewer object.

Reimplemented in bspline_tissue_model::TissueModel< RealModel, TissueClass >, and tissue_model::TissueModel< RealModel, TissueClass >.

Definition at line 167 of file model.h.

References draw().

Referenced by draw().

00167 { this->draw(); }

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

Convenience function used if the viewer is not necessary.

Reimplemented in bspline_tissue_model::TissueModel< RealModel, TissueClass >, and tissue_model::TissueModel< RealModel, TissueClass >.

Definition at line 238 of file model.h.

00238 {}

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

Draw with object naming.

Used for object selection. The name is to be setup using glPushName(int) / glPopName()

Parameters:
viewer Viewer object. Useful to use the capabilities of QGLViewer object.

Definition at line 234 of file model.h.

References drawWithNames().

Referenced by drawWithNames().

00234 { this->drawWithNames(); }

void Model::fileRegister ( std::string   )  [signal]

Signal emitted anytime the user is registering a file to the file checker.

Referenced by Model(), and registerFile().

void Model::fileUnregister ( std::string   )  [signal]

Signal emitted anytime the user is unregistering a file .

..

Referenced by Model(), and unregisterFile().

virtual void Model::finalizeDraw (  )  [inline, virtual]

Convenience function used if the viewer is not necessary.

Definition at line 223 of file model.h.

00223 {}

void Model::finalizeDraw ( Viewer viewer  )  [inline, virtual]

This function is called if the OpenGL environment is destroyed or if the model is detroyed.

Parameters:
viewer Viewer object. Useful to use the capabilities of QGLViewer object.

Definition at line 219 of file model.h.

References finalizeDraw().

Referenced by finalizeDraw().

00219 { this->finalizeDraw(); }

virtual void Model::finalizePrint (  )  [inline, virtual]

This method is called once when the model is about to be destroyed in batch mode.

It is intended to initialize any variable or to print an initial message. Any output should be directed on the standard output of the application.

Definition at line 372 of file model.h.

00372 {}

QString Model::helpString (  )  const [virtual]

This function is used to setup the help in the help box.

It should typically return a description of the model. Default implementation will read the description.txt file if available.

Definition at line 59 of file model_.cpp.

References QString::append(), QFile::exists(), QFile::open(), and QString::prepend().

00060 {
00061   if(QFile::exists("description.html"))
00062   {
00063     QFile f("description.html");
00064     if(f.open(QIODevice::ReadOnly | QIODevice::Text))
00065     {
00066       QTextStream fss(&f);
00067       QString content = f.readAll();
00068       return content;
00069     }
00070   }
00071   else if(QFile::exists("description.txt"))
00072   {
00073     QFile f("description.txt");
00074     if(f.open(QIODevice::ReadOnly | QIODevice::Text))
00075     {
00076       QTextStream fss(&f);
00077       QString content = f.readAll();
00078       content.prepend("<pre>");
00079       content.append("</pre>");
00080       return content;
00081     }
00082   }
00083   return QString("Undocumented VV model");
00084 }

virtual void Model::initDraw (  )  [inline, virtual]

Convenience function used if the viewer is not necessary.

Reimplemented in bspline_tissue_model::TissueModel< RealModel, TissueClass >, and tissue_model::TissueModel< RealModel, TissueClass >.

Definition at line 209 of file model.h.

00209 {}

void Model::initDraw ( Viewer viewer  )  [inline, virtual]

This function is called everytime a new OpenGL environment is created, before the first preDraw(Viewer*).

Warning:
It may be called multiple times if the OpenGL environment is destroyed and recreated.

Useful to initialize camera and lights or to gather data about the rendering capabilities. Also used for any initialization requiring a valid OpenGL context.

Parameters:
viewer Viewer object. Useful to use the capabilities of QGLViewer object.

Definition at line 205 of file model.h.

References initDraw().

Referenced by initDraw().

00205 { this->initDraw(); }

virtual void Model::initPrint (  )  [inline, virtual]

This method is called once before the model is ran in batch mode.

It is intended to initialize any variable or to print an initial message. Any output should be directed on the standard output of the application.

Definition at line 354 of file model.h.

00354 {}

void Model::insertAction ( QAction before,
QAction action 
)

Insert an action in the context menu.

Definition at line 206 of file model_.cpp.

References QList::indexOf(), QList::insert(), menuActionInserted(), and QList::size().

Referenced by addAction(), and insertActions().

00207 {
00208   int pos = _actions.indexOf(before);
00209   if(pos < 0)
00210   {
00211     pos = _actions.size();
00212   }
00213   _actions.insert(pos, action);
00214   emit menuActionInserted(before, action);
00215 }

void Model::insertActions ( QAction before,
QList< QAction * >  action 
)

Insert a list of actions in the context menu.

Definition at line 217 of file model_.cpp.

References insertAction(), and QList::size().

Referenced by addActions().

00218 {
00219   for(int i = 0 ; i < actions.size() ; ++i)
00220   {
00221     insertAction(before, actions[i]);
00222   }
00223 }

void Model::loadingSnapshot ( const QString filename,
Model  
) [signal]

Signal emitted when the user wants to load a snapshot.

Parameters:
filename Name of the snapshot. The extension will be used to determine the format.
void Model::loadingSnapshot ( bool  auto_naming,
Model  
) [signal]

Signal emitted when the user wants to load a snapshot.

Referenced by loadSnapshot(), and Model().

bool Model::loadSnapshot ( const QString filename  )  [slot]

Load a snapshot.

be careful with the state of the model after this call

Definition at line 252 of file model_.cpp.

References loadingSnapshot().

00253 {
00254   _error = false;
00255   emit loadingSnapshot(filename, this);
00256   return !_error;
00257 }

bool Model::loadSnapshot (  )  [slot]

Load a snapshot specified by the user of the model.

be careful with the state of the model after this call

Definition at line 245 of file model_.cpp.

References loadingSnapshot().

Referenced by Model().

00246 {
00247   _error = false;
00248   emit loadingSnapshot(false, this);
00249   return !_error;
00250 }

void Model::menuActionInserted ( QAction before,
QAction act 
) [signal]

Signal emitted when an action is inserted.

Referenced by insertAction(), and Model().

void Model::menuActionRemoved ( QAction act  )  [signal]

Signal emitted when an action is removed.

Referenced by Model(), and removeAction().

QAction * Model::menuItem ( const QString text  )  const

Returns the action representing the menu item text.

Returns:
0 if no such item exist

Definition at line 130 of file model_.cpp.

References actions().

Referenced by addMenuItem(), and removeMenuItem().

00131 {
00132   foreach(QAction* act, actions())
00133   {
00134     if(act->text() == text)
00135       return act;
00136   }
00137   return 0;
00138 }

virtual void Model::modifiedFiles (  )  [inline, virtual]

Convenience function to be used if the list of files is ignored.

Definition at line 87 of file model.h.

00087 {}

void Model::modifiedFiles ( const std::set< std::string > &  files  )  [inline, virtual]

This function is called anytime one or more registered files are modified.

Parameters:
files Registered files modified since last call to this function.

Reimplemented in bspline_tissue_model::TissueModel< RealModel, TissueClass >, and tissue_model::TissueModel< RealModel, TissueClass >.

Definition at line 82 of file model.h.

References modifiedFiles().

Referenced by modifiedFiles().

00083     { this->modifiedFiles(); }

virtual void Model::postDraw (  )  [inline, virtual]

Convenience function used if the viewer is not necessary.

Reimplemented in bspline_tissue_model::TissueModel< RealModel, TissueClass >, and tissue_model::TissueModel< RealModel, TissueClass >.

Definition at line 188 of file model.h.

00188 {}

void Model::postDraw ( Viewer viewer  )  [inline, virtual]

This function should be redefined to restore the original OpenGL context.

It is called right after the draw(Viewer*) method and should restore the OpenGL context to allow for correct drawing of the decorators (grid, axes, ...)

Parameters:
viewer Viewer object. Useful to use the capabilities of QGLViewer object.

Definition at line 184 of file model.h.

References postDraw().

Referenced by postDraw().

00184 { this->postDraw(); }

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

This function is used to resolve a selection event.

Parameters:
pos 2D position of the user click event
viewer Viewer object on which the selection occured

It should implement the action associated with a selection. The user can call viewer->selectedName() to get the id of the selected item. The number returned depend on the number allocated within the drawWithNames() method.

Definition at line 101 of file model_.cpp.

00102 {
00103 }

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

Convenience function used if the viewer is not necessary.

Reimplemented in bspline_tissue_model::TissueModel< RealModel, TissueClass >, and tissue_model::TissueModel< RealModel, TissueClass >.

Definition at line 158 of file model.h.

00158 {}

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

This function should be redefined to setup the OpenGL context.

Called at the beginning of every drawing, right after the initialization of the OpenGL context.

Parameters:
viewer Viewer object. Useful to use the capabilities of QGLViewer object.

Definition at line 154 of file model.h.

References preDraw().

Referenced by preDraw().

00154 { this->preDraw(); }

virtual void Model::print (  )  [inline, virtual]

This function is called after each step of a model launched in batch mode.

The output is expected to be on the standard output (i.e. stdout or cout).

Definition at line 363 of file model.h.

00363 {}

void Model::registerFile ( std::string  filename  )  [slot]

This function registers a file to the file alteration monitor.

Definition at line 49 of file model_.cpp.

References fileRegister().

Referenced by Model(), and bspline_tissue_model::TissueModel< RealModel, TissueClass >::registerFiles().

00050 {
00051   emit fileRegister(filename);
00052 }

void Model::removeAction ( QAction action  ) 

Remove an action from the context menu.

Definition at line 225 of file model_.cpp.

References menuActionRemoved(), and QList::removeAll().

Referenced by removeMenuItem().

00226 {
00227   if(_actions.removeAll(action))
00228     emit menuActionRemoved(action);
00229 }

bool Model::removeMenuItem ( const QString text,
const char *  slot 
)

Disconnect a menu item, the receiver is the current model.

Definition at line 183 of file model_.cpp.

References removeMenuItem().

00184 {
00185   return removeMenuItem(text, this, slot);
00186 }

bool Model::removeMenuItem ( const QString text,
QObject receiver,
const char *  slot 
)

Remove the slot from a menu item, if there are more connection, the item is not deleted.

Returns:
true if the menu item and the connection are found

Definition at line 188 of file model_.cpp.

References QObject::disconnect(), and menuItem().

00189 {
00190   QAction* toremove = menuItem(text);
00191   if(toremove and disconnect(toremove, SIGNAL(triggerred()), receiver, slot))
00192     return true;
00193   return false;
00194 }

bool Model::removeMenuItem ( const QString text  ) 

Remove a menu item.

Returns:
true is the menu item is found

Definition at line 172 of file model_.cpp.

References menuItem(), and removeAction().

Referenced by removeMenuItem().

00173 {
00174   QAction* toremove = menuItem(text);
00175   if(toremove)
00176   {
00177     removeAction(toremove);
00178     return true;
00179   }
00180   return false;
00181 }

virtual void Model::reread (  )  [inline, virtual]

Reimplement the reread method to allow using the model without a parameter file.

Implements util::FileObject.

Definition at line 93 of file model.h.

00093 {}

void Model::restart (  )  [virtual]

This function requests a restart of the simulation.

Definition at line 96 of file model_.cpp.

References restartModel().

00097 {
00098   emit restartModel();
00099 }

void Model::restartModel (  )  [signal]

Signal emitted when the model request the end of computations.

Referenced by Model(), and restart().

void Model::run (  )  [virtual]

This function requests the model to run.

Definition at line 86 of file model_.cpp.

References runModel().

00087 {
00088   emit runModel();
00089 }

void Model::runModel (  )  [signal]

Signal emitted when the model request the end of computations.

Referenced by Model(), and run().

bool Model::saveNextSnapshot (  )  [slot]

Save the current model as a snapshot on the current recording.

If the model is not being recorded, this method has no effect

Definition at line 238 of file model_.cpp.

References savingNextSnapshot().

00239 {
00240   _error = false;
00241   emit savingNextSnapshot(true, this);
00242   return !_error;
00243 }

bool Model::saveSnapshot ( const QString filename  )  [slot]

Save the current model as a snapshot.

Definition at line 231 of file model_.cpp.

References savingSnapshot().

Referenced by Model().

00232 {
00233   _error = false;
00234   emit savingSnapshot(filename, this);
00235   return !_error;
00236 }

void Model::savingNextSnapshot ( bool  ,
Model  
) [signal]

Signal emitted when the user want to save the next snapshot.

Useful to save intermediate state ...

Referenced by Model(), and saveNextSnapshot().

void Model::savingScreenshot ( const QString filename,
bool  overwrite 
) [signal]

Signal emitted when the user request the saving of a snapshot.

Referenced by Model(), and screenshot().

void Model::savingSnapshot ( const QString filename,
Model  
) [signal]

Signal emitted when the user wants to save a snapshot.

Parameters:
filename Name of the snapshot. The extension will be used to determine the format.

Referenced by Model(), and saveSnapshot().

void Model::screenshot ( const QString fileName,
bool  overwrite = false 
) [slot]

Save a screenshot.

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

Definition at line 259 of file model_.cpp.

References savingScreenshot().

Referenced by Model().

00260 {
00261   emit savingScreenshot(filename, overwrite);
00262 }

virtual bool Model::serialize ( storage::VVEStorage  )  [inline, virtual]

Reimplement this method to load/save the current state of the model.

Returns:
true if serialization was successful, false otherwise.
Parameters:
store Object to store the state in the model in.

Reimplemented in cell_system::CellSystem< Complex, MyModel >, and cell_system::CellSystem< TissueClass, RealModel >.

Definition at line 120 of file model.h.

Referenced by storage::VVEStorage::field(), storage::VVEStorage_XMLReader::serialize(), storage::VVEStorage_XMLWriter::serialize(), storage::VVEStorage_BINReader::serialize(), storage::old::VVEStorage_BINReader::serialize(), and storage::VVEStorage_BINWriter::serialize().

00120 { return false; }

void Model::setAnimationPeriod ( int  ms  )  [slot]

Set the animation period, i.e.

the period in between two calls to the step() method, in ms.

Definition at line 110 of file model_.cpp.

References QObject::parent().

00111 {
00112   if(parent())
00113     parent()->setProperty("animationPeriod", ms);
00114 }

void Model::setExitCode ( int  code  )  [slot]

Set the exit code.

Useful for testing purposes.

Definition at line 105 of file model_.cpp.

References changedExitCode().

00106 {
00107   emit changedExitCode(code);
00108 }

void Model::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 264 of file model_.cpp.

References QObject::parent().

00265 {
00266   bool success = parent()->setProperty("statusMessage", msg);
00267   assert(success);
00268 }

QString Model::statusMessage (  )  const

Get the current status message.

Definition at line 270 of file model_.cpp.

References QObject::parent().

00271 {
00272   QString result = parent()->property("statusMessage").toString();
00273   return result;
00274 }

virtual void Model::step (  )  [pure virtual]
void Model::stop (  )  [virtual]

This function requests the end of the simulation.

Definition at line 91 of file model_.cpp.

References stopModel().

00092 {
00093   emit stopModel();
00094 }

void Model::stopModel (  )  [signal]

Signal emitted when the model request the end of computations.

Referenced by Model(), and stop().

void Model::unregisterFile ( std::string  filename  )  [slot]

This function unregisters a file from the file alteration monitor.

Definition at line 54 of file model_.cpp.

References fileUnregister().

Referenced by Model().

00055 {
00056   emit fileUnregister(filename);
00057 }

virtual QString Model::version (  )  const [inline, virtual]
Returns:
the current version of the class.

The default implementation returns an empty string

Reimplemented in cell_system::CellSystem< Complex, MyModel >, and cell_system::CellSystem< TissueClass, RealModel >.

Definition at line 137 of file model.h.

Referenced by storage::VVEStorage_XMLWriter::serialize(), and storage::VVEStorage_BINWriter::serialize().

00137 { return ""; }

virtual int Model::versionNumber ( const QString  )  [inline, virtual]
Returns:
an integer representing the version string for the model.

The default implementation always return 0.

The number has no meaning outside the model.

Reimplemented in cell_system::CellSystem< Complex, MyModel >, and cell_system::CellSystem< TissueClass, RealModel >.

Definition at line 130 of file model.h.

Referenced by storage::VVEStorage_XMLReader::serialize(), storage::VVEStorage_XMLWriter::serialize(), storage::VVEStorage_BINReader::serialize(), storage::old::VVEStorage_BINReader::serialize(), and storage::VVEStorage_BINWriter::serialize().

00130 { return 0; }


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:00 2013 for VVE by  doxygen 1.6.3