31 |
31 |
32 virtual bool allowFreeCamera() const = 0; |
32 virtual bool allowFreeCamera() const = 0; |
33 virtual void render (QPainter& painter) const {}; |
33 virtual void render (QPainter& painter) const {}; |
34 GLRenderer* renderer() const; |
34 GLRenderer* renderer() const; |
35 virtual EditModeType type() const = 0; |
35 virtual EditModeType type() const = 0; |
36 virtual void mousePressed (MouseEventData const& data) {} |
36 virtual bool mousePressed (MouseEventData const& data) { return false; } |
37 virtual void mouseReleased (MouseEventData const& data) {} |
37 virtual bool mouseReleased (MouseEventData const& data) { return false; } |
38 |
38 |
39 static AbstractEditMode* createByType (GLRenderer* renderer, EditModeType type); |
39 static AbstractEditMode* createByType (GLRenderer* renderer, EditModeType type); |
40 }; |
40 }; |
41 |
41 |
42 // |
42 // |
45 class AbstractDrawMode : public AbstractEditMode |
45 class AbstractDrawMode : public AbstractEditMode |
46 { |
46 { |
47 QList<Vertex> m_drawedVerts; |
47 QList<Vertex> m_drawedVerts; |
48 Vertex m_rectverts[4]; |
48 Vertex m_rectverts[4]; |
49 |
49 |
|
50 DEFINE_CLASS (AbstractDrawMode, AbstractEditMode) |
|
51 |
50 public: |
52 public: |
51 AbstractDrawMode (GLRenderer* renderer); |
53 AbstractDrawMode (GLRenderer* renderer); |
52 |
54 |
53 virtual bool allowFreeCamera() const override |
55 virtual bool allowFreeCamera() const override |
54 { |
56 { |
55 return false; |
57 return false; |
56 } |
58 } |
57 |
59 |
58 virtual void mouseReleased (MouseEventData const& data) override; |
60 bool mouseReleased (const AbstractEditMode::MouseEventData& data) override; |
59 void addDrawnVertex (const Vertex& pos); |
61 void addDrawnVertex (const Vertex& pos); |
60 |
62 |
61 virtual bool preAddVertex (Vertex const&) |
63 virtual bool preAddVertex (Vertex const&) |
62 { |
64 { |
63 return false; |
65 return false; |
67 // |
69 // |
68 // Base class for select-like edit modes |
70 // Base class for select-like edit modes |
69 // |
71 // |
70 class AbstractSelectMode : public AbstractEditMode |
72 class AbstractSelectMode : public AbstractEditMode |
71 { |
73 { |
|
74 DEFINE_CLASS (AbstractSelectMode, AbstractEditMode) |
|
75 |
72 public: |
76 public: |
73 AbstractSelectMode (GLRenderer* renderer); |
77 AbstractSelectMode (GLRenderer* renderer); |
74 |
78 |
75 virtual bool allowFreeCamera() const override |
79 virtual bool allowFreeCamera() const override |
76 { |
80 { |