Mon, 16 May 2022 01:40:49 +0300
work on circle tool
96 | 1 | #pragma once |
2 | #include "basetool.h" | |
3 | ||
185 | 4 | class AbstractDrawTool : public BaseTool |
5 | { | |
6 | public: | |
7 | AbstractDrawTool(Document* document); | |
8 | void reset() override; | |
9 | void overpaint(Canvas*, QPainter*) const override; | |
10 | bool mouseMove(Document* document, Canvas* canvas, QMouseEvent* event) override; | |
11 | bool mouseClick(Canvas* canvas, QMouseEvent* event) override; | |
12 | bool keyReleased(Document*, Canvas* canvas, QKeyEvent* event) override; | |
13 | protected: | |
14 | void addCurrentPoint(Canvas *canvas); | |
15 | virtual void addPoint(const glm::vec3& pos); | |
16 | virtual void closeShape() = 0; | |
17 | void removeLastPoint(); | |
18 | void clearPoints(); | |
19 | bool isCloseToExistingPoints(const glm::vec3& pos) const; | |
20 | std::vector<glm::vec3> polygon; | |
21 | std::vector<glm::vec3> previewPolygon; | |
22 | glm::vec3 previewPoint; | |
23 | bool isconcave = false; | |
24 | void updatePreviewPolygon(); | |
25 | }; | |
26 | ||
27 | class DrawTool : public AbstractDrawTool | |
96 | 28 | { |
29 | Q_OBJECT | |
30 | ||
31 | public: | |
152 | 32 | Q_INVOKABLE DrawTool(Document* document); |
96 | 33 | |
105
6ca6e8c647d4
added preview layer code and fixed build warnings
Teemu Piippo <teemu@hecknology.net>
parents:
104
diff
changeset
|
34 | QString name() const override; |
6ca6e8c647d4
added preview layer code and fixed build warnings
Teemu Piippo <teemu@hecknology.net>
parents:
104
diff
changeset
|
35 | QString toolTip() const override; |
163 | 36 | QString iconName() const override; |
185 | 37 | protected: |
38 | virtual void addPoint(const glm::vec3& pos) override; | |
39 | void closeShape() override; | |
96 | 40 | }; |