The main window of the graphical interface.
More...
#include <collisionsystem.h>
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).
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
-
parent | the parent widget, if one exists. Defaults to 0. |
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 |
void CollisionSystem::setDisplayFinished |
( |
| ) |
|
|
slot |
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
-
d | the 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
-
d | the 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
-
d | the 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
-
b | a 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
-
n | the 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
-
n | the 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
-
b | the 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:
- GUI/SpaceCollisionSystem/collisionsystem.h
- GUI/SpaceCollisionSystem/collisionsystem.cpp