diff --git a/src/libs/vtools/visualization/line/vistoolrotation.cpp b/src/libs/vtools/visualization/line/vistoolrotation.cpp index 9cd40790a..e5602e3eb 100644 --- a/src/libs/vtools/visualization/line/vistoolrotation.cpp +++ b/src/libs/vtools/visualization/line/vistoolrotation.cpp @@ -44,12 +44,14 @@ VisToolRotation::VisToolRotation(const VContainer *data, QGraphicsItem *parent) angle(INT_MIN), objects(), point(nullptr), + angleArc(nullptr), xAxis(nullptr), supportColor2(Qt::darkGreen), points(), curves() { point = InitPoint(supportColor2, this); + angleArc = InitItem(supportColor2, this); xAxis = InitItem(supportColor2, this); } @@ -75,31 +77,31 @@ void VisToolRotation::RefreshGeometry() if (object1Id != NULL_ID) { - const QPointF origin = *Visualization::data->GeometricObject(object1Id); - DrawPoint(point, origin, supportColor2); + const QSharedPointer origin = Visualization::data->GeometricObject(object1Id); + DrawPoint(point, *origin, supportColor2); QLineF rLine; if (VFuzzyComparePossibleNulls(angle, INT_MIN)) { - rLine = QLineF(origin, Visualization::scenePos); + rLine = QLineF(*origin, Visualization::scenePos); if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier) { rLine.setAngle(CorrectAngle(rLine.angle())); } - rLine.setP2(Ray(origin, rLine.angle())); + rLine.setP2(Ray(*origin, rLine.angle())); } else { - rLine = QLineF(origin, Ray(origin, angle)); + rLine = QLineF(*origin, Ray(*origin, angle)); } - if (mode == Mode::Creation) - { - DrawLine(this, rLine, supportColor2, Qt::DashLine); - DrawLine(xAxis, QLineF(origin, Ray(origin, 0)), supportColor2, Qt::DashLine); - } + DrawLine(this, rLine, supportColor2, Qt::DashLine); + DrawLine(xAxis, QLineF(*origin, Ray(*origin, 0)), supportColor2, Qt::DashLine); + + VArc arc(*origin, ToPixel(DefPointRadius/*mm*/*2, Unit::Mm), 0, rLine.angle()); + DrawPath(angleArc, arc.GetPath(PathDirection::Hide), supportColor2, Qt::SolidLine, Qt::RoundCap); Visualization::toolTip = tr("Rotating angle = %1°, Shift - sticking angle, " "Mouse click - finish creation").arg(rLine.angle()); @@ -126,37 +128,37 @@ void VisToolRotation::RefreshGeometry() ++iPoint; point = GetPoint(iPoint); - DrawPoint(point, p->Rotate(origin, angle), supportColor); + DrawPoint(point, p->Rotate(*origin, angle), supportColor); break; } case GOType::Arc: { - iCurve = AddCurve(origin, id, iCurve); + iCurve = AddCurve(*origin, id, iCurve); break; } case GOType::EllipticalArc: { - iCurve = AddCurve(origin, id, iCurve); + iCurve = AddCurve(*origin, id, iCurve); break; } case GOType::Spline: { - iCurve = AddCurve(origin, id, iCurve); + iCurve = AddCurve(*origin, id, iCurve); break; } case GOType::SplinePath: { - iCurve = AddCurve(origin, id, iCurve); + iCurve = AddCurve(*origin, id, iCurve); break; } case GOType::CubicBezier: { - iCurve = AddCurve(origin, id, iCurve); + iCurve = AddCurve(*origin, id, iCurve); break; } case GOType::CubicBezierPath: { - iCurve = AddCurve(origin, id, iCurve); + iCurve = AddCurve(*origin, id, iCurve); break; } case GOType::Unknown: diff --git a/src/libs/vtools/visualization/line/vistoolrotation.h b/src/libs/vtools/visualization/line/vistoolrotation.h index 00f36202a..e7a660e8e 100644 --- a/src/libs/vtools/visualization/line/vistoolrotation.h +++ b/src/libs/vtools/visualization/line/vistoolrotation.h @@ -55,6 +55,7 @@ private: qreal angle; QVector objects; QGraphicsEllipseItem *point; + QGraphicsPathItem *angleArc; QGraphicsLineItem *xAxis; QColor supportColor2;