Refactoring.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-05-28 15:13:37 +03:00
parent 9145d4d4f1
commit 605b299f15
39 changed files with 98 additions and 190 deletions

View File

@ -221,6 +221,14 @@ void VAbstractSpline::ReadToolAttributes(const QDomElement &domElement)
lineColor = doc->GetParametrString(domElement, AttrColor, ColorBlack);
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractSpline::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
VDrawTool::SaveOptions(tag, obj);
doc->SetAttribute(tag, AttrColor, lineColor);
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractSpline::ShowHandles(bool show)
{

View File

@ -89,6 +89,7 @@ protected:
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
QPainterPath ToolPath(PathDirection direction = PathDirection::Hide) const;
virtual void ReadToolAttributes(const QDomElement &domElement);
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
template <typename T>
void ShowToolVisualization(bool show)

View File

@ -170,6 +170,35 @@ void VDrawTool::RefreshDataInFile()
}
}
//---------------------------------------------------------------------------------------------------------------------
void VDrawTool::SaveOption(QSharedPointer<VGObject> &obj)
{
qCDebug(vTool, "Saving tool options");
QDomElement oldDomElement = doc->elementById(id);
if (oldDomElement.isElement())
{
QDomElement newDomElement = oldDomElement.cloneNode().toElement();
SaveOptions(newDomElement, obj);
SaveToolOptions *saveOptions = new SaveToolOptions(oldDomElement, newDomElement, doc, id);
connect(saveOptions, &SaveToolOptions::NeedLiteParsing, doc, &VPattern::LiteParseTree);
qApp->getUndoStack()->push(saveOptions);
}
else
{
qCDebug(vTool, "Can't find tool with id = %u", id);
}
}
//---------------------------------------------------------------------------------------------------------------------
void VDrawTool::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
Q_UNUSED(obj)
doc->SetAttribute(tag, VDomDocument::AttrId, id);
}
//---------------------------------------------------------------------------------------------------------------------
QColor VDrawTool::CorrectColor(const QColor &color) const
{

View File

@ -94,6 +94,8 @@ protected:
void SaveDialogChange();
virtual void AddToFile();
virtual void RefreshDataInFile();
void SaveOption(QSharedPointer<VGObject> &obj);
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
QColor CorrectColor(const QColor &color) const;
bool CorrectDisable(bool disable, const QString &namePP) const;

View File

@ -120,17 +120,9 @@ void VToolAlongLine::SaveDialog(QDomElement &domElement)
//---------------------------------------------------------------------------------------------------------------------
void VToolAlongLine::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
QSharedPointer<VPointF> point = qSharedPointerDynamicCast<VPointF>(obj);
SCASSERT(point.isNull() == false);
VToolLinePoint::SaveOptions(tag, obj);
doc->SetAttribute(tag, VDomDocument::AttrId, id);
doc->SetAttribute(tag, AttrType, ToolType);
doc->SetAttribute(tag, AttrName, point->name());
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(tag, AttrTypeLine, typeLine);
doc->SetAttribute(tag, AttrLineColor, lineColor);
doc->SetAttribute(tag, AttrLength, formulaLength);
doc->SetAttribute(tag, AttrFirstPoint, basePointId);
doc->SetAttribute(tag, AttrSecondPoint, secondPointId);

View File

@ -323,16 +323,16 @@ void VToolArc::SaveDialog(QDomElement &domElement)
//---------------------------------------------------------------------------------------------------------------------
void VToolArc::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
VAbstractSpline::SaveOptions(tag, obj);
QSharedPointer<VArc> arc = qSharedPointerDynamicCast<VArc>(obj);
SCASSERT(arc.isNull() == false);
doc->SetAttribute(tag, VDomDocument::AttrId, id);
doc->SetAttribute(tag, AttrType, ToolType);
doc->SetAttribute(tag, AttrCenter, arc->GetCenter().id());
doc->SetAttribute(tag, AttrRadius, arc->GetFormulaRadius());
doc->SetAttribute(tag, AttrAngle1, arc->GetFormulaF1());
doc->SetAttribute(tag, AttrAngle2, arc->GetFormulaF2());
doc->SetAttribute(tag, AttrColor, lineColor);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -286,17 +286,9 @@ void VToolBisector::SaveDialog(QDomElement &domElement)
//---------------------------------------------------------------------------------------------------------------------
void VToolBisector::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
QSharedPointer<VPointF> point = qSharedPointerDynamicCast<VPointF>(obj);
SCASSERT(point.isNull() == false);
VToolLinePoint::SaveOptions(tag, obj);
doc->SetAttribute(tag, VDomDocument::AttrId, id);
doc->SetAttribute(tag, AttrType, ToolType);
doc->SetAttribute(tag, AttrName, point->name());
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(tag, AttrTypeLine, typeLine);
doc->SetAttribute(tag, AttrLineColor, lineColor);
doc->SetAttribute(tag, AttrLength, formulaLength);
doc->SetAttribute(tag, AttrFirstPoint, firstPointId);
doc->SetAttribute(tag, AttrSecondPoint, basePointId);

View File

@ -258,17 +258,9 @@ void VToolCurveIntersectAxis::SaveDialog(QDomElement &domElement)
//---------------------------------------------------------------------------------------------------------------------
void VToolCurveIntersectAxis::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
QSharedPointer<VPointF> point = qSharedPointerDynamicCast<VPointF>(obj);
SCASSERT(point.isNull() == false);
VToolLinePoint::SaveOptions(tag, obj);
doc->SetAttribute(tag, VDomDocument::AttrId, id);
doc->SetAttribute(tag, AttrType, ToolType);
doc->SetAttribute(tag, AttrName, point->name());
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(tag, AttrTypeLine, typeLine);
doc->SetAttribute(tag, AttrLineColor, lineColor);
doc->SetAttribute(tag, AttrAngle, formulaAngle);
doc->SetAttribute(tag, AttrBasePoint, basePointId);
doc->SetAttribute(tag, AttrCurve, curveId);

View File

@ -155,3 +155,11 @@ void VToolCut::FullUpdateCurveFromFile(const QString &attrCurve)
curveCutId = domElement.attribute(attrCurve, "").toUInt();
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolCut::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
VToolPoint::SaveOptions(tag, obj);
doc->SetAttribute(tag, AttrColor, lineColor);
}

