diff --git a/src/libs/vgeometry/vellipticalarc.cpp b/src/libs/vgeometry/vellipticalarc.cpp index 09b5d790f..ad8186dd9 100644 --- a/src/libs/vgeometry/vellipticalarc.cpp +++ b/src/libs/vgeometry/vellipticalarc.cpp @@ -58,9 +58,10 @@ VEllipticalArc::VEllipticalArc() */ VEllipticalArc::VEllipticalArc (const VPointF ¢er, qreal radius1, qreal radius2, const QString &formulaRadius1, const QString &formulaRadius2, qreal f1, const QString &formulaF1, qreal f2, - const QString &formulaF2, qreal rotationAngle, quint32 idObject, Draw mode) + const QString &formulaF2, qreal rotationAngle, const QString &formulaRotationAngle, + quint32 idObject, Draw mode) : VAbstractArc(GOType::EllipticalArc, center, f1, formulaF1, f2, formulaF2, idObject, mode), - d (new VEllipticalArcData(radius1, radius2, formulaRadius1, formulaRadius2, rotationAngle)) + d (new VEllipticalArcData(radius1, radius2, formulaRadius1, formulaRadius2, rotationAngle, formulaRotationAngle)) { CreateName(); } @@ -77,9 +78,10 @@ VEllipticalArc::VEllipticalArc(const VPointF ¢er, qreal radius1, qreal radiu //--------------------------------------------------------------------------------------------------------------------- VEllipticalArc::VEllipticalArc(qreal length, const QString &formulaLength, const VPointF ¢er, qreal radius1, qreal radius2, const QString &formulaRadius1, const QString &formulaRadius2, qreal f1, - const QString &formulaF1, qreal rotationAngle, quint32 idObject, Draw mode) + const QString &formulaF1, qreal rotationAngle, const QString &formulaRotationAngle, + quint32 idObject, Draw mode) : VAbstractArc(GOType::EllipticalArc, formulaLength, center, f1, formulaF1, idObject, mode), - d (new VEllipticalArcData(radius1, radius2, formulaRadius1, formulaRadius2, rotationAngle)) + d (new VEllipticalArcData(radius1, radius2, formulaRadius1, formulaRadius2, rotationAngle, formulaRotationAngle)) { CreateName(); FindF2(length); @@ -445,12 +447,12 @@ QPointF VEllipticalArc::CutArc(const qreal &length, VEllipticalArc &arc1, VEllip // the first arc has given length and startAngle just like in the origin arc arc1 = VEllipticalArc (len, QString().setNum(length), GetCenter(), d->radius1, d->radius2, d->formulaRadius1, d->formulaRadius2, GetStartAngle(), GetFormulaF1(), d->rotationAngle, - getIdObject(), getMode()); + GetFormulaRotationAngle(), getIdObject(), getMode()); // the second arc has startAngle just like endAngle of the first arc // and it has endAngle just like endAngle of the origin arc arc2 = VEllipticalArc (GetCenter(), d->radius1, d->radius2, d->formulaRadius1, d->formulaRadius2, arc1.GetEndAngle(), arc1.GetFormulaF2(), GetEndAngle(), GetFormulaF2(), d->rotationAngle, - getIdObject(), getMode()); + GetFormulaRotationAngle(), getIdObject(), getMode()); return arc1.GetP1(); } @@ -540,7 +542,7 @@ qreal VEllipticalArc::MaxLength() const //--------------------------------------------------------------------------------------------------------------------- /** - * @brief GetRadius return arc major radius. + * @brief GetFormulaRadius1 return formula for major radius. * @return radius. */ QString VEllipticalArc::GetFormulaRadius1() const @@ -550,7 +552,7 @@ QString VEllipticalArc::GetFormulaRadius1() const //--------------------------------------------------------------------------------------------------------------------- /** - * @brief GetRadius return arc minor radius. + * @brief GetFormulaRadius2 return formula for minor radius. * @return radius. */ QString VEllipticalArc::GetFormulaRadius2() const @@ -560,12 +562,12 @@ QString VEllipticalArc::GetFormulaRadius2() const //--------------------------------------------------------------------------------------------------------------------- /** - * @brief GetRotationAngle return rotation angle. + * @brief GetFormulaRotationAngle return formula for rotation angle. * @return rotationAngle. */ -qreal VEllipticalArc::GetRotationAngle() const +QString VEllipticalArc::GetFormulaRotationAngle() const { - return d->rotationAngle; + return d->formulaRotationAngle; } //--------------------------------------------------------------------------------------------------------------------- @@ -582,9 +584,16 @@ void VEllipticalArc::SetFormulaRadius2(const QString &formula, qreal value) d->radius2 = value; } +//--------------------------------------------------------------------------------------------------------------------- +void VEllipticalArc::SetFormulaRotationAngle(const QString &formula, qreal value) +{ + d->formulaRotationAngle = formula; + d->rotationAngle = value; +} + //--------------------------------------------------------------------------------------------------------------------- /** - * @brief GetRadius return formula for major radius. + * @brief GetRadius1 return elliptical arc major radius. * @return string with formula. */ qreal VEllipticalArc::GetRadius1() const @@ -594,10 +603,20 @@ qreal VEllipticalArc::GetRadius1() const //--------------------------------------------------------------------------------------------------------------------- /** - * @brief GetRadius return formula for minor radius. + * @brief GetRadius2 return elliptical arc minor radius. * @return string with formula. */ qreal VEllipticalArc::GetRadius2() const { return d->radius2; } + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief GetRotationAngle return rotation angle. + * @return rotationAngle. + */ +qreal VEllipticalArc::GetRotationAngle() const +{ + return d->rotationAngle; +} diff --git a/src/libs/vgeometry/vellipticalarc.h b/src/libs/vgeometry/vellipticalarc.h index 1f15025e4..8527f3498 100644 --- a/src/libs/vgeometry/vellipticalarc.h +++ b/src/libs/vgeometry/vellipticalarc.h @@ -52,11 +52,12 @@ public: VEllipticalArc(); VEllipticalArc (const VPointF ¢er, qreal radius1, qreal radius2, const QString &formulaRadius1, const QString &formulaRadius2, qreal f1, const QString &formulaF1, qreal f2, - const QString &formulaF2, qreal rotationAngle, quint32 idObject = 0, Draw mode = Draw::Calculation); + const QString &formulaF2, qreal rotationAngle, const QString &formulaRotationAngle, + quint32 idObject = 0, Draw mode = Draw::Calculation); VEllipticalArc (const VPointF ¢er, qreal radius1, qreal radius2, qreal f1, qreal f2, qreal rotationAngle); VEllipticalArc (qreal length, const QString &formulaLength, const VPointF ¢er, qreal radius1, qreal radius2, const QString &formulaRadius1, const QString &formulaRadius2, qreal f1, const QString &formulaF1, - qreal rotationAngle, quint32 idObject = 0, Draw mode = Draw::Calculation); + qreal rotationAngle, const QString &formulaRotationAngle, quint32 idObject = 0, Draw mode = Draw::Calculation); VEllipticalArc (qreal length, const VPointF ¢er, qreal radius1, qreal radius2, qreal f1, qreal rotationAngle); VEllipticalArc(const VEllipticalArc &arc); @@ -68,7 +69,9 @@ public: virtual ~VEllipticalArc() Q_DECL_OVERRIDE; - qreal GetRotationAngle() const; + QString GetFormulaRotationAngle () const; + void SetFormulaRotationAngle (const QString &formula, qreal value); + qreal GetRotationAngle() const; QString GetFormulaRadius1 () const; void SetFormulaRadius1 (const QString &formula, qreal value); diff --git a/src/libs/vgeometry/vellipticalarc_p.h b/src/libs/vgeometry/vellipticalarc_p.h index ed8ec938e..e829153c3 100644 --- a/src/libs/vgeometry/vellipticalarc_p.h +++ b/src/libs/vgeometry/vellipticalarc_p.h @@ -14,7 +14,7 @@ class VEllipticalArcData : public QSharedData public: VEllipticalArcData (); VEllipticalArcData (qreal radius1, qreal radius2, const QString &formulaRadius1, const QString &formulaRadius2, - qreal rotationAngle); + qreal rotationAngle, const QString &formulaRotationAngle); VEllipticalArcData(qreal radius1, qreal radius2, qreal rotationAngle); VEllipticalArcData(const VEllipticalArcData &arc); @@ -30,6 +30,8 @@ public: QString formulaRadius2; /** @brief rotationAngle in degree. */ qreal rotationAngle; + /** @brief formulaRotationAngle formula for rotationAngle. */ + QString formulaRotationAngle; private: VEllipticalArcData &operator=(const VEllipticalArcData &) Q_DECL_EQ_DELETE; @@ -41,17 +43,20 @@ VEllipticalArcData::VEllipticalArcData() radius2(0), formulaRadius1(), formulaRadius2(), - rotationAngle(0) + rotationAngle(0), + formulaRotationAngle() {} //--------------------------------------------------------------------------------------------------------------------- VEllipticalArcData::VEllipticalArcData(qreal radius1, qreal radius2, const QString &formulaRadius1, - const QString &formulaRadius2, qreal rotationAngle) + const QString &formulaRadius2, qreal rotationAngle, + const QString &formulaRotationAngle) : radius1(radius1), radius2(radius2), formulaRadius1(formulaRadius1), formulaRadius2(formulaRadius2), - rotationAngle(rotationAngle) + rotationAngle(rotationAngle), + formulaRotationAngle(formulaRotationAngle) {} //--------------------------------------------------------------------------------------------------------------------- @@ -60,7 +65,8 @@ VEllipticalArcData::VEllipticalArcData(qreal radius1, qreal radius2, qreal rotat radius2(radius2), formulaRadius1(QString().number(qApp->fromPixel(radius1))), formulaRadius2(QString().number(qApp->fromPixel(radius2))), - rotationAngle(rotationAngle) + rotationAngle(rotationAngle), + formulaRotationAngle(QString().number(qApp->fromPixel(rotationAngle))) {} //--------------------------------------------------------------------------------------------------------------------- @@ -70,7 +76,8 @@ VEllipticalArcData::VEllipticalArcData(const VEllipticalArcData &arc) radius2(arc.radius2), formulaRadius1(arc.formulaRadius1), formulaRadius2(arc.formulaRadius2), - rotationAngle(arc.rotationAngle) + rotationAngle(arc.rotationAngle), + formulaRotationAngle(arc.formulaRotationAngle) {} //---------------------------------------------------------------------------------------------------------------------