From 50f6418f10b05a10186b3c08b1cdcd031ca64255 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Sat, 17 Dec 2016 03:40:17 +0200 Subject: [PATCH] Added AddEllipticalArc method to VContainer. --HG-- branch : feature --- src/libs/vpatterndb/vcontainer.cpp | 16 +++++++++++++++- src/libs/vpatterndb/vcontainer.h | 3 +++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/libs/vpatterndb/vcontainer.cpp b/src/libs/vpatterndb/vcontainer.cpp index 5661de0c3..4af8fe2bf 100644 --- a/src/libs/vpatterndb/vcontainer.cpp +++ b/src/libs/vpatterndb/vcontainer.cpp @@ -40,10 +40,12 @@ #include "../vgeometry/vpointf.h" #include "../vgeometry/vspline.h" #include "../vgeometry/varc.h" +#include "../vgeometry/vellipticalarc.h" #include "../vmisc/diagnostic.h" #include "../vmisc/logging.h" #include "../vmisc/vabstractapplication.h" #include "variables/varcradius.h" +#include "variables/vellipticalarcradius.h" #include "variables/vcurveangle.h" #include "variables/vcurvelength.h" #include "variables/vcurveclength.h" @@ -388,13 +390,25 @@ void VContainer::AddArc(const QSharedPointer &arc, const quint32 &id, cons AddVariable(radius->GetName(), radius); } +//--------------------------------------------------------------------------------------------------------------------- +void VContainer::AddEllipticalArc(const QSharedPointer &arc, const quint32 &id, const quint32 &parentId) +{ + AddCurve(arc, id, parentId); + + VEllipticalArcRadius *radius1 = new VEllipticalArcRadius(id, parentId, arc.data(), 1, *GetPatternUnit()); + AddVariable(radius1->GetName(), radius1); + + VEllipticalArcRadius *radius2 = new VEllipticalArcRadius(id, parentId, arc.data(), 2, *GetPatternUnit()); + AddVariable(radius2->GetName(), radius2); +} + //--------------------------------------------------------------------------------------------------------------------- void VContainer::AddCurve(const QSharedPointer &curve, const quint32 &id, quint32 parentId) { const GOType curveType = curve->getType(); if (curveType != GOType::Spline && curveType != GOType::SplinePath && curveType != GOType::CubicBezier && curveType != GOType::CubicBezierPath && - curveType != GOType::Arc) + curveType != GOType::Arc && curveType != GOType::EllipticalArc) { throw VException(tr("Can't create a curve with type '%1'").arg(static_cast(curveType))); } diff --git a/src/libs/vpatterndb/vcontainer.h b/src/libs/vpatterndb/vcontainer.h index 028d763ce..94eccfdac 100644 --- a/src/libs/vpatterndb/vcontainer.h +++ b/src/libs/vpatterndb/vcontainer.h @@ -59,6 +59,7 @@ class VAbstractCubicBezierPath; class VAbstractCurve; class VArc; +class VEllipticalArc; class VArcRadius; class VCurveAngle; class VCurveLength; @@ -146,6 +147,8 @@ public: quint32 AddDetail(const VDetail &detail); void AddLine(const quint32 &firstPointId, const quint32 &secondPointId); void AddArc(const QSharedPointer &arc, const quint32 &arcId, const quint32 &parentId = NULL_ID); + void AddEllipticalArc(const QSharedPointer &arc, const quint32 &arcId, + const quint32 &parentId = NULL_ID); void AddSpline(const QSharedPointer &curve, quint32 id, quint32 parentId = NULL_ID); void AddCurveWithSegments(const QSharedPointer &curve, const quint32 &id, quint32 parentId = NULL_ID);