diff --git a/src/libs/vgeometry/vellipticalarc.cpp b/src/libs/vgeometry/vellipticalarc.cpp index 29669e78c..2f8fbdf35 100644 --- a/src/libs/vgeometry/vellipticalarc.cpp +++ b/src/libs/vgeometry/vellipticalarc.cpp @@ -58,7 +58,7 @@ VEllipticalArc::VEllipticalArc (VPointF center, qreal radius1, qreal radius2, d (new VEllipticalArcData(center, radius1, radius2, formulaRadius1, formulaRadius2, f1, formulaF1, f2, formulaF2, rotationAngle)) { - EllipticalArcName(); + CreateName(); } //--------------------------------------------------------------------------------------------------------------------- @@ -66,7 +66,7 @@ VEllipticalArc::VEllipticalArc(VPointF center, qreal radius1, qreal radius2, qre : VAbstractCurve(GOType::EllipticalArc, NULL_ID, Draw::Calculation), d (new VEllipticalArcData(center, radius1, radius2, f1, f2, rotationAngle)) { - EllipticalArcName(); + CreateName(); } //--------------------------------------------------------------------------------------------------------------------- @@ -77,7 +77,7 @@ VEllipticalArc::VEllipticalArc(qreal length, QString formulaLength, VPointF cent d (new VEllipticalArcData(formulaLength, center, radius1, radius2, formulaRadius1, formulaRadius2, f1, formulaF1, rotationAngle)) { - EllipticalArcName(); + CreateName(); FindF2(length); } @@ -87,7 +87,7 @@ VEllipticalArc::VEllipticalArc(qreal length, VPointF center, qreal radius1, qrea : VAbstractCurve(GOType::EllipticalArc, NULL_ID, Draw::Calculation), d (new VEllipticalArcData(center, radius1, radius2, f1, rotationAngle)) { - EllipticalArcName(); + CreateName(); FindF2(length); } @@ -372,13 +372,25 @@ QPointF VEllipticalArc::CutArc(const qreal &length) const void VEllipticalArc::setId(const quint32 &id) { VAbstractCurve::setId(id); - setName(EARC_ + QString("%1_%2").arg(d->center.name()).arg(id)); + CreateName(); } //--------------------------------------------------------------------------------------------------------------------- -void VEllipticalArc::EllipticalArcName() +void VEllipticalArc::CreateName() { - setName(EARC_ + QString("%1").arg(this->GetCenter().name())); + QString name = EARC_ + QString("%1").arg(this->GetCenter().name()); + + if (VAbstractCurve::id() != NULL_ID) + { + name += QString("_%1").arg(VAbstractCurve::id()); + } + + if (GetDuplicate() > 0) + { + name += QString("_%1").arg(GetDuplicate()); + } + + setName(name); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vgeometry/vellipticalarc.h b/src/libs/vgeometry/vellipticalarc.h index 45a8d01cd..44a3f2cd1 100644 --- a/src/libs/vgeometry/vellipticalarc.h +++ b/src/libs/vgeometry/vellipticalarc.h @@ -92,10 +92,10 @@ public: QPointF CutArc (const qreal &length, VEllipticalArc &arc1, VEllipticalArc &arc2) const; QPointF CutArc (const qreal &length) const; virtual void setId(const quint32 &id) Q_DECL_OVERRIDE; +protected: + virtual void CreateName() Q_DECL_OVERRIDE; private: QSharedDataPointer d; - - void EllipticalArcName(); void FindF2(qreal length); qreal MaxLength() const; diff --git a/src/libs/vgeometry/vgeometry.pri b/src/libs/vgeometry/vgeometry.pri index 2283a411e..1c80d0ed3 100644 --- a/src/libs/vgeometry/vgeometry.pri +++ b/src/libs/vgeometry/vgeometry.pri @@ -8,7 +8,7 @@ SOURCES += \ $$PWD/vpointf.cpp \ $$PWD/vspline.cpp \ $$PWD/vsplinepath.cpp \ - $$PWD/vsplinepoint.cpp \ + $$PWD/vsplinepoint.cpp \ $$PWD/vellipticalarc.cpp win32-msvc*:SOURCES += $$PWD/stable.cpp @@ -29,6 +29,6 @@ HEADERS += \ $$PWD/vsplinepoint.h \ $$PWD/vsplinepoint_p.h \ $$PWD/vgeometrydef.h \ - $$PWD/vellipticalarc.h \ - $$PWD/vellipticalarc_p.h - $$PWD/vabstractcurve_p.h + $$PWD/vellipticalarc.h \ + $$PWD/vellipticalarc_p.h \ + $$PWD/vabstractcurve_p.h diff --git a/src/test/ValentinaTest/ValentinaTest.pro b/src/test/ValentinaTest/ValentinaTest.pro index cba46d81f..52a187aa9 100644 --- a/src/test/ValentinaTest/ValentinaTest.pro +++ b/src/test/ValentinaTest/ValentinaTest.pro @@ -54,7 +54,8 @@ SOURCES += \ tst_vcommandline.cpp \ tst_tstranslation.cpp \ tst_vdetail.cpp \ - tst_findpoint.cpp + tst_findpoint.cpp \ + tst_vellipticalarc.cpp HEADERS += \ tst_vposter.h \ @@ -76,7 +77,8 @@ HEADERS += \ tst_vcommandline.h \ tst_tstranslation.h \ tst_vdetail.h \ - tst_findpoint.h + tst_findpoint.h \ + tst_vellipticalarc.h # Set using ccache. Function enable_ccache() defined in common.pri. $$enable_ccache()