The parent class of 2D and 3D visualization windows. More...
#include <collisiondisplay.h>
Public Slots | |
virtual void | start ()=0 |
Slot used to initialize the display. More... | |
virtual void | stop ()=0 |
Slot used to stop the display. More... | |
virtual void | step ()=0 |
Slot used to step the display. More... | |
Signals | |
virtual void | finished ()=0 |
Signals that the display is no longer running. More... | |
Public Member Functions | |
CollisionDisplay () | |
Constructs a CollisionDisplay. More... | |
QTimer * | getTimer () |
Returns a pointer to the timer. More... | |
int | getNumCollisions () |
Returns the number of collisions seen so far. More... | |
void | setQAlgorithm (QAlgorithm *qalgorithm) |
Gives a pointer to the QAlgorithm to the display. More... | |
int | getDisplayTimestep () |
Returns the display timestep. More... | |
Protected Attributes | |
QTimer * | timer |
QAlgorithm * | qalg |
int | numCollisions |
int | displayTimestep |
MultiQueue * | positionQueue |
std::queue< int > | collisionTimesteps |
The parent class of 2D and 3D visualization windows.
CollisionDisplay defines variables and methods necessary for both 2D and 3D visualization as well as the slots and signals that must be overwritten by its subclasses.
|
explicit |
Constructs a CollisionDisplay.
Initializes the timer, the number of collisions seen, and the display timestep.
|
pure virtualsignal |
Signals that the display is no longer running.
Signals that the display has finished running so it is safe to run a new simulation or close the program.
int CollisionDisplay::getDisplayTimestep | ( | ) |
Returns the display timestep.
int CollisionDisplay::getNumCollisions | ( | ) |
Returns the number of collisions seen so far.
QTimer * CollisionDisplay::getTimer | ( | ) |
Returns a pointer to the timer.
Returns a pointer to the timer which is responsible for maintaining the framerate of the display.
void CollisionDisplay::setQAlgorithm | ( | QAlgorithm * | qalgorithm | ) |
Gives a pointer to the QAlgorithm to the display.
Sets the QAlgorithm pointer for the display so the display can access the position and collision queues.
qalgorithm | a pointer to the QAlgorithm. |
|
pure virtualslot |
Slot used to initialize the display.
A purely virtual method which should be used for initilization tasks, such as building a list of drawn particles and reseting values.
|
pure virtualslot |
Slot used to step the display.
A purely virtual method which should be used to move the display forward one step. For example, drawn particle positions and collision information should be updated.
|
pure virtualslot |
Slot used to stop the display.
A purely virtual method which should be used to stop and clean up the display. In particular, the timer should be stopped, and the finished() signal should be emitted.