diff --git a/src/app/tools/drawTools/vtoolpointofcontact.cpp b/src/app/tools/drawTools/vtoolpointofcontact.cpp index e81d5aaae..35780776d 100644 --- a/src/app/tools/drawTools/vtoolpointofcontact.cpp +++ b/src/app/tools/drawTools/vtoolpointofcontact.cpp @@ -30,6 +30,7 @@ #include "../../container/calculator.h" #include "../../dialogs/tools/dialogpointofcontact.h" #include "../../geometry/vpointf.h" +#include "../../container/vformula.h" const QString VToolPointOfContact::ToolType = QStringLiteral("pointOfContact"); @@ -304,3 +305,69 @@ void VToolPointOfContact::SaveOptions(QDomElement &tag, QSharedPointer doc->SetAttribute(tag, AttrFirstPoint, firstPointId); doc->SetAttribute(tag, AttrSecondPoint, secondPointId); } + +//--------------------------------------------------------------------------------------------------------------------- +quint32 VToolPointOfContact::getSecondPointId() const +{ + return secondPointId; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolPointOfContact::setSecondPointId(const quint32 &value) +{ + secondPointId = value; +} + +//--------------------------------------------------------------------------------------------------------------------- +quint32 VToolPointOfContact::getFirstPointId() const +{ + return firstPointId; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolPointOfContact::setFirstPointId(const quint32 &value) +{ + firstPointId = value; +} + +//--------------------------------------------------------------------------------------------------------------------- +quint32 VToolPointOfContact::getCenter() const +{ + return center; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolPointOfContact::setCenter(const quint32 &value) +{ + if (value != NULL_ID) + { + center = value; + + QSharedPointer obj = VAbstractTool::data.GetGObject(id); + SaveOption(obj); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +VFormula VToolPointOfContact::getArcRadius() const +{ + VFormula radius(arcRadius, this->getData()); + radius.setCheckZero(true); + radius.setToolId(id); + radius.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit())); + + return radius; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolPointOfContact::setArcRadius(const VFormula &value) +{ + if (value.error() == false) + { + arcRadius = value.getFormula(FormulaType::FromUser); + + QSharedPointer obj = VAbstractTool::data.GetGObject(id); + SaveOption(obj); + } +} + diff --git a/src/app/tools/drawTools/vtoolpointofcontact.h b/src/app/tools/drawTools/vtoolpointofcontact.h index cbbefba91..60c4924ef 100644 --- a/src/app/tools/drawTools/vtoolpointofcontact.h +++ b/src/app/tools/drawTools/vtoolpointofcontact.h @@ -31,6 +31,8 @@ #include "vtoolpoint.h" +class VFormula; + /** * @brief The VToolPointOfContact class tool for creation point intersection line and arc. */ @@ -53,6 +55,19 @@ public: static const QString ToolType; virtual int type() const {return Type;} enum { Type = UserType + static_cast(Tool::PointOfContact) }; + + VFormula getArcRadius() const; + void setArcRadius(const VFormula &value); + + quint32 getCenter() const; + void setCenter(const quint32 &value); + + quint32 getFirstPointId() const; + void setFirstPointId(const quint32 &value); + + quint32 getSecondPointId() const; + void setSecondPointId(const quint32 &value); + public slots: virtual void FullUpdateFromFile(); virtual void SetFactor(qreal factor); @@ -67,13 +82,13 @@ private: QString arcRadius; /** @brief center id center arc point. */ - quint32 center; + quint32 center; /** @brief firstPointId id first line point. */ - quint32 firstPointId; + quint32 firstPointId; /** @brief secondPointId id second line point. */ - quint32 secondPointId; + quint32 secondPointId; }; #endif // VTOOLPOINTOFCONTACT_H