Space Comps
 All Classes Files Functions Variables
Public Slots | Signals | Public Member Functions | List of all members
CollisionSystem Class Reference

The main window of the graphical interface. More...

#include <collisionsystem.h>

Inheritance diagram for CollisionSystem:

Public Slots

void start ()
 Creates an Algorithm and sets up connections to the GUI. More...
 
void terminate ()
 Kills the algorithm thread and cleans up for the next algorithm. More...
 
void printInfo ()
 Prints selected information to the GUI text output. More...
 
void changePausedState ()
 Pauses or unpauses the display. More...
 
void resetCamera ()
 Moves the camera back to the starting position (for a 3D display only). More...
 
void generateSeed ()
 Generates a new seed for the random number generator. More...
 
void setAlgFinished ()
 Tells the CollisionSystem the the Algorithm is no longer running. More...
 
void setDisplayFinished ()
 Tells the CollisionSystem that the display is no longer running. More...
 
void setLookaheadTime (double d)
 Changes the lookahead time to the specified value. More...
 
void setTargetFramerate (int n)
 Sets the new target framerate for the display. More...
 
void setMinRadiusMax (double d)
 Sets the maximum value for the minimum radius input. More...
 
void setMaxRadiusMin (double d)
 Sets the minimum value for the maximum radius input. More...
 
void setTimestepLimit (int n)
 Sets a limit on the number of timesteps the Algorithm will run. More...
 
void setTimestepLimitEnabled (bool b)
 Enables or disables the timestep limit input field. More...
 
void setSpace (int b)
 Sets the variable representing the simulation dimensionality. More...
 

Signals

void begin ()
 A signal emitted to begin the Algorithm and display.
 

Public Member Functions

 CollisionSystem (QWidget *parent=0)
 Constructs a CollisionSystem object. More...
 
void setSeed ()
 Sets the seed for the random number generator. More...
 
void setNumParticles ()
 Sets the number of particles with which an Algorithm will run. More...
 
void setRadiusRange ()
 Sets the range for Particle radius. More...
 

Detailed Description

The main window of the graphical interface.

CollisionSystem is the graphical user interface as well as the bridge between an Algoithm and the CollisionDisplay objects (2D and 3D).

Constructor & Destructor Documentation

CollisionSystem::CollisionSystem ( QWidget *  parent = 0)
explicit

Constructs a CollisionSystem object.

Constructs a CollisionSystem object, initializing the elements of the GUI and connecting signals and slots that should remain connected for the duration of the program.

Parameters
parentthe parent widget, if one exists. Defaults to 0.

Member Function Documentation

void CollisionSystem::changePausedState ( )
slot

Pauses or unpauses the display.

Stops a CollisionDisplay's timer so that the display effectively pauses. If pausing, enables the Step button and changes the label of the paused button to "Play." If unpausing (playing), disables the Step button and changes the label back to "Pause." Called when the Pause button is clicked.

Note that this does not pause the Algorithm; it will continue running until it fills the position queue.

void CollisionSystem::generateSeed ( )
slot

Generates a new seed for the random number generator.

Uses the system time to create a new value for SEED, sets the value of the input field to the new seed. Does not actually change the value of SEED. Called when the Generate Seed button is clicked.

See Also
setSeed()
void CollisionSystem::printInfo ( )
slot

Prints selected information to the GUI text output.

Clears and rewrites certain information to the text output field in the GUI. The information written depends on the items chosen by the user in the view menu. By default, the current timestep and the number of collisions are displayed.

void CollisionSystem::resetCamera ( )
slot

Moves the camera back to the starting position (for a 3D display only).

Changes the location of the camera and the up direction so that the dispaly returns to the original view location. Called when the Reset Camera button is clicked.

void CollisionSystem::setAlgFinished ( )
slot

Tells the CollisionSystem the the Algorithm is no longer running.

Sets the corresponding boolean so that the CollisionSystem can consider the Algorithm as finished when calling terminate(). Called when an QAlgorithm emits the QAlgorithm::finished() signal.

void CollisionSystem::setDisplayFinished ( )
slot

