src/editmodes/abstractEditMode.cpp

changeset 1323
05b3e173c900
parent 1321
413d7be6f042
child 1326
69a90bd2dba2
equal deleted inserted replaced
1322:d8935cdb24c0 1323:05b3e173c900
205 * - v0 and v1 are the line vertices in 3D space. 205 * - v0 and v1 are the line vertices in 3D space.
206 * - v0p and v1p are the line vertices in 2D space (so that this function does not have to calculate them separately) 206 * - v0p and v1p are the line vertices in 2D space (so that this function does not have to calculate them separately)
207 */ 207 */
208 void AbstractDrawMode::drawLineLength(QPainter &painter, const Vertex &v0, const Vertex &v1, const QPointF& v0p, const QPointF& v1p) const 208 void AbstractDrawMode::drawLineLength(QPainter &painter, const Vertex &v0, const Vertex &v1, const QPointF& v0p, const QPointF& v1p) const
209 { 209 {
210 if (not m_config->drawLineLengths()) 210 if (not config::drawLineLengths())
211 return; 211 return;
212 212
213 const QString label = QString::number(abs(v1 - v0), 'f', 2); 213 const QString label = QString::number(abs(v1 - v0), 'f', 2);
214 QPoint origin = QLineF {v0p, v1p}.pointAt(0.5).toPoint(); 214 QPoint origin = QLineF {v0p, v1p}.pointAt(0.5).toPoint();
215 painter.drawText (origin, label); 215 painter.drawText (origin, label);
254 int prior = (i - 1 >= 0) ? (i - 1) : (countof(polygon3d) - 1); 254 int prior = (i - 1 >= 0) ? (i - 1) : (countof(polygon3d) - 1);
255 255
256 if (drawLineLengths) 256 if (drawLineLengths)
257 drawLineLength(painter, polygon3d[i], polygon3d[j], polygon2d[i], polygon2d[j]); 257 drawLineLength(painter, polygon3d[i], polygon3d[j], polygon2d[i], polygon2d[j]);
258 258
259 if (drawAngles and m_config->drawAngles()) 259 if (drawAngles and config::drawAngles())
260 { 260 {
261 QLineF line0 = {polygon2d[prior], polygon2d[i]}; 261 QLineF line0 = {polygon2d[prior], polygon2d[i]};
262 QLineF line1 = {polygon2d[i], polygon2d[j]}; 262 QLineF line1 = {polygon2d[i], polygon2d[j]};
263 double angle = 180 - line0.angleTo(line1); 263 double angle = 180 - line0.angleTo(line1);
264 264

mercurial