diff --git a/src/tools/drawTools/vtoolalongline.cpp b/src/tools/drawTools/vtoolalongline.cpp index c8bb272c2..7b2c29892 100644 --- a/src/tools/drawTools/vtoolalongline.cpp +++ b/src/tools/drawTools/vtoolalongline.cpp @@ -43,6 +43,10 @@ VToolAlongLine::VToolAlongLine(VDomDocument *doc, VContainer *data, qint64 id, c { AddToFile(); } + else + { + RefreshDataInFile(); + } } void VToolAlongLine::FullUpdateFromFile() @@ -106,6 +110,22 @@ void VToolAlongLine::AddToFile() AddToCalculation(domElement); } +void VToolAlongLine::RefreshDataInFile() +{ + VPointF point = VAbstractTool::data.GetPoint(id); + 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); + } +} + void VToolAlongLine::RemoveReferens() { doc->DecrementReferens(secondPointId); diff --git a/src/tools/drawTools/vtoolalongline.h b/src/tools/drawTools/vtoolalongline.h index 99dd29f6c..b989b0583 100644 --- a/src/tools/drawTools/vtoolalongline.h +++ b/src/tools/drawTools/vtoolalongline.h @@ -116,6 +116,10 @@ protected: * @brief AddToFile */ virtual void AddToFile(); + /** + * @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them. + */ + virtual void RefreshDataInFile(); /** * @brief RemoveReferens */ diff --git a/src/tools/drawTools/vtoolarc.cpp b/src/tools/drawTools/vtoolarc.cpp index 9951bfcfb..db2f91b10 100644 --- a/src/tools/drawTools/vtoolarc.cpp +++ b/src/tools/drawTools/vtoolarc.cpp @@ -49,6 +49,10 @@ VToolArc::VToolArc(VDomDocument *doc, VContainer *data, qint64 id, const Tool::S { AddToFile(); } + else + { + RefreshDataInFile(); + } } void VToolArc::setDialog() @@ -199,6 +203,19 @@ void VToolArc::AddToFile() AddToCalculation(domElement); } +void VToolArc::RefreshDataInFile() +{ + VArc arc = VAbstractTool::data.GetArc(id); + QDomElement domElement = doc->elementById(QString().setNum(id)); + if (domElement.isElement()) + { + domElement.setAttribute(AttrCenter, arc.GetCenter()); + domElement.setAttribute(AttrRadius, arc.GetFormulaRadius()); + domElement.setAttribute(AttrAngle1, arc.GetFormulaF1()); + domElement.setAttribute(AttrAngle2, arc.GetFormulaF2()); + } +} + void VToolArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { if (event->button() == Qt::LeftButton) diff --git a/src/tools/drawTools/vtoolarc.h b/src/tools/drawTools/vtoolarc.h index 57b940c10..cedeed99a 100644 --- a/src/tools/drawTools/vtoolarc.h +++ b/src/tools/drawTools/vtoolarc.h @@ -125,6 +125,10 @@ protected: * @brief AddToFile */ virtual void AddToFile(); + /** + * @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them. + */ + virtual void RefreshDataInFile(); /** * @brief mouseReleaseEvent * @param event diff --git a/src/tools/drawTools/vtoolbisector.cpp b/src/tools/drawTools/vtoolbisector.cpp index e29886be5..637ed4bdd 100644 --- a/src/tools/drawTools/vtoolbisector.cpp +++ b/src/tools/drawTools/vtoolbisector.cpp @@ -45,6 +45,10 @@ VToolBisector::VToolBisector(VDomDocument *doc, VContainer *data, const qint64 & { AddToFile(); } + else + { + RefreshDataInFile(); + } } QPointF VToolBisector::FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, @@ -204,6 +208,23 @@ void VToolBisector::AddToFile() AddToCalculation(domElement); } +void VToolBisector::RefreshDataInFile() +{ + VPointF point = VAbstractTool::data.GetPoint(id); + 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); + } +} + void VToolBisector::RemoveReferens() { doc->DecrementReferens(firstPointId); diff --git a/src/tools/drawTools/vtoolbisector.h b/src/tools/drawTools/vtoolbisector.h index 824e102aa..a94fc4f2f 100644 --- a/src/tools/drawTools/vtoolbisector.h +++ b/src/tools/drawTools/vtoolbisector.h @@ -129,6 +129,10 @@ protected: * @brief AddToFile */ virtual void AddToFile(); + /** + * @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them. + */ + virtual void RefreshDataInFile(); /** * @brief RemoveReferens */ diff --git a/src/tools/drawTools/vtoolcutspline.cpp b/src/tools/drawTools/vtoolcutspline.cpp index a1c71c1d7..0a62b55ca 100644 --- a/src/tools/drawTools/vtoolcutspline.cpp +++ b/src/tools/drawTools/vtoolcutspline.cpp @@ -58,6 +58,10 @@ VToolCutSpline::VToolCutSpline(VDomDocument *doc, VContainer *data, const qint64 { AddToFile(); } + else + { + RefreshDataInFile(); + } } void VToolCutSpline::setDialog() @@ -222,6 +226,20 @@ void VToolCutSpline::AddToFile() AddToCalculation(domElement); } +void VToolCutSpline::RefreshDataInFile() +{ + VPointF point = VAbstractTool::data.GetPoint(id); + 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); + } +} + void VToolCutSpline::RefreshGeometry() { RefreshSpline(firstSpline, spl1id, SimpleSpline::ForthPoint); diff --git a/src/tools/drawTools/vtoolcutspline.h b/src/tools/drawTools/vtoolcutspline.h index 795fdd34a..65b23dd11 100644 --- a/src/tools/drawTools/vtoolcutspline.h +++ b/src/tools/drawTools/vtoolcutspline.h @@ -119,6 +119,13 @@ protected: * @brief AddToFile */ virtual void AddToFile(); + /** + * @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them. + */ + virtual void RefreshDataInFile(); + /** + * @brief RefreshGeometry + */ void RefreshGeometry(); private: Q_DISABLE_COPY(VToolCutSpline) diff --git a/src/tools/drawTools/vtoolcutsplinepath.cpp b/src/tools/drawTools/vtoolcutsplinepath.cpp index 92bca9703..d563c217f 100644 --- a/src/tools/drawTools/vtoolcutsplinepath.cpp +++ b/src/tools/drawTools/vtoolcutsplinepath.cpp @@ -60,6 +60,10 @@ VToolCutSplinePath::VToolCutSplinePath(VDomDocument *doc, VContainer *data, cons { AddToFile(); } + else + { + RefreshDataInFile(); + } } void VToolCutSplinePath::setDialog() @@ -289,6 +293,20 @@ void VToolCutSplinePath::AddToFile() AddToCalculation(domElement); } +void VToolCutSplinePath::RefreshDataInFile() +{ + VPointF point = VAbstractTool::data.GetPoint(id); + 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); + } +} + void VToolCutSplinePath::RefreshGeometry() { RefreshSpline(firstSpline, splPath1id, SimpleSpline::ForthPoint); diff --git a/src/tools/drawTools/vtoolcutsplinepath.h b/src/tools/drawTools/vtoolcutsplinepath.h index e5a2af1e4..232511d95 100644 --- a/src/tools/drawTools/vtoolcutsplinepath.h +++ b/src/tools/drawTools/vtoolcutsplinepath.h @@ -109,6 +109,13 @@ protected: * @brief AddToFile */ virtual void AddToFile(); + /** + * @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them. + */ + virtual void RefreshDataInFile(); + /** + * @brief RefreshGeometry + */ void RefreshGeometry(); private: Q_DISABLE_COPY(VToolCutSplinePath) diff --git a/src/tools/drawTools/vtoolendline.cpp b/src/tools/drawTools/vtoolendline.cpp index 0f08affbc..bfd8e8085 100644 --- a/src/tools/drawTools/vtoolendline.cpp +++ b/src/tools/drawTools/vtoolendline.cpp @@ -43,6 +43,10 @@ VToolEndLine::VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id { AddToFile(); } + else + { + RefreshDataInFile(); + } } void VToolEndLine::setDialog() @@ -166,3 +170,19 @@ void VToolEndLine::AddToFile() AddToCalculation(domElement); } + +void VToolEndLine::RefreshDataInFile() +{ + VPointF point = VAbstractTool::data.GetPoint(id); + 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); + } +} diff --git a/src/tools/drawTools/vtoolendline.h b/src/tools/drawTools/vtoolendline.h index a43938d7e..32cfe0365 100644 --- a/src/tools/drawTools/vtoolendline.h +++ b/src/tools/drawTools/vtoolendline.h @@ -111,6 +111,10 @@ protected: * @brief AddToFile */ virtual void AddToFile(); + /** + * @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them. + */ + virtual void RefreshDataInFile(); private: /** * @brief dialogEndLine pointer to the dialog diff --git a/src/tools/drawTools/vtoolheight.cpp b/src/tools/drawTools/vtoolheight.cpp index 528f1515c..1d48a7dbf 100644 --- a/src/tools/drawTools/vtoolheight.cpp +++ b/src/tools/drawTools/vtoolheight.cpp @@ -41,6 +41,10 @@ VToolHeight::VToolHeight(VDomDocument *doc, VContainer *data, const qint64 &id, { AddToFile(); } + else + { + RefreshDataInFile(); + } } void VToolHeight::setDialog() @@ -187,3 +191,19 @@ void VToolHeight::AddToFile() AddToCalculation(domElement); } + +void VToolHeight::RefreshDataInFile() +{ + VPointF point = VAbstractTool::data.GetPoint(id); + 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); + } +} diff --git a/src/tools/drawTools/vtoolheight.h b/src/tools/drawTools/vtoolheight.h index 3aa016801..d336f7d2d 100644 --- a/src/tools/drawTools/vtoolheight.h +++ b/src/tools/drawTools/vtoolheight.h @@ -118,6 +118,10 @@ protected: * @brief AddToFile */ virtual void AddToFile(); + /** + * @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them. + */ + virtual void RefreshDataInFile(); private: /** * @brief dialogHeight diff --git a/src/tools/drawTools/vtoolline.cpp b/src/tools/drawTools/vtoolline.cpp index 5b6e0f3bf..8b61e012b 100644 --- a/src/tools/drawTools/vtoolline.cpp +++ b/src/tools/drawTools/vtoolline.cpp @@ -49,6 +49,10 @@ VToolLine::VToolLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firs { AddToFile(); } + else + { + RefreshDataInFile(); + } } void VToolLine::setDialog() @@ -166,6 +170,16 @@ void VToolLine::AddToFile() AddToCalculation(domElement); } +void VToolLine::RefreshDataInFile() +{ + QDomElement domElement = doc->elementById(QString().setNum(id)); + if (domElement.isElement()) + { + domElement.setAttribute(AttrFirstPoint, firstPoint); + domElement.setAttribute(AttrSecondPoint, secondPoint); + } +} + void VToolLine::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); diff --git a/src/tools/drawTools/vtoolline.h b/src/tools/drawTools/vtoolline.h index 80df5efcf..d02b95f03 100644 --- a/src/tools/drawTools/vtoolline.h +++ b/src/tools/drawTools/vtoolline.h @@ -120,6 +120,10 @@ protected: * @brief AddToFile */ virtual void AddToFile(); + /** + * @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them. + */ + virtual void RefreshDataInFile(); /** * @brief hoverMoveEvent * @param event diff --git a/src/tools/drawTools/vtoollineintersect.cpp b/src/tools/drawTools/vtoollineintersect.cpp index 1663b4c71..6db550e12 100644 --- a/src/tools/drawTools/vtoollineintersect.cpp +++ b/src/tools/drawTools/vtoollineintersect.cpp @@ -42,6 +42,10 @@ VToolLineIntersect::VToolLineIntersect(VDomDocument *doc, VContainer *data, cons { AddToFile(); } + else + { + RefreshDataInFile(); + } } void VToolLineIntersect::setDialog() @@ -184,6 +188,22 @@ void VToolLineIntersect::AddToFile() AddToCalculation(domElement); } +void VToolLineIntersect::RefreshDataInFile() +{ + VPointF point = VAbstractTool::data.GetPoint(id); + 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); + } +} + void VToolLineIntersect::RemoveReferens() { doc->DecrementReferens(p1Line1); diff --git a/src/tools/drawTools/vtoollineintersect.h b/src/tools/drawTools/vtoollineintersect.h index 1812d638f..98a90a32e 100644 --- a/src/tools/drawTools/vtoollineintersect.h +++ b/src/tools/drawTools/vtoollineintersect.h @@ -116,6 +116,10 @@ protected: * @brief AddToFile */ virtual void AddToFile(); + /** + * @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them. + */ + virtual void RefreshDataInFile(); /** * @brief RemoveReferens */ diff --git a/src/tools/drawTools/vtoolnormal.cpp b/src/tools/drawTools/vtoolnormal.cpp index 0acb05cdf..d00089f6f 100644 --- a/src/tools/drawTools/vtoolnormal.cpp +++ b/src/tools/drawTools/vtoolnormal.cpp @@ -42,7 +42,10 @@ VToolNormal::VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id, { AddToFile(); } - + else + { + RefreshDataInFile(); + } } void VToolNormal::setDialog() @@ -190,6 +193,23 @@ void VToolNormal::AddToFile() AddToCalculation(domElement); } +void VToolNormal::RefreshDataInFile() +{ + VPointF point = VAbstractTool::data.GetPoint(id); + 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); + } +} + void VToolNormal::RemoveReferens() { doc->DecrementReferens(secondPointId); diff --git a/src/tools/drawTools/vtoolnormal.h b/src/tools/drawTools/vtoolnormal.h index 830eeff5a..61e7fe6fc 100644 --- a/src/tools/drawTools/vtoolnormal.h +++ b/src/tools/drawTools/vtoolnormal.h @@ -130,6 +130,10 @@ protected: * @brief AddToFile */ virtual void AddToFile(); + /** + * @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them. + */ + virtual void RefreshDataInFile(); /** * @brief RemoveReferens */ diff --git a/src/tools/drawTools/vtoolpointofcontact.cpp b/src/tools/drawTools/vtoolpointofcontact.cpp index 9d94bc7e9..f1365103d 100644 --- a/src/tools/drawTools/vtoolpointofcontact.cpp +++ b/src/tools/drawTools/vtoolpointofcontact.cpp @@ -42,6 +42,10 @@ VToolPointOfContact::VToolPointOfContact(VDomDocument *doc, VContainer *data, co { AddToFile(); } + else + { + RefreshDataInFile(); + } } void VToolPointOfContact::setDialog() @@ -207,6 +211,22 @@ void VToolPointOfContact::AddToFile() AddToCalculation(domElement); } +void VToolPointOfContact::RefreshDataInFile() +{ + VPointF point = VAbstractTool::data.GetPoint(id); + 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); + } +} + void VToolPointOfContact::RemoveReferens() { doc->DecrementReferens(center); diff --git a/src/tools/drawTools/vtoolpointofcontact.h b/src/tools/drawTools/vtoolpointofcontact.h index d53113fa2..c38a23bcb 100644 --- a/src/tools/drawTools/vtoolpointofcontact.h +++ b/src/tools/drawTools/vtoolpointofcontact.h @@ -126,6 +126,10 @@ protected: * @brief AddToFile */ virtual void AddToFile(); + /** + * @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them. + */ + virtual void RefreshDataInFile(); /** * @brief RemoveReferens */ diff --git a/src/tools/drawTools/vtoolpointofintersection.cpp b/src/tools/drawTools/vtoolpointofintersection.cpp index dc0d4d7e8..8bec57a1d 100644 --- a/src/tools/drawTools/vtoolpointofintersection.cpp +++ b/src/tools/drawTools/vtoolpointofintersection.cpp @@ -41,6 +41,10 @@ VToolPointOfIntersection::VToolPointOfIntersection(VDomDocument *doc, VContainer { AddToFile(); } + else + { + RefreshDataInFile(); + } } void VToolPointOfIntersection::setDialog() @@ -152,3 +156,17 @@ void VToolPointOfIntersection::AddToFile() AddToCalculation(domElement); } + +void VToolPointOfIntersection::RefreshDataInFile() +{ + VPointF point = VAbstractTool::data.GetPoint(id); + 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); + } +} diff --git a/src/tools/drawTools/vtoolpointofintersection.h b/src/tools/drawTools/vtoolpointofintersection.h index 2aa964adc..f19e8c982 100644 --- a/src/tools/drawTools/vtoolpointofintersection.h +++ b/src/tools/drawTools/vtoolpointofintersection.h @@ -111,6 +111,10 @@ protected: * @brief AddToFile */ virtual void AddToFile(); + /** + * @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them. + */ + virtual void RefreshDataInFile(); private: Q_DISABLE_COPY(VToolPointOfIntersection) /** diff --git a/src/tools/drawTools/vtoolshoulderpoint.cpp b/src/tools/drawTools/vtoolshoulderpoint.cpp index 115cc7b47..adda7877f 100644 --- a/src/tools/drawTools/vtoolshoulderpoint.cpp +++ b/src/tools/drawTools/vtoolshoulderpoint.cpp @@ -42,6 +42,10 @@ VToolShoulderPoint::VToolShoulderPoint(VDomDocument *doc, VContainer *data, cons { AddToFile(); } + else + { + RefreshDataInFile(); + } } void VToolShoulderPoint::setDialog() @@ -211,6 +215,23 @@ void VToolShoulderPoint::AddToFile() AddToCalculation(domElement); } +void VToolShoulderPoint::RefreshDataInFile() +{ + VPointF point = VAbstractTool::data.GetPoint(id); + 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); + } +} + void VToolShoulderPoint::RemoveReferens() { doc->DecrementReferens(p2Line); diff --git a/src/tools/drawTools/vtoolshoulderpoint.h b/src/tools/drawTools/vtoolshoulderpoint.h index a6f9faf1a..95c0565cd 100644 --- a/src/tools/drawTools/vtoolshoulderpoint.h +++ b/src/tools/drawTools/vtoolshoulderpoint.h @@ -128,6 +128,10 @@ protected: * @brief AddToFile */ virtual void AddToFile(); + /** + * @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them. + */ + virtual void RefreshDataInFile(); /** * @brief RemoveReferens */ diff --git a/src/tools/drawTools/vtoolsinglepoint.cpp b/src/tools/drawTools/vtoolsinglepoint.cpp index b8f56cf21..cd70c474b 100644 --- a/src/tools/drawTools/vtoolsinglepoint.cpp +++ b/src/tools/drawTools/vtoolsinglepoint.cpp @@ -41,6 +41,10 @@ VToolSinglePoint::VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64 { AddToFile(); } + else + { + RefreshDataInFile(); + } } void VToolSinglePoint::setDialog() @@ -66,6 +70,20 @@ void VToolSinglePoint::AddToFile() AddToCalculation(domElement); } +void VToolSinglePoint::RefreshDataInFile() +{ + VPointF point = VAbstractTool::data.GetPoint(id); + 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()))); + } +} + QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) { if (change == ItemPositionChange && scene()) diff --git a/src/tools/drawTools/vtoolsinglepoint.h b/src/tools/drawTools/vtoolsinglepoint.h index 8079d2ce7..837c27748 100644 --- a/src/tools/drawTools/vtoolsinglepoint.h +++ b/src/tools/drawTools/vtoolsinglepoint.h @@ -92,6 +92,10 @@ protected: * @brief AddToFile */ virtual void AddToFile(); + /** + * @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them. + */ + virtual void RefreshDataInFile(); /** * @brief itemChange * @param change diff --git a/src/tools/drawTools/vtoolspline.cpp b/src/tools/drawTools/vtoolspline.cpp index b1ab4c6dd..f7534aeec 100644 --- a/src/tools/drawTools/vtoolspline.cpp +++ b/src/tools/drawTools/vtoolspline.cpp @@ -68,6 +68,10 @@ VToolSpline::VToolSpline(VDomDocument *doc, VContainer *data, qint64 id, const T { AddToFile(); } + else + { + RefreshDataInFile(); + } } void VToolSpline::setDialog() @@ -222,6 +226,22 @@ void VToolSpline::AddToFile() AddToCalculation(domElement); } +void VToolSpline::RefreshDataInFile() +{ + VSpline spl = VAbstractTool::data.GetSpline(id); + QDomElement domElement = doc->elementById(QString().setNum(id)); + if (domElement.isElement()) + { + domElement.setAttribute(AttrPoint1, QString().setNum(spl.GetP1())); + domElement.setAttribute(AttrPoint4, QString().setNum(spl.GetP4())); + 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())); + } +} + void VToolSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { if (event->button() == Qt::LeftButton) diff --git a/src/tools/drawTools/vtoolspline.h b/src/tools/drawTools/vtoolspline.h index cf0aeaf8e..d4133e8ac 100644 --- a/src/tools/drawTools/vtoolspline.h +++ b/src/tools/drawTools/vtoolspline.h @@ -153,6 +153,10 @@ protected: * @brief AddToFile */ virtual void AddToFile (); + /** + * @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them. + */ + virtual void RefreshDataInFile(); /** * @brief mouseReleaseEvent * @param event diff --git a/src/tools/drawTools/vtoolsplinepath.cpp b/src/tools/drawTools/vtoolsplinepath.cpp index bd656dc79..25f9ee03e 100644 --- a/src/tools/drawTools/vtoolsplinepath.cpp +++ b/src/tools/drawTools/vtoolsplinepath.cpp @@ -69,6 +69,10 @@ VToolSplinePath::VToolSplinePath(VDomDocument *doc, VContainer *data, qint64 id, { AddToFile(); } + else + { + RefreshDataInFile(); + } } void VToolSplinePath::setDialog() @@ -271,6 +275,39 @@ void VToolSplinePath::AddToFile() AddToCalculation(domElement); } +void VToolSplinePath::RefreshDataInFile() +{ + VSplinePath splPath = VAbstractTool::data.GetSplinePath(id); + for (qint32 i = 1; i<=splPath.Count(); ++i) + { + VSpline spl = splPath.GetSpline(i); + qint32 j = i*2; + disconnect(controlPoints[j-2], &VControlPointSpline::ControlPointChangePosition, this, + &VToolSplinePath::ControlPointChangePosition); + disconnect(controlPoints[j-1], &VControlPointSpline::ControlPointChangePosition, this, + &VToolSplinePath::ControlPointChangePosition); + controlPoints[j-2]->setPos(spl.GetP2()); + controlPoints[j-1]->setPos(spl.GetP3()); + connect(controlPoints[j-2], &VControlPointSpline::ControlPointChangePosition, this, + &VToolSplinePath::ControlPointChangePosition); + connect(controlPoints[j-1], &VControlPointSpline::ControlPointChangePosition, this, + &VToolSplinePath::ControlPointChangePosition); + + spl = VSpline (VAbstractTool::data.DataPoints(), spl.GetP1(), controlPoints[j-2]->pos(), + controlPoints[j-1]->pos(), spl.GetP4(), splPath.getKCurve()); + CorectControlPoints(spl, splPath, i); + CorectControlPoints(spl, splPath, i); + + QDomElement domElement = doc->elementById(QString().setNum(id)); + if (domElement.isElement()) + { + domElement.setAttribute(AttrKCurve, QString().setNum(splPath.getKCurve())); + UpdatePathPoint(domElement, splPath); + } + + } +} + void VToolSplinePath::AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint) { QDomElement pathPoint = doc->createElement(AttrPathPoint); diff --git a/src/tools/drawTools/vtoolsplinepath.h b/src/tools/drawTools/vtoolsplinepath.h index 5f20851c4..2febbba44 100644 --- a/src/tools/drawTools/vtoolsplinepath.h +++ b/src/tools/drawTools/vtoolsplinepath.h @@ -145,6 +145,10 @@ protected: * @brief AddToFile */ virtual void AddToFile(); + /** + * @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them. + */ + virtual void RefreshDataInFile(); /** * @brief mouseReleaseEvent * @param event diff --git a/src/tools/drawTools/vtooltriangle.cpp b/src/tools/drawTools/vtooltriangle.cpp index e313a659f..fcd425df6 100644 --- a/src/tools/drawTools/vtooltriangle.cpp +++ b/src/tools/drawTools/vtooltriangle.cpp @@ -41,6 +41,10 @@ VToolTriangle::VToolTriangle(VDomDocument *doc, VContainer *data, const qint64 & { AddToFile(); } + else + { + RefreshDataInFile(); + } } void VToolTriangle::setDialog() @@ -212,3 +216,19 @@ void VToolTriangle::AddToFile() AddToCalculation(domElement); } + +void VToolTriangle::RefreshDataInFile() +{ + VPointF point = VAbstractTool::data.GetPoint(id); + 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, QString().setNum(axisP1Id)); + domElement.setAttribute(AttrAxisP2, QString().setNum(axisP2Id)); + domElement.setAttribute(AttrFirstPoint, QString().setNum(firstPointId)); + domElement.setAttribute(AttrSecondPoint, QString().setNum(secondPointId)); + } +} diff --git a/src/tools/drawTools/vtooltriangle.h b/src/tools/drawTools/vtooltriangle.h index 5a9543cde..e6d13c8af 100644 --- a/src/tools/drawTools/vtooltriangle.h +++ b/src/tools/drawTools/vtooltriangle.h @@ -125,6 +125,10 @@ protected: * @brief AddToFile */ virtual void AddToFile(); + /** + * @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them. + */ + virtual void RefreshDataInFile(); private: Q_DISABLE_COPY(VToolTriangle) /** diff --git a/src/tools/nodeDetails/vnodearc.cpp b/src/tools/nodeDetails/vnodearc.cpp index e6edbd547..0d58f0b07 100644 --- a/src/tools/nodeDetails/vnodearc.cpp +++ b/src/tools/nodeDetails/vnodearc.cpp @@ -44,6 +44,10 @@ VNodeArc::VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, { AddToFile(); } + else + { + RefreshDataInFile(); + } } void VNodeArc::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, const Document::Documents &parse, @@ -78,6 +82,15 @@ void VNodeArc::AddToFile() AddToModeling(domElement); } +void VNodeArc::RefreshDataInFile() +{ + QDomElement domElement = doc->elementById(QString().setNum(id)); + if (domElement.isElement()) + { + domElement.setAttribute(AttrIdObject, QString().setNum(idNode)); + } +} + void VNodeArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { if (event->button() == Qt::LeftButton) diff --git a/src/tools/nodeDetails/vnodearc.h b/src/tools/nodeDetails/vnodearc.h index 571687551..5693fd307 100644 --- a/src/tools/nodeDetails/vnodearc.h +++ b/src/tools/nodeDetails/vnodearc.h @@ -79,6 +79,10 @@ protected: * @brief AddToFile */ virtual void AddToFile(); + /** + * @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them. + */ + virtual void RefreshDataInFile(); /** * @brief mouseReleaseEvent * @param event diff --git a/src/tools/nodeDetails/vnodepoint.cpp b/src/tools/nodeDetails/vnodepoint.cpp index dc7e8f293..8ab9c79de 100644 --- a/src/tools/nodeDetails/vnodepoint.cpp +++ b/src/tools/nodeDetails/vnodepoint.cpp @@ -51,6 +51,10 @@ VNodePoint::VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 id { AddToFile(); } + else + { + RefreshDataInFile(); + } } void VNodePoint::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, @@ -88,6 +92,18 @@ void VNodePoint::AddToFile() AddToModeling(domElement); } +void VNodePoint::RefreshDataInFile() +{ + VPointF point = VAbstractTool::data.GetPoint(id); + QDomElement domElement = doc->elementById(QString().setNum(id)); + if (domElement.isElement()) + { + domElement.setAttribute(AttrIdObject, QString().setNum(idNode)); + domElement.setAttribute(AttrMx, QString().setNum(toMM(point.mx()))); + domElement.setAttribute(AttrMy, QString().setNum(toMM(point.my()))); + } +} + void VNodePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { if (event->button() == Qt::LeftButton) diff --git a/src/tools/nodeDetails/vnodepoint.h b/src/tools/nodeDetails/vnodepoint.h index e724430a0..f2616fbac 100644 --- a/src/tools/nodeDetails/vnodepoint.h +++ b/src/tools/nodeDetails/vnodepoint.h @@ -96,6 +96,10 @@ protected: * @brief AddToFile */ virtual void AddToFile(); + /** + * @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them. + */ + virtual void RefreshDataInFile(); /** * @brief mouseReleaseEvent * @param event diff --git a/src/tools/nodeDetails/vnodespline.cpp b/src/tools/nodeDetails/vnodespline.cpp index c95ab9684..9934f2ca5 100644 --- a/src/tools/nodeDetails/vnodespline.cpp +++ b/src/tools/nodeDetails/vnodespline.cpp @@ -44,6 +44,10 @@ VNodeSpline::VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 { AddToFile(); } + else + { + RefreshDataInFile(); + } } VNodeSpline *VNodeSpline::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, @@ -79,6 +83,15 @@ void VNodeSpline::AddToFile() AddToModeling(domElement); } +void VNodeSpline::RefreshDataInFile() +{ + QDomElement domElement = doc->elementById(QString().setNum(id)); + if (domElement.isElement()) + { + domElement.setAttribute(AttrIdObject, QString().setNum(idNode)); + } +} + void VNodeSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { if (event->button() == Qt::LeftButton) diff --git a/src/tools/nodeDetails/vnodespline.h b/src/tools/nodeDetails/vnodespline.h index 0e4b64837..e3ac4b963 100644 --- a/src/tools/nodeDetails/vnodespline.h +++ b/src/tools/nodeDetails/vnodespline.h @@ -80,6 +80,10 @@ protected: * @brief AddToFile */ virtual void AddToFile (); + /** + * @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them. + */ + virtual void RefreshDataInFile(); /** * @brief mouseReleaseEvent * @param event diff --git a/src/tools/nodeDetails/vnodesplinepath.cpp b/src/tools/nodeDetails/vnodesplinepath.cpp index 997e3d556..6be0872fa 100644 --- a/src/tools/nodeDetails/vnodesplinepath.cpp +++ b/src/tools/nodeDetails/vnodesplinepath.cpp @@ -44,6 +44,10 @@ VNodeSplinePath::VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, { AddToFile(); } + else + { + RefreshDataInFile(); + } } void VNodeSplinePath::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, @@ -83,6 +87,15 @@ void VNodeSplinePath::AddToFile() AddToModeling(domElement); } +void VNodeSplinePath::RefreshDataInFile() +{ + QDomElement domElement = doc->elementById(QString().setNum(id)); + if (domElement.isElement()) + { + domElement.setAttribute(AttrIdObject, QString().setNum(idNode)); + } +} + void VNodeSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { if (event->button() == Qt::LeftButton) diff --git a/src/tools/nodeDetails/vnodesplinepath.h b/src/tools/nodeDetails/vnodesplinepath.h index b82e365e8..840f7dc5f 100644 --- a/src/tools/nodeDetails/vnodesplinepath.h +++ b/src/tools/nodeDetails/vnodesplinepath.h @@ -79,6 +79,10 @@ protected: * @brief AddToFile */ virtual void AddToFile(); + /** + * @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them. + */ + virtual void RefreshDataInFile(); /** * @brief mouseReleaseEvent * @param event diff --git a/src/tools/vabstracttool.h b/src/tools/vabstracttool.h index 038b3e2d4..e7950b4f0 100644 --- a/src/tools/vabstracttool.h +++ b/src/tools/vabstracttool.h @@ -285,6 +285,10 @@ protected: * @brief AddToFile */ virtual void AddToFile()=0; + /** + * @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them. + */ + virtual void RefreshDataInFile()=0; /** * @brief getData * @return diff --git a/src/tools/vtooldetail.cpp b/src/tools/vtooldetail.cpp index 5b30f986c..28c29e845 100644 --- a/src/tools/vtooldetail.cpp +++ b/src/tools/vtooldetail.cpp @@ -215,6 +215,24 @@ void VToolDetail::AddToFile() } } +void VToolDetail::RefreshDataInFile() +{ + QDomElement domElement = doc->elementById(QString().setNum(id)); + 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())); + RemoveAllChild(domElement); + for (ptrdiff_t i = 0; i < det.CountNode(); ++i) + { + AddNode(domElement, det[i]); + } + } +} + QVariant VToolDetail::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) { if (change == ItemPositionHasChanged && scene()) diff --git a/src/tools/vtooldetail.h b/src/tools/vtooldetail.h index 571d13c05..65cfcaf37 100644 --- a/src/tools/vtooldetail.h +++ b/src/tools/vtooldetail.h @@ -156,6 +156,10 @@ protected: * @brief AddToFile */ virtual void AddToFile (); + /** + * @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them. + */ + virtual void RefreshDataInFile(); /** * @brief itemChange * @param change