Tells the CollisionSystem that the display is no longer running.

Sets the corresponding boolean so that the CollisionSystem can consider the display as finished when calling terminate(). Called when a CollisionDisplay emits the CollisionDisplay::finished() signal.

void CollisionSystem::setLookaheadTime ( double  d)
slot

Changes the lookahead time to the specified value.

Sets the value of LOOKAHEAD_TIMESTEPS by multiplying the desired lookahead time by the current framerate. Called whenever the lookahead input field is changed.

Parameters
dthe new lookahead time in seconds.
void CollisionSystem::setMaxRadiusMin ( double  d)
slot

Sets the minimum value for the maximum radius input.

Changes the minimum possible value for the maximum Particle radius input to the value of the minimum radius input (i.e. the maximum radius cannot be set below the minimum radius). Called when the maximum radius input changes.

Parameters
dthe new minimum for the maximum Particle radius.
void CollisionSystem::setMinRadiusMax ( double  d)
slot

Sets the maximum value for the minimum radius input.

Changes the maximum possible value for the minimum Particle radius input to the value of the maximum radius input (i.e. the minimum radius cannot be set above the maximum radius). Called when the maximum radius input changes.

Parameters
dthe new maximum for the minimum Particle radius.
void CollisionSystem::setNumParticles ( )

Sets the number of particles with which an Algorithm will run.

Change the value of NUM_PARTICLES to be the value in the Particle number input field. Called when the value changes.

void CollisionSystem::setRadiusRange ( )

Sets the range for Particle radius.

Set the values of MIN_PARTICLE_RADIUS and MAX_PARTICLE_RADIUS to match the values in the min and max radius input field.

void CollisionSystem::setSeed ( )

Sets the seed for the random number generator.

Sets the value of SEED based on the value in the corresponding GUI input field.

void CollisionSystem::setSpace ( int  b)
slot

Sets the variable representing the simulation dimensionality.

Sets a variable which determines if the simulation is in 2D or 3D and switches the corresponding display to be visible. Changes the maximum value of the framerate slider (MAX_FRAMERATE in 2D and 60 in 3D). Enables (3D) or disables (2D) the Reset Camera button.

Parameters
ba boolean represeting whether or not simulation set to 3D.
void CollisionSystem::setTargetFramerate ( int  n)
slot

Sets the new target framerate for the display.

Changes the value of FRAMERATE to the provided value, and uses the new framerate to recalculate the value of LOOKAHEAD_TIMESTEPS such that the lookahead time stays the same. Note that the framerate will only change in between timesteps, so the effect of this method is not immediate. Called when the framerate slider is dragged.

Parameters
nthe target framerate in frames per second.
void CollisionSystem::setTimestepLimit ( int  n)
slot

Sets a limit on the number of timesteps the Algorithm will run.

Sets the value of TIMESTEP_LIMIT so that the Algorithm and display will quit running on that timestep. In truth, an Algorithm will keep running until TIMESTEP_LIMIT + LOOKAHEAD_TIMESTEPS so that it can continue warning about collisions that don't actually happen during the timestep limit.

Parameters
nthe new value for the timestep limit.
void CollisionSystem::setTimestepLimitEnabled ( bool  b)
slot

Enables or disables the timestep limit input field.

Based on the value of the input boolean, enables or disables the timestep input field and sets the value of TIMESTEP_LIMIT to the value of the field (if true) or -1 (if false).

Parameters
bthe eneabled state of the timestep limit field.
void CollisionSystem::start ( )
slot

Creates an Algorithm and sets up connections to the GUI.

Uses the current parameters set in the GUI to create a new Algorithm object. Connects GUI input to the Algorithm and appropriate display, and begins the algorithm and display. Called when the Start button is clicked.

void CollisionSystem::terminate ( )
slot

Kills the algorithm thread and cleans up for the next algorithm.

Stops the algorithm thread, destroys the Algorithm object, and disconnects GUI input elements to prepare for the next time Start is clicked. Only runs if both the Algorithm and display have finished (emitting the finsihed() signal).


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