-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMainWindow.h
75 lines (57 loc) · 1.51 KB
/
MainWindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QRectF>
#include "View.h"
#include "Scene.h"
#include "PointItem.h"
#include "spholes/Path.h"
#include "spholes/Graph.h"
class QActionGroup;
class MainWindow : public QMainWindow
{
Q_OBJECT
static const qreal SCENE_BOX_RADIUS;
static const QRectF SCENE_RECT;
private:
Scene *scene;
View *view;
QActionGroup *actions;
QAction *stopAction;
QAction *cancelAction;
QAction *solveAction;
void setupGraphicView();
void setupGraphicItems();
void setupActions();
void setupToolBar();
void clearInteractionMode();
void addPointToNewPolygon(QPointF);
void drawVisibilityGraph(const spholes::Graph<spholes::Point> &);
void drawShortestPath(const spholes::Path &);
enum InteractionMode
{
NoInteraction,
SetStart,
SetDestination,
AddNewPolygon
};
InteractionMode currentMode;
PointItem *startPoint;
PointItem *destinationPoint;
QGraphicsItemGroup *obstacleGroup;
QGraphicsItemGroup *newPolygon;
PointItem *newPolygonStartPoint;
QGraphicsPathItem *newPolygonPath;
QGraphicsItemGroup *visibilityGraph;
QGraphicsPathItem *shortestPath;
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
public slots:
void changeInteractionMode(QAction *);
void stopActionTriggered();
void cancelActionTriggered();
void solveActionTriggered();
void scenePointClicked(QPointF);
};
#endif // MAINWINDOW_H