Fri, 04 Jul 2014 22:40:35 +0300
- more work on edit modes
823
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | #include <QPainter> |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | #include "circlemode.h" |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
3 | #include "../miscallenous.h" |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | #include "../ldObject.h" |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | CircleMode::CircleMode (GLRenderer* renderer) : |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | Super (renderer) {} |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | double CircleMode::getCircleDrawDist (int pos) const |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | { |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | assert (m_drawedVerts.size() >= pos + 1); |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | Vertex v1 = (m_drawedVerts.size() >= pos + 2) ? m_drawedVerts[pos + 1] : |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | renderer()->coordconv2_3 (renderer()->mousePosition(), false); |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | Axis localx, localy; |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | renderer()->getRelativeAxes (localx, localy); |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | double dx = m_drawedVerts[0][localx] - v1[localx]; |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | double dy = m_drawedVerts[0][localy] - v1[localy]; |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | return Grid::snap (sqrt ((dx * dx) + (dy * dy)), Grid::Coordinate); |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | } |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | Matrix CircleMode::getCircleDrawMatrix (double scale) |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | { |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | // Matrix templates. 2 is substituted with the scale value, 1 is inverted to -1 if needed. |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | static const Matrix templates[3] = |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | { |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | { 2, 0, 0, 0, 1, 0, 0, 0, 2 }, |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | { 2, 0, 0, 0, 0, 2, 0, 1, 0 }, |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | { 0, 1, 0, 2, 0, 0, 0, 0, 2 }, |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | }; |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | Matrix transform = templates[renderer()->camera() % 3]; |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
32 | |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | for (int i = 0; i < 9; ++i) |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | { |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | if (transform[i] == 2) |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
36 | transform[i] = scale; |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
37 | elif (transform[i] == 1 && renderer()->camera() >= 3) |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
38 | transform[i] = -1; |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
39 | } |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
40 | |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
41 | return transform; |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
42 | } |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
43 | |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
44 | void CircleMode::render (QPainter& painter) const |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
45 | { |
824
6add2126e7ff
- more work on edit modes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
823
diff
changeset
|
46 | QFontMetrics const metrics (QFont()); |
6add2126e7ff
- more work on edit modes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
823
diff
changeset
|
47 | |
823
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
48 | // If we have not specified the center point of the circle yet, preview it on the screen. |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
49 | if (m_drawedVerts.isEmpty()) |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
50 | { |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
51 | renderer()->drawBlip (painter, renderer()->coordconv3_2 (renderer()->position3D())); |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
52 | } |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
53 | else |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
54 | { |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
55 | QVector<Vertex> verts, verts2; |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
56 | const double dist0 = getCircleDrawDist (0), |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
57 | dist1 = (m_drawedVerts.size() >= 2) ? getCircleDrawDist (1) : -1; |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
58 | const int segs = g_lores; |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
59 | const double angleUnit = (2 * pi) / segs; |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
60 | Axis relX, relY; |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
61 | QVector<QPoint> ringpoints, circlepoints, circle2points; |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
62 | |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
63 | renderer()->getRelativeAxes (relX, relY); |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
64 | |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
65 | // Calculate the preview positions of vertices |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
66 | for (int i = 0; i < segs; ++i) |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
67 | { |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
68 | Vertex v = g_origin; |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
69 | v.setCoordinate (relX, m_drawedVerts[0][relX] + (cos (i * angleUnit) * dist0)); |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
70 | v.setCoordinate (relY, m_drawedVerts[0][relY] + (sin (i * angleUnit) * dist0)); |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
71 | verts << v; |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
72 | |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
73 | if (dist1 != -1) |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
74 | { |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
75 | v.setCoordinate (relX, m_drawedVerts[0][relX] + (cos (i * angleUnit) * dist1)); |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
76 | v.setCoordinate (relY, m_drawedVerts[0][relY] + (sin (i * angleUnit) * dist1)); |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
77 | verts2 << v; |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
78 | } |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
79 | } |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
80 | |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
81 | int i = 0; |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
82 | for (const Vertex& v : verts + verts2) |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
83 | { |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
84 | // Calculate the 2D point of the vertex |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
85 | QPoint point = renderer()->coordconv3_2 (v); |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
86 | |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
87 | // Draw a green blip at where it is |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
88 | renderer()->drawBlip (painter, point); |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
89 | |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
90 | // Add it to the list of points for the green ring fill. |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
91 | ringpoints << point; |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
92 | |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
93 | // Also add the circle points to separate lists |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
94 | if (i < verts.size()) |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
95 | circlepoints << point; |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
96 | else |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
97 | circle2points << point; |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
98 | |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
99 | ++i; |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
100 | } |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
101 | |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
102 | // Insert the first point as the seventeenth one so that |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
103 | // the ring polygon is closed properly. |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
104 | if (ringpoints.size() >= 16) |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
105 | ringpoints.insert (16, ringpoints[0]); |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
106 | |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
107 | // Same for the outer ring. Note that the indices are offset by 1 |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
108 | // because of the insertion done above bumps the values. |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
109 | if (ringpoints.size() >= 33) |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
110 | ringpoints.insert (33, ringpoints[17]); |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
111 | |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
112 | // Draw the ring |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
113 | painter.setBrush ((m_drawedVerts.size() >= 2) ? _polybrush : Qt::NoBrush); |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
114 | painter.setPen (Qt::NoPen); |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
115 | painter.drawPolygon (QPolygon (ringpoints)); |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
116 | |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
117 | // Draw the circles |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
118 | painter.setBrush (Qt::NoBrush); |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
119 | painter.setPen (renderer()->getLinePen()); |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
120 | painter.drawPolygon (QPolygon (circlepoints)); |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
121 | painter.drawPolygon (QPolygon (circle2points)); |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
122 | |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
123 | // Draw the current radius in the middle of the circle. |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
124 | QPoint origin = renderer()->coordconv3_2 (m_drawedVerts[0]); |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
125 | QString label = QString::number (dist0); |
824
6add2126e7ff
- more work on edit modes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
823
diff
changeset
|
126 | painter.setPen (renderer()->getTextPen()); |
823
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
127 | painter.drawText (origin.x() - (metrics.width (label) / 2), origin.y(), label); |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
128 | |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
129 | if (m_drawedVerts.size() >= 2) |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
130 | { |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
131 | painter.drawText (origin.x() - (metrics.width (label) / 2), |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
132 | origin.y() + metrics.height(), QString::number (dist1)); |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
133 | } |
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
134 | } |
824
6add2126e7ff
- more work on edit modes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
823
diff
changeset
|
135 | } |
6add2126e7ff
- more work on edit modes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
823
diff
changeset
|
136 | |
6add2126e7ff
- more work on edit modes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
823
diff
changeset
|
137 | bool CircleMode::mouseReleased (MouseEventData const& data) |
6add2126e7ff
- more work on edit modes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
823
diff
changeset
|
138 | { |
6add2126e7ff
- more work on edit modes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
823
diff
changeset
|
139 | if (Super::mouseReleased (data)) |
6add2126e7ff
- more work on edit modes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
823
diff
changeset
|
140 | return true; |
6add2126e7ff
- more work on edit modes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
823
diff
changeset
|
141 | |
6add2126e7ff
- more work on edit modes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
823
diff
changeset
|
142 | if (m_drawedVerts.size() < 3) |
6add2126e7ff
- more work on edit modes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
823
diff
changeset
|
143 | { |
6add2126e7ff
- more work on edit modes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
823
diff
changeset
|
144 | addDrawnVertex (m_position3D); |
6add2126e7ff
- more work on edit modes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
823
diff
changeset
|
145 | return; |
6add2126e7ff
- more work on edit modes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
823
diff
changeset
|
146 | } |
6add2126e7ff
- more work on edit modes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
823
diff
changeset
|
147 | |
6add2126e7ff
- more work on edit modes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
823
diff
changeset
|
148 | Super::mouseReleased (data); |
6add2126e7ff
- more work on edit modes
Santeri Piippo <crimsondusk64@gmail.com>
parents:
823
diff
changeset
|
149 | } |