Space Comps
 All Classes Files Functions Variables
collisiondisplay2d.h
1 #ifndef COLLISIONDISPLAY2D_H
2 #define COLLISIONDISPLAY2D_H
3 
4 #include <QGraphicsView>
5 #include <QGraphicsScene>
6 #include <QTimer>
7 #include <unordered_map>
8 #include "collisiondisplay.h"
9 #include "qalgorithm.h"
10 #include "qparticle2d.h"
11 
21 class CollisionDisplay2D : public QGraphicsView, public CollisionDisplay
22 {
23  Q_OBJECT
24 public:
25 
35  explicit CollisionDisplay2D(QWidget *parent = 0);
37 
42  QGraphicsScene* getScene();
43 
48  QTimer* getTimer();
49 
54  void setQAlgorithm(QAlgorithm *qalgorithm);
55 
56 // int getNumCollisions();
57 // int getDisplayTimestep();
58 
59 signals:
66  void finished();
67 
68 public slots:
69 
79  void start();
80 
85  void stop();
86 
96  void step();
97 
98 private:
99  QGraphicsScene* scene;
100 
101  std::vector<QParticle2D*> drawnParticles;
102  std::unordered_map<Particle*, QParticle2D*> particleMap;
103 };
104 
105 #endif // COLLISIONDISPLAY2D_H
void finished()
Signals that the display has finished. Usually because the user clicked "stop", for example...
The QAlgorithm class is a QT wrapper for Algorithm.
Definition: qalgorithm.h:13
CollisionDisplay2D(QWidget *parent=0)
Constructs a CollisionDisplay2D.
Definition: collisiondisplay2d.cpp:4
The parent class of 2D and 3D visualization windows.
Definition: collisiondisplay.h:14
QGraphicsScene * getScene()
Gets the scene that is declared in CollisionDisplay2D.
Definition: collisiondisplay2d.cpp:128
void stop()
Stops the timer and reinitializes the QTimer timer, QGraphicsScene scene, QAlgorithm qalg...
Definition: collisiondisplay2d.cpp:48
QTimer * getTimer()
Gets the timer declared in CollisionDisplay.
Definition: collisiondisplay2d.cpp:124
The view containing 2D visualization.
Definition: collisiondisplay2d.h:21
void step()
Performs one step of the display.
Definition: collisiondisplay2d.cpp:60
void start()
Starts the simulation.
Definition: collisiondisplay2d.cpp:23
void setQAlgorithm(QAlgorithm *qalgorithm)
Sets the algorithm declared in CollisionDisplay.
Definition: collisiondisplay2d.cpp:136