diff --git a/src/app/tools/drawTools/vtoolcut.cpp b/src/app/tools/drawTools/vtoolcut.cpp index 4593f5112..1a870021c 100644 --- a/src/app/tools/drawTools/vtoolcut.cpp +++ b/src/app/tools/drawTools/vtoolcut.cpp @@ -28,6 +28,7 @@ #include "vtoolcut.h" #include "../../geometry/vpointf.h" +#include "../../container/vformula.h" //--------------------------------------------------------------------------------------------------------------------- VToolCut::VToolCut(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, @@ -84,6 +85,42 @@ void VToolCut::HoverPath(quint32 id, SimpleCurvePoint curvePosition, PathDirecti } } +//--------------------------------------------------------------------------------------------------------------------- +quint32 VToolCut::getCurveCutId() const +{ + return curveCutId; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolCut::setCurveCutId(const quint32 &value) +{ + if (value != NULL_ID) + { + curveCutId = value; + QSharedPointer obj = VAbstractTool::data.GetGObject(id); + SaveOption(obj); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +VFormula VToolCut::getFormula() const +{ + VFormula val(formula, getData()); + val.setCheckZero(true); + val.setToolId(id); + val.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit())); + return val; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolCut::setFormula(const VFormula &value) +{ + if (value.error() == false) + { + formula = value.getFormula(FormulaType::FromUser); + } +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief RefreshGeometry refresh item on scene. diff --git a/src/app/tools/drawTools/vtoolcut.h b/src/app/tools/drawTools/vtoolcut.h index 838b58fed..f99e82847 100644 --- a/src/app/tools/drawTools/vtoolcut.h +++ b/src/app/tools/drawTools/vtoolcut.h @@ -32,6 +32,8 @@ #include "vtoolpoint.h" #include "../../visualization/vsimplecurve.h" +class VFormula; + class VToolCut : public VToolPoint { Q_OBJECT @@ -40,6 +42,13 @@ public: const quint32 &curve1id, const quint32 &curve2id, QGraphicsItem * parent = nullptr); virtual int type() const {return Type;} enum { Type = UserType + static_cast(Tool::Cut)}; + + VFormula getFormula() const; + void setFormula(const VFormula &value); + + quint32 getCurveCutId() const; + void setCurveCutId(const quint32 &value); + public slots: virtual void ChangedActivDraw(const QString &newName); virtual void CurveChoosed(quint32 id)=0;