-
Notifications
You must be signed in to change notification settings - Fork 2
/
vizmanipulationmanager.h
117 lines (93 loc) · 3 KB
/
vizmanipulationmanager.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#ifndef VIZMANIPULATIONMANAGER_H
#define VIZMANIPULATIONMANAGER_H
#include <QObject>
#include <QPointF>
class VizPolyhedron;
class VizPoint;
class VizCoordinateSystem;
struct TransformationGroup;
class ClintScop;
class VizManipulationManager : public QObject {
Q_OBJECT
public:
explicit VizManipulationManager(QObject *parent = 0);
void rearrangePiles2D(std::vector<int> &createdBeta, bool pileDeleted, TransformationGroup &group, int pileIdx, size_t pileNb);
void rearrangeCSs2D(int coordinateSystemIdx, bool csDeleted, std::vector<int> &createdBeta, size_t pileSize, TransformationGroup &group);
enum Dir {
LEFT,
RIGHT,
UP,
DOWN
};
enum Corner {
C_BOTTOM = 0x1, // TOP = ~BOTTOM
C_RIGHT = 0x2, // LEFT = ~RIGHT
};
enum {
C_LEFT = 0x0
};
enum {
C_TOP = 0x0
};
int rotationCase();
signals:
void intentionMoveHorizontally(int amount);
void intentionMoveVertically(int amount);
void movedHorizontally(int amount);
void movedVertically(int amount);
public slots:
void polyhedronAboutToMove(VizPolyhedron *polyhedron);
void polyhedronMoving(VizPolyhedron *polyhedron, QPointF displacement);
void polyhedronHasMoved(VizPolyhedron *polyhedron);
void polyhedronAboutToDetach(VizPolyhedron *polyhedron);
void polyhedronDetaching(QPointF position);
void polyhedronHasDetached(VizPolyhedron *polyhedron);
void pointAboutToMove(VizPoint *point);
void pointMoving(QPointF position);
void pointHasMoved(VizPoint *point);
void pointRightClicked(VizPoint *point);
void polyhedronAboutToResize(VizPolyhedron *polyhedron, Dir direction);
void polyhedronResizing(QPointF displacement);
void polyhedronHasResized(VizPolyhedron *polyhedron);
void polyhedronHasCreatedDimension(VizPolyhedron *polyhedron);
void polyhedronAboutToSkew(VizPolyhedron *polyhedron, int corner);
void polyhedronSkewing(QPointF displacement);
void polyhedronHasSkewed(VizPolyhedron *polyhedron);
void polyhedronAboutToRotate(VizPolyhedron *polyhedron, int corner);
void polyhedronRotating(QPointF displacement);
void polyhedronHasRotated(VizPolyhedron *polyhedron);
private:
VizPolyhedron *m_polyhedron = nullptr;
VizPoint *m_point = nullptr;
VizCoordinateSystem *m_coordinateSystem = nullptr;
int m_initCSHorizontalMin, m_initCSVerticalMin;
int m_horzOffset, m_vertOffset;
bool m_detached;
bool m_firstMovement = false;
Dir m_direction;
int m_corner;
double m_rotationAngle;
bool m_skewing = false;
bool m_resizing = false;
int m_creatingDimension = 0;
enum {
PT_NODETACH,
PT_DETACH_HORIZONTAL,
PT_DETACH_VERTICAL,
PT_DETACHED_HORIZONTAL,
PT_DETACHED_VERTICAL,
PT_ATTACH,
PT_ATTACHED
} m_pointDetachState;
int m_pointDetachValue;
bool m_pointDetachLast;
void ensureTargetConsistency();
bool isFlagSet(int flags, int flag) {
if (flag == 0) {
return (~flags) & flag;
}
return flags & flag;
}
void remapBetas(TransformationGroup group, ClintScop *scop);
};
#endif // VIZMANIPULATIONMANAGER_H