From d269e45858210cc399fbda7e843a2b3f58373922 Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 20 Jan 2014 16:00:38 +0200 Subject: [PATCH] Schema fixes. --HG-- branch : feature --- share/resources/schema/pattern.xsd | 256 ++++++++++-------- src/dialogs/dialogincrements.cpp | 6 +- src/tools/drawTools/vtoolalongline.cpp | 42 +-- src/tools/drawTools/vtoolarc.cpp | 28 +- src/tools/drawTools/vtoolbisector.cpp | 48 ++-- src/tools/drawTools/vtoolcutarc.cpp | 30 +- src/tools/drawTools/vtoolcutspline.cpp | 30 +- src/tools/drawTools/vtoolcutsplinepath.cpp | 30 +- src/tools/drawTools/vtoolendline.cpp | 42 +-- src/tools/drawTools/vtoolheight.cpp | 42 +-- src/tools/drawTools/vtoolline.cpp | 14 +- src/tools/drawTools/vtoollineintersect.cpp | 42 +-- src/tools/drawTools/vtoolnormal.cpp | 48 ++-- src/tools/drawTools/vtoolpoint.cpp | 4 +- src/tools/drawTools/vtoolpointofcontact.cpp | 42 +-- .../drawTools/vtoolpointofintersection.cpp | 30 +- src/tools/drawTools/vtoolshoulderpoint.cpp | 48 ++-- src/tools/drawTools/vtoolsinglepoint.cpp | 34 +-- src/tools/drawTools/vtoolspline.cpp | 56 ++-- src/tools/drawTools/vtoolsplinepath.cpp | 28 +- src/tools/drawTools/vtooltriangle.cpp | 42 +-- src/tools/nodeDetails/vnodearc.cpp | 12 +- src/tools/nodeDetails/vnodepoint.cpp | 24 +- src/tools/nodeDetails/vnodespline.cpp | 12 +- src/tools/nodeDetails/vnodesplinepath.cpp | 12 +- src/tools/vabstracttool.h | 12 +- src/tools/vtooldetail.cpp | 52 ++-- src/tools/vtooluniondetails.cpp | 30 +- 28 files changed, 555 insertions(+), 541 deletions(-) diff --git a/share/resources/schema/pattern.xsd b/share/resources/schema/pattern.xsd index afc28d690..4bed79202 100644 --- a/share/resources/schema/pattern.xsd +++ b/share/resources/schema/pattern.xsd @@ -9,12 +9,12 @@ - - - - - - + + + + + + @@ -26,124 +26,142 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -163,7 +181,7 @@ - + diff --git a/src/dialogs/dialogincrements.cpp b/src/dialogs/dialogincrements.cpp index f78e57f7e..9f668329d 100644 --- a/src/dialogs/dialogincrements.cpp +++ b/src/dialogs/dialogincrements.cpp @@ -442,7 +442,7 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ) if (domElement.isElement()) { bool ok = false; - qreal value = item->text().toDouble(&ok); + qreal value = item->text().replace(",", ".").toDouble(&ok); if (ok) { domElement.setAttribute("base", value); @@ -462,7 +462,7 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ) domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute("ksize", item->text().toDouble()); + domElement.setAttribute("ksize", item->text().replace(",", ".").toDouble()); this->column = 4; emit FullUpdateTree(); } @@ -474,7 +474,7 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ) domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute("kgrowth", item->text().toDouble()); + domElement.setAttribute("kgrowth", item->text().replace(",", ".").toDouble()); this->column = 5; emit FullUpdateTree(); } diff --git a/src/tools/drawTools/vtoolalongline.cpp b/src/tools/drawTools/vtoolalongline.cpp index 978d18b6f..d08b36ec9 100644 --- a/src/tools/drawTools/vtoolalongline.cpp +++ b/src/tools/drawTools/vtoolalongline.cpp @@ -69,11 +69,11 @@ void VToolAlongLine::FullUpdateFromGui(int result) QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrName, dialogAlongLine->getPointName()); - domElement.setAttribute(AttrTypeLine, dialogAlongLine->getTypeLine()); - domElement.setAttribute(AttrLength, dialogAlongLine->getFormula()); - domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogAlongLine->getFirstPointId())); - domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogAlongLine->getSecondPointId())); + SetAttribute(domElement, AttrName, dialogAlongLine->getPointName()); + SetAttribute(domElement, AttrTypeLine, dialogAlongLine->getTypeLine()); + SetAttribute(domElement, AttrLength, dialogAlongLine->getFormula()); + SetAttribute(domElement, AttrFirstPoint, dialogAlongLine->getFirstPointId()); + SetAttribute(domElement, AttrSecondPoint, dialogAlongLine->getSecondPointId()); emit FullUpdateTree(); } } @@ -101,16 +101,16 @@ void VToolAlongLine::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrName, point->name()); - AddAttribute(domElement, AttrMx, toMM(point->mx())); - AddAttribute(domElement, AttrMy, toMM(point->my())); + SetAttribute(domElement, AttrId, id); + SetAttribute(domElement, AttrType, ToolType); + SetAttribute(domElement, AttrName, point->name()); + SetAttribute(domElement, AttrMx, toMM(point->mx())); + SetAttribute(domElement, AttrMy, toMM(point->my())); - AddAttribute(domElement, AttrTypeLine, typeLine); - AddAttribute(domElement, AttrLength, formula); - AddAttribute(domElement, AttrFirstPoint, basePointId); - AddAttribute(domElement, AttrSecondPoint, secondPointId); + SetAttribute(domElement, AttrTypeLine, typeLine); + SetAttribute(domElement, AttrLength, formula); + SetAttribute(domElement, AttrFirstPoint, basePointId); + SetAttribute(domElement, AttrSecondPoint, secondPointId); AddToCalculation(domElement); } @@ -121,13 +121,13 @@ void VToolAlongLine::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrMx, toMM(point->mx())); - domElement.setAttribute(AttrMy, toMM(point->my())); - domElement.setAttribute(AttrName, point->name()); - domElement.setAttribute(AttrTypeLine, typeLine); - domElement.setAttribute(AttrLength, formula); - domElement.setAttribute(AttrFirstPoint, basePointId); - domElement.setAttribute(AttrSecondPoint, secondPointId); + SetAttribute(domElement, AttrMx, toMM(point->mx())); + SetAttribute(domElement, AttrMy, toMM(point->my())); + SetAttribute(domElement, AttrName, point->name()); + SetAttribute(domElement, AttrTypeLine, typeLine); + SetAttribute(domElement, AttrLength, formula); + SetAttribute(domElement, AttrFirstPoint, basePointId); + SetAttribute(domElement, AttrSecondPoint, secondPointId); } } diff --git a/src/tools/drawTools/vtoolarc.cpp b/src/tools/drawTools/vtoolarc.cpp index 9169fd6ad..bc9dce3f8 100644 --- a/src/tools/drawTools/vtoolarc.cpp +++ b/src/tools/drawTools/vtoolarc.cpp @@ -144,10 +144,10 @@ void VToolArc::FullUpdateFromGui(int result) QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrCenter, QString().setNum(dialogArc->GetCenter())); - domElement.setAttribute(AttrRadius, dialogArc->GetRadius()); - domElement.setAttribute(AttrAngle1, dialogArc->GetF1()); - domElement.setAttribute(AttrAngle2, dialogArc->GetF2()); + SetAttribute(domElement, AttrCenter, QString().setNum(dialogArc->GetCenter())); + SetAttribute(domElement, AttrRadius, dialogArc->GetRadius()); + SetAttribute(domElement, AttrAngle1, dialogArc->GetF1()); + SetAttribute(domElement, AttrAngle2, dialogArc->GetF2()); emit FullUpdateTree(); } } @@ -194,12 +194,12 @@ void VToolArc::AddToFile() const VArc *arc = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrCenter, arc->GetCenter().id()); - AddAttribute(domElement, AttrRadius, arc->GetFormulaRadius()); - AddAttribute(domElement, AttrAngle1, arc->GetFormulaF1()); - AddAttribute(domElement, AttrAngle2, arc->GetFormulaF2()); + SetAttribute(domElement, AttrId, id); + SetAttribute(domElement, AttrType, ToolType); + SetAttribute(domElement, AttrCenter, arc->GetCenter().id()); + SetAttribute(domElement, AttrRadius, arc->GetFormulaRadius()); + SetAttribute(domElement, AttrAngle1, arc->GetFormulaF1()); + SetAttribute(domElement, AttrAngle2, arc->GetFormulaF2()); AddToCalculation(domElement); } @@ -210,10 +210,10 @@ void VToolArc::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrCenter, arc->GetCenter().id()); - domElement.setAttribute(AttrRadius, arc->GetFormulaRadius()); - domElement.setAttribute(AttrAngle1, arc->GetFormulaF1()); - domElement.setAttribute(AttrAngle2, arc->GetFormulaF2()); + SetAttribute(domElement, AttrCenter, arc->GetCenter().id()); + SetAttribute(domElement, AttrRadius, arc->GetFormulaRadius()); + SetAttribute(domElement, AttrAngle1, arc->GetFormulaF1()); + SetAttribute(domElement, AttrAngle2, arc->GetFormulaF2()); } } diff --git a/src/tools/drawTools/vtoolbisector.cpp b/src/tools/drawTools/vtoolbisector.cpp index 8393cd93c..c57ffc44e 100644 --- a/src/tools/drawTools/vtoolbisector.cpp +++ b/src/tools/drawTools/vtoolbisector.cpp @@ -164,12 +164,12 @@ void VToolBisector::FullUpdateFromGui(int result) QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrName, dialogBisector->getPointName()); - domElement.setAttribute(AttrTypeLine, dialogBisector->getTypeLine()); - domElement.setAttribute(AttrLength, dialogBisector->getFormula()); - domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogBisector->getFirstPointId())); - domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogBisector->getSecondPointId())); - domElement.setAttribute(AttrThirdPoint, QString().setNum(dialogBisector->getThirdPointId())); + SetAttribute(domElement, AttrName, dialogBisector->getPointName()); + SetAttribute(domElement, AttrTypeLine, dialogBisector->getTypeLine()); + SetAttribute(domElement, AttrLength, dialogBisector->getFormula()); + SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogBisector->getFirstPointId())); + SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogBisector->getSecondPointId())); + SetAttribute(domElement, AttrThirdPoint, QString().setNum(dialogBisector->getThirdPointId())); emit FullUpdateTree(); } } @@ -197,17 +197,17 @@ void VToolBisector::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrName, point->name()); - AddAttribute(domElement, AttrMx, toMM(point->mx())); - AddAttribute(domElement, AttrMy, toMM(point->my())); + SetAttribute(domElement, AttrId, id); + SetAttribute(domElement, AttrType, ToolType); + SetAttribute(domElement, AttrName, point->name()); + SetAttribute(domElement, AttrMx, toMM(point->mx())); + SetAttribute(domElement, AttrMy, toMM(point->my())); - AddAttribute(domElement, AttrTypeLine, typeLine); - AddAttribute(domElement, AttrLength, formula); - AddAttribute(domElement, AttrFirstPoint, firstPointId); - AddAttribute(domElement, AttrSecondPoint, basePointId); - AddAttribute(domElement, AttrThirdPoint, thirdPointId); + SetAttribute(domElement, AttrTypeLine, typeLine); + SetAttribute(domElement, AttrLength, formula); + SetAttribute(domElement, AttrFirstPoint, firstPointId); + SetAttribute(domElement, AttrSecondPoint, basePointId); + SetAttribute(domElement, AttrThirdPoint, thirdPointId); AddToCalculation(domElement); } @@ -218,14 +218,14 @@ void VToolBisector::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrMx, toMM(point->mx())); - domElement.setAttribute(AttrMy, toMM(point->my())); - domElement.setAttribute(AttrName, point->name()); - domElement.setAttribute(AttrTypeLine, typeLine); - domElement.setAttribute(AttrLength, formula); - domElement.setAttribute(AttrFirstPoint, firstPointId); - domElement.setAttribute(AttrSecondPoint, basePointId); - domElement.setAttribute(AttrThirdPoint, thirdPointId); + SetAttribute(domElement, AttrMx, toMM(point->mx())); + SetAttribute(domElement, AttrMy, toMM(point->my())); + SetAttribute(domElement, AttrName, point->name()); + SetAttribute(domElement, AttrTypeLine, typeLine); + SetAttribute(domElement, AttrLength, formula); + SetAttribute(domElement, AttrFirstPoint, firstPointId); + SetAttribute(domElement, AttrSecondPoint, basePointId); + SetAttribute(domElement, AttrThirdPoint, thirdPointId); } } diff --git a/src/tools/drawTools/vtoolcutarc.cpp b/src/tools/drawTools/vtoolcutarc.cpp index ef24503c6..530ec0b61 100644 --- a/src/tools/drawTools/vtoolcutarc.cpp +++ b/src/tools/drawTools/vtoolcutarc.cpp @@ -171,9 +171,9 @@ void VToolCutArc::FullUpdateFromGui(int result) QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrName, dialogCutArc->getPointName()); - domElement.setAttribute(AttrLength, dialogCutArc->getFormula()); - domElement.setAttribute(AttrArc, QString().setNum(dialogCutArc->getArcId())); + SetAttribute(domElement, AttrName, dialogCutArc->getPointName()); + SetAttribute(domElement, AttrLength, dialogCutArc->getFormula()); + SetAttribute(domElement, AttrArc, QString().setNum(dialogCutArc->getArcId())); emit FullUpdateTree(); } } @@ -223,14 +223,14 @@ void VToolCutArc::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrName, point->name()); - AddAttribute(domElement, AttrMx, toMM(point->mx())); - AddAttribute(domElement, AttrMy, toMM(point->my())); + SetAttribute(domElement, AttrId, id); + SetAttribute(domElement, AttrType, ToolType); + SetAttribute(domElement, AttrName, point->name()); + SetAttribute(domElement, AttrMx, toMM(point->mx())); + SetAttribute(domElement, AttrMy, toMM(point->my())); - AddAttribute(domElement, AttrLength, formula); - AddAttribute(domElement, AttrArc, arcId); + SetAttribute(domElement, AttrLength, formula); + SetAttribute(domElement, AttrArc, arcId); AddToCalculation(domElement); } @@ -241,11 +241,11 @@ void VToolCutArc::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrName, point->name()); - domElement.setAttribute(AttrMx, toMM(point->mx())); - domElement.setAttribute(AttrMy, toMM(point->my())); - domElement.setAttribute(AttrLength, formula); - domElement.setAttribute(AttrArc, arcId); + SetAttribute(domElement, AttrName, point->name()); + SetAttribute(domElement, AttrMx, toMM(point->mx())); + SetAttribute(domElement, AttrMy, toMM(point->my())); + SetAttribute(domElement, AttrLength, formula); + SetAttribute(domElement, AttrArc, arcId); } } diff --git a/src/tools/drawTools/vtoolcutspline.cpp b/src/tools/drawTools/vtoolcutspline.cpp index 86cbe343d..8f4fac639 100644 --- a/src/tools/drawTools/vtoolcutspline.cpp +++ b/src/tools/drawTools/vtoolcutspline.cpp @@ -172,9 +172,9 @@ void VToolCutSpline::FullUpdateFromGui(int result) QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrName, dialogCutSpline->getPointName()); - domElement.setAttribute(AttrLength, dialogCutSpline->getFormula()); - domElement.setAttribute(AttrSpline, QString().setNum(dialogCutSpline->getSplineId())); + SetAttribute(domElement, AttrName, dialogCutSpline->getPointName()); + SetAttribute(domElement, AttrLength, dialogCutSpline->getFormula()); + SetAttribute(domElement, AttrSpline, QString().setNum(dialogCutSpline->getSplineId())); emit FullUpdateTree(); } } @@ -224,14 +224,14 @@ void VToolCutSpline::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrName, point->name()); - AddAttribute(domElement, AttrMx, toMM(point->mx())); - AddAttribute(domElement, AttrMy, toMM(point->my())); + SetAttribute(domElement, AttrId, id); + SetAttribute(domElement, AttrType, ToolType); + SetAttribute(domElement, AttrName, point->name()); + SetAttribute(domElement, AttrMx, toMM(point->mx())); + SetAttribute(domElement, AttrMy, toMM(point->my())); - AddAttribute(domElement, AttrLength, formula); - AddAttribute(domElement, AttrSpline, splineId); + SetAttribute(domElement, AttrLength, formula); + SetAttribute(domElement, AttrSpline, splineId); AddToCalculation(domElement); } @@ -242,11 +242,11 @@ void VToolCutSpline::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrName, point->name()); - domElement.setAttribute(AttrMx, toMM(point->mx())); - domElement.setAttribute(AttrMy, toMM(point->my())); - domElement.setAttribute(AttrLength, formula); - domElement.setAttribute(AttrSpline, splineId); + SetAttribute(domElement, AttrName, point->name()); + SetAttribute(domElement, AttrMx, toMM(point->mx())); + SetAttribute(domElement, AttrMy, toMM(point->my())); + SetAttribute(domElement, AttrLength, formula); + SetAttribute(domElement, AttrSpline, splineId); } } diff --git a/src/tools/drawTools/vtoolcutsplinepath.cpp b/src/tools/drawTools/vtoolcutsplinepath.cpp index d6698e907..eb95355db 100644 --- a/src/tools/drawTools/vtoolcutsplinepath.cpp +++ b/src/tools/drawTools/vtoolcutsplinepath.cpp @@ -249,9 +249,9 @@ void VToolCutSplinePath::FullUpdateFromGui(int result) QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrName, dialogCutSplinePath->getPointName()); - domElement.setAttribute(AttrLength, dialogCutSplinePath->getFormula()); - domElement.setAttribute(AttrSplinePath, QString().setNum(dialogCutSplinePath->getSplinePathId())); + SetAttribute(domElement, AttrName, dialogCutSplinePath->getPointName()); + SetAttribute(domElement, AttrLength, dialogCutSplinePath->getFormula()); + SetAttribute(domElement, AttrSplinePath, QString().setNum(dialogCutSplinePath->getSplinePathId())); emit FullUpdateTree(); } } @@ -301,14 +301,14 @@ void VToolCutSplinePath::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrName, point->name()); - AddAttribute(domElement, AttrMx, toMM(point->mx())); - AddAttribute(domElement, AttrMy, toMM(point->my())); + SetAttribute(domElement, AttrId, id); + SetAttribute(domElement, AttrType, ToolType); + SetAttribute(domElement, AttrName, point->name()); + SetAttribute(domElement, AttrMx, toMM(point->mx())); + SetAttribute(domElement, AttrMy, toMM(point->my())); - AddAttribute(domElement, AttrLength, formula); - AddAttribute(domElement, AttrSplinePath, splinePathId); + SetAttribute(domElement, AttrLength, formula); + SetAttribute(domElement, AttrSplinePath, splinePathId); AddToCalculation(domElement); } @@ -319,11 +319,11 @@ void VToolCutSplinePath::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrName, point->name()); - domElement.setAttribute(AttrMx, toMM(point->mx())); - domElement.setAttribute(AttrMy, toMM(point->my())); - domElement.setAttribute(AttrLength, formula); - domElement.setAttribute(AttrSplinePath, splinePathId); + SetAttribute(domElement, AttrName, point->name()); + SetAttribute(domElement, AttrMx, toMM(point->mx())); + SetAttribute(domElement, AttrMy, toMM(point->my())); + SetAttribute(domElement, AttrLength, formula); + SetAttribute(domElement, AttrSplinePath, splinePathId); } } diff --git a/src/tools/drawTools/vtoolendline.cpp b/src/tools/drawTools/vtoolendline.cpp index f2f69cd92..a41e3796e 100644 --- a/src/tools/drawTools/vtoolendline.cpp +++ b/src/tools/drawTools/vtoolendline.cpp @@ -140,11 +140,11 @@ void VToolEndLine::FullUpdateFromGui(int result) QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrName, dialogEndLine->getPointName()); - domElement.setAttribute(AttrTypeLine, dialogEndLine->getTypeLine()); - domElement.setAttribute(AttrLength, dialogEndLine->getFormula()); - domElement.setAttribute(AttrAngle, QString().setNum(dialogEndLine->getAngle())); - domElement.setAttribute(AttrBasePoint, QString().setNum(dialogEndLine->getBasePointId())); + SetAttribute(domElement, AttrName, dialogEndLine->getPointName()); + SetAttribute(domElement, AttrTypeLine, dialogEndLine->getTypeLine()); + SetAttribute(domElement, AttrLength, dialogEndLine->getFormula()); + SetAttribute(domElement, AttrAngle, QString().setNum(dialogEndLine->getAngle())); + SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogEndLine->getBasePointId())); emit FullUpdateTree(); } } @@ -161,16 +161,16 @@ void VToolEndLine::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrName, point->name()); - AddAttribute(domElement, AttrMx, toMM(point->mx())); - AddAttribute(domElement, AttrMy, toMM(point->my())); + SetAttribute(domElement, AttrId, id); + SetAttribute(domElement, AttrType, ToolType); + SetAttribute(domElement, AttrName, point->name()); + SetAttribute(domElement, AttrMx, toMM(point->mx())); + SetAttribute(domElement, AttrMy, toMM(point->my())); - AddAttribute(domElement, AttrTypeLine, typeLine); - AddAttribute(domElement, AttrLength, formula); - AddAttribute(domElement, AttrAngle, angle); - AddAttribute(domElement, AttrBasePoint, basePointId); + SetAttribute(domElement, AttrTypeLine, typeLine); + SetAttribute(domElement, AttrLength, formula); + SetAttribute(domElement, AttrAngle, angle); + SetAttribute(domElement, AttrBasePoint, basePointId); AddToCalculation(domElement); } @@ -181,12 +181,12 @@ void VToolEndLine::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrName, point->name()); - domElement.setAttribute(AttrMx, toMM(point->mx())); - domElement.setAttribute(AttrMy, toMM(point->my())); - domElement.setAttribute(AttrTypeLine, typeLine); - domElement.setAttribute(AttrLength, formula); - domElement.setAttribute(AttrAngle, angle); - domElement.setAttribute(AttrBasePoint, basePointId); + SetAttribute(domElement, AttrName, point->name()); + SetAttribute(domElement, AttrMx, toMM(point->mx())); + SetAttribute(domElement, AttrMy, toMM(point->my())); + SetAttribute(domElement, AttrTypeLine, typeLine); + SetAttribute(domElement, AttrLength, formula); + SetAttribute(domElement, AttrAngle, angle); + SetAttribute(domElement, AttrBasePoint, basePointId); } } diff --git a/src/tools/drawTools/vtoolheight.cpp b/src/tools/drawTools/vtoolheight.cpp index 35802c133..2d096ffa3 100644 --- a/src/tools/drawTools/vtoolheight.cpp +++ b/src/tools/drawTools/vtoolheight.cpp @@ -155,11 +155,11 @@ void VToolHeight::FullUpdateFromGui(int result) QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrName, dialogHeight->getPointName()); - domElement.setAttribute(AttrTypeLine, dialogHeight->getTypeLine()); - domElement.setAttribute(AttrBasePoint, QString().setNum(dialogHeight->getBasePointId())); - domElement.setAttribute(AttrP1Line, QString().setNum(dialogHeight->getP1LineId())); - domElement.setAttribute(AttrP2Line, QString().setNum(dialogHeight->getP2LineId())); + SetAttribute(domElement, AttrName, dialogHeight->getPointName()); + SetAttribute(domElement, AttrTypeLine, dialogHeight->getTypeLine()); + SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogHeight->getBasePointId())); + SetAttribute(domElement, AttrP1Line, QString().setNum(dialogHeight->getP1LineId())); + SetAttribute(domElement, AttrP2Line, QString().setNum(dialogHeight->getP2LineId())); emit FullUpdateTree(); } } @@ -181,16 +181,16 @@ void VToolHeight::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrName, point->name()); - AddAttribute(domElement, AttrMx, toMM(point->mx())); - AddAttribute(domElement, AttrMy, toMM(point->my())); + SetAttribute(domElement, AttrId, id); + SetAttribute(domElement, AttrType, ToolType); + SetAttribute(domElement, AttrName, point->name()); + SetAttribute(domElement, AttrMx, toMM(point->mx())); + SetAttribute(domElement, AttrMy, toMM(point->my())); - AddAttribute(domElement, AttrTypeLine, typeLine); - AddAttribute(domElement, AttrBasePoint, basePointId); - AddAttribute(domElement, AttrP1Line, p1LineId); - AddAttribute(domElement, AttrP2Line, p2LineId); + SetAttribute(domElement, AttrTypeLine, typeLine); + SetAttribute(domElement, AttrBasePoint, basePointId); + SetAttribute(domElement, AttrP1Line, p1LineId); + SetAttribute(domElement, AttrP2Line, p2LineId); AddToCalculation(domElement); @@ -202,12 +202,12 @@ void VToolHeight::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrName, point->name()); - domElement.setAttribute(AttrMx, toMM(point->mx())); - domElement.setAttribute(AttrMy, toMM(point->my())); - domElement.setAttribute(AttrTypeLine, typeLine); - domElement.setAttribute(AttrBasePoint, basePointId); - domElement.setAttribute(AttrP1Line, p1LineId); - domElement.setAttribute(AttrP2Line, p2LineId); + SetAttribute(domElement, AttrName, point->name()); + SetAttribute(domElement, AttrMx, toMM(point->mx())); + SetAttribute(domElement, AttrMy, toMM(point->my())); + SetAttribute(domElement, AttrTypeLine, typeLine); + SetAttribute(domElement, AttrBasePoint, basePointId); + SetAttribute(domElement, AttrP1Line, p1LineId); + SetAttribute(domElement, AttrP2Line, p2LineId); } } diff --git a/src/tools/drawTools/vtoolline.cpp b/src/tools/drawTools/vtoolline.cpp index e55890a26..d7af297ce 100644 --- a/src/tools/drawTools/vtoolline.cpp +++ b/src/tools/drawTools/vtoolline.cpp @@ -118,8 +118,8 @@ void VToolLine::FullUpdateFromGui(int result) QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogLine->getFirstPoint())); - domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogLine->getSecondPoint())); + SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogLine->getFirstPoint())); + SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogLine->getSecondPoint())); emit FullUpdateTree(); } } @@ -163,9 +163,9 @@ void VToolLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolLine::AddToFile() { QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrFirstPoint, firstPoint); - AddAttribute(domElement, AttrSecondPoint, secondPoint); + SetAttribute(domElement, AttrId, id); + SetAttribute(domElement, AttrFirstPoint, firstPoint); + SetAttribute(domElement, AttrSecondPoint, secondPoint); AddToCalculation(domElement); } @@ -175,8 +175,8 @@ void VToolLine::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrFirstPoint, firstPoint); - domElement.setAttribute(AttrSecondPoint, secondPoint); + SetAttribute(domElement, AttrFirstPoint, firstPoint); + SetAttribute(domElement, AttrSecondPoint, secondPoint); } } diff --git a/src/tools/drawTools/vtoollineintersect.cpp b/src/tools/drawTools/vtoollineintersect.cpp index 6cd5d6123..04ace6d25 100644 --- a/src/tools/drawTools/vtoollineintersect.cpp +++ b/src/tools/drawTools/vtoollineintersect.cpp @@ -146,11 +146,11 @@ void VToolLineIntersect::FullUpdateFromGui(int result) QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrName, dialogLineIntersect->getPointName()); - domElement.setAttribute(AttrP1Line1, QString().setNum(dialogLineIntersect->getP1Line1())); - domElement.setAttribute(AttrP2Line1, QString().setNum(dialogLineIntersect->getP2Line1())); - domElement.setAttribute(AttrP1Line2, QString().setNum(dialogLineIntersect->getP1Line2())); - domElement.setAttribute(AttrP2Line2, QString().setNum(dialogLineIntersect->getP2Line2())); + SetAttribute(domElement, AttrName, dialogLineIntersect->getPointName()); + SetAttribute(domElement, AttrP1Line1, QString().setNum(dialogLineIntersect->getP1Line1())); + SetAttribute(domElement, AttrP2Line1, QString().setNum(dialogLineIntersect->getP2Line1())); + SetAttribute(domElement, AttrP1Line2, QString().setNum(dialogLineIntersect->getP1Line2())); + SetAttribute(domElement, AttrP2Line2, QString().setNum(dialogLineIntersect->getP2Line2())); emit FullUpdateTree(); } } @@ -178,16 +178,16 @@ void VToolLineIntersect::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrName, point->name()); - AddAttribute(domElement, AttrMx, toMM(point->mx())); - AddAttribute(domElement, AttrMy, toMM(point->my())); + SetAttribute(domElement, AttrId, id); + SetAttribute(domElement, AttrType, ToolType); + SetAttribute(domElement, AttrName, point->name()); + SetAttribute(domElement, AttrMx, toMM(point->mx())); + SetAttribute(domElement, AttrMy, toMM(point->my())); - AddAttribute(domElement, AttrP1Line1, p1Line1); - AddAttribute(domElement, AttrP2Line1, p2Line1); - AddAttribute(domElement, AttrP1Line2, p1Line2); - AddAttribute(domElement, AttrP2Line2, p2Line2); + SetAttribute(domElement, AttrP1Line1, p1Line1); + SetAttribute(domElement, AttrP2Line1, p2Line1); + SetAttribute(domElement, AttrP1Line2, p1Line2); + SetAttribute(domElement, AttrP2Line2, p2Line2); AddToCalculation(domElement); } @@ -198,13 +198,13 @@ void VToolLineIntersect::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrName, point->name()); - domElement.setAttribute(AttrMx, toMM(point->mx())); - domElement.setAttribute(AttrMy, toMM(point->my())); - domElement.setAttribute(AttrP1Line1, p1Line1); - domElement.setAttribute(AttrP2Line1, p2Line1); - domElement.setAttribute(AttrP1Line2, p1Line2); - domElement.setAttribute(AttrP2Line2, p2Line2); + SetAttribute(domElement, AttrName, point->name()); + SetAttribute(domElement, AttrMx, toMM(point->mx())); + SetAttribute(domElement, AttrMy, toMM(point->my())); + SetAttribute(domElement, AttrP1Line1, p1Line1); + SetAttribute(domElement, AttrP2Line1, p2Line1); + SetAttribute(domElement, AttrP1Line2, p1Line2); + SetAttribute(domElement, AttrP2Line2, p2Line2); } } diff --git a/src/tools/drawTools/vtoolnormal.cpp b/src/tools/drawTools/vtoolnormal.cpp index dcceb0f8d..5b58ab0fa 100644 --- a/src/tools/drawTools/vtoolnormal.cpp +++ b/src/tools/drawTools/vtoolnormal.cpp @@ -149,12 +149,12 @@ void VToolNormal::FullUpdateFromGui(int result) QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrName, dialogNormal->getPointName()); - domElement.setAttribute(AttrTypeLine, dialogNormal->getTypeLine()); - domElement.setAttribute(AttrLength, dialogNormal->getFormula()); - domElement.setAttribute(AttrAngle, QString().setNum(dialogNormal->getAngle())); - domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogNormal->getFirstPointId())); - domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogNormal->getSecondPointId())); + SetAttribute(domElement, AttrName, dialogNormal->getPointName()); + SetAttribute(domElement, AttrTypeLine, dialogNormal->getTypeLine()); + SetAttribute(domElement, AttrLength, dialogNormal->getFormula()); + SetAttribute(domElement, AttrAngle, QString().setNum(dialogNormal->getAngle())); + SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogNormal->getFirstPointId())); + SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogNormal->getSecondPointId())); emit FullUpdateTree(); } } @@ -182,17 +182,17 @@ void VToolNormal::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrName, point->name()); - AddAttribute(domElement, AttrMx, toMM(point->mx())); - AddAttribute(domElement, AttrMy, toMM(point->my())); + SetAttribute(domElement, AttrId, id); + SetAttribute(domElement, AttrType, ToolType); + SetAttribute(domElement, AttrName, point->name()); + SetAttribute(domElement, AttrMx, toMM(point->mx())); + SetAttribute(domElement, AttrMy, toMM(point->my())); - AddAttribute(domElement, AttrTypeLine, typeLine); - AddAttribute(domElement, AttrLength, formula); - AddAttribute(domElement, AttrAngle, angle); - AddAttribute(domElement, AttrFirstPoint, basePointId); - AddAttribute(domElement, AttrSecondPoint, secondPointId); + SetAttribute(domElement, AttrTypeLine, typeLine); + SetAttribute(domElement, AttrLength, formula); + SetAttribute(domElement, AttrAngle, angle); + SetAttribute(domElement, AttrFirstPoint, basePointId); + SetAttribute(domElement, AttrSecondPoint, secondPointId); AddToCalculation(domElement); } @@ -203,14 +203,14 @@ void VToolNormal::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrName, point->name()); - domElement.setAttribute(AttrMx, toMM(point->mx())); - domElement.setAttribute(AttrMy, toMM(point->my())); - domElement.setAttribute(AttrTypeLine, typeLine); - domElement.setAttribute(AttrLength, formula); - domElement.setAttribute(AttrAngle, angle); - domElement.setAttribute(AttrFirstPoint, basePointId); - domElement.setAttribute(AttrSecondPoint, secondPointId); + SetAttribute(domElement, AttrName, point->name()); + SetAttribute(domElement, AttrMx, toMM(point->mx())); + SetAttribute(domElement, AttrMy, toMM(point->my())); + SetAttribute(domElement, AttrTypeLine, typeLine); + SetAttribute(domElement, AttrLength, formula); + SetAttribute(domElement, AttrAngle, angle); + SetAttribute(domElement, AttrFirstPoint, basePointId); + SetAttribute(domElement, AttrSecondPoint, secondPointId); } } diff --git a/src/tools/drawTools/vtoolpoint.cpp b/src/tools/drawTools/vtoolpoint.cpp index e5ff1e066..0e2efcde6 100644 --- a/src/tools/drawTools/vtoolpoint.cpp +++ b/src/tools/drawTools/vtoolpoint.cpp @@ -65,8 +65,8 @@ void VToolPoint::UpdateNamePosition(qreal mx, qreal my) QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrMx, toMM(mx)); - domElement.setAttribute(AttrMy, toMM(my)); + SetAttribute(domElement, AttrMx, toMM(mx)); + SetAttribute(domElement, AttrMy, toMM(my)); emit toolhaveChange(); } } diff --git a/src/tools/drawTools/vtoolpointofcontact.cpp b/src/tools/drawTools/vtoolpointofcontact.cpp index 85ea30731..63aa548be 100644 --- a/src/tools/drawTools/vtoolpointofcontact.cpp +++ b/src/tools/drawTools/vtoolpointofcontact.cpp @@ -169,11 +169,11 @@ void VToolPointOfContact::FullUpdateFromGui(int result) QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrName, dialogPointOfContact->getPointName()); - domElement.setAttribute(AttrRadius, dialogPointOfContact->getRadius()); - domElement.setAttribute(AttrCenter, QString().setNum(dialogPointOfContact->getCenter())); - domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogPointOfContact->getFirstPoint())); - domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogPointOfContact->getSecondPoint())); + SetAttribute(domElement, AttrName, dialogPointOfContact->getPointName()); + SetAttribute(domElement, AttrRadius, dialogPointOfContact->getRadius()); + SetAttribute(domElement, AttrCenter, QString().setNum(dialogPointOfContact->getCenter())); + SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogPointOfContact->getFirstPoint())); + SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogPointOfContact->getSecondPoint())); emit FullUpdateTree(); } } @@ -201,16 +201,16 @@ void VToolPointOfContact::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrName, point->name()); - AddAttribute(domElement, AttrMx, toMM(point->mx())); - AddAttribute(domElement, AttrMy, toMM(point->my())); + SetAttribute(domElement, AttrId, id); + SetAttribute(domElement, AttrType, ToolType); + SetAttribute(domElement, AttrName, point->name()); + SetAttribute(domElement, AttrMx, toMM(point->mx())); + SetAttribute(domElement, AttrMy, toMM(point->my())); - AddAttribute(domElement, AttrRadius, radius); - AddAttribute(domElement, AttrCenter, center); - AddAttribute(domElement, AttrFirstPoint, firstPointId); - AddAttribute(domElement, AttrSecondPoint, secondPointId); + SetAttribute(domElement, AttrRadius, radius); + SetAttribute(domElement, AttrCenter, center); + SetAttribute(domElement, AttrFirstPoint, firstPointId); + SetAttribute(domElement, AttrSecondPoint, secondPointId); AddToCalculation(domElement); } @@ -221,13 +221,13 @@ void VToolPointOfContact::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrName, point->name()); - domElement.setAttribute(AttrMx, toMM(point->mx())); - domElement.setAttribute(AttrMy, toMM(point->my())); - domElement.setAttribute(AttrRadius, radius); - domElement.setAttribute(AttrCenter, center); - domElement.setAttribute(AttrFirstPoint, firstPointId); - domElement.setAttribute(AttrSecondPoint, secondPointId); + SetAttribute(domElement, AttrName, point->name()); + SetAttribute(domElement, AttrMx, toMM(point->mx())); + SetAttribute(domElement, AttrMy, toMM(point->my())); + SetAttribute(domElement, AttrRadius, radius); + SetAttribute(domElement, AttrCenter, center); + SetAttribute(domElement, AttrFirstPoint, firstPointId); + SetAttribute(domElement, AttrSecondPoint, secondPointId); } } diff --git a/src/tools/drawTools/vtoolpointofintersection.cpp b/src/tools/drawTools/vtoolpointofintersection.cpp index c403dcd92..60330edb3 100644 --- a/src/tools/drawTools/vtoolpointofintersection.cpp +++ b/src/tools/drawTools/vtoolpointofintersection.cpp @@ -119,9 +119,9 @@ void VToolPointOfIntersection::FullUpdateFromGui(int result) QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrName, dialogPointOfIntersection->getPointName()); - domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogPointOfIntersection->getFirstPointId())); - domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogPointOfIntersection->getSecondPointId())); + SetAttribute(domElement, AttrName, dialogPointOfIntersection->getPointName()); + SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogPointOfIntersection->getFirstPointId())); + SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogPointOfIntersection->getSecondPointId())); emit FullUpdateTree(); } } @@ -149,14 +149,14 @@ void VToolPointOfIntersection::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrName, point->name()); - AddAttribute(domElement, AttrMx, toMM(point->mx())); - AddAttribute(domElement, AttrMy, toMM(point->my())); + SetAttribute(domElement, AttrId, id); + SetAttribute(domElement, AttrType, ToolType); + SetAttribute(domElement, AttrName, point->name()); + SetAttribute(domElement, AttrMx, toMM(point->mx())); + SetAttribute(domElement, AttrMy, toMM(point->my())); - AddAttribute(domElement, AttrFirstPoint, firstPointId); - AddAttribute(domElement, AttrSecondPoint, secondPointId); + SetAttribute(domElement, AttrFirstPoint, firstPointId); + SetAttribute(domElement, AttrSecondPoint, secondPointId); AddToCalculation(domElement); } @@ -167,10 +167,10 @@ void VToolPointOfIntersection::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrName, point->name()); - domElement.setAttribute(AttrName, toMM(point->mx())); - domElement.setAttribute(AttrName, toMM(point->my())); - domElement.setAttribute(AttrFirstPoint, firstPointId); - domElement.setAttribute(AttrSecondPoint, secondPointId); + SetAttribute(domElement, AttrName, point->name()); + SetAttribute(domElement, AttrName, toMM(point->mx())); + SetAttribute(domElement, AttrName, toMM(point->my())); + SetAttribute(domElement, AttrFirstPoint, firstPointId); + SetAttribute(domElement, AttrSecondPoint, secondPointId); } } diff --git a/src/tools/drawTools/vtoolshoulderpoint.cpp b/src/tools/drawTools/vtoolshoulderpoint.cpp index ea46e79c4..6bc21c411 100644 --- a/src/tools/drawTools/vtoolshoulderpoint.cpp +++ b/src/tools/drawTools/vtoolshoulderpoint.cpp @@ -172,12 +172,12 @@ void VToolShoulderPoint::FullUpdateFromGui(int result) QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrName, dialogShoulderPoint->getPointName()); - domElement.setAttribute(AttrTypeLine, dialogShoulderPoint->getTypeLine()); - domElement.setAttribute(AttrLength, dialogShoulderPoint->getFormula()); - domElement.setAttribute(AttrP1Line, QString().setNum(dialogShoulderPoint->getP1Line())); - domElement.setAttribute(AttrP2Line, QString().setNum(dialogShoulderPoint->getP2Line())); - domElement.setAttribute(AttrPShoulder, QString().setNum(dialogShoulderPoint->getPShoulder())); + SetAttribute(domElement, AttrName, dialogShoulderPoint->getPointName()); + SetAttribute(domElement, AttrTypeLine, dialogShoulderPoint->getTypeLine()); + SetAttribute(domElement, AttrLength, dialogShoulderPoint->getFormula()); + SetAttribute(domElement, AttrP1Line, QString().setNum(dialogShoulderPoint->getP1Line())); + SetAttribute(domElement, AttrP2Line, QString().setNum(dialogShoulderPoint->getP2Line())); + SetAttribute(domElement, AttrPShoulder, QString().setNum(dialogShoulderPoint->getPShoulder())); emit FullUpdateTree(); } } @@ -205,17 +205,17 @@ void VToolShoulderPoint::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrName, point->name()); - AddAttribute(domElement, AttrMx, toMM(point->mx())); - AddAttribute(domElement, AttrMy, toMM(point->my())); + SetAttribute(domElement, AttrId, id); + SetAttribute(domElement, AttrType, ToolType); + SetAttribute(domElement, AttrName, point->name()); + SetAttribute(domElement, AttrMx, toMM(point->mx())); + SetAttribute(domElement, AttrMy, toMM(point->my())); - AddAttribute(domElement, AttrTypeLine, typeLine); - AddAttribute(domElement, AttrLength, formula); - AddAttribute(domElement, AttrP1Line, basePointId); - AddAttribute(domElement, AttrP2Line, p2Line); - AddAttribute(domElement, AttrPShoulder, pShoulder); + SetAttribute(domElement, AttrTypeLine, typeLine); + SetAttribute(domElement, AttrLength, formula); + SetAttribute(domElement, AttrP1Line, basePointId); + SetAttribute(domElement, AttrP2Line, p2Line); + SetAttribute(domElement, AttrPShoulder, pShoulder); AddToCalculation(domElement); } @@ -226,14 +226,14 @@ void VToolShoulderPoint::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrName, point->name()); - domElement.setAttribute(AttrName, toMM(point->mx())); - domElement.setAttribute(AttrName, toMM(point->my())); - domElement.setAttribute(AttrTypeLine, typeLine); - domElement.setAttribute(AttrLength, formula); - domElement.setAttribute(AttrP1Line, basePointId); - domElement.setAttribute(AttrP2Line, p2Line); - domElement.setAttribute(AttrPShoulder, pShoulder); + SetAttribute(domElement, AttrName, point->name()); + SetAttribute(domElement, AttrName, toMM(point->mx())); + SetAttribute(domElement, AttrName, toMM(point->my())); + SetAttribute(domElement, AttrTypeLine, typeLine); + SetAttribute(domElement, AttrLength, formula); + SetAttribute(domElement, AttrP1Line, basePointId); + SetAttribute(domElement, AttrP2Line, p2Line); + SetAttribute(domElement, AttrPShoulder, pShoulder); } } diff --git a/src/tools/drawTools/vtoolsinglepoint.cpp b/src/tools/drawTools/vtoolsinglepoint.cpp index 8b6b6cc69..c98ec47f9 100644 --- a/src/tools/drawTools/vtoolsinglepoint.cpp +++ b/src/tools/drawTools/vtoolsinglepoint.cpp @@ -63,13 +63,13 @@ void VToolSinglePoint::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrName, point->name()); - AddAttribute(domElement, AttrX, toMM(point->x())); - AddAttribute(domElement, AttrY, toMM(point->y())); - AddAttribute(domElement, AttrMx, toMM(point->mx())); - AddAttribute(domElement, AttrMy, toMM(point->my())); + SetAttribute(domElement, AttrId, id); + SetAttribute(domElement, AttrType, ToolType); + SetAttribute(domElement, AttrName, point->name()); + SetAttribute(domElement, AttrX, toMM(point->x())); + SetAttribute(domElement, AttrY, toMM(point->y())); + SetAttribute(domElement, AttrMx, toMM(point->mx())); + SetAttribute(domElement, AttrMy, toMM(point->my())); AddToCalculation(domElement); } @@ -80,11 +80,11 @@ void VToolSinglePoint::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrName, point->name()); - domElement.setAttribute(AttrX, QString().setNum(toMM(point->x()))); - domElement.setAttribute(AttrY, QString().setNum(toMM(point->y()))); - domElement.setAttribute(AttrMx, QString().setNum(toMM(point->mx()))); - domElement.setAttribute(AttrMy, QString().setNum(toMM(point->my()))); + SetAttribute(domElement, AttrName, point->name()); + SetAttribute(domElement, AttrX, QString().setNum(toMM(point->x()))); + SetAttribute(domElement, AttrY, QString().setNum(toMM(point->y()))); + SetAttribute(domElement, AttrMx, QString().setNum(toMM(point->mx()))); + SetAttribute(domElement, AttrMy, QString().setNum(toMM(point->my()))); } } @@ -110,8 +110,8 @@ QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change, QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrX, QString().setNum(toMM(newPos.x()))); - domElement.setAttribute(AttrY, QString().setNum(toMM(newPos.y()))); + SetAttribute(domElement, AttrX, QString().setNum(toMM(newPos.x()))); + SetAttribute(domElement, AttrY, QString().setNum(toMM(newPos.y()))); QList list = this->scene()->views(); VAbstractTool::NewSceneRect(this->scene(), list[0]); @@ -157,9 +157,9 @@ void VToolSinglePoint::FullUpdateFromGui(int result) QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrName, name); - domElement.setAttribute(AttrX, QString().setNum(toMM(p.x()))); - domElement.setAttribute(AttrY, QString().setNum(toMM(p.y()))); + SetAttribute(domElement, AttrName, name); + SetAttribute(domElement, AttrX, QString().setNum(toMM(p.x()))); + SetAttribute(domElement, AttrY, QString().setNum(toMM(p.y()))); //I don't now why but signal does not work. doc->FullUpdateTree(); } diff --git a/src/tools/drawTools/vtoolspline.cpp b/src/tools/drawTools/vtoolspline.cpp index 2f30be4fc..102a9a34d 100644 --- a/src/tools/drawTools/vtoolspline.cpp +++ b/src/tools/drawTools/vtoolspline.cpp @@ -168,13 +168,13 @@ void VToolSpline::FullUpdateFromGui(int result) QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrPoint1, spl.GetP1().id()); - domElement.setAttribute(AttrPoint4, spl.GetP4().id()); - domElement.setAttribute(AttrAngle1, spl.GetAngle1()); - domElement.setAttribute(AttrAngle2, spl.GetAngle2()); - domElement.setAttribute(AttrKAsm1, spl.GetKasm1()); - domElement.setAttribute(AttrKAsm2, spl.GetKasm2()); - domElement.setAttribute(AttrKCurve, spl.GetKcurve()); + SetAttribute(domElement, AttrPoint1, spl.GetP1().id()); + SetAttribute(domElement, AttrPoint4, spl.GetP4().id()); + SetAttribute(domElement, AttrAngle1, spl.GetAngle1()); + SetAttribute(domElement, AttrAngle2, spl.GetAngle2()); + SetAttribute(domElement, AttrKAsm1, spl.GetKasm1()); + SetAttribute(domElement, AttrKAsm2, spl.GetKasm2()); + SetAttribute(domElement, AttrKCurve, spl.GetKcurve()); emit FullUpdateTree(); } } @@ -198,11 +198,11 @@ void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, const Sp QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrAngle1, QString().setNum(spl.GetAngle1())); - domElement.setAttribute(AttrAngle2, QString().setNum(spl.GetAngle2())); - domElement.setAttribute(AttrKAsm1, QString().setNum(spl.GetKasm1())); - domElement.setAttribute(AttrKAsm2, QString().setNum(spl.GetKasm2())); - domElement.setAttribute(AttrKCurve, QString().setNum(spl.GetKcurve())); + SetAttribute(domElement, AttrAngle1, QString().setNum(spl.GetAngle1())); + SetAttribute(domElement, AttrAngle2, QString().setNum(spl.GetAngle2())); + SetAttribute(domElement, AttrKAsm1, QString().setNum(spl.GetKasm1())); + SetAttribute(domElement, AttrKAsm2, QString().setNum(spl.GetKasm2())); + SetAttribute(domElement, AttrKCurve, QString().setNum(spl.GetKcurve())); emit FullUpdateTree(); } } @@ -217,15 +217,15 @@ void VToolSpline::AddToFile() const VSpline *spl = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrPoint1, spl->GetP1().id()); - AddAttribute(domElement, AttrPoint4, spl->GetP4().id()); - AddAttribute(domElement, AttrAngle1, spl->GetAngle1()); - AddAttribute(domElement, AttrAngle2, spl->GetAngle2()); - AddAttribute(domElement, AttrKAsm1, spl->GetKasm1()); - AddAttribute(domElement, AttrKAsm2, spl->GetKasm2()); - AddAttribute(domElement, AttrKCurve, spl->GetKcurve()); + SetAttribute(domElement, AttrId, id); + SetAttribute(domElement, AttrType, ToolType); + SetAttribute(domElement, AttrPoint1, spl->GetP1().id()); + SetAttribute(domElement, AttrPoint4, spl->GetP4().id()); + SetAttribute(domElement, AttrAngle1, spl->GetAngle1()); + SetAttribute(domElement, AttrAngle2, spl->GetAngle2()); + SetAttribute(domElement, AttrKAsm1, spl->GetKasm1()); + SetAttribute(domElement, AttrKAsm2, spl->GetKasm2()); + SetAttribute(domElement, AttrKCurve, spl->GetKcurve()); AddToCalculation(domElement); } @@ -236,13 +236,13 @@ void VToolSpline::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrPoint1, spl->GetP1().id()); - domElement.setAttribute(AttrPoint4, spl->GetP4().id()); - domElement.setAttribute(AttrAngle1, spl->GetAngle1()); - domElement.setAttribute(AttrAngle2, spl->GetAngle2()); - domElement.setAttribute(AttrKAsm1, spl->GetKasm1()); - domElement.setAttribute(AttrKAsm2, spl->GetKasm2()); - domElement.setAttribute(AttrKCurve, spl->GetKcurve()); + SetAttribute(domElement, AttrPoint1, spl->GetP1().id()); + SetAttribute(domElement, AttrPoint4, spl->GetP4().id()); + SetAttribute(domElement, AttrAngle1, spl->GetAngle1()); + SetAttribute(domElement, AttrAngle2, spl->GetAngle2()); + SetAttribute(domElement, AttrKAsm1, spl->GetKasm1()); + SetAttribute(domElement, AttrKAsm2, spl->GetKasm2()); + SetAttribute(domElement, AttrKCurve, spl->GetKcurve()); } } diff --git a/src/tools/drawTools/vtoolsplinepath.cpp b/src/tools/drawTools/vtoolsplinepath.cpp index 905a7d1c6..4ec238d9c 100644 --- a/src/tools/drawTools/vtoolsplinepath.cpp +++ b/src/tools/drawTools/vtoolsplinepath.cpp @@ -157,7 +157,7 @@ void VToolSplinePath::FullUpdateFromGui(int result) QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrKCurve, QString().setNum(splPath.getKCurve())); + SetAttribute(domElement, AttrKCurve, QString().setNum(splPath.getKCurve())); UpdatePathPoint(domElement, splPath); emit FullUpdateTree(); } @@ -185,7 +185,7 @@ void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, cons QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrKCurve, QString().setNum(splPath.getKCurve())); + SetAttribute(domElement, AttrKCurve, QString().setNum(splPath.getKCurve())); UpdatePathPoint(domElement, splPath); emit FullUpdateTree(); } @@ -214,10 +214,10 @@ void VToolSplinePath::UpdatePathPoint(QDomNode& node, VSplinePath &path) if (domElement.isNull() == false) { VSplinePoint p = path[i]; - domElement.setAttribute(AttrPSpline, p.P().id()); - domElement.setAttribute(AttrKAsm1, p.KAsm1()); - domElement.setAttribute(AttrKAsm2, p.KAsm2()); - domElement.setAttribute(AttrAngle, p.Angle2()); + SetAttribute(domElement, AttrPSpline, p.P().id()); + SetAttribute(domElement, AttrKAsm1, p.KAsm1()); + SetAttribute(domElement, AttrKAsm2, p.KAsm2()); + SetAttribute(domElement, AttrAngle, p.Angle2()); } } } @@ -263,9 +263,9 @@ void VToolSplinePath::AddToFile() VSplinePath splPath = *VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrKCurve, splPath.getKCurve()); + SetAttribute(domElement, AttrId, id); + SetAttribute(domElement, AttrType, ToolType); + SetAttribute(domElement, AttrKCurve, splPath.getKCurve()); for (qint32 i = 0; i < splPath.CountPoint(); ++i) { @@ -301,7 +301,7 @@ void VToolSplinePath::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrKCurve, QString().setNum(splPath.getKCurve())); + SetAttribute(domElement, AttrKCurve, QString().setNum(splPath.getKCurve())); UpdatePathPoint(domElement, splPath); } @@ -312,10 +312,10 @@ void VToolSplinePath::AddPathPoint(QDomElement &domElement, const VSplinePoint & { QDomElement pathPoint = doc->createElement(AttrPathPoint); - AddAttribute(pathPoint, AttrPSpline, splPoint.P().id()); - AddAttribute(pathPoint, AttrKAsm1, splPoint.KAsm1()); - AddAttribute(pathPoint, AttrKAsm2, splPoint.KAsm2()); - AddAttribute(pathPoint, AttrAngle, splPoint.Angle2()); + SetAttribute(pathPoint, AttrPSpline, splPoint.P().id()); + SetAttribute(pathPoint, AttrKAsm1, splPoint.KAsm1()); + SetAttribute(pathPoint, AttrKAsm2, splPoint.KAsm2()); + SetAttribute(pathPoint, AttrAngle, splPoint.Angle2()); domElement.appendChild(pathPoint); } diff --git a/src/tools/drawTools/vtooltriangle.cpp b/src/tools/drawTools/vtooltriangle.cpp index 12b59448f..183b19df4 100644 --- a/src/tools/drawTools/vtooltriangle.cpp +++ b/src/tools/drawTools/vtooltriangle.cpp @@ -172,11 +172,11 @@ void VToolTriangle::FullUpdateFromGui(int result) QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrName, dialogTriangle->getPointName()); - domElement.setAttribute(AttrAxisP1, QString().setNum(dialogTriangle->getAxisP1Id())); - domElement.setAttribute(AttrAxisP2, QString().setNum(dialogTriangle->getAxisP2Id())); - domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogTriangle->getFirstPointId())); - domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogTriangle->getSecondPointId())); + SetAttribute(domElement, AttrName, dialogTriangle->getPointName()); + SetAttribute(domElement, AttrAxisP1, QString().setNum(dialogTriangle->getAxisP1Id())); + SetAttribute(domElement, AttrAxisP2, QString().setNum(dialogTriangle->getAxisP2Id())); + SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTriangle->getFirstPointId())); + SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTriangle->getSecondPointId())); emit FullUpdateTree(); } @@ -207,16 +207,16 @@ void VToolTriangle::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrName, point->name()); - AddAttribute(domElement, AttrMx, toMM(point->mx())); - AddAttribute(domElement, AttrMy, toMM(point->my())); + SetAttribute(domElement, AttrId, id); + SetAttribute(domElement, AttrType, ToolType); + SetAttribute(domElement, AttrName, point->name()); + SetAttribute(domElement, AttrMx, toMM(point->mx())); + SetAttribute(domElement, AttrMy, toMM(point->my())); - AddAttribute(domElement, AttrAxisP1, axisP1Id); - AddAttribute(domElement, AttrAxisP2, axisP2Id); - AddAttribute(domElement, AttrFirstPoint, firstPointId); - AddAttribute(domElement, AttrSecondPoint, secondPointId); + SetAttribute(domElement, AttrAxisP1, axisP1Id); + SetAttribute(domElement, AttrAxisP2, axisP2Id); + SetAttribute(domElement, AttrFirstPoint, firstPointId); + SetAttribute(domElement, AttrSecondPoint, secondPointId); AddToCalculation(domElement); } @@ -227,12 +227,12 @@ void VToolTriangle::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrName, point->name()); - domElement.setAttribute(AttrMx, toMM(point->mx())); - domElement.setAttribute(AttrMy, toMM(point->my())); - domElement.setAttribute(AttrAxisP1, axisP1Id); - domElement.setAttribute(AttrAxisP2, axisP2Id); - domElement.setAttribute(AttrFirstPoint, firstPointId); - domElement.setAttribute(AttrSecondPoint, secondPointId); + SetAttribute(domElement, AttrName, point->name()); + SetAttribute(domElement, AttrMx, toMM(point->mx())); + SetAttribute(domElement, AttrMy, toMM(point->my())); + SetAttribute(domElement, AttrAxisP1, axisP1Id); + SetAttribute(domElement, AttrAxisP2, axisP2Id); + SetAttribute(domElement, AttrFirstPoint, firstPointId); + SetAttribute(domElement, AttrSecondPoint, secondPointId); } } diff --git a/src/tools/nodeDetails/vnodearc.cpp b/src/tools/nodeDetails/vnodearc.cpp index 2a9208197..c2375e625 100644 --- a/src/tools/nodeDetails/vnodearc.cpp +++ b/src/tools/nodeDetails/vnodearc.cpp @@ -93,12 +93,12 @@ void VNodeArc::AddToFile() { QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrIdObject, idNode); + SetAttribute(domElement, AttrId, id); + SetAttribute(domElement, AttrType, ToolType); + SetAttribute(domElement, AttrIdObject, idNode); if (idTool != 0) { - AddAttribute(domElement, AttrIdTool, idTool); + SetAttribute(domElement, AttrIdTool, idTool); } AddToModeling(domElement); @@ -109,10 +109,10 @@ void VNodeArc::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrIdObject, idNode); + SetAttribute(domElement, AttrIdObject, idNode); if (idTool != 0) { - domElement.setAttribute(AttrIdTool, idTool); + SetAttribute(domElement, AttrIdTool, idTool); } } } diff --git a/src/tools/nodeDetails/vnodepoint.cpp b/src/tools/nodeDetails/vnodepoint.cpp index 5d48ce2a5..f28b82e96 100644 --- a/src/tools/nodeDetails/vnodepoint.cpp +++ b/src/tools/nodeDetails/vnodepoint.cpp @@ -105,14 +105,14 @@ void VNodePoint::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrIdObject, idNode); - AddAttribute(domElement, AttrMx, toMM(point->mx())); - AddAttribute(domElement, AttrMy, toMM(point->my())); + SetAttribute(domElement, AttrId, id); + SetAttribute(domElement, AttrType, ToolType); + SetAttribute(domElement, AttrIdObject, idNode); + SetAttribute(domElement, AttrMx, toMM(point->mx())); + SetAttribute(domElement, AttrMy, toMM(point->my())); if (idTool != 0) { - AddAttribute(domElement, AttrIdTool, idTool); + SetAttribute(domElement, AttrIdTool, idTool); } AddToModeling(domElement); @@ -124,12 +124,12 @@ void VNodePoint::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrIdObject, idNode); - domElement.setAttribute(AttrMx, toMM(point->mx())); - domElement.setAttribute(AttrMy, toMM(point->my())); + SetAttribute(domElement, AttrIdObject, idNode); + SetAttribute(domElement, AttrMx, toMM(point->mx())); + SetAttribute(domElement, AttrMy, toMM(point->my())); if (idTool != 0) { - domElement.setAttribute(AttrIdTool, idTool); + SetAttribute(domElement, AttrIdTool, idTool); } } } @@ -172,8 +172,8 @@ void VNodePoint::UpdateNamePosition(qreal mx, qreal my) QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrMx, QString().setNum(toMM(mx))); - domElement.setAttribute(AttrMy, QString().setNum(toMM(my))); + SetAttribute(domElement, AttrMx, QString().setNum(toMM(mx))); + SetAttribute(domElement, AttrMy, QString().setNum(toMM(my))); emit toolhaveChange(); } } diff --git a/src/tools/nodeDetails/vnodespline.cpp b/src/tools/nodeDetails/vnodespline.cpp index f6ce6014d..2746cd11e 100644 --- a/src/tools/nodeDetails/vnodespline.cpp +++ b/src/tools/nodeDetails/vnodespline.cpp @@ -96,12 +96,12 @@ void VNodeSpline::AddToFile() { QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrIdObject, idNode); + SetAttribute(domElement, AttrId, id); + SetAttribute(domElement, AttrType, ToolType); + SetAttribute(domElement, AttrIdObject, idNode); if (idTool != 0) { - AddAttribute(domElement, AttrIdTool, idTool); + SetAttribute(domElement, AttrIdTool, idTool); } AddToModeling(domElement); @@ -112,10 +112,10 @@ void VNodeSpline::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrIdObject, QString().setNum(idNode)); + SetAttribute(domElement, AttrIdObject, QString().setNum(idNode)); if (idTool != 0) { - domElement.setAttribute(AttrIdTool, idTool); + SetAttribute(domElement, AttrIdTool, idTool); } } } diff --git a/src/tools/nodeDetails/vnodesplinepath.cpp b/src/tools/nodeDetails/vnodesplinepath.cpp index 590fd4f19..58c998da9 100644 --- a/src/tools/nodeDetails/vnodesplinepath.cpp +++ b/src/tools/nodeDetails/vnodesplinepath.cpp @@ -100,12 +100,12 @@ void VNodeSplinePath::AddToFile() { QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrIdObject, idNode); + SetAttribute(domElement, AttrId, id); + SetAttribute(domElement, AttrType, ToolType); + SetAttribute(domElement, AttrIdObject, idNode); if (idTool != 0) { - AddAttribute(domElement, AttrIdTool, idTool); + SetAttribute(domElement, AttrIdTool, idTool); } AddToModeling(domElement); @@ -116,10 +116,10 @@ void VNodeSplinePath::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrIdObject, QString().setNum(idNode)); + SetAttribute(domElement, AttrIdObject, QString().setNum(idNode)); if (idTool != 0) { - domElement.setAttribute(AttrIdTool, idTool); + SetAttribute(domElement, AttrIdTool, idTool); } } } diff --git a/src/tools/vabstracttool.h b/src/tools/vabstracttool.h index 592740618..2db87e517 100644 --- a/src/tools/vabstracttool.h +++ b/src/tools/vabstracttool.h @@ -314,23 +314,19 @@ protected: * @param name * @param value */ - void AddAttribute(QDomElement &domElement, const QString &name, const T &value) + void SetAttribute(QDomElement &domElement, const QString &name, const T &value) { - QDomAttr domAttr = doc->createAttribute(name); QString val = QString().setNum(value); val = val.replace(",", "."); - domAttr.setValue(val); - domElement.setAttributeNode(domAttr); + domElement.setAttribute(name, val); } private: Q_DISABLE_COPY(VAbstractTool) }; template <> -inline void VAbstractTool::AddAttribute(QDomElement &domElement, const QString &name, const QString &value) +inline void VAbstractTool::SetAttribute(QDomElement &domElement, const QString &name, const QString &value) { - QDomAttr domAttr = doc->createAttribute(name); - domAttr.setValue(value); - domElement.setAttributeNode(domAttr); + domElement.setAttribute(name, value); } #endif // VABSTRACTTOOL_H diff --git a/src/tools/vtooldetail.cpp b/src/tools/vtooldetail.cpp index 42a23f9fd..b5861f466 100644 --- a/src/tools/vtooldetail.cpp +++ b/src/tools/vtooldetail.cpp @@ -176,10 +176,10 @@ void VToolDetail::FullUpdateFromGui(int result) if (domElement.isElement()) { VDetail det = dialogDetail->getDetails(); - domElement.setAttribute(AttrName, det.getName()); - domElement.setAttribute(AttrSupplement, QString().setNum(det.getSupplement())); - domElement.setAttribute(AttrClosed, QString().setNum(det.getClosed())); - domElement.setAttribute(AttrWidth, QString().setNum(det.getWidth())); + SetAttribute(domElement, AttrName, det.getName()); + SetAttribute(domElement, AttrSupplement, QString().setNum(det.getSupplement())); + SetAttribute(domElement, AttrClosed, QString().setNum(det.getClosed())); + SetAttribute(domElement, AttrWidth, QString().setNum(det.getWidth())); RemoveAllChild(domElement); for (ptrdiff_t i = 0; i < det.CountNode(); ++i) { @@ -207,13 +207,13 @@ void VToolDetail::AddToFile() VDetail detail = VAbstractTool::data.GetDetail(id); QDomElement domElement = doc->createElement(TagName); - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrName, detail.getName()); - AddAttribute(domElement, AttrMx, toMM(detail.getMx())); - AddAttribute(domElement, AttrMy, toMM(detail.getMy())); - AddAttribute(domElement, AttrSupplement, detail.getSupplement()); - AddAttribute(domElement, AttrClosed, detail.getClosed()); - AddAttribute(domElement, AttrWidth, detail.getWidth()); + SetAttribute(domElement, AttrId, id); + SetAttribute(domElement, AttrName, detail.getName()); + SetAttribute(domElement, AttrMx, toMM(detail.getMx())); + SetAttribute(domElement, AttrMy, toMM(detail.getMy())); + SetAttribute(domElement, AttrSupplement, detail.getSupplement()); + SetAttribute(domElement, AttrClosed, detail.getClosed()); + SetAttribute(domElement, AttrWidth, detail.getWidth()); for (ptrdiff_t i = 0; i < detail.CountNode(); ++i) { @@ -234,10 +234,10 @@ void VToolDetail::RefreshDataInFile() if (domElement.isElement()) { VDetail det = VAbstractTool::data.GetDetail(id); - domElement.setAttribute(AttrName, det.getName()); - domElement.setAttribute(AttrSupplement, QString().setNum(det.getSupplement())); - domElement.setAttribute(AttrClosed, QString().setNum(det.getClosed())); - domElement.setAttribute(AttrWidth, QString().setNum(det.getWidth())); + SetAttribute(domElement, AttrName, det.getName()); + SetAttribute(domElement, AttrSupplement, QString().setNum(det.getSupplement())); + SetAttribute(domElement, AttrClosed, QString().setNum(det.getClosed())); + SetAttribute(domElement, AttrWidth, QString().setNum(det.getWidth())); RemoveAllChild(domElement); for (ptrdiff_t i = 0; i < det.CountNode(); ++i) { @@ -256,8 +256,8 @@ QVariant VToolDetail::itemChange(QGraphicsItem::GraphicsItemChange change, const QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrMx, QString().setNum(toMM(newPos.x()))); - domElement.setAttribute(AttrMy, QString().setNum(toMM(newPos.y()))); + SetAttribute(domElement, AttrMx, QString().setNum(toMM(newPos.x()))); + SetAttribute(domElement, AttrMy, QString().setNum(toMM(newPos.y()))); QList list = this->scene()->views(); VAbstractTool::NewSceneRect(this->scene(), list[0]); @@ -346,30 +346,30 @@ void VToolDetail::AddNode(QDomElement &domElement, const VNodeDetail &node) { QDomElement nod = doc->createElement(TagNode); - AddAttribute(nod, AttrIdObject, node.getId()); - AddAttribute(nod, AttrMx, toMM(node.getMx())); - AddAttribute(nod, AttrMy, toMM(node.getMy())); + SetAttribute(nod, AttrIdObject, node.getId()); + SetAttribute(nod, AttrMx, toMM(node.getMx())); + SetAttribute(nod, AttrMy, toMM(node.getMy())); if (node.getTypeNode() == NodeDetail::Contour) { - AddAttribute(nod, AttrNodeType, NodeTypeContour); + SetAttribute(nod, AttrNodeType, NodeTypeContour); } else { - AddAttribute(nod, AttrNodeType, NodeTypeModeling); + SetAttribute(nod, AttrNodeType, NodeTypeModeling); } switch (node.getTypeTool()) { case (Tool::NodeArc): - AddAttribute(nod, AttrType, QStringLiteral("NodeArc")); + SetAttribute(nod, AttrType, QStringLiteral("NodeArc")); break; case (Tool::NodePoint): - AddAttribute(nod, AttrType, QStringLiteral("NodePoint")); + SetAttribute(nod, AttrType, QStringLiteral("NodePoint")); break; case (Tool::NodeSpline): - AddAttribute(nod, AttrType, QStringLiteral("NodeSpline")); + SetAttribute(nod, AttrType, QStringLiteral("NodeSpline")); break; case (Tool::NodeSplinePath): - AddAttribute(nod, AttrType, QStringLiteral("NodeSplinePath")); + SetAttribute(nod, AttrType, QStringLiteral("NodeSplinePath")); break; default: qWarning()<<"May be wrong tool type!!! Ignoring."<createElement(TagName); - AddAttribute(domElement, AttrId, id); - AddAttribute(domElement, AttrType, ToolType); - AddAttribute(domElement, AttrIndexD1, indexD1); - AddAttribute(domElement, AttrIndexD2, indexD2); + SetAttribute(domElement, AttrId, id); + SetAttribute(domElement, AttrType, ToolType); + SetAttribute(domElement, AttrIndexD1, indexD1); + SetAttribute(domElement, AttrIndexD2, indexD2); AddDetail(domElement, d1); AddDetail(domElement, d2); @@ -686,8 +686,8 @@ void VToolUnionDetails::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - domElement.setAttribute(AttrIndexD1, indexD1); - domElement.setAttribute(AttrIndexD2, indexD2); + SetAttribute(domElement, AttrIndexD1, indexD1); + SetAttribute(domElement, AttrIndexD2, indexD2); QDomNode domNode = domElement.firstChild(); domNode = UpdateDetail(domNode, d1); @@ -711,30 +711,30 @@ void VToolUnionDetails::AddNode(QDomElement &domElement, const VNodeDetail &node { QDomElement nod = doc->createElement(TagNode); - AddAttribute(nod, AttrIdObject, node.getId()); - AddAttribute(nod, AttrMx, toMM(node.getMx())); - AddAttribute(nod, AttrMy, toMM(node.getMy())); + SetAttribute(nod, AttrIdObject, node.getId()); + SetAttribute(nod, AttrMx, toMM(node.getMx())); + SetAttribute(nod, AttrMy, toMM(node.getMy())); if (node.getTypeNode() == NodeDetail::Contour) { - AddAttribute(nod, AttrNodeType, NodeTypeContour); + SetAttribute(nod, AttrNodeType, NodeTypeContour); } else { - AddAttribute(nod, AttrNodeType, NodeTypeModeling); + SetAttribute(nod, AttrNodeType, NodeTypeModeling); } switch (node.getTypeTool()) { case (Tool::NodeArc): - AddAttribute(nod, AttrType, QStringLiteral("NodeArc")); + SetAttribute(nod, AttrType, QStringLiteral("NodeArc")); break; case (Tool::NodePoint): - AddAttribute(nod, AttrType, QStringLiteral("NodePoint")); + SetAttribute(nod, AttrType, QStringLiteral("NodePoint")); break; case (Tool::NodeSpline): - AddAttribute(nod, AttrType, QStringLiteral("NodeSpline")); + SetAttribute(nod, AttrType, QStringLiteral("NodeSpline")); break; case (Tool::NodeSplinePath): - AddAttribute(nod, AttrType, QStringLiteral("NodeSplinePath")); + SetAttribute(nod, AttrType, QStringLiteral("NodeSplinePath")); break; default: qWarning()<<"May be wrong tool type!!! Ignoring."<