View File

@ -76,6 +76,7 @@ protected:
void RefreshGeometry();
virtual void RemoveReferens();
void FullUpdateCurveFromFile(const QString &attrCurve);
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
template <typename T>
void ShowToolVisualization(bool show)

View File

@ -257,16 +257,9 @@ void VToolCutArc::RefreshCurve(VSimpleCurve *curve, quint32 curveId, SimpleCurve
//---------------------------------------------------------------------------------------------------------------------
void VToolCutArc::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
QSharedPointer<VPointF> point = qSharedPointerDynamicCast<VPointF>(obj);
SCASSERT(point.isNull() == false);
VToolCut::SaveOptions(tag, obj);
doc->SetAttribute(tag, VDomDocument::AttrId, id);
doc->SetAttribute(tag, AttrType, ToolType);
doc->SetAttribute(tag, AttrName, point->name());
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(tag, AttrColor, lineColor);
doc->SetAttribute(tag, AttrLength, formula);
doc->SetAttribute(tag, AttrArc, curveCutId);
}

View File

@ -266,16 +266,9 @@ void VToolCutSpline::RefreshCurve(VSimpleCurve *curve, quint32 curveId, SimpleCu
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSpline::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
QSharedPointer<VPointF> point = qSharedPointerDynamicCast<VPointF>(obj);
SCASSERT(point.isNull() == false);
VToolCut::SaveOptions(tag, obj);
doc->SetAttribute(tag, VDomDocument::AttrId, id);
doc->SetAttribute(tag, AttrType, ToolType);
doc->SetAttribute(tag, AttrName, point->name());
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(tag, AttrColor, lineColor);
doc->SetAttribute(tag, AttrLength, formula);
doc->SetAttribute(tag, AttrSpline, curveCutId);
}

