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 "../../container/calculator.h"
#include "../../dialogs/tools/dialogpointofcontact.h" #include "../../dialogs/tools/dialogpointofcontact.h"
#include "../../geometry/vpointf.h" #include "../../geometry/vpointf.h"
#include "../../container/vformula.h"
const QString VToolPointOfContact::ToolType = QStringLiteral("pointOfContact"); 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, AttrFirstPoint, firstPointId);
doc->SetAttribute(tag, AttrSecondPoint, secondPointId); 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" #include "vtoolpoint.h"
class VFormula;
/** /**
* @brief The VToolPointOfContact class tool for creation point intersection line and arc. * @brief The VToolPointOfContact class tool for creation point intersection line and arc.
*/ */
@ -53,6 +55,19 @@ public:
static const QString ToolType; static const QString ToolType;
virtual int type() const {return Type;} virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::PointOfContact) }; 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: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void SetFactor(qreal factor); virtual void SetFactor(qreal factor);
@ -67,13 +82,13 @@ private:
QString arcRadius; QString arcRadius;
/** @brief center id center arc point. */ /** @brief center id center arc point. */
quint32 center; quint32 center;
/** @brief firstPointId id first line point. */ /** @brief firstPointId id first line point. */
quint32 firstPointId; quint32 firstPointId;
/** @brief secondPointId id second line point. */ /** @brief secondPointId id second line point. */
quint32 secondPointId; quint32 secondPointId;
}; };
#endif // VTOOLPOINTOFCONTACT_H #endif // VTOOLPOINTOFCONTACT_H