Added AddEllipticalArc method to VContainer.

--HG--
branch : feature
This commit is contained in:
Valentina Zhuravska 2016-12-17 03:40:17 +02:00
parent 9e3fd67eb6
commit 50f6418f10
2 changed files with 18 additions and 1 deletions

View File

@ -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<VArc> &arc, const quint32 &id, cons
AddVariable(radius->GetName(), radius);
}
//---------------------------------------------------------------------------------------------------------------------
void VContainer::AddEllipticalArc(const QSharedPointer<VEllipticalArc> &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<VAbstractCurve> &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<int>(curveType)));
}

View File

@ -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<VArc> &arc, const quint32 &arcId, const quint32 &parentId = NULL_ID);
void AddEllipticalArc(const QSharedPointer<VEllipticalArc> &arc, const quint32 &arcId,
const quint32 &parentId = NULL_ID);
void AddSpline(const QSharedPointer<VAbstractBezier> &curve, quint32 id, quint32 parentId = NULL_ID);
void AddCurveWithSegments(const QSharedPointer<VAbstractCubicBezierPath> &curve, const quint32 &id,
quint32 parentId = NULL_ID);