View File

@ -312,16 +312,9 @@ void VToolCutSplinePath::RefreshCurve(VSimpleCurve *curve, quint32 curveId, Simp
//---------------------------------------------------------------------------------------------------------------------
void VToolCutSplinePath::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
QSharedPointer<VPointF> point = qSharedPointerDynamicCast<VPointF>(obj);
SCASSERT(point.isNull() == false);
VToolCut::SaveOptions(tag, obj);
doc->SetAttribute(tag, VDomDocument::AttrId, id);
doc->SetAttribute(tag, AttrType, ToolType);
doc->SetAttribute(tag, AttrName, point->name());
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(tag, AttrColor, lineColor);
doc->SetAttribute(tag, AttrLength, formula);
doc->SetAttribute(tag, AttrSplinePath, curveCutId);
}

View File

@ -215,17 +215,9 @@ void VToolEndLine::SaveDialog(QDomElement &domElement)
//---------------------------------------------------------------------------------------------------------------------
void VToolEndLine::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
QSharedPointer<VPointF> point = qSharedPointerDynamicCast<VPointF>(obj);
SCASSERT(point.isNull() == false);
VToolLinePoint::SaveOptions(tag, obj);
doc->SetAttribute(tag, VDomDocument::AttrId, id);
doc->SetAttribute(tag, AttrType, ToolType);
doc->SetAttribute(tag, AttrName, point->name());
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(tag, AttrTypeLine, typeLine);
doc->SetAttribute(tag, AttrLineColor, lineColor);
doc->SetAttribute(tag, AttrLength, formulaLength);
doc->SetAttribute(tag, AttrAngle, formulaAngle);
doc->SetAttribute(tag, AttrBasePoint, basePointId);

View File

@ -223,17 +223,9 @@ void VToolHeight::SaveDialog(QDomElement &domElement)
//---------------------------------------------------------------------------------------------------------------------
void VToolHeight::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
QSharedPointer<VPointF> point = qSharedPointerDynamicCast<VPointF>(obj);
SCASSERT(point.isNull() == false);
VToolLinePoint::SaveOptions(tag, obj);
doc->SetAttribute(tag, VDomDocument::AttrId, id);
doc->SetAttribute(tag, AttrType, ToolType);
doc->SetAttribute(tag, AttrName, point->name());
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(tag, AttrTypeLine, typeLine);
doc->SetAttribute(tag, AttrLineColor, lineColor);
doc->SetAttribute(tag, AttrBasePoint, basePointId);
doc->SetAttribute(tag, AttrP1Line, p1LineId);
doc->SetAttribute(tag, AttrP2Line, p2LineId);

View File

@ -360,9 +360,8 @@ void VToolLine::SaveDialog(QDomElement &domElement)
//---------------------------------------------------------------------------------------------------------------------
void VToolLine::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
Q_UNUSED(obj)
VDrawTool::SaveOptions(tag, obj);
doc->SetAttribute(tag, VDomDocument::AttrId, id);
doc->SetAttribute(tag, AttrFirstPoint, firstPoint);
doc->SetAttribute(tag, AttrSecondPoint, secondPoint);
doc->SetAttribute(tag, AttrTypeLine, typeLine);

View File

@ -243,15 +243,9 @@ void VToolLineIntersect::SaveDialog(QDomElement &domElement)
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersect::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
QSharedPointer<VPointF> point = qSharedPointerDynamicCast<VPointF>(obj);
SCASSERT(point.isNull() == false);
VToolPoint::SaveOptions(tag, obj);
doc->SetAttribute(tag, VDomDocument::AttrId, id);
doc->SetAttribute(tag, AttrType, ToolType);
doc->SetAttribute(tag, AttrName, point->name());
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(tag, AttrP1Line1, p1Line1);
doc->SetAttribute(tag, AttrP2Line1, p2Line1);
doc->SetAttribute(tag, AttrP1Line2, p1Line2);

View File

@ -262,17 +262,9 @@ void VToolLineIntersectAxis::SaveDialog(QDomElement &domElement)
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersectAxis::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
QSharedPointer<VPointF> point = qSharedPointerDynamicCast<VPointF>(obj);
SCASSERT(point.isNull() == false);
VToolLinePoint::SaveOptions(tag, obj);
doc->SetAttribute(tag, VDomDocument::AttrId, id);
doc->SetAttribute(tag, AttrType, ToolType);
doc->SetAttribute(tag, AttrName, point->name());
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(tag, AttrTypeLine, typeLine);
doc->SetAttribute(tag, AttrLineColor, lineColor);
doc->SetAttribute(tag, AttrAngle, formulaAngle);
doc->SetAttribute(tag, AttrBasePoint, basePointId);
doc->SetAttribute(tag, AttrP1Line, firstPointId);

View File

@ -87,6 +87,15 @@ void VToolLinePoint::RemoveReferens()
doc->DecrementReferens(basePointId);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolLinePoint::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
VToolPoint::SaveOptions(tag, obj);
doc->SetAttribute(tag, AttrTypeLine, typeLine);
doc->SetAttribute(tag, AttrLineColor, lineColor);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetFactor set current scale factor of scene.

View File

@ -72,6 +72,7 @@ protected:
virtual void RefreshGeometry();
virtual void RemoveReferens();
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
private:
Q_DISABLE_COPY(VToolLinePoint)
};

View File

@ -253,17 +253,9 @@ void VToolNormal::SaveDialog(QDomElement &domElement)
//---------------------------------------------------------------------------------------------------------------------
void VToolNormal::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
QSharedPointer<VPointF> point = qSharedPointerDynamicCast<VPointF>(obj);
SCASSERT(point.isNull() == false);
VToolLinePoint::SaveOptions(tag, obj);
doc->SetAttribute(tag, VDomDocument::AttrId, id);
doc->SetAttribute(tag, AttrType, ToolType);
doc->SetAttribute(tag, AttrName, point->name());
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(tag, AttrTypeLine, typeLine);
doc->SetAttribute(tag, AttrLineColor, lineColor);
doc->SetAttribute(tag, AttrLength, formulaLength);
doc->SetAttribute(tag, AttrAngle, angle);
doc->SetAttribute(tag, AttrFirstPoint, basePointId);

View File

@ -332,6 +332,19 @@ void VToolPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
Q_UNUSED(event)
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPoint::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
VDrawTool::SaveOptions(tag, obj);
QSharedPointer<VPointF> point = qSharedPointerDynamicCast<VPointF>(obj);
SCASSERT(point.isNull() == false);
doc->SetAttribute(tag, AttrName, point->name());
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
}
//---------------------------------------------------------------------------------------------------------------------
void VToolPoint::setEnabled(bool enabled)
{

View File

@ -78,6 +78,7 @@ protected:
virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
virtual void keyReleaseEvent(QKeyEvent * event);
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
template <typename T>
void ShowToolVisualization(bool show)

View File

@ -295,15 +295,9 @@ void VToolPointOfContact::SaveDialog(QDomElement &domElement)
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfContact::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
QSharedPointer<VPointF> point = qSharedPointerDynamicCast<VPointF>(obj);
SCASSERT(point.isNull() == false);
VToolPoint::SaveOptions(tag, obj);
doc->SetAttribute(tag, VDomDocument::AttrId, id);
doc->SetAttribute(tag, AttrType, ToolType);
doc->SetAttribute(tag, AttrName, point->name());
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(tag, AttrRadius, arcRadius);
doc->SetAttribute(tag, AttrCenter, center);
doc->SetAttribute(tag, AttrFirstPoint, firstPointId);

View File

@ -200,15 +200,9 @@ void VToolPointOfIntersection::SaveDialog(QDomElement &domElement)
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersection::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
QSharedPointer<VPointF> point = qSharedPointerDynamicCast<VPointF>(obj);
SCASSERT(point.isNull() == false);
VToolPoint::SaveOptions(tag, obj);
doc->SetAttribute(tag, VDomDocument::AttrId, id);
doc->SetAttribute(tag, AttrType, ToolType);
doc->SetAttribute(tag, AttrName, point->name());
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(tag, AttrFirstPoint, firstPointId);
doc->SetAttribute(tag, AttrSecondPoint, secondPointId);
}

View File

@ -245,15 +245,9 @@ void VToolPointOfIntersectionArcs::SaveDialog(QDomElement &domElement)
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionArcs::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
QSharedPointer<VPointF> point = qSharedPointerDynamicCast<VPointF>(obj);
SCASSERT(point.isNull() == false);
VToolPoint::SaveOptions(tag, obj);
doc->SetAttribute(tag, VDomDocument::AttrId, id);
doc->SetAttribute(tag, AttrType, ToolType);
doc->SetAttribute(tag, AttrName, point->name());
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(tag, AttrFirstArc, firstArcId);
doc->SetAttribute(tag, AttrSecondArc, secondArcId);
doc->SetAttribute(tag, AttrCrossPoint, static_cast<int>(crossPoint));

View File

@ -280,17 +280,9 @@ void VToolShoulderPoint::SaveDialog(QDomElement &domElement)
//---------------------------------------------------------------------------------------------------------------------
void VToolShoulderPoint::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
QSharedPointer<VPointF> point = qSharedPointerDynamicCast<VPointF>(obj);
SCASSERT(point.isNull() == false);
VToolLinePoint::SaveOptions(tag, obj);
doc->SetAttribute(tag, VDomDocument::AttrId, id);
doc->SetAttribute(tag, AttrType, ToolType);
doc->SetAttribute(tag, AttrName, point->name());
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(tag, AttrTypeLine, typeLine);
doc->SetAttribute(tag, AttrLineColor, lineColor);
doc->SetAttribute(tag, AttrLength, formulaLength);
doc->SetAttribute(tag, AttrP1Line, basePointId);
doc->SetAttribute(tag, AttrP2Line, p2Line);

View File

@ -264,16 +264,14 @@ void VToolSinglePoint::SetColorLabel(const Qt::GlobalColor &color)
//---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
VToolPoint::SaveOptions(tag, obj);
QSharedPointer<VPointF> point = qSharedPointerDynamicCast<VPointF>(obj);
SCASSERT(point.isNull() == false);
doc->SetAttribute(tag, VDomDocument::AttrId, id);
doc->SetAttribute(tag, AttrType, ToolType);
doc->SetAttribute(tag, AttrName, point->name());
doc->SetAttribute(tag, AttrX, qApp->fromPixel(point->x()));
doc->SetAttribute(tag, AttrY, qApp->fromPixel(point->y()));
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -321,10 +321,11 @@ void VToolSpline::SaveDialog(QDomElement &domElement)
//---------------------------------------------------------------------------------------------------------------------
void VToolSpline::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
VAbstractSpline::SaveOptions(tag, obj);
QSharedPointer<VSpline> spl = qSharedPointerDynamicCast<VSpline>(obj);
SCASSERT(spl.isNull() == false);
doc->SetAttribute(tag, VDomDocument::AttrId, id);
doc->SetAttribute(tag, AttrType, ToolType);
doc->SetAttribute(tag, AttrPoint1, spl->GetP1().id());
doc->SetAttribute(tag, AttrPoint4, spl->GetP4().id());
@ -333,7 +334,6 @@ void VToolSpline::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
doc->SetAttribute(tag, AttrKAsm1, spl->GetKasm1());
doc->SetAttribute(tag, AttrKAsm2, spl->GetKasm2());
doc->SetAttribute(tag, AttrKCurve, spl->GetKcurve());
doc->SetAttribute(tag, AttrColor, lineColor);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -389,13 +389,13 @@ void VToolSplinePath::SaveDialog(QDomElement &domElement)
//---------------------------------------------------------------------------------------------------------------------
void VToolSplinePath::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
VAbstractSpline::SaveOptions(tag, obj);
QSharedPointer<VSplinePath> splPath = qSharedPointerDynamicCast<VSplinePath>(obj);
SCASSERT(splPath.isNull() == false);
doc->SetAttribute(tag, VDomDocument::AttrId, id);
doc->SetAttribute(tag, AttrType, ToolType);
doc->SetAttribute(tag, AttrKCurve, splPath->GetKCurve());
doc->SetAttribute(tag, AttrColor, lineColor);
doc->RemoveAllChild(tag);
for (qint32 i = 0; i < splPath->CountPoint(); ++i)

View File

@ -259,15 +259,9 @@ void VToolTriangle::SaveDialog(QDomElement &domElement)
//---------------------------------------------------------------------------------------------------------------------
void VToolTriangle::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
QSharedPointer<VPointF> point = qSharedPointerDynamicCast<VPointF>(obj);
SCASSERT(point.isNull() == false);
VToolPoint::SaveOptions(tag, obj);
doc->SetAttribute(tag, VDomDocument::AttrId, id);
doc->SetAttribute(tag, AttrType, ToolType);
doc->SetAttribute(tag, AttrName, point->name());
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(tag, AttrAxisP1, axisP1Id);
doc->SetAttribute(tag, AttrAxisP2, axisP2Id);
doc->SetAttribute(tag, AttrFirstPoint, firstPointId);

View File

@ -136,10 +136,3 @@ void VAbstractNode::RestoreReferens()
doc->IncrementReferens(idNode);
}
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractNode::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
Q_UNUSED(tag)
Q_UNUSED(obj)
}

View File

@ -62,7 +62,6 @@ protected:
virtual void decrementReferens();
virtual void RemoveReferens();
virtual void RestoreReferens();
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
virtual void SetVisualization() {}
};

View File

@ -330,27 +330,6 @@ QMap<QString, quint32> VAbstractTool::PointsList() const
return list;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractTool::SaveOption(QSharedPointer<VGObject> &obj)
{
qCDebug(vTool, "Saving tool options");
QDomElement oldDomElement = doc->elementById(id);
if (oldDomElement.isElement())
{
QDomElement newDomElement = oldDomElement.cloneNode().toElement();
SaveOptions(newDomElement, obj);
SaveToolOptions *saveOptions = new SaveToolOptions(oldDomElement, newDomElement, doc, id);
connect(saveOptions, &SaveToolOptions::NeedLiteParsing, doc, &VPattern::LiteParseTree);
qApp->getUndoStack()->push(saveOptions);
}
else
{
qCDebug(vTool, "Can't find tool with id = %u", id);
}
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractTool::ToolCreation(const Source &typeCreation)
{

View File

@ -170,8 +170,6 @@ protected:
virtual void RemoveReferens(){}
virtual void DeleteTool(bool ask = true);
static int ConfirmDeletion();
void SaveOption(QSharedPointer<VGObject> &obj);
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)=0;
template <typename T>
void AddVisualization()

View File

@ -373,13 +373,6 @@ void VToolDetail::keyReleaseEvent(QKeyEvent *event)
QGraphicsItem::keyReleaseEvent ( event );
}
//---------------------------------------------------------------------------------------------------------------------
void VToolDetail::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
Q_UNUSED(tag)
Q_UNUSED(obj)
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief mouseReleaseEvent handle mouse release events.

View File

@ -98,7 +98,6 @@ protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void RemoveReferens();
virtual void keyReleaseEvent(QKeyEvent * event);
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
virtual void SetVisualization() {}
private:
Q_DISABLE_COPY(VToolDetail)

View File

@ -741,13 +741,6 @@ void VToolUnionDetails::RefreshDataInFile()
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolUnionDetails::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
Q_UNUSED(tag)
Q_UNUSED(obj)
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddDetail add detail to xml file.

View File

@ -86,7 +86,6 @@ public slots:
protected:
virtual void AddToFile();
virtual void RefreshDataInFile();
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
virtual void SetVisualization() {}
private:
Q_DISABLE_COPY(VToolUnionDetails)