Fix undo bug. Undocommand doesn't increment/decrement reference counters.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2017-10-17 19:35:39 +03:00
parent ca79c7ff93
commit f4c5ad7213
83 changed files with 443 additions and 1147 deletions

View File

@ -196,12 +196,16 @@ void VToolFlippingByAxis::SetVisualization()
}
//---------------------------------------------------------------------------------------------------------------------
void VToolFlippingByAxis::SaveDialog(QDomElement &domElement)
void VToolFlippingByAxis::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogFlippingByAxis> dialogTool = m_dialog.objectCast<DialogFlippingByAxis>();
SCASSERT(not dialogTool.isNull())
AddDependence(oldDependencies, m_originPointId);
AddDependence(newDependencies, dialogTool->GetOriginPointId());
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetOriginPointId()));
doc->SetAttribute(domElement, AttrAxisType, QString().setNum(static_cast<int>(dialogTool->GetAxisType())));
doc->SetAttribute(domElement, AttrSuffix, dialogTool->GetSuffix());
@ -247,4 +251,3 @@ VToolFlippingByAxis::VToolFlippingByAxis(const VToolFlippingByAxisInitData &init
InitOperatedObjects();
ToolCreation(initData.typeCreation);
}

View File

@ -70,7 +70,8 @@ protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void SetVisualization() Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual QString MakeToolTip() const Q_DECL_OVERRIDE;

View File

@ -181,12 +181,18 @@ void VToolFlippingByLine::SetVisualization()
}
//---------------------------------------------------------------------------------------------------------------------
void VToolFlippingByLine::SaveDialog(QDomElement &domElement)
void VToolFlippingByLine::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogFlippingByLine> dialogTool = m_dialog.objectCast<DialogFlippingByLine>();
SCASSERT(not dialogTool.isNull())
AddDependence(oldDependencies, m_firstLinePointId);
AddDependence(oldDependencies, m_secondLinePointId);
AddDependence(newDependencies, dialogTool->GetFirstLinePointId());
AddDependence(newDependencies, dialogTool->GetSecondLinePointId());
doc->SetAttribute(domElement, AttrP1Line, QString().setNum(dialogTool->GetFirstLinePointId()));
doc->SetAttribute(domElement, AttrP2Line, QString().setNum(dialogTool->GetSecondLinePointId()));
doc->SetAttribute(domElement, AttrSuffix, dialogTool->GetSuffix());

View File

@ -69,7 +69,8 @@ protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void SetVisualization() Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual QString MakeToolTip() const Q_DECL_OVERRIDE;

View File

@ -330,12 +330,15 @@ void VToolMove::SetVisualization()
}
//---------------------------------------------------------------------------------------------------------------------
void VToolMove::SaveDialog(QDomElement &domElement)
void VToolMove::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies, QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogMove> dialogTool = m_dialog.objectCast<DialogMove>();
SCASSERT(not dialogTool.isNull())
Q_UNUSED(oldDependencies);
Q_UNUSED(newDependencies)
doc->SetAttribute(domElement, AttrAngle, dialogTool->GetAngle());
QString length = dialogTool->GetLength();
doc->SetAttribute(domElement, AttrLength, length);

View File

@ -83,7 +83,8 @@ protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void SetVisualization() Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual QString MakeToolTip() const Q_DECL_OVERRIDE;

View File

@ -332,12 +332,16 @@ void VToolRotation::SetVisualization()
}
//---------------------------------------------------------------------------------------------------------------------
void VToolRotation::SaveDialog(QDomElement &domElement)
void VToolRotation::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogRotation> dialogTool = m_dialog.objectCast<DialogRotation>();
SCASSERT(not dialogTool.isNull())
AddDependence(oldDependencies, origPointId);
AddDependence(newDependencies, dialogTool->GetOrigPointId());
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetOrigPointId()));
doc->SetAttribute(domElement, AttrAngle, dialogTool->GetAngle());
doc->SetAttribute(domElement, AttrSuffix, dialogTool->GetSuffix());

View File

@ -82,7 +82,8 @@ protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void SetVisualization() Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual QString MakeToolTip() const Q_DECL_OVERRIDE;

View File

@ -47,6 +47,7 @@
#include "../vgeometry/vgobject.h"
#include "../vgeometry/vpointf.h"
#include "../vgeometry/vspline.h"
#include "../vgeometry/vabstractarc.h"
#include "../vpatterndb/vcontainer.h"
#include "../vwidgets/vcontrolpointspline.h"
#include "../../../visualization/line/visline.h"
@ -453,3 +454,18 @@ void VAbstractSpline::GroupVisibility(quint32 object, bool visible)
Q_UNUSED(object)
setVisible(visible);
}
// VToolAbstractArc
//---------------------------------------------------------------------------------------------------------------------
VToolAbstractArc::VToolAbstractArc(VAbstractPattern *doc, VContainer *data, quint32 id, QGraphicsItem *parent)
: VAbstractSpline(doc, data, id, parent)
{}
//---------------------------------------------------------------------------------------------------------------------
QString VToolAbstractArc::CenterPointName() const
{
QSharedPointer<VAbstractArc> arc = VAbstractTool::data.GeometricObject<VAbstractArc>(m_id);
SCASSERT(arc.isNull() == false)
return VAbstractTool::data.GetGObject(arc->GetCenter().id())->name();
}

View File

@ -238,4 +238,15 @@ void VAbstractSpline::InitElArcToolConnections(VMainGraphicsScene *scene, T *too
QObject::connect(scene, &VMainGraphicsScene::EnableElArcItemSelection, tool, &T::AllowSelecting);
}
class VToolAbstractArc:public VAbstractSpline
{
public:
VToolAbstractArc(VAbstractPattern *doc, VContainer *data, quint32 id, QGraphicsItem *parent = nullptr);
virtual ~VToolAbstractArc() = default;
QString CenterPointName() const;
private:
Q_DISABLE_COPY(VToolAbstractArc)
};
#endif // VABSTRACTSPLINE_H

View File

@ -64,7 +64,7 @@ const QString VToolArc::ToolType = QStringLiteral("simple");
* @param initData init data
*/
VToolArc::VToolArc(const VToolArcInitData &initData, QGraphicsItem *parent)
: VAbstractSpline(initData.doc, initData.data, initData.id, parent)
: VToolAbstractArc(initData.doc, initData.data, initData.id, parent)
{
sceneType = SceneObject::Arc;
@ -183,35 +183,6 @@ QString VToolArc::getTagName() const
return VAbstractPattern::TagArc;
}
//---------------------------------------------------------------------------------------------------------------------
QString VToolArc::CenterPointName() const
{
return VAbstractTool::data.GetGObject(getCenter())->name();
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolArc::getCenter() const
{
QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(m_id);
SCASSERT(arc.isNull() == false)
return arc->GetCenter().id();
}
//---------------------------------------------------------------------------------------------------------------------
void VToolArc::setCenter(const quint32 &value)
{
if (value != NULL_ID)
{
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
QSharedPointer<VArc> arc = qSharedPointerDynamicCast<VArc>(obj);
QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(value);
arc->SetCenter(*point.data());
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
VFormula VToolArc::GetFormulaRadius() const
{
@ -350,11 +321,17 @@ void VToolArc::RemoveReferens()
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolArc::SaveDialog(QDomElement &domElement)
void VToolArc::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies, QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogArc> dialogTool = m_dialog.objectCast<DialogArc>();
SCASSERT(not dialogTool.isNull())
QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(m_id);
SCASSERT(arc.isNull() == false)
AddDependence(oldDependencies, arc->GetCenter().id());
AddDependence(newDependencies, dialogTool->GetCenter());
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetCenter()));
doc->SetAttribute(domElement, AttrRadius, dialogTool->GetRadius());
doc->SetAttribute(domElement, AttrAngle1, dialogTool->GetF1());

View File

@ -62,7 +62,7 @@ struct VToolArcInitData : VAbstractSplineInitData
/**
* @brief The VToolArc class tool for creation arc.
*/
class VToolArc :public VAbstractSpline
class VToolArc :public VToolAbstractArc
{
Q_OBJECT
public:
@ -76,11 +76,6 @@ public:
enum { Type = UserType + static_cast<int>(Tool::Arc)};
virtual QString getTagName() const Q_DECL_OVERRIDE;
QString CenterPointName() const;
quint32 getCenter() const;
void setCenter(const quint32 &value);
VFormula GetFormulaRadius() const;
void SetFormulaRadius(const VFormula &value);
@ -98,7 +93,8 @@ protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void RemoveReferens() Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;
virtual QString MakeToolTip() const Q_DECL_OVERRIDE;
@ -106,6 +102,7 @@ private:
Q_DISABLE_COPY(VToolArc)
VToolArc(const VToolArcInitData &initData, QGraphicsItem * parent = nullptr);
virtual ~VToolArc()=default;
};
#endif // VTOOLARC_H

View File

@ -60,7 +60,7 @@ const QString VToolArcWithLength::ToolType = QStringLiteral("arcWithLength");
//---------------------------------------------------------------------------------------------------------------------
VToolArcWithLength::VToolArcWithLength(const VToolArcWithLengthInitData &initData, QGraphicsItem *parent)
:VAbstractSpline(initData.doc, initData.data, initData.id, parent)
:VToolAbstractArc(initData.doc, initData.data, initData.id, parent)
{
sceneType = SceneObject::Arc;
@ -163,35 +163,6 @@ QString VToolArcWithLength::getTagName() const
return VAbstractPattern::TagArc;
}
//---------------------------------------------------------------------------------------------------------------------
QString VToolArcWithLength::CenterPointName() const
{
return VAbstractTool::data.GetGObject(getCenter())->name();
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolArcWithLength::getCenter() const
{
QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(m_id);
SCASSERT(arc.isNull() == false)
return arc->GetCenter().id();
}
//---------------------------------------------------------------------------------------------------------------------
void VToolArcWithLength::setCenter(const quint32 &value)
{
if (value != NULL_ID)
{
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
QSharedPointer<VArc> arc = qSharedPointerDynamicCast<VArc>(obj);
QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(value);
arc->SetCenter(*point.data());
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
VFormula VToolArcWithLength::GetFormulaRadius() const
{
@ -321,11 +292,18 @@ void VToolArcWithLength::RemoveReferens()
}
//---------------------------------------------------------------------------------------------------------------------
void VToolArcWithLength::SaveDialog(QDomElement &domElement)
void VToolArcWithLength::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogArcWithLength> dialogTool = m_dialog.objectCast<DialogArcWithLength>();
SCASSERT(not dialogTool.isNull())
QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(m_id);
SCASSERT(arc.isNull() == false)
AddDependence(oldDependencies, arc->GetCenter().id());
AddDependence(newDependencies, dialogTool->GetCenter());
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetCenter()));
doc->SetAttribute(domElement, AttrRadius, dialogTool->GetRadius());
doc->SetAttribute(domElement, AttrAngle1, dialogTool->GetF1());

View File

@ -59,7 +59,7 @@ struct VToolArcWithLengthInitData : VAbstractSplineInitData
QString length;
};
class VToolArcWithLength : public VAbstractSpline
class VToolArcWithLength : public VToolAbstractArc
{
Q_OBJECT
public:
@ -73,11 +73,6 @@ public:
enum { Type = UserType + static_cast<int>(Tool::ArcWithLength)};
virtual QString getTagName() const Q_DECL_OVERRIDE;
QString CenterPointName() const;
quint32 getCenter() const;
void setCenter(const quint32 &value);
VFormula GetFormulaRadius() const;
void SetFormulaRadius(const VFormula &value);
@ -95,7 +90,8 @@ protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void RemoveReferens() Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;
virtual QString MakeToolTip() const Q_DECL_OVERRIDE;
@ -103,6 +99,7 @@ private:
Q_DISABLE_COPY(VToolArcWithLength)
VToolArcWithLength(const VToolArcWithLengthInitData &initData, QGraphicsItem *parent = nullptr);
virtual ~VToolArcWithLength()=default;
};
#endif // VTOOLARCWITHLENGTH_H

View File

@ -212,13 +212,24 @@ void VToolCubicBezier::RemoveReferens()
}
//---------------------------------------------------------------------------------------------------------------------
void VToolCubicBezier::SaveDialog(QDomElement &domElement)
void VToolCubicBezier::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
auto dialogTool = qobject_cast<DialogCubicBezier*>(m_dialog);
SCASSERT(dialogTool != nullptr)
const auto oldSpl = VAbstractTool::data.GeometricObject<VCubicBezier>(m_id);
AddDependence(oldDependencies, oldSpl->GetP1().id());
AddDependence(oldDependencies, oldSpl->GetP2().id());
AddDependence(oldDependencies, oldSpl->GetP3().id());
AddDependence(oldDependencies, oldSpl->GetP4().id());
const VCubicBezier spl = dialogTool->GetSpline();
AddDependence(newDependencies, spl.GetP1().id());
AddDependence(newDependencies, spl.GetP2().id());
AddDependence(newDependencies, spl.GetP3().id());
AddDependence(newDependencies, spl.GetP4().id());
SetSplineAttributes(domElement, spl);
}

View File

@ -84,7 +84,8 @@ protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void RemoveReferens() Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;
virtual void RefreshGeometry() Q_DECL_OVERRIDE;

View File

@ -191,20 +191,33 @@ void VToolCubicBezierPath::ShowContextMenu(QGraphicsSceneContextMenuEvent *event
void VToolCubicBezierPath::RemoveReferens()
{
const QSharedPointer<VCubicBezierPath> splPath = VAbstractTool::data.GeometricObject<VCubicBezierPath>(m_id);
for (qint32 i = 0; i < splPath->CountSubSpl(); ++i)
for (qint32 i = 0; i < splPath->CountPoints(); ++i)
{
doc->DecrementReferens(splPath->at(i).getIdTool());
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolCubicBezierPath::SaveDialog(QDomElement &domElement)
void VToolCubicBezierPath::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
const auto dialogTool = qobject_cast<DialogCubicBezierPath*>(m_dialog);
SCASSERT(dialogTool != nullptr)
SetSplinePathAttributes(domElement, dialogTool->GetPath());
const auto oldSplPath = VAbstractTool::data.GeometricObject<VCubicBezierPath>(m_id);
for (qint32 i = 0; i < oldSplPath->CountPoints(); ++i)
{
AddDependence(oldDependencies, oldSplPath->at(i).id());
}
const VCubicBezierPath splPath = dialogTool->GetPath();
for (qint32 i = 0; i < splPath.CountPoints(); ++i)
{
AddDependence(newDependencies, splPath.at(i).id());
}
SetSplinePathAttributes(domElement, splPath);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -81,7 +81,8 @@ protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void RemoveReferens() Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;
virtual void RefreshGeometry() Q_DECL_OVERRIDE;

View File

@ -65,7 +65,7 @@ const QString VToolEllipticalArc::ToolType = QStringLiteral("simple");
* @param parent parent object
*/
VToolEllipticalArc::VToolEllipticalArc(const VToolEllipticalArcInitData &initData, QGraphicsItem *parent)
:VAbstractSpline(initData.doc, initData.data, initData.id, parent)
:VToolAbstractArc(initData.doc, initData.data, initData.id, parent)
{
sceneType = SceneObject::ElArc;
@ -190,35 +190,6 @@ QString VToolEllipticalArc::getTagName() const
return VAbstractPattern::TagElArc;
}
//---------------------------------------------------------------------------------------------------------------------
QString VToolEllipticalArc::CenterPointName() const
{
return VAbstractTool::data.GetGObject(getCenter())->name();
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolEllipticalArc::getCenter() const
{
QSharedPointer<VEllipticalArc> elArc = VAbstractTool::data.GeometricObject<VEllipticalArc>(m_id);
SCASSERT(elArc.isNull() == false)
return elArc->GetCenter().id();
}
//---------------------------------------------------------------------------------------------------------------------
void VToolEllipticalArc::setCenter(const quint32 &value)
{
if (value != NULL_ID)
{
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
QSharedPointer<VEllipticalArc> elArc = qSharedPointerDynamicCast<VEllipticalArc>(obj);
QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(value);
elArc->SetCenter(*point.data());
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
VFormula VToolEllipticalArc::GetFormulaRadius1() const
{
@ -392,11 +363,18 @@ void VToolEllipticalArc::RemoveReferens()
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolEllipticalArc::SaveDialog(QDomElement &domElement)
void VToolEllipticalArc::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogEllipticalArc> dialogTool = m_dialog.objectCast<DialogEllipticalArc>();
SCASSERT(not dialogTool.isNull())
const auto elArc = VAbstractTool::data.GeometricObject<VEllipticalArc>(m_id);
SCASSERT(elArc.isNull() == false)
AddDependence(oldDependencies, elArc->GetCenter().id());
AddDependence(newDependencies, dialogTool->GetCenter());
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetCenter()));
doc->SetAttribute(domElement, AttrRadius1, dialogTool->GetRadius1());
doc->SetAttribute(domElement, AttrRadius2, dialogTool->GetRadius2());

View File

@ -66,7 +66,7 @@ struct VToolEllipticalArcInitData : VAbstractSplineInitData
/**
* @brief The VToolEllipticalArc class tool for creation elliptical arc.
*/
class VToolEllipticalArc : public VAbstractSpline
class VToolEllipticalArc : public VToolAbstractArc
{
Q_OBJECT
public:
@ -79,11 +79,6 @@ public:
enum { Type = UserType + static_cast<int>(Tool::EllipticalArc)};
virtual QString getTagName() const Q_DECL_OVERRIDE;
QString CenterPointName() const;
quint32 getCenter() const;
void setCenter(const quint32 &value);
VFormula GetFormulaRadius1() const;
void SetFormulaRadius1(const VFormula &value);
@ -104,7 +99,8 @@ protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void RemoveReferens() Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;
virtual QString MakeToolTip() const Q_DECL_OVERRIDE;
@ -112,6 +108,7 @@ protected:
private:
Q_DISABLE_COPY(VToolEllipticalArc)
VToolEllipticalArc(const VToolEllipticalArcInitData &initData, QGraphicsItem *parent = nullptr);
virtual ~VToolEllipticalArc()=default;
};
#endif // VTOOLELLIPTICALARC_H

View File

@ -313,13 +313,19 @@ void VToolSpline::RemoveReferens()
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolSpline::SaveDialog(QDomElement &domElement)
void VToolSpline::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies, QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
auto dialogTool = qobject_cast<DialogSpline*>(m_dialog);
SCASSERT(dialogTool != nullptr)
const auto oldSpl = VAbstractTool::data.GeometricObject<VSpline>(m_id);
AddDependence(oldDependencies, oldSpl->GetP1().id());
AddDependence(oldDependencies, oldSpl->GetP4().id());
const VSpline spl = dialogTool->GetSpline();
AddDependence(newDependencies, spl.GetP1().id());
AddDependence(newDependencies, spl.GetP4().id());
controlPoints[0]->blockSignals(true);
controlPoints[1]->blockSignals(true);

View File

@ -97,7 +97,8 @@ protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void RemoveReferens() Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void mousePressEvent(QGraphicsSceneMouseEvent * event) Q_DECL_OVERRIDE;
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;

View File

@ -447,7 +447,7 @@ void VToolSplinePath::AddPathPoint(VAbstractPattern *doc, QDomElement &domElemen
void VToolSplinePath::RemoveReferens()
{
const QSharedPointer<VSplinePath> splPath = VAbstractTool::data.GeometricObject<VSplinePath>(m_id);
for (qint32 i = 0; i < splPath->CountSubSpl(); ++i)
for (qint32 i = 0; i < splPath->CountPoints(); ++i)
{
doc->DecrementReferens(splPath->at(i).P().getIdTool());
}
@ -457,13 +457,25 @@ void VToolSplinePath::RemoveReferens()
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolSplinePath::SaveDialog(QDomElement &domElement)
void VToolSplinePath::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogSplinePath> dialogTool = m_dialog.objectCast<DialogSplinePath>();
SCASSERT(not dialogTool.isNull())
const auto oldSplPath = VAbstractTool::data.GeometricObject<VSplinePath>(m_id);
for (qint32 i = 0; i < oldSplPath->CountPoints(); ++i)
{
AddDependence(oldDependencies, oldSplPath->at(i).P().id());
}
const VSplinePath splPath = dialogTool->GetPath();
for (qint32 i = 0; i < splPath.CountPoints(); ++i)
{
AddDependence(newDependencies, splPath.at(i).P().id());
}
for (qint32 i = 1; i <= splPath.CountSubSpl(); ++i)
{
VSpline spl = splPath.GetSpline(i);

View File

@ -108,7 +108,8 @@ protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void RemoveReferens() Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void mousePressEvent(QGraphicsSceneMouseEvent * event) Q_DECL_OVERRIDE;
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;

View File

@ -229,96 +229,6 @@ QString VToolTrueDarts::DartP3Name() const
return VAbstractTool::data.GetGObject(dartP3Id)->name();
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolTrueDarts::GetBaseLineP1Id() const
{
return baseLineP1Id;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolTrueDarts::SetBaseLineP1Id(const quint32 &value)
{
if (value != NULL_ID)
{
baseLineP1Id = value;
QSharedPointer<VGObject> obj = VContainer::GetFakeGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolTrueDarts::GetBaseLineP2Id() const
{
return baseLineP2Id;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolTrueDarts::SetBaseLineP2Id(const quint32 &value)
{
if (value != NULL_ID)
{
baseLineP2Id = value;
QSharedPointer<VGObject> obj = VContainer::GetFakeGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolTrueDarts::GetDartP1Id() const
{
return dartP1Id;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolTrueDarts::SetDartP1Id(const quint32 &value)
{
if (value != NULL_ID)
{
dartP1Id = value;
QSharedPointer<VGObject> obj = VContainer::GetFakeGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolTrueDarts::GetDartP2Id() const
{
return dartP2Id;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolTrueDarts::SetDartP2Id(const quint32 &value)
{
if (value != NULL_ID)
{
dartP2Id = value;
QSharedPointer<VGObject> obj = VContainer::GetFakeGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolTrueDarts::GetDartP3Id() const
{
return dartP3Id;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolTrueDarts::SetDartP3Id(const quint32 &value)
{
if (value != NULL_ID)
{
dartP3Id = value;
QSharedPointer<VGObject> obj = VContainer::GetFakeGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolTrueDarts::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
{
@ -351,12 +261,25 @@ void VToolTrueDarts::RemoveReferens()
}
//---------------------------------------------------------------------------------------------------------------------
void VToolTrueDarts::SaveDialog(QDomElement &domElement)
void VToolTrueDarts::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogTrueDarts> dialogTool = m_dialog.objectCast<DialogTrueDarts>();
SCASSERT(not dialogTool.isNull())
AddDependence(oldDependencies, baseLineP1Id);
AddDependence(oldDependencies, baseLineP2Id);
AddDependence(oldDependencies, dartP1Id);
AddDependence(oldDependencies, dartP2Id);
AddDependence(oldDependencies, dartP3Id);
AddDependence(newDependencies, dialogTool->GetFirstBasePointId());
AddDependence(newDependencies, dialogTool->GetSecondBasePointId());
AddDependence(newDependencies, dialogTool->GetFirstDartPointId());
AddDependence(newDependencies, dialogTool->GetSecondDartPointId());
AddDependence(newDependencies, dialogTool->GetThirdDartPointId());
doc->SetAttribute(domElement, AttrName1, dialogTool->GetFirstNewDartPointName());
doc->SetAttribute(domElement, AttrName2, dialogTool->GetSecondNewDartPointName());
doc->SetAttribute(domElement, AttrBaseLineP1, QString().setNum(dialogTool->GetFirstBasePointId()));

View File

@ -104,26 +104,12 @@ public:
QString DartP2Name() const;
QString DartP3Name() const;
quint32 GetBaseLineP1Id() const;
void SetBaseLineP1Id(const quint32 &value);
quint32 GetBaseLineP2Id() const;
void SetBaseLineP2Id(const quint32 &value);
quint32 GetDartP1Id() const;
void SetDartP1Id(const quint32 &value);
quint32 GetDartP2Id() const;
void SetDartP2Id(const quint32 &value);
quint32 GetDartP3Id() const;
void SetDartP3Id(const quint32 &value);
protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void RemoveReferens() Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;

View File

@ -74,25 +74,6 @@ void VToolCut::FullUpdateFromFile()
SetVisualization();
}
//---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress unusedFunction
quint32 VToolCut::getCurveCutId() const
{
return curveCutId;
}
//---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress unusedFunction
void VToolCut::setCurveCutId(const quint32 &value)
{
if (value != NULL_ID)
{
curveCutId = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
VFormula VToolCut::GetFormula() const
{

View File

@ -59,9 +59,6 @@ public:
QString CurveName() const;
quint32 getCurveCutId() const;
void setCurveCutId(const quint32 &value);
public slots:
virtual void Disable(bool disable, const QString &namePP) Q_DECL_OVERRIDE;
virtual void DetailsMode(bool mode) Q_DECL_OVERRIDE;

View File

@ -195,11 +195,16 @@ void VToolCutArc::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolCutArc::SaveDialog(QDomElement &domElement)
void VToolCutArc::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogCutArc> dialogTool = m_dialog.objectCast<DialogCutArc>();
SCASSERT(not dialogTool.isNull())
AddDependence(oldDependencies, curveCutId);
AddDependence(newDependencies, dialogTool->getArcId());
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrLength, dialogTool->GetFormula());
doc->SetAttribute(domElement, AttrArc, QString().setNum(dialogTool->getArcId()));

View File

@ -73,7 +73,8 @@ public:
protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;

View File

@ -194,11 +194,16 @@ void VToolCutSpline::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quin
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolCutSpline::SaveDialog(QDomElement &domElement)
void VToolCutSpline::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogCutSpline> dialogTool = m_dialog.objectCast<DialogCutSpline>();
SCASSERT(not dialogTool.isNull())
AddDependence(oldDependencies, curveCutId);
AddDependence(newDependencies, dialogTool->getSplineId());
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrLength, dialogTool->GetFormula());
doc->SetAttribute(domElement, AttrSpline, QString().setNum(dialogTool->getSplineId()));

View File

@ -74,7 +74,8 @@ public:
protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;

View File

@ -283,11 +283,16 @@ void VToolCutSplinePath::ShowContextMenu(QGraphicsSceneContextMenuEvent *event,
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolCutSplinePath::SaveDialog(QDomElement &domElement)
void VToolCutSplinePath::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogCutSplinePath> dialogTool = m_dialog.objectCast<DialogCutSplinePath>();
SCASSERT(not dialogTool.isNull())
AddDependence(oldDependencies, curveCutId);
AddDependence(newDependencies, dialogTool->getSplinePathId());
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrLength, dialogTool->GetFormula());
doc->SetAttribute(domElement, AttrSplinePath, QString().setNum(dialogTool->getSplinePathId()));

View File

@ -81,7 +81,8 @@ public:
protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;

View File

@ -87,11 +87,18 @@ void VToolAlongLine::RemoveReferens()
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolAlongLine::SaveDialog(QDomElement &domElement)
void VToolAlongLine::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogAlongLine> dialogTool = m_dialog.objectCast<DialogAlongLine>();
SCASSERT(not dialogTool.isNull())
AddDependence(oldDependencies, basePointId);
AddDependence(oldDependencies, secondPointId);
AddDependence(newDependencies, dialogTool->GetFirstPointId());
AddDependence(newDependencies, dialogTool->GetSecondPointId());
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine());
doc->SetAttribute(domElement, AttrLineColor, dialogTool->GetLineColor());
@ -166,24 +173,6 @@ QString VToolAlongLine::MakeToolTip() const
return toolTip;
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolAlongLine::GetSecondPointId() const
{
return secondPointId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolAlongLine::SetSecondPointId(const quint32 &value)
{
if (value != NULL_ID)
{
secondPointId = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolAlongLine::ShowVisualization(bool show)
{

View File

@ -74,14 +74,13 @@ public:
QString SecondPointName() const;
quint32 GetSecondPointId() const;
void SetSecondPointId(const quint32 &value);
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void RemoveReferens() Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;

View File

@ -240,11 +240,20 @@ void VToolBisector::RemoveReferens()
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolBisector::SaveDialog(QDomElement &domElement)
void VToolBisector::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogBisector> dialogTool = m_dialog.objectCast<DialogBisector>();
SCASSERT(not dialogTool.isNull())
AddDependence(oldDependencies, firstPointId);
AddDependence(oldDependencies, basePointId);
AddDependence(oldDependencies, thirdPointId);
AddDependence(newDependencies, dialogTool->GetFirstPointId());
AddDependence(newDependencies, dialogTool->GetSecondPointId());
AddDependence(newDependencies, dialogTool->GetThirdPointId());
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine());
doc->SetAttribute(domElement, AttrLineColor, dialogTool->GetLineColor());
@ -294,24 +303,6 @@ void VToolBisector::SetVisualization()
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolBisector::GetThirdPointId() const
{
return thirdPointId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolBisector::SetThirdPointId(const quint32 &value)
{
if (value != NULL_ID)
{
thirdPointId = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolBisector::ShowVisualization(bool show)
{
@ -331,21 +322,3 @@ void VToolBisector::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolBisector::GetFirstPointId() const
{
return firstPointId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolBisector::SetFirstPointId(const quint32 &value)
{
if (value != NULL_ID)
{
firstPointId = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}

View File

@ -81,18 +81,13 @@ public:
QString FirstPointName() const;
QString ThirdPointName() const;
quint32 GetFirstPointId() const;
void SetFirstPointId(const quint32 &value);
quint32 GetThirdPointId() const;
void SetThirdPointId(const quint32 &value);
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void RemoveReferens() Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;

View File

@ -237,24 +237,6 @@ QString VToolCurveIntersectAxis::CurveName() const
return VAbstractTool::data.GetGObject(curveId)->name();
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolCurveIntersectAxis::getCurveId() const
{
return curveId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolCurveIntersectAxis::setCurveId(const quint32 &value)
{
if (value != NULL_ID)
{
curveId = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolCurveIntersectAxis::ShowVisualization(bool show)
{
@ -276,11 +258,18 @@ void VToolCurveIntersectAxis::ShowContextMenu(QGraphicsSceneContextMenuEvent *ev
}
//---------------------------------------------------------------------------------------------------------------------
void VToolCurveIntersectAxis::SaveDialog(QDomElement &domElement)
void VToolCurveIntersectAxis::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogCurveIntersectAxis> dialogTool = m_dialog.objectCast<DialogCurveIntersectAxis>();
SCASSERT(not dialogTool.isNull())
AddDependence(oldDependencies, basePointId);
AddDependence(oldDependencies, curveId);
AddDependence(newDependencies, dialogTool->GetBasePointId());
AddDependence(newDependencies, dialogTool->getCurveId());
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine());
doc->SetAttribute(domElement, AttrLineColor, dialogTool->GetLineColor());

View File

@ -82,14 +82,12 @@ public:
QString CurveName() const;
quint32 getCurveId() const;
void setCurveId(const quint32 &value);
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;

View File

@ -174,11 +174,16 @@ VToolEndLine* VToolEndLine::Create(VToolEndLineInitData &initData)
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolEndLine::SaveDialog(QDomElement &domElement)
void VToolEndLine::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogEndLine> dialogTool = m_dialog.objectCast<DialogEndLine>();
SCASSERT(not dialogTool.isNull())
AddDependence(oldDependencies, basePointId);
AddDependence(newDependencies, dialogTool->GetBasePointId());
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine());
doc->SetAttribute(domElement, AttrLineColor, dialogTool->GetLineColor());

View File

@ -80,7 +80,8 @@ public:
protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;

View File

@ -201,11 +201,20 @@ QString VToolHeight::SecondLinePointName() const
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolHeight::SaveDialog(QDomElement &domElement)
void VToolHeight::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogHeight> dialogTool = m_dialog.objectCast<DialogHeight>();
SCASSERT(not dialogTool.isNull())
AddDependence(oldDependencies, basePointId);
AddDependence(oldDependencies, p1LineId);
AddDependence(oldDependencies, p2LineId);
AddDependence(newDependencies, dialogTool->GetBasePointId());
AddDependence(newDependencies, dialogTool->GetP1LineId());
AddDependence(newDependencies, dialogTool->GetP2LineId());
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine());
doc->SetAttribute(domElement, AttrLineColor, dialogTool->GetLineColor());
@ -284,24 +293,6 @@ QString VToolHeight::MakeToolTip() const
return toolTip;
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolHeight::GetP2LineId() const
{
return p2LineId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolHeight::SetP2LineId(const quint32 &value)
{
if (value != NULL_ID)
{
p2LineId = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolHeight::ShowVisualization(bool show)
{
@ -321,21 +312,3 @@ void VToolHeight::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolHeight::GetP1LineId() const
{
return p1LineId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolHeight::SetP1LineId(const quint32 &value)
{
if (value != NULL_ID)
{
p1LineId = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}

View File

@ -78,17 +78,12 @@ public:
QString FirstLinePointName() const;
QString SecondLinePointName() const;
quint32 GetP1LineId() const;
void SetP1LineId(const quint32 &value);
quint32 GetP2LineId() const;
void SetP2LineId(const quint32 &value);
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;

View File

@ -220,42 +220,6 @@ void VToolLineIntersectAxis::SetFormulaAngle(const VFormula &value)
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolLineIntersectAxis::GetFirstPointId() const
{
return firstPointId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersectAxis::SetFirstPointId(const quint32 &value)
{
if (value != NULL_ID)
{
firstPointId = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolLineIntersectAxis::GetSecondPointId() const
{
return secondPointId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersectAxis::SetSecondPointId(const quint32 &value)
{
if (value != NULL_ID)
{
secondPointId = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersectAxis::ShowVisualization(bool show)
{
@ -277,11 +241,20 @@ void VToolLineIntersectAxis::ShowContextMenu(QGraphicsSceneContextMenuEvent *eve
}
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersectAxis::SaveDialog(QDomElement &domElement)
void VToolLineIntersectAxis::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogLineIntersectAxis> dialogTool = m_dialog.objectCast<DialogLineIntersectAxis>();
SCASSERT(not dialogTool.isNull())
AddDependence(oldDependencies, basePointId);
AddDependence(oldDependencies, firstPointId);
AddDependence(oldDependencies, secondPointId);
AddDependence(newDependencies, dialogTool->GetBasePointId());
AddDependence(newDependencies, dialogTool->GetFirstPointId());
AddDependence(newDependencies, dialogTool->GetSecondPointId());
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine());
doc->SetAttribute(domElement, AttrLineColor, dialogTool->GetLineColor());

View File

@ -85,17 +85,12 @@ public:
VFormula GetFormulaAngle() const;
void SetFormulaAngle(const VFormula &value);
quint32 GetFirstPointId() const;
void SetFirstPointId(const quint32 &value);
quint32 GetSecondPointId() const;
void SetSecondPointId(const quint32 &value);
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;

View File

@ -213,24 +213,6 @@ void VToolLinePoint::SetLineColor(const QString &value)
SaveOption(obj);
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolLinePoint::GetBasePointId() const
{
return basePointId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolLinePoint::SetBasePointId(const quint32 &value)
{
if (value != NULL_ID)
{
basePointId = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
VFormula VToolLinePoint::GetFormulaLength() const
{

View File

@ -76,9 +76,6 @@ public:
QString BasePointName() const;
quint32 GetBasePointId() const;
void SetBasePointId(const quint32 &value);
qreal GetAngle() const;
void SetAngle(const qreal &value);

View File

@ -213,11 +213,18 @@ void VToolNormal::RemoveReferens()
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolNormal::SaveDialog(QDomElement &domElement)
void VToolNormal::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogNormal> dialogTool = m_dialog.objectCast<DialogNormal>();
SCASSERT(not dialogTool.isNull())
AddDependence(oldDependencies, basePointId);
AddDependence(oldDependencies, secondPointId);
AddDependence(newDependencies, dialogTool->GetFirstPointId());
AddDependence(newDependencies, dialogTool->GetSecondPointId());
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine());
doc->SetAttribute(domElement, AttrLineColor, dialogTool->GetLineColor());
@ -267,24 +274,6 @@ void VToolNormal::SetVisualization()
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolNormal::GetSecondPointId() const
{
return secondPointId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolNormal::SetSecondPointId(const quint32 &value)
{
if (value != NULL_ID)
{
secondPointId = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolNormal::ShowVisualization(bool show)
{

View File

@ -79,15 +79,13 @@ public:
QString SecondPointName() const;
quint32 GetSecondPointId() const;
void SetSecondPointId(const quint32 &value);
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void RemoveReferens() Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;

View File

@ -258,11 +258,20 @@ void VToolShoulderPoint::RemoveReferens()
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolShoulderPoint::SaveDialog(QDomElement &domElement)
void VToolShoulderPoint::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogShoulderPoint> dialogTool = m_dialog.objectCast<DialogShoulderPoint>();
SCASSERT(not dialogTool.isNull())
AddDependence(oldDependencies, basePointId);
AddDependence(oldDependencies, p2Line);
AddDependence(oldDependencies, pShoulder);
AddDependence(newDependencies, dialogTool->GetP1Line());
AddDependence(newDependencies, dialogTool->GetP2Line());
AddDependence(newDependencies, dialogTool->GetP3());
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine());
doc->SetAttribute(domElement, AttrLineColor, dialogTool->GetLineColor());
@ -354,46 +363,8 @@ void VToolShoulderPoint::ShowContextMenu(QGraphicsSceneContextMenuEvent *event,
}
}
//---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress unusedFunction
quint32 VToolShoulderPoint::getPShoulder() const
{
return pShoulder;
}
//---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress unusedFunction
void VToolShoulderPoint::setPShoulder(const quint32 &value)
{
if (value != NULL_ID)
{
pShoulder = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolShoulderPoint::ShowVisualization(bool show)
{
ShowToolVisualization<VisToolShoulderPoint>(show);
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolShoulderPoint::GetP2Line() const
{
return p2Line;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolShoulderPoint::SetP2Line(const quint32 &value)
{
if (value != NULL_ID)
{
p2Line = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}

View File

@ -90,7 +90,8 @@ public:
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
protected:
virtual void RemoveReferens() Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;

View File

@ -285,11 +285,16 @@ void VToolBasePoint::DeleteToolWithConfirm(bool ask)
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolBasePoint::SaveDialog(QDomElement &domElement)
void VToolBasePoint::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogSinglePoint> dialogTool = m_dialog.objectCast<DialogSinglePoint>();
SCASSERT(not dialogTool.isNull())
Q_UNUSED(oldDependencies)
Q_UNUSED(newDependencies)
const QPointF p = dialogTool->GetPoint();
const QString name = dialogTool->getPointName();
doc->SetAttribute(domElement, AttrName, name);

View File

@ -90,7 +90,8 @@ protected:
virtual void AddToFile() Q_DECL_OVERRIDE;
virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value ) Q_DECL_OVERRIDE;
virtual void DeleteToolWithConfirm(bool ask = true) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
virtual void mousePressEvent( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;

View File

@ -229,11 +229,22 @@ void VToolLineIntersect::RemoveReferens()
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolLineIntersect::SaveDialog(QDomElement &domElement)
void VToolLineIntersect::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogLineIntersect> dialogTool = m_dialog.objectCast<DialogLineIntersect>();
SCASSERT(not dialogTool.isNull())
AddDependence(oldDependencies, p1Line1);
AddDependence(oldDependencies, p2Line1);
AddDependence(oldDependencies, p1Line2);
AddDependence(oldDependencies, p2Line2);
AddDependence(newDependencies, dialogTool->GetP1Line1());
AddDependence(newDependencies, dialogTool->GetP2Line1());
AddDependence(newDependencies, dialogTool->GetP1Line2());
AddDependence(newDependencies, dialogTool->GetP2Line2());
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrP1Line1, QString().setNum(dialogTool->GetP1Line1()));
doc->SetAttribute(domElement, AttrP2Line1, QString().setNum(dialogTool->GetP2Line1()));
@ -313,24 +324,6 @@ QString VToolLineIntersect::MakeToolTip() const
return toolTip;
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolLineIntersect::GetP2Line2() const
{
return p2Line2;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersect::SetP2Line2(const quint32 &value)
{
if (value != NULL_ID)
{
p2Line2 = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersect::ShowVisualization(bool show)
{
@ -350,57 +343,3 @@ void VToolLineIntersect::ShowContextMenu(QGraphicsSceneContextMenuEvent *event,
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolLineIntersect::GetP1Line2() const
{
return p1Line2;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersect::SetP1Line2(const quint32 &value)
{
if (value != NULL_ID)
{
p1Line2 = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolLineIntersect::GetP2Line1() const
{
return p2Line1;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersect::SetP2Line1(const quint32 &value)
{
if (value != NULL_ID)
{
p2Line1 = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolLineIntersect::GetP1Line1() const
{
return p1Line1;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersect::SetP1Line1(const quint32 &value)
{
if (value != NULL_ID)
{
p1Line1 = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}

View File

@ -79,24 +79,13 @@ public:
QString Line2P1Name() const;
QString Line2P2Name() const;
quint32 GetP1Line1() const;
void SetP1Line1(const quint32 &value);
quint32 GetP2Line1() const;
void SetP2Line1(const quint32 &value);
quint32 GetP1Line2() const;
void SetP1Line2(const quint32 &value);
quint32 GetP2Line2() const;
void SetP2Line2(const quint32 &value);
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void RemoveReferens() Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;

View File

@ -233,42 +233,6 @@ QString VToolPointFromArcAndTangent::ArcName() const
return VAbstractTool::data.GetGObject(arcId)->name();
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolPointFromArcAndTangent::GetTangentPointId() const
{
return tangentPointId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointFromArcAndTangent::SetTangentPointId(const quint32 &value)
{
if (value != NULL_ID)
{
tangentPointId = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolPointFromArcAndTangent::GetArcId() const
{
return arcId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointFromArcAndTangent::SetArcId(const quint32 &value)
{
if (value != NULL_ID)
{
arcId = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
CrossCirclesPoint VToolPointFromArcAndTangent::GetCrossCirclesPoint() const
{
@ -315,11 +279,18 @@ void VToolPointFromArcAndTangent::RemoveReferens()
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointFromArcAndTangent::SaveDialog(QDomElement &domElement)
void VToolPointFromArcAndTangent::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogPointFromArcAndTangent> dialogTool = m_dialog.objectCast<DialogPointFromArcAndTangent>();
SCASSERT(not dialogTool.isNull())
AddDependence(oldDependencies, arcId);
AddDependence(oldDependencies, tangentPointId);
AddDependence(newDependencies, dialogTool->GetArcId());
AddDependence(newDependencies, dialogTool->GetTangentPointId());
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrArc, QString().setNum(dialogTool->GetArcId()));
doc->SetAttribute(domElement, AttrTangent, QString().setNum(dialogTool->GetTangentPointId()));

View File

@ -74,12 +74,6 @@ public:
QString TangentPointName() const;
QString ArcName() const;
quint32 GetTangentPointId() const;
void SetTangentPointId(const quint32 &value);
quint32 GetArcId() const;
void SetArcId(const quint32 &value);
CrossCirclesPoint GetCrossCirclesPoint() const;
void SetCrossCirclesPoint(const CrossCirclesPoint &value);
@ -88,7 +82,8 @@ protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void RemoveReferens() Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;

View File

@ -190,42 +190,6 @@ QString VToolPointFromCircleAndTangent::CircleCenterPointName() const
return VAbstractTool::data.GetGObject(circleCenterId)->name();
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolPointFromCircleAndTangent::GetTangentPointId() const
{
return tangentPointId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointFromCircleAndTangent::SetTangentPointId(const quint32 &value)
{
if (value != NULL_ID)
{
tangentPointId = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolPointFromCircleAndTangent::GetCircleCenterId() const
{
return circleCenterId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointFromCircleAndTangent::SetCircleCenterId(const quint32 &value)
{
if (value != NULL_ID)
{
circleCenterId = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
VFormula VToolPointFromCircleAndTangent::GetCircleRadius() const
{
@ -296,11 +260,18 @@ void VToolPointFromCircleAndTangent::RemoveReferens()
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointFromCircleAndTangent::SaveDialog(QDomElement &domElement)
void VToolPointFromCircleAndTangent::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogPointFromCircleAndTangent> dialogTool = m_dialog.objectCast<DialogPointFromCircleAndTangent>();
SCASSERT(not dialogTool.isNull())
AddDependence(oldDependencies, circleCenterId);
AddDependence(oldDependencies, tangentPointId);
AddDependence(newDependencies, dialogTool->GetTangentPointId());
AddDependence(newDependencies, dialogTool->GetCircleCenterId());
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrCCenter, QString().setNum(dialogTool->GetCircleCenterId()));
doc->SetAttribute(domElement, AttrTangent, QString().setNum(dialogTool->GetTangentPointId()));

View File

@ -77,12 +77,6 @@ public:
QString TangentPointName() const;
QString CircleCenterPointName() const;
quint32 GetTangentPointId() const;
void SetTangentPointId(const quint32 &value);
quint32 GetCircleCenterId() const;
void SetCircleCenterId(const quint32 &value);
VFormula GetCircleRadius() const;
void SetCircleRadius(const VFormula &value);
@ -94,7 +88,8 @@ protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void RemoveReferens() Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;

View File

@ -274,11 +274,20 @@ void VToolPointOfContact::RemoveReferens()
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolPointOfContact::SaveDialog(QDomElement &domElement)
void VToolPointOfContact::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogPointOfContact> dialogTool = m_dialog.objectCast<DialogPointOfContact>();
SCASSERT(not dialogTool.isNull())
AddDependence(oldDependencies, center);
AddDependence(oldDependencies, firstPointId);
AddDependence(oldDependencies, secondPointId);
AddDependence(newDependencies, dialogTool->getCenter());
AddDependence(newDependencies, dialogTool->GetFirstPoint());
AddDependence(newDependencies, dialogTool->GetSecondPoint());
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrRadius, dialogTool->getRadius());
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->getCenter()));
@ -356,18 +365,6 @@ QString VToolPointOfContact::MakeToolTip() const
return toolTip;
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolPointOfContact::GetSecondPointId() const
{
return secondPointId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfContact::SetSecondPointId(const quint32 &value)
{
secondPointId = value;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfContact::ShowVisualization(bool show)
{
@ -388,36 +385,6 @@ void VToolPointOfContact::ShowContextMenu(QGraphicsSceneContextMenuEvent *event,
}
}
//---------------------------------------------------------------------------------------------------------------------
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(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
VFormula VToolPointOfContact::getArcRadius() const
{

View File

@ -85,21 +85,13 @@ public:
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);
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void RemoveReferens() Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;

View File

@ -189,11 +189,18 @@ void VToolPointOfIntersection::RemoveReferens()
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolPointOfIntersection::SaveDialog(QDomElement &domElement)
void VToolPointOfIntersection::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogPointOfIntersection> dialogTool = m_dialog.objectCast<DialogPointOfIntersection>();
SCASSERT(not dialogTool.isNull())
AddDependence(oldDependencies, firstPointId);
AddDependence(oldDependencies, secondPointId);
AddDependence(newDependencies, dialogTool->GetFirstPointId());
AddDependence(newDependencies, dialogTool->GetSecondPointId());
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->GetFirstPointId()));
doc->SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->GetSecondPointId()));
@ -244,44 +251,8 @@ void VToolPointOfIntersection::ShowContextMenu(QGraphicsSceneContextMenuEvent *e
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolPointOfIntersection::GetSecondPointId() const
{
return secondPointId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersection::SetSecondPointId(const quint32 &value)
{
if (value != NULL_ID)
{
secondPointId = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersection::ShowVisualization(bool show)
{
ShowToolVisualization<VisToolPointOfIntersection>(show);
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolPointOfIntersection::GetFirstPointId() const
{
return firstPointId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersection::SetFirstPointId(const quint32 &value)
{
if (value != NULL_ID)
{
firstPointId = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}

View File

@ -73,16 +73,11 @@ public:
QString FirstPointName() const;
QString SecondPointName() const;
quint32 GetFirstPointId() const;
void SetFirstPointId(const quint32 &value);
quint32 GetSecondPointId() const;
void SetSecondPointId(const quint32 &value);
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
protected:
virtual void RemoveReferens() Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;

View File

@ -238,42 +238,6 @@ QString VToolPointOfIntersectionArcs::SecondArcName() const
return VAbstractTool::data.GetGObject(secondArcId)->name();
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolPointOfIntersectionArcs::GetFirstArcId() const
{
return firstArcId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionArcs::SetFirstArcId(const quint32 &value)
{
if (value != NULL_ID)
{
firstArcId = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolPointOfIntersectionArcs::GetSecondArcId() const
{
return secondArcId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionArcs::SetSecondArcId(const quint32 &value)
{
if (value != NULL_ID)
{
secondArcId = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
CrossCirclesPoint VToolPointOfIntersectionArcs::GetCrossCirclesPoint() const
{
@ -320,11 +284,18 @@ void VToolPointOfIntersectionArcs::RemoveReferens()
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionArcs::SaveDialog(QDomElement &domElement)
void VToolPointOfIntersectionArcs::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogPointOfIntersectionArcs> dialogTool = m_dialog.objectCast<DialogPointOfIntersectionArcs>();
SCASSERT(not dialogTool.isNull())
AddDependence(oldDependencies, firstArcId);
AddDependence(oldDependencies, secondArcId);
AddDependence(newDependencies, dialogTool->GetFirstArcId());
AddDependence(newDependencies, dialogTool->GetSecondArcId());
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrFirstArc, QString().setNum(dialogTool->GetFirstArcId()));
doc->SetAttribute(domElement, AttrSecondArc, QString().setNum(dialogTool->GetSecondArcId()));

View File

@ -75,12 +75,6 @@ public:
QString FirstArcName() const;
QString SecondArcName() const;
quint32 GetFirstArcId() const;
void SetFirstArcId(const quint32 &value);
quint32 GetSecondArcId() const;
void SetSecondArcId(const quint32 &value);
CrossCirclesPoint GetCrossCirclesPoint() const;
void SetCrossCirclesPoint(const CrossCirclesPoint &value);
@ -89,7 +83,8 @@ protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void RemoveReferens() Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;

View File

@ -196,42 +196,6 @@ QString VToolPointOfIntersectionCircles::SecondCircleCenterPointName() const
return VAbstractTool::data.GetGObject(secondCircleCenterId)->name();
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolPointOfIntersectionCircles::GetFirstCircleCenterId() const
{
return firstCircleCenterId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCircles::SetFirstCircleCenterId(const quint32 &value)
{
if (value != NULL_ID)
{
firstCircleCenterId = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolPointOfIntersectionCircles::GetSecondCircleCenterId() const
{
return secondCircleCenterId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCircles::SetSecondCircleCenterId(const quint32 &value)
{
if (value != NULL_ID)
{
secondCircleCenterId = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
VFormula VToolPointOfIntersectionCircles::GetFirstCircleRadius() const
{
@ -326,12 +290,19 @@ void VToolPointOfIntersectionCircles::RemoveReferens()
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCircles::SaveDialog(QDomElement &domElement)
void VToolPointOfIntersectionCircles::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogPointOfIntersectionCircles> dialogTool =
m_dialog.objectCast<DialogPointOfIntersectionCircles>();
SCASSERT(not dialogTool.isNull())
AddDependence(oldDependencies, firstCircleCenterId);
AddDependence(oldDependencies, secondCircleCenterId);
AddDependence(newDependencies, dialogTool->GetFirstCircleCenterId());
AddDependence(newDependencies, dialogTool->GetSecondCircleCenterId());
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrC1Center, QString().setNum(dialogTool->GetFirstCircleCenterId()));
doc->SetAttribute(domElement, AttrC2Center, QString().setNum(dialogTool->GetSecondCircleCenterId()));

View File

@ -80,12 +80,6 @@ public:
QString FirstCircleCenterPointName() const;
QString SecondCircleCenterPointName() const;
quint32 GetFirstCircleCenterId() const;
void SetFirstCircleCenterId(const quint32 &value);
quint32 GetSecondCircleCenterId() const;
void SetSecondCircleCenterId(const quint32 &value);
VFormula GetFirstCircleRadius() const;
void SetFirstCircleRadius(const VFormula &value);
@ -100,7 +94,8 @@ protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void RemoveReferens() Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;

View File

@ -273,42 +273,6 @@ QString VToolPointOfIntersectionCurves::SecondCurveName() const
return VAbstractTool::data.GetGObject(secondCurveId)->name();
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolPointOfIntersectionCurves::GetFirstCurveId() const
{
return firstCurveId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCurves::SetFirstCurveId(const quint32 &value)
{
if (value != NULL_ID)
{
firstCurveId = value;
auto obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolPointOfIntersectionCurves::GetSecondCurveId() const
{
return secondCurveId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCurves::SetSecondCurveId(const quint32 &value)
{
if (value != NULL_ID)
{
secondCurveId = value;
auto obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
VCrossCurvesPoint VToolPointOfIntersectionCurves::GetVCrossPoint() const
{
@ -370,11 +334,18 @@ void VToolPointOfIntersectionCurves::RemoveReferens()
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCurves::SaveDialog(QDomElement &domElement)
void VToolPointOfIntersectionCurves::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
auto dialogTool = qobject_cast<DialogPointOfIntersectionCurves*>(m_dialog);
SCASSERT(dialogTool != nullptr)
AddDependence(oldDependencies, firstCurveId);
AddDependence(oldDependencies, secondCurveId);
AddDependence(newDependencies, dialogTool->GetFirstCurveId());
AddDependence(newDependencies, dialogTool->GetSecondCurveId());
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrCurve1, QString().setNum(dialogTool->GetFirstCurveId()));
doc->SetAttribute(domElement, AttrCurve2, QString().setNum(dialogTool->GetSecondCurveId()));

View File

@ -78,12 +78,6 @@ public:
QString FirstCurveName() const;
QString SecondCurveName() const;
quint32 GetFirstCurveId() const;
void SetFirstCurveId(const quint32 &value);
quint32 GetSecondCurveId() const;
void SetSecondCurveId(const quint32 &value);
VCrossCurvesPoint GetVCrossPoint() const;
void SetVCrossPoint(const VCrossCurvesPoint &value);
@ -95,7 +89,8 @@ protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
protected:
virtual void RemoveReferens() Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;

View File

@ -265,11 +265,22 @@ void VToolTriangle::RemoveReferens()
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolTriangle::SaveDialog(QDomElement &domElement)
void VToolTriangle::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogTriangle> dialogTool = m_dialog.objectCast<DialogTriangle>();
SCASSERT(not dialogTool.isNull())
AddDependence(oldDependencies, axisP1Id);
AddDependence(oldDependencies, axisP2Id);
AddDependence(oldDependencies, firstPointId);
AddDependence(oldDependencies, secondPointId);
AddDependence(newDependencies, dialogTool->GetAxisP1Id());
AddDependence(newDependencies, dialogTool->GetAxisP2Id());
AddDependence(newDependencies, dialogTool->GetFirstPointId());
AddDependence(newDependencies, dialogTool->GetSecondPointId());
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
doc->SetAttribute(domElement, AttrAxisP1, QString().setNum(dialogTool->GetAxisP1Id()));
doc->SetAttribute(domElement, AttrAxisP2, QString().setNum(dialogTool->GetAxisP2Id()));
@ -328,80 +339,8 @@ void VToolTriangle::ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolTriangle::GetSecondPointId() const
{
return secondPointId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolTriangle::SetSecondPointId(const quint32 &value)
{
if (value != NULL_ID)
{
secondPointId = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolTriangle::ShowVisualization(bool show)
{
ShowToolVisualization<VisToolTriangle>(show);
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolTriangle::GetFirstPointId() const
{
return firstPointId;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolTriangle::SetFirstPointId(const quint32 &value)
{
if (value != NULL_ID)
{
firstPointId = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolTriangle::GetAxisP2Id() const
{
return axisP2Id;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolTriangle::SetAxisP2Id(const quint32 &value)
{
if (value != NULL_ID)
{
axisP2Id = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolTriangle::GetAxisP1Id() const
{
return axisP1Id;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolTriangle::SetAxisP1Id(const quint32 &value)
{
if (value != NULL_ID)
{
axisP1Id = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
SaveOption(obj);
}
}

View File

@ -98,7 +98,8 @@ public:
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
protected:
virtual void RemoveReferens() Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;

View File

@ -110,9 +110,12 @@ void VDrawTool::SaveDialogChange()
if (oldDomElement.isElement())
{
QDomElement newDomElement = oldDomElement.cloneNode().toElement();
SaveDialog(newDomElement);
QList<quint32> oldDependencies;
QList<quint32> newDependencies;
SaveDialog(newDomElement, oldDependencies, newDependencies);
SaveToolOptions *saveOptions = new SaveToolOptions(oldDomElement, newDomElement, doc, m_id);
SaveToolOptions *saveOptions = new SaveToolOptions(oldDomElement, newDomElement, oldDependencies,
newDependencies, doc, m_id);
connect(saveOptions, &SaveToolOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
qApp->getUndoStack()->push(saveOptions);
}
@ -145,7 +148,8 @@ void VDrawTool::SaveOption(QSharedPointer<VGObject> &obj)
SaveOptions(newDomElement, obj);
SaveToolOptions *saveOptions = new SaveToolOptions(oldDomElement, newDomElement, doc, m_id);
SaveToolOptions *saveOptions = new SaveToolOptions(oldDomElement, newDomElement, QList<quint32>(),
QList<quint32>(), doc, m_id);
connect(saveOptions, &SaveToolOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
qApp->getUndoStack()->push(saveOptions);
}
@ -229,6 +233,13 @@ void VDrawTool::AddToCalculation(const QDomElement &domElement)
qApp->getUndoStack()->push(addToCal);
}
//---------------------------------------------------------------------------------------------------------------------
void VDrawTool::AddDependence(QList<quint32> &list, quint32 objectId) const
{
auto originPoint = VAbstractTool::data.GetGObject(objectId);
list.append(originPoint->getIdTool());
}
//---------------------------------------------------------------------------------------------------------------------
QString VDrawTool::getLineType() const
{

View File

@ -95,9 +95,11 @@ protected:
QString m_lineType;
void AddToCalculation(const QDomElement &domElement);
void AddDependence(QList<quint32> &list, quint32 objectId) const;
/** @brief SaveDialog save options into file after change in dialog. */
virtual void SaveDialog(QDomElement &domElement)=0;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)=0;
virtual void SaveDialogChange() Q_DECL_FINAL;
virtual void AddToFile() Q_DECL_OVERRIDE;
void SaveOption(QSharedPointer<VGObject> &obj);

View File

@ -364,11 +364,18 @@ void VToolLine::keyReleaseEvent(QKeyEvent *event)
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolLine::SaveDialog(QDomElement &domElement)
void VToolLine::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies)
{
SCASSERT(not m_dialog.isNull())
QSharedPointer<DialogLine> dialogTool = m_dialog.objectCast<DialogLine>();
SCASSERT(not dialogTool.isNull())
AddDependence(oldDependencies, firstPoint);
AddDependence(oldDependencies, secondPoint);
AddDependence(newDependencies, dialogTool->GetFirstPoint());
AddDependence(newDependencies, dialogTool->GetSecondPoint());
doc->SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->GetFirstPoint()));
doc->SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->GetSecondPoint()));
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine());
@ -430,24 +437,6 @@ QString VToolLine::MakeToolTip() const
return toolTip;
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolLine::GetSecondPoint() const
{
return secondPoint;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolLine::SetSecondPoint(const quint32 &value)
{
if (value != NULL_ID)
{
secondPoint = value;
QSharedPointer<VGObject> obj;//We don't have object for line in data container. Just will send empty object.
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolLine::ShowVisualization(bool show)
{
@ -504,24 +493,6 @@ void VToolLine::GroupVisibility(quint32 object, bool visible)
setVisible(visible);
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolLine::GetFirstPoint() const
{
return firstPoint;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolLine::SetFirstPoint(const quint32 &value)
{
if (value != NULL_ID)
{
firstPoint = value;
QSharedPointer<VGObject> obj;//We don't have object for line in data container. Just will send empty object.
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshGeometry refresh item on scene.

View File

@ -83,12 +83,6 @@ public:
QString FirstPointName() const;
QString SecondPointName() const;
quint32 GetFirstPoint() const;
void SetFirstPoint(const quint32 &value);
quint32 GetSecondPoint() const;
void SetSecondPoint(const quint32 &value);
QString GetLineColor() const;
void SetLineColor(const QString &value);
@ -112,7 +106,8 @@ protected:
virtual void RemoveReferens() Q_DECL_OVERRIDE;
virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value ) Q_DECL_OVERRIDE;
virtual void keyReleaseEvent(QKeyEvent * event) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement, QList<quint32> &oldDependencies,
QList<quint32> &newDependencies) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;

View File

@ -89,37 +89,3 @@ void SavePlaceLabelOptions::redo()
qCDebug(vUndo, "Can't find path with id = %u.", nodeId);
}
}
//---------------------------------------------------------------------------------------------------------------------
bool SavePlaceLabelOptions::mergeWith(const QUndoCommand *command)
{
const SavePlaceLabelOptions *saveCommand = static_cast<const SavePlaceLabelOptions *>(command);
SCASSERT(saveCommand != nullptr);
const quint32 id = saveCommand->LabelId();
if (id != nodeId)
{
return false;
}
m_newLabel = saveCommand->NewLabel();
return true;
}
//---------------------------------------------------------------------------------------------------------------------
int SavePlaceLabelOptions::id() const
{
return static_cast<int>(UndoCommand::SavePlaceLabelOptions);
}
//---------------------------------------------------------------------------------------------------------------------
quint32 SavePlaceLabelOptions::LabelId() const
{
return nodeId;
}
//---------------------------------------------------------------------------------------------------------------------
VPlaceLabelItem SavePlaceLabelOptions::NewLabel() const
{
return m_newLabel;
}

View File

@ -40,11 +40,6 @@ public:
virtual void undo() Q_DECL_OVERRIDE;
virtual void redo() Q_DECL_OVERRIDE;
virtual bool mergeWith(const QUndoCommand *command) Q_DECL_OVERRIDE;
virtual int id() const Q_DECL_OVERRIDE;
quint32 LabelId() const;
VPlaceLabelItem NewLabel() const;
private:
Q_DISABLE_COPY(SavePlaceLabelOptions)

View File

@ -36,18 +36,19 @@
#include "vundocommand.h"
//---------------------------------------------------------------------------------------------------------------------
SaveToolOptions::SaveToolOptions(const QDomElement &oldXml, const QDomElement &newXml, VAbstractPattern *doc,
const quint32 &id, QUndoCommand *parent)
: VUndoCommand(QDomElement(), doc, parent), oldXml(oldXml), newXml(newXml)
SaveToolOptions::SaveToolOptions(const QDomElement &oldXml, const QDomElement &newXml,
const QList<quint32> &oldDependencies, const QList<quint32> &newDependencies,
VAbstractPattern *doc, const quint32 &id, QUndoCommand *parent)
: VUndoCommand(QDomElement(), doc, parent),
oldXml(oldXml),
newXml(newXml),
oldDependencies(oldDependencies),
newDependencies(newDependencies)
{
setText(tr("save tool option"));
nodeId = id;
}
//---------------------------------------------------------------------------------------------------------------------
SaveToolOptions::~SaveToolOptions()
{}
//---------------------------------------------------------------------------------------------------------------------
void SaveToolOptions::undo()
{
@ -58,6 +59,9 @@ void SaveToolOptions::undo()
{
domElement.parentNode().replaceChild(oldXml, domElement);
DecrementReferences(Missing(newDependencies, oldDependencies));
IncrementReferences(Missing(oldDependencies, newDependencies));
emit NeedLiteParsing(Document::LiteParse);
}
else
@ -76,6 +80,9 @@ void SaveToolOptions::redo()
{
domElement.parentNode().replaceChild(newXml, domElement);
DecrementReferences(Missing(oldDependencies, newDependencies));
IncrementReferences(Missing(newDependencies, oldDependencies));
emit NeedLiteParsing(Document::LiteParse);
}
else
@ -85,23 +92,9 @@ void SaveToolOptions::redo()
}
//---------------------------------------------------------------------------------------------------------------------
bool SaveToolOptions::mergeWith(const QUndoCommand *command)
QVector<quint32> SaveToolOptions::Missing(const QList<quint32> &list1, const QList<quint32> &list2) const
{
const SaveToolOptions *saveCommand = static_cast<const SaveToolOptions *>(command);
SCASSERT(saveCommand != nullptr)
const quint32 id = saveCommand->getToolId();
if (id != nodeId)
{
return false;
}
newXml = saveCommand->getNewXml();
return true;
}
//---------------------------------------------------------------------------------------------------------------------
int SaveToolOptions::id() const
{
return static_cast<int>(UndoCommand::SaveToolOptions);
QSet<quint32> set1 = QSet<quint32>::fromList(list1);
QSet<quint32> set2 = QSet<quint32>::fromList(list2);
return set1.subtract(set2).toList().toVector();
}

View File

@ -42,31 +42,20 @@ class SaveToolOptions : public VUndoCommand
{
Q_OBJECT
public:
SaveToolOptions(const QDomElement &oldXml, const QDomElement &newXml, VAbstractPattern *doc, const quint32 &id,
SaveToolOptions(const QDomElement &oldXml, const QDomElement &newXml, const QList<quint32> &oldDependencies,
const QList<quint32> &newDependencies, VAbstractPattern *doc, const quint32 &id,
QUndoCommand *parent = nullptr);
virtual ~SaveToolOptions() Q_DECL_OVERRIDE;
virtual ~SaveToolOptions() = default;
virtual void undo() Q_DECL_OVERRIDE;
virtual void redo() Q_DECL_OVERRIDE;
virtual bool mergeWith(const QUndoCommand *command) Q_DECL_OVERRIDE;
virtual int id() const Q_DECL_OVERRIDE;
QDomElement getNewXml() const;
quint32 getToolId() const;
private:
Q_DISABLE_COPY(SaveToolOptions)
const QDomElement oldXml;
QDomElement newXml;
const QDomElement newXml;
const QList<quint32> oldDependencies;
const QList<quint32> newDependencies;
QVector<quint32> Missing(const QList<quint32> &list1, const QList<quint32> &list2) const;
};
//---------------------------------------------------------------------------------------------------------------------
inline QDomElement SaveToolOptions::getNewXml() const
{
return newXml;
}
//---------------------------------------------------------------------------------------------------------------------
inline quint32 SaveToolOptions::getToolId() const
{
return nodeId;
}
#endif // SAVETOOLOPTIONS_H