src/editmodes/abstractEditMode.cc

changeset 850
a3d72b0e916d
parent 844
11587d419d2f
child 861
83426c5fa732
equal deleted inserted replaced
849:4af6f977d04b 850:a3d72b0e916d
25 #include "circleMode.h" 25 #include "circleMode.h"
26 #include "magicWandMode.h" 26 #include "magicWandMode.h"
27 #include "../mainWindow.h" 27 #include "../mainWindow.h"
28 #include "../glRenderer.h" 28 #include "../glRenderer.h"
29 29
30 CFGENTRY (Bool, drawLineLengths, true) 30 CFGENTRY (Bool, DrawLineLengths, true)
31 CFGENTRY (Bool, drawAngles, false) 31 CFGENTRY (Bool, DrawAngles, false)
32 32
33 AbstractEditMode::AbstractEditMode (GLRenderer* renderer) : 33 AbstractEditMode::AbstractEditMode (GLRenderer* renderer) :
34 _renderer (renderer) {} 34 _renderer (renderer) {}
35 35
36 AbstractEditMode::~AbstractEditMode() {} 36 AbstractEditMode::~AbstractEditMode() {}
207 for (int i = 0; i < poly3d.size(); ++i) 207 for (int i = 0; i < poly3d.size(); ++i)
208 { 208 {
209 const int j = (i + 1) % poly3d.size(); 209 const int j = (i + 1) % poly3d.size();
210 const int h = (i - 1 >= 0) ? (i - 1) : (poly3d.size() - 1); 210 const int h = (i - 1 >= 0) ? (i - 1) : (poly3d.size() - 1);
211 211
212 if (cfg::drawLineLengths) 212 if (cfg::DrawLineLengths)
213 { 213 {
214 const QString label = QString::number ((poly3d[j] - poly3d[i]).length()); 214 const QString label = QString::number ((poly3d[j] - poly3d[i]).length());
215 QPoint origin = QLineF (poly[i], poly[j]).pointAt (0.5).toPoint(); 215 QPoint origin = QLineF (poly[i], poly[j]).pointAt (0.5).toPoint();
216 painter.drawText (origin, label); 216 painter.drawText (origin, label);
217 } 217 }
218 218
219 if (withangles and cfg::drawAngles) 219 if (withangles and cfg::DrawAngles)
220 { 220 {
221 QLineF l0 (poly[h], poly[i]), 221 QLineF l0 (poly[h], poly[i]),
222 l1 (poly[i], poly[j]); 222 l1 (poly[i], poly[j]);
223 223
224 double angle = 180 - l0.angleTo (l1); 224 double angle = 180 - l0.angleTo (l1);

mercurial