-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscene2d.h
81 lines (56 loc) · 1.68 KB
/
scene2d.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
#ifndef SCENE2D_H
#define SCENE2D_H
#include "scene.h"
#include "lineinfo.h"
#include "rectinfo.h"
#include "circleinfo.h"
#include "ellipseinfo.h"
#include <QTimer>
class FrameParser;
class Window;
class Scene2D : public Scene
{
Q_OBJECT
public:
explicit Scene2D(QWidget *parent = nullptr);
~Scene2D() override;
void readTextFile(const QString &fileName);
bool nextFrame();
void toTextFile();
void doChangeColor(const QColor &color);
void doFillColor(const QColor &color);
void deleteItem();
void clearAll();
void doTranslation();
void doRotation();
void doScaling();
void doReflection();
void updateInfo(Item *item);
void setThickness(int value) override;
void addScene();
void addItemFrom2Points(const QPoint &p1, const QPoint &p2);
void addBoundingRect(const QPoint &p1, const QPoint &p2);
RectInfo *getRectInfo() const;
LineInfo *getLineInfo() const;
CircleInfo *getCircleInfo() const;
EllipseInfo *getEllipseInfo() const;
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent) override;
void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) override;
void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent) override;
private:
bool isDrawing = false;
Item *tmpItem = nullptr;
Line *tmpLine = nullptr;
Rectangle *tmpRectange = nullptr;
Circle *tmpCircle = nullptr;
Ellipse *tmpEllipse = nullptr;
QGraphicsRectItem *tmpSelected = nullptr;
LineInfo *lineInfo;
RectInfo *rectInfo;
CircleInfo *circleInfo;
EllipseInfo *ellipseInfo;
FrameParser *parser;
std::vector<QPoint> points;
};
#endif // SCENE2D_H