![]() |
Computer Assited Medical Intervention Tool Kit
|
This class manages the display of a simulation (either an already made simulation opened in a single lml file by LoadsMovie, or a simple step given by a simulation motor). More...
#include <LoadsSimulationDriver.h>
Classes | |
struct | Position |
private struct to store the initial positions More... |
Public Slots | |
void | play () |
Slot called when at each timer tick (i.e. after the same interval of time) |
Signals | |
void | doOneStep () |
signal call when one step is to be performed |
Public Member Functions | |
double | getDt () const |
get delta-t | |
double | getNextRefreshTime () |
get the next planed time when the 3D will be refreshed | |
double | getRefreshDt () const |
get delta-t between 3d view refresh | |
double | getTime () const |
get time | |
double | getTMax () const |
get tmax | |
double | getTMin () const |
get tmin | |
bool | isTimerActive () |
is the timer currently running | |
LoadsSimulationDriver (LoadsManager *, Loads *) | |
Constructor. | |
void | maxSpeed () |
set the timer interval to maxSpeed (1000Hz) | |
void | quicker () |
decrease the timer interval by 5ms, thus calling doOneStep more often | |
void | resetPositions () |
reset the 3D positions to the initial value (stored in the map during init), (do not update the display) | |
void | resetTMaxToDefault () |
set default tmax (using the current loads last event) | |
void | resetTMinToDefault () |
set default tmin (using the current loads first event) | |
void | resetToDefault () |
set tmin, tmax and dt to default | |
void | rewind () |
rewind time to tMin (do not update the display) | |
void | setDt (double dt) |
set the delta-t (default is 0.1) | |
void | setLoads (Loads *) |
set the current loads to be displayed | |
void | setRefreshDt (double) |
set delta-t between 3d view refresh (default 0.1) | |
void | setTime (double) |
set the time to a different value ("jump" to a given time) | |
void | setTMax (double) |
set the new tMax | |
void | setTMin (double) |
set the new tMin | |
void | slower () |
increase the timer interval by 5ms, thus calling doOneStep less often | |
void | startTimer () |
starts the timer that will repeatedly call play and emit doOneStep | |
void | stopTimer () |
stop the timer | |
void | updateDisplay (bool force) |
update the display using the current loads (and refresh the 3D viewers if parameter is true) | |
virtual | ~LoadsSimulationDriver () |
Destructor. |
Private Member Functions | |
void | getInitialPosition (unsigned int, double[3]) |
get an initial position using the key (i.e. targetId) | |
void | init () |
init display and initial positions. | |
void | updateAtomData () |
update Atom data | |
void | updatePositions (bool force) |
update the positions depending on the current loads (and refresh the DCs position if parameter is true) |
Private Attributes | |
Loads * | currentLoads |
the current loads | |
double | dt |
the delta-t used to change t | |
QMap< unsigned int, Position > | initialPositionMap |
initial positions of all the targets | |
int | interval |
timer interval in ms | |
double | lastRefreshTime |
last time the display was refresh | |
double | lastUpdateTime |
last time we updated the display | |
LoadsManager * | myLM |
the load manager | |
QMap< unsigned int, Position > | referencePositionMap |
the reference pm positions (used to display the distances, ...) | |
double | refreshDt |
the delta-t between two refresh of the 3D view | |
double | t |
simulation time | |
QTimer * | timer |
the simulation timer | |
double | tMax |
last event time | |
double | tMin |
first event time |
This class manages the display of a simulation (either an already made simulation opened in a single lml file by LoadsMovie, or a simple step given by a simulation motor).
It is just a utility class for handling the display of loads a given time, using a timer.
LoadsSimulationDriver::LoadsSimulationDriver | ( | LoadsManager * | lm, |
Loads * | initialLoads | ||
) |
Constructor.
Set the load manager, and (initial) current loads (if the loads ptr is null, then all atoms initial positions will be stored; just in case they have to move in the future)
References dt, init(), lastRefreshTime, lastUpdateTime, myLM, refreshDt, setLoads(), timer, tMax, and tMin.
|
virtual |
Destructor.
References stopTimer(), and timer.
|
signal |
signal call when one step is to be performed
Referenced by play().
double LoadsSimulationDriver::getDt | ( | ) | const |
get delta-t
References dt.
Referenced by LoadsMovie::doOneStep(), LoadsSimulation::doOneStep(), LoadsMovie::init(), LoadsMovie::initSlider(), LoadsSimulation::LoadsSimulation(), and LoadsMovie::makeVideo().
|
inlineprivate |
get an initial position using the key (i.e. targetId)
References initialPositionMap.
Referenced by updateAtomData().
double LoadsSimulationDriver::getNextRefreshTime | ( | ) |
get the next planed time when the 3D will be refreshed
References lastRefreshTime, and refreshDt.
Referenced by LoadsSimulation::doOneStep(), updateDisplay(), and updatePositions().
double LoadsSimulationDriver::getRefreshDt | ( | ) | const |
get delta-t between 3d view refresh
References refreshDt.
Referenced by LoadsSimulation::doOneStep(), LoadsSimulation::LoadsSimulation(), and LoadsSimulation::pause().
double LoadsSimulationDriver::getTime | ( | ) | const |
get time
References t.
Referenced by LoadsMovie::doOneStep(), LoadsSimulation::doOneStep(), LoadsMovie::getTime(), LoadsSimulation::getTime(), LoadsMovie::initSlider(), LoadsMovie::makeVideo(), LoadsMovie::updateDisplay(), and LoadsSimulation::updateTime().
double LoadsSimulationDriver::getTMax | ( | ) | const |
get tmax
References tMax.
Referenced by LoadsMovie::defaultTMax(), LoadsMovie::doOneStep(), LoadsSimulation::doOneStep(), LoadsMovie::initSlider(), LoadsSimulation::LoadsSimulation(), and LoadsMovie::makeVideo().
double LoadsSimulationDriver::getTMin | ( | ) | const |
get tmin
References tMin.
Referenced by LoadsMovie::defaultTMin(), LoadsMovie::initSlider(), and LoadsMovie::makeVideo().
|
private |
init display and initial positions.
stores all the initial position of the atoms implied in the loads. if current loads is NULL, then all the atoms will have their initial positions stored.
References currentLoads, PMManagerDC::getDC(), PMManagerDC::getPhysicalModel(), LoadsManager::getPMManagerDC(), initialPositionMap, maxSpeed(), myLM, play(), resetTMaxToDefault(), resetTMinToDefault(), rewind(), timer, tMax, tMin, LoadsSimulationDriver::Position::x, LoadsSimulationDriver::Position::y, and LoadsSimulationDriver::Position::z.
Referenced by LoadsSimulationDriver().
bool LoadsSimulationDriver::isTimerActive | ( | ) |
is the timer currently running
References timer.
Referenced by LoadsSimulation::doOneStep(), LoadsMovie::play(), and LoadsSimulation::simulate().
void LoadsSimulationDriver::maxSpeed | ( | ) |
set the timer interval to maxSpeed (1000Hz)
References interval, and timer.
Referenced by init(), quicker(), and LoadsSimulation::simulate().
|
slot |
Slot called when at each timer tick (i.e. after the same interval of time)
References doOneStep(), startTimer(), and timer.
Referenced by init().
void LoadsSimulationDriver::quicker | ( | ) |
decrease the timer interval by 5ms, thus calling doOneStep more often
References interval, maxSpeed(), and timer.
void LoadsSimulationDriver::resetPositions | ( | ) |
reset the 3D positions to the initial value (stored in the map during init), (do not update the display)
References PMManagerDC::getDC(), PMManagerDC::getPhysicalModel(), LoadsManager::getPMManagerDC(), initialPositionMap, lastRefreshTime, lastUpdateTime, myLM, AtomDC::resetAlreadyMovedFlag(), and AtomDC::setPosition().
Referenced by LoadsMovie::reset(), and rewind().
void LoadsSimulationDriver::resetTMaxToDefault | ( | ) |
set default tmax (using the current loads last event)
References currentLoads, myLM, and tMax.
Referenced by LoadsMovie::defaultTMax(), init(), LoadsSimulation::LoadsSimulation(), and resetToDefault().
void LoadsSimulationDriver::resetTMinToDefault | ( | ) |
set default tmin (using the current loads first event)
References currentLoads, myLM, and tMin.
Referenced by LoadsMovie::defaultTMin(), init(), and resetToDefault().
void LoadsSimulationDriver::resetToDefault | ( | ) |
set tmin, tmax and dt to default
References dt, refreshDt, resetTMaxToDefault(), and resetTMinToDefault().
void LoadsSimulationDriver::rewind | ( | ) |
rewind time to tMin (do not update the display)
References dt, LoadsManager::getLoads(), myLM, resetPositions(), t, tMin, and updatePositions().
Referenced by LoadsMovie::doOneStep(), init(), LoadsMovie::rewind(), and setTime().
void LoadsSimulationDriver::setDt | ( | double | dt | ) |
set the delta-t (default is 0.1)
References dt.
Referenced by LoadsMovie::dtChanged(), LoadsSimulation::dtChanged(), and LoadsSimulation::LoadsSimulation().
void LoadsSimulationDriver::setLoads | ( | Loads * | l | ) |
set the current loads to be displayed
References currentLoads.
Referenced by LoadsSimulation::doOneStep(), LoadsSimulationDriver(), and LoadsSimulation::rewind().
void LoadsSimulationDriver::setRefreshDt | ( | double | dt | ) |
set delta-t between 3d view refresh (default 0.1)
Referenced by LoadsMovie::dtChanged(), LoadsSimulation::LoadsSimulation(), LoadsSimulation::pause(), and LoadsSimulation::refreshDtChanged().
void LoadsSimulationDriver::setTime | ( | double | newTime | ) |
set the time to a different value ("jump" to a given time)
References dt, rewind(), t, tMin, and updatePositions().
Referenced by LoadsMovie::doOneStep(), LoadsSimulation::LoadsSimulation(), LoadsMovie::makeVideo(), LoadsSimulation::rewind(), LoadsMovie::tChanged(), and LoadsSimulation::updateTime().
void LoadsSimulationDriver::setTMax | ( | double | newTMax | ) |
set the new tMax
References tMax.
Referenced by LoadsSimulation::LoadsSimulation(), LoadsMovie::tMaxChanged(), and LoadsSimulation::tMaxChanged().
void LoadsSimulationDriver::setTMin | ( | double | newTMin | ) |
void LoadsSimulationDriver::slower | ( | ) |
increase the timer interval by 5ms, thus calling doOneStep less often
References interval, and timer.
Referenced by LoadsSimulation::doOneStep().
void LoadsSimulationDriver::startTimer | ( | ) |
starts the timer that will repeatedly call play and emit doOneStep
References interval, and timer.
Referenced by LoadsMovie::play(), play(), and LoadsSimulation::simulate().
void LoadsSimulationDriver::stopTimer | ( | ) |
stop the timer
References timer.
Referenced by LoadsMovie::doOneStep(), LoadsMovie::pause(), LoadsSimulation::pause(), LoadsMovie::playOneStep(), LoadsSimulation::reject(), LoadsMovie::stop(), and ~LoadsSimulationDriver().
|
private |
update Atom data
References LoadsManager::ADD_ON, PMManagerDC::destroyPointData(), LoadsManager::DISPLACEMENTS, LoadsManager::DISTANCES, LoadsManager::getAtomData(), LoadsManager::getAtomDataDisplay(), LoadsManager::getAtomDataScale(), PMManagerDC::getDC(), getInitialPosition(), PMManagerDC::getPhysicalModel(), LoadsManager::getPMManagerDC(), LoadsManager::getReferencePM(), LoadsManager::getUserConstrainedAtomDataScale(), initialPositionMap, myLM, LoadsManager::NONE, referencePositionMap, LoadsManager::RELATIVE_ENERGY_NORM_ERROR, LoadsManager::updateAtomDataScale(), LoadsSimulationDriver::Position::x, LoadsSimulationDriver::Position::y, and LoadsSimulationDriver::Position::z.
Referenced by updateDisplay(), and updatePositions().
void LoadsSimulationDriver::updateDisplay | ( | bool | force | ) |
update the display using the current loads (and refresh the 3D viewers if parameter is true)
force | if true force display update independantly from refresh dt (default is false) |
References getNextRefreshTime(), lastRefreshTime, myLM, t, updateAtomData(), LoadsManager::updateLoadsDisplay(), and updatePositions().
Referenced by LoadsMovie::updateDisplay(), and LoadsSimulation::updateDisplay().
|
private |
update the positions depending on the current loads (and refresh the DCs position if parameter is true)
References currentLoads, PMManagerDC::getDC(), getNextRefreshTime(), PMManagerDC::getPhysicalModel(), LoadsManager::getPMManagerDC(), lastUpdateTime, myLM, AtomDC::resetAlreadyMovedFlag(), AtomDC::setPosition(), t, and updateAtomData().
Referenced by rewind(), setTime(), and updateDisplay().
|
private |
the current loads
Referenced by init(), resetTMaxToDefault(), resetTMinToDefault(), setLoads(), and updatePositions().
|
private |
the delta-t used to change t
Referenced by getDt(), LoadsSimulationDriver(), resetToDefault(), rewind(), setDt(), setRefreshDt(), and setTime().
|
private |
initial positions of all the targets
Referenced by getInitialPosition(), init(), resetPositions(), and updateAtomData().
|
private |
timer interval in ms
Referenced by maxSpeed(), quicker(), slower(), and startTimer().
|
private |
last time the display was refresh
Referenced by getNextRefreshTime(), LoadsSimulationDriver(), resetPositions(), and updateDisplay().
|
private |
last time we updated the display
Referenced by LoadsSimulationDriver(), resetPositions(), and updatePositions().
|
private |
the load manager
Referenced by init(), LoadsSimulationDriver(), resetPositions(), resetTMaxToDefault(), resetTMinToDefault(), rewind(), updateAtomData(), updateDisplay(), and updatePositions().
|
private |
the reference pm positions (used to display the distances, ...)
Referenced by updateAtomData().
|
private |
the delta-t between two refresh of the 3D view
Referenced by getNextRefreshTime(), getRefreshDt(), LoadsSimulationDriver(), resetToDefault(), and setRefreshDt().
|
private |
simulation time
Referenced by getTime(), rewind(), setTime(), updateDisplay(), and updatePositions().
|
private |
the simulation timer
Referenced by init(), isTimerActive(), LoadsSimulationDriver(), maxSpeed(), play(), quicker(), slower(), startTimer(), stopTimer(), and ~LoadsSimulationDriver().
|
private |
last event time
Referenced by getTMax(), init(), LoadsSimulationDriver(), resetTMaxToDefault(), and setTMax().
|
private |
first event time
Referenced by getTMin(), init(), LoadsSimulationDriver(), resetTMinToDefault(), rewind(), setTime(), and setTMin().