![]() |
Computer Assited Medical Intervention Tool Kit
version 4.0
|
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>
Inherits QObject.
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) More... | |
Signals | |
void | doOneStep () |
signal call when one step is to be performed More... | |
Public Member Functions | |
double | getDt () const |
get delta-t More... | |
double | getNextRefreshTime () |
get the next planed time when the 3D will be refreshed More... | |
double | getRefreshDt () const |
get delta-t between 3d view refresh More... | |
double | getTime () const |
get time More... | |
double | getTMax () const |
get tmax More... | |
double | getTMin () const |
get tmin More... | |
bool | isTimerActive () |
is the timer currently running More... | |
LoadsSimulationDriver (LoadsManager *, Loads *) | |
Constructor. More... | |
void | maxSpeed () |
set the timer interval to maxSpeed (1000Hz) More... | |
void | quicker () |
decrease the timer interval by 5ms, thus calling doOneStep more often More... | |
void | resetPositions () |
reset the 3D positions to the initial value (stored in the map during init), (do not update the display) More... | |
void | resetTMaxToDefault () |
set default tmax (using the current loads last event) More... | |
void | resetTMinToDefault () |
set default tmin (using the current loads first event) More... | |
void | resetToDefault () |
set tmin, tmax and dt to default More... | |
void | rewind () |
rewind time to tMin (do not update the display) More... | |
void | setDt (double dt) |
set the delta-t (default is 0.1) More... | |
void | setLoads (Loads *) |
set the current loads to be displayed More... | |
void | setRefreshDt (double) |
set delta-t between 3d view refresh (default 0.1) More... | |
void | setTime (double) |
set the time to a different value ("jump" to a given time) More... | |
void | setTMax (double) |
set the new tMax More... | |
void | setTMin (double) |
set the new tMin More... | |
void | slower () |
increase the timer interval by 5ms, thus calling doOneStep less often More... | |
void | startTimer () |
starts the timer that will repeatedly call play and emit doOneStep More... | |
void | stopTimer () |
stop the timer More... | |
void | updateAtomData () |
only update the Atom data More... | |
void | updateDisplay (bool force) |
update the display using the current loads (and refresh the 3D viewers if parameter is true) More... | |
virtual | ~LoadsSimulationDriver () |
Destructor. More... | |
Private Member Functions | |
void | getInitialPosition (unsigned int, double [3]) |
get an initial position using the key (i.e. targetId) More... | |
void | init () |
init display and initial positions. More... | |
void | updatePositions (bool force) |
update the positions depending on the current loads (and refresh the DCs position if parameter is true) More... | |
Private Attributes | |
Loads * | currentLoads |
the current loads More... | |
double | dt |
the delta-t used to change t More... | |
QMap< unsigned int, Position > | initialPositionMap |
initial positions of all the targets More... | |
int | interval |
timer interval in ms More... | |
double | lastRefreshTime |
last time the display was refresh More... | |
double | lastUpdateTime |
last time we updated the display More... | |
LoadsManager * | myLM |
the load manager More... | |
QMap< unsigned int, Position > | referencePositionMap |
the reference pm positions (used to display the distances, ...) More... | |
double | refreshDt |
the delta-t between two refresh of the 3D view More... | |
double | t |
simulation time More... | |
QTimer * | timer |
the simulation timer More... | |
double | tMax |
last event time More... | |
double | tMin |
first event time More... | |
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)
|
virtual |
Destructor.
|
signal |
signal call when one step is to be performed
double LoadsSimulationDriver::getDt | ( | ) | const |
get delta-t
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.
double LoadsSimulationDriver::getNextRefreshTime | ( | ) |
get the next planed time when the 3D will be refreshed
Referenced by LoadsSimulation::doOneStep().
double LoadsSimulationDriver::getRefreshDt | ( | ) | const |
get delta-t between 3d view refresh
Referenced by LoadsSimulation::doOneStep(), LoadsSimulation::LoadsSimulation(), and LoadsSimulation::pause().
double LoadsSimulationDriver::getTime | ( | ) | const |
double LoadsSimulationDriver::getTMax | ( | ) | const |
double LoadsSimulationDriver::getTMin | ( | ) | const |
get 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 PhysicalModel::getAtoms(), PMManagerDC::getDC(), Structure::getIndex(), StructuralComponent::getNumberOfStructures(), PMManagerDC::getPhysicalModel(), Atom::getPosition(), StructuralComponent::getStructure(), LoadsSimulationDriver::Position::x, LoadsSimulationDriver::Position::y, and LoadsSimulationDriver::Position::z.
bool LoadsSimulationDriver::isTimerActive | ( | ) |
is the timer currently running
Referenced by LoadsSimulation::doOneStep(), LoadsMovie::play(), and LoadsSimulation::simulate().
void LoadsSimulationDriver::maxSpeed | ( | ) |
set the timer interval to maxSpeed (1000Hz)
Referenced by LoadsSimulation::simulate().
|
slot |
Slot called when at each timer tick (i.e. after the same interval of time)
void LoadsSimulationDriver::quicker | ( | ) |
decrease the timer interval by 5ms, thus calling doOneStep more often
void LoadsSimulationDriver::resetPositions | ( | ) |
reset the 3D positions to the initial value (stored in the map during init), (do not update the display)
References PhysicalModel::getAtom(), PMManagerDC::getDC(), PMManagerDC::getPhysicalModel(), AtomDC::resetAlreadyMovedFlag(), and AtomDC::setPosition().
Referenced by LoadsMovie::reset().
void LoadsSimulationDriver::resetTMaxToDefault | ( | ) |
set default tmax (using the current loads last event)
Referenced by LoadsMovie::defaultTMax(), and LoadsSimulation::LoadsSimulation().
void LoadsSimulationDriver::resetTMinToDefault | ( | ) |
set default tmin (using the current loads first event)
Referenced by LoadsMovie::defaultTMin().
void LoadsSimulationDriver::resetToDefault | ( | ) |
set tmin, tmax and dt to default
void LoadsSimulationDriver::rewind | ( | ) |
rewind time to tMin (do not update the display)
Referenced by LoadsMovie::doOneStep(), and LoadsMovie::rewind().
void LoadsSimulationDriver::setDt | ( | double | dt | ) |
set the delta-t (default is 0.1)
Referenced by LoadsMovie::dtChanged(), LoadsSimulation::dtChanged(), and LoadsSimulation::LoadsSimulation().
void LoadsSimulationDriver::setLoads | ( | Loads * | l | ) |
set the current loads to be displayed
Referenced by LoadsSimulation::doOneStep(), 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)
Referenced by LoadsMovie::doOneStep(), LoadsSimulation::LoadsSimulation(), LoadsMovie::makeVideo(), LoadsSimulation::rewind(), LoadsMovie::tChanged(), and LoadsSimulation::updateTime().
void LoadsSimulationDriver::setTMax | ( | double | newTMax | ) |
set the new tMax
Referenced by LoadsSimulation::LoadsSimulation(), LoadsMovie::tMaxChanged(), and LoadsSimulation::tMaxChanged().
void LoadsSimulationDriver::setTMin | ( | double | newTMin | ) |
set the new tMin
Referenced by LoadsMovie::tMinChanged().
void LoadsSimulationDriver::slower | ( | ) |
increase the timer interval by 5ms, thus calling doOneStep less often
Referenced by LoadsSimulation::doOneStep().
void LoadsSimulationDriver::startTimer | ( | ) |
starts the timer that will repeatedly call play and emit doOneStep
Referenced by LoadsMovie::play(), and LoadsSimulation::simulate().
void LoadsSimulationDriver::stopTimer | ( | ) |
stop the timer
Referenced by LoadsMovie::doOneStep(), LoadsMovie::pause(), LoadsSimulation::pause(), LoadsMovie::playOneStep(), LoadsSimulation::reject(), and LoadsMovie::stop().
void LoadsSimulationDriver::updateAtomData | ( | ) |
only update the Atom data
References LoadsManager::ADD_ON, PMManagerDC::destroyPointData(), LoadsManager::DISPLACEMENTS, distance(), LoadsManager::DISTANCES, PhysicalModel::getAtom(), StructuralComponent::getAtoms(), PMManagerDC::getDC(), Structure::getIndex(), StructuralComponent::getNumberOfStructures(), Atom::getPosition(), StructuralComponent::getStructure(), LoadsManager::NONE, LoadsManager::RELATIVE_ENERGY_NORM_ERROR, LoadsSimulationDriver::Position::x, LoadsSimulationDriver::Position::y, and LoadsSimulationDriver::Position::z.
Referenced by LoadsSimulation::updateAtomData().
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 independently from refresh dt (default is false) |
References camitk::InteractiveViewer::get3DViewer(), and camitk::InteractiveViewer::refreshRenderer().
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 PhysicalModel::getAtom(), PhysicalModel::getAtoms(), PMManagerDC::getDC(), Load::getDirection(), StructuralComponent::getNumberOfStructures(), PMManagerDC::getPhysicalModel(), Atom::getPosition(), StructuralComponent::getStructure(), Load::getTarget(), Load::getType(), Load::getValue(), Load::numberOfTargets(), AtomDC::resetAlreadyMovedFlag(), Atom::setPosition(), and AtomDC::setPosition().
|
private |
the current loads
|
private |
the delta-t used to change t
|
private |
initial positions of all the targets
Referenced by getInitialPosition().
|
private |
timer interval in ms
|
private |
last time the display was refresh
|
private |
last time we updated the display
|
private |
the load manager
|
private |
the reference pm positions (used to display the distances, ...)
|
private |
the delta-t between two refresh of the 3D view
|
private |
simulation time
|
private |
the simulation timer
|
private |
last event time
|
private |
first event time