ChirpSim
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
Public Slots | Public Member Functions | Private Attributes | List of all members
SimulatorView Class Reference

The SimulatorView class implements a view of the World currently being simulated. More...

#include <simulatorview.h>

Inheritance diagram for SimulatorView:
Inheritance graph

Public Slots

void step (void)
 Called by a QTimer periodically, depending on the set timestep. More...
 

Public Member Functions

 SimulatorView (QWidget *parent=0)
 
 ~SimulatorView ()
 
void wheelEvent (QWheelEvent *event)
 Called when the mouse wheel moves inside the SimulatorView. Calls zoom(1) when the wheel is scrolled upwards and zoom(-1) when the wheel is scrolled downwards. More...
 
void mouseMoveEvent (QMouseEvent *event)
 Called when the mouse moves within SimulatorView. Will scroll around the world when the right mouse button is held down. More...
 
void zoom (int direction)
 Zooms the view in or out depending on the sign of direction. More...
 
void setPhysicalSteps (unsigned numberOfSteps)
 Sets the number of physical steps being run between each time the graphics are updated. More...
 

Private Attributes

World_world
 
QTimer * _timer
 
QElapsedTimer * _elapsedTimer
 
unsigned _timestep
 
unsigned _physicalSteps
 

Detailed Description

The SimulatorView class implements a view of the World currently being simulated.

Constructor & Destructor Documentation

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

References _elapsedTimer, _physicalSteps, _timer, _timestep, _world, World::instance(), and step().

Here is the call graph for this function:

SimulatorView::~SimulatorView ( )

Member Function Documentation

void SimulatorView::mouseMoveEvent ( QMouseEvent *  event)

Called when the mouse moves within SimulatorView. Will scroll around the world when the right mouse button is held down.

Parameters
eventQMouseEvent sent by the QGraphicsView base class.
void SimulatorView::setPhysicalSteps ( unsigned  numberOfSteps)

Sets the number of physical steps being run between each time the graphics are updated.

Parameters
numberOfStepsNumber of steps between each time the graphics are updated.

References _physicalSteps.

Referenced by MainWindow::on_action1x_triggered(), MainWindow::on_action2x_triggered(), and MainWindow::on_action3x_triggered().

Here is the caller graph for this function:

void SimulatorView::step ( void  )
slot

Called by a QTimer periodically, depending on the set timestep.

References _elapsedTimer, _physicalSteps, _timer, _timestep, _world, World::step(), and World::stepGraphics().

Referenced by SimulatorView().

Here is the call graph for this function:

Here is the caller graph for this function:

void SimulatorView::wheelEvent ( QWheelEvent *  event)

Called when the mouse wheel moves inside the SimulatorView. Calls zoom(1) when the wheel is scrolled upwards and zoom(-1) when the wheel is scrolled downwards.

Parameters
eventQWheelEvent sent by the QGraphicsView base class.

References sign(), and zoom().

Here is the call graph for this function:

void SimulatorView::zoom ( int  direction)

Zooms the view in or out depending on the sign of direction.

Parameters
directionA positive value will zoom in, a negative value will zoom out.

References sign().

Referenced by MainWindow::on_actionZoom_in_triggered(), MainWindow::on_actionZoom_out_triggered(), and wheelEvent().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

QElapsedTimer* SimulatorView::_elapsedTimer
private

Referenced by SimulatorView(), and step().

unsigned SimulatorView::_physicalSteps
private
QTimer* SimulatorView::_timer
private

Referenced by SimulatorView(), and step().

unsigned SimulatorView::_timestep
private

Referenced by SimulatorView(), and step().

World* SimulatorView::_world
private

Referenced by SimulatorView(), and step().


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