Setter and getter for options VToolBisector.

--HG--
branch : feature
This commit is contained in:
dismine 2014-09-01 17:47:44 +03:00
parent 3d3282ae61
commit 162794c70b
5 changed files with 61 additions and 9 deletions

View File

@ -37,9 +37,11 @@
class QString;
static const quint32 null_id = 0;
#define SceneSize 50000
#define DefPointRadius 2.0//mm
#define NULL_ID 0//use this value for initialization variables that keeps id values. 0 mean uknown id value.
#define NULL_ID null_id//use this value for initialization variables that keeps id values. 0 mean uknown id value.
enum class SceneObject : char { Point, Line, Spline, Arc, SplinePath, Detail, Unknown };
enum class Tool : unsigned char

View File

@ -166,10 +166,13 @@ quint32 VToolAlongLine::getSecondPointId() const
//---------------------------------------------------------------------------------------------------------------------
void VToolAlongLine::setSecondPointId(const quint32 &value)
{
secondPointId = value;
if (value != NULL_ID)
{
secondPointId = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
SaveOption(obj);
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -184,12 +184,15 @@ quint32 VToolArc::getCenter() const
//---------------------------------------------------------------------------------------------------------------------
void VToolArc::setCenter(const quint32 &value)
{
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
QSharedPointer<VArc> arc = qSharedPointerDynamicCast<VArc>(obj);
if (value != NULL_ID)
{
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
QSharedPointer<VArc> arc = qSharedPointerDynamicCast<VArc>(obj);
QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(value);
arc->SetCenter(*point.data());
SaveOption(obj);
QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(value);
arc->SetCenter(*point.data());
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -309,3 +309,40 @@ void VToolBisector::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
doc->SetAttribute(tag, AttrSecondPoint, basePointId);
doc->SetAttribute(tag, AttrThirdPoint, thirdPointId);
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolBisector::getThirdPointId() const
{
return thirdPointId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolBisector::setThirdPointId(const quint32 &value)
{
if (value != NULL_ID)
{
thirdPointId = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolBisector::getFirstPointId() const
{
return firstPointId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolBisector::setFirstPointId(const quint32 &value)
{
if (value != NULL_ID)
{
firstPointId = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
SaveOption(obj);
}
}

View File

@ -55,6 +55,13 @@ public:
static const QString ToolType;
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::Bisector)};
quint32 getFirstPointId() const;
void setFirstPointId(const quint32 &value);
quint32 getThirdPointId() const;
void setThirdPointId(const quint32 &value);
public slots:
virtual void FullUpdateFromFile();
virtual void SetFactor(qreal factor);