Setter and getter for options VToolPointOfContact.

--HG--
branch : feature
This commit is contained in:
dismine 2014-09-01 19:19:41 +03:00
parent 4a6a3f3cc9
commit bf79d8f0bd
2 changed files with 85 additions and 3 deletions

View File

@ -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<VGObject>
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<VGObject> 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<VGObject> obj = VAbstractTool::data.GetGObject(id);
SaveOption(obj);
}
}

View File

@ -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<int>(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);