Space Comps
 All Classes Files Functions Variables
Public Slots | Signals | Public Member Functions | Protected Attributes | List of all members
CollisionDisplay Class Referenceabstract

The parent class of 2D and 3D visualization windows. More...

#include <collisiondisplay.h>

Inheritance diagram for CollisionDisplay:
CollisionDisplay2D CollisionDisplay3D

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
 
QAlgorithmqalg
 
int numCollisions
 
int displayTimestep
 
MultiQueuepositionQueue
 
std::queue< int > collisionTimesteps
 

Detailed Description

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.

Constructor & Destructor Documentation

CollisionDisplay::CollisionDisplay ( )
explicit

Constructs a CollisionDisplay.

Initializes the timer, the number of collisions seen, and the display timestep.

Member Function Documentation

virtual void CollisionDisplay::finished ( )
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.

Returns
the display timestep.
int CollisionDisplay::getNumCollisions ( )

Returns the number of collisions seen so far.

Returns
the number of collisions seen.
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.

Returns
a pointer to the timer.
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.

Parameters
qalgorithma pointer to the QAlgorithm.
virtual void CollisionDisplay::start ( )
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.

virtual void CollisionDisplay::step ( )
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.

virtual void CollisionDisplay::stop ( )
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.


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