Setter and getter for options VToolCut.

--HG--
branch : feature
This commit is contained in:
dismine 2014-09-01 18:07:21 +03:00
parent 162794c70b
commit 109b071134
2 changed files with 46 additions and 0 deletions

View File

@ -28,6 +28,7 @@
#include "vtoolcut.h" #include "vtoolcut.h"
#include "../../geometry/vpointf.h" #include "../../geometry/vpointf.h"
#include "../../container/vformula.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VToolCut::VToolCut(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, 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<VGObject> 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. * @brief RefreshGeometry refresh item on scene.

View File

@ -32,6 +32,8 @@
#include "vtoolpoint.h" #include "vtoolpoint.h"
#include "../../visualization/vsimplecurve.h" #include "../../visualization/vsimplecurve.h"
class VFormula;
class VToolCut : public VToolPoint class VToolCut : public VToolPoint
{ {
Q_OBJECT Q_OBJECT
@ -40,6 +42,13 @@ public:
const quint32 &curve1id, const quint32 &curve2id, QGraphicsItem * parent = nullptr); const quint32 &curve1id, const quint32 &curve2id, QGraphicsItem * parent = nullptr);
virtual int type() const {return Type;} virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::Cut)}; enum { Type = UserType + static_cast<int>(Tool::Cut)};
VFormula getFormula() const;
void setFormula(const VFormula &value);
quint32 getCurveCutId() const;
void setCurveCutId(const quint32 &value);
public slots: public slots:
virtual void ChangedActivDraw(const QString &newName); virtual void ChangedActivDraw(const QString &newName);
virtual void CurveChoosed(quint32 id)=0; virtual void CurveChoosed(quint32 id)=0;