diff --git a/src/app/tools/drawTools/vabstractspline.cpp b/src/app/tools/drawTools/vabstractspline.cpp index 94df69d36..385622c0c 100644 --- a/src/app/tools/drawTools/vabstractspline.cpp +++ b/src/app/tools/drawTools/vabstractspline.cpp @@ -68,6 +68,7 @@ QString VAbstractSpline::getTagName() const */ void VAbstractSpline::FullUpdateFromFile() { + ReadAttributes(); RefreshGeometry(); } @@ -212,6 +213,12 @@ QPainterPath VAbstractSpline::ToolPath(PathDirection direction) const return path; } +//--------------------------------------------------------------------------------------------------------------------- +void VAbstractSpline::ReadToolAttributes(const QDomElement &domElement) +{ + lineColor = doc->GetParametrString(domElement, AttrColor, ColorBlack); +} + //--------------------------------------------------------------------------------------------------------------------- void VAbstractSpline::ShowFoot(bool show) { diff --git a/src/app/tools/drawTools/vabstractspline.h b/src/app/tools/drawTools/vabstractspline.h index 3476081cf..b1e5cdd05 100644 --- a/src/app/tools/drawTools/vabstractspline.h +++ b/src/app/tools/drawTools/vabstractspline.h @@ -86,6 +86,7 @@ protected: virtual void keyReleaseEvent(QKeyEvent * event); virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); QPainterPath ToolPath(PathDirection direction = PathDirection::Hide) const; + virtual void ReadToolAttributes(const QDomElement &domElement); private: Q_DISABLE_COPY(VAbstractSpline) }; diff --git a/src/app/tools/drawTools/vdrawtool.cpp b/src/app/tools/drawTools/vdrawtool.cpp index 765af4cea..70b538e86 100644 --- a/src/app/tools/drawTools/vdrawtool.cpp +++ b/src/app/tools/drawTools/vdrawtool.cpp @@ -158,7 +158,7 @@ void VDrawTool::RefreshDataInFile() } else { - qDebug()<<"Can't find tool with id ="<< id << Q_FUNC_INFO; + qCDebug(vTool)<<"Can't find tool with id ="<< id << Q_FUNC_INFO; } } @@ -175,6 +175,20 @@ QColor VDrawTool::CorrectColor(const QColor &color) const } } +//--------------------------------------------------------------------------------------------------------------------- +void VDrawTool::ReadAttributes() +{ + const QDomElement domElement = doc->elementById(QString().setNum(id)); + if (domElement.isElement()) + { + ReadToolAttributes(domElement); + } + else + { + qCDebug(vTool)<<"Can't find tool with id ="<< id << Q_FUNC_INFO; + } +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief DialogLinkDestroy removes dialog pointer diff --git a/src/app/tools/drawTools/vdrawtool.h b/src/app/tools/drawTools/vdrawtool.h index 40dc27722..1e4025f70 100644 --- a/src/app/tools/drawTools/vdrawtool.h +++ b/src/app/tools/drawTools/vdrawtool.h @@ -97,6 +97,9 @@ protected: virtual void RefreshDataInFile(); QColor CorrectColor(const QColor &color) const; + void ReadAttributes(); + virtual void ReadToolAttributes(const QDomElement &domElement)=0; + template /** * @brief ContextMenu show context menu for tool. diff --git a/src/app/tools/drawTools/vtoolalongline.cpp b/src/app/tools/drawTools/vtoolalongline.cpp index ec04e8c46..27c624a55 100644 --- a/src/app/tools/drawTools/vtoolalongline.cpp +++ b/src/app/tools/drawTools/vtoolalongline.cpp @@ -71,14 +71,7 @@ VToolAlongLine::VToolAlongLine(VPattern *doc, VContainer *data, quint32 id, cons */ void VToolAlongLine::FullUpdateFromFile() { - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - typeLine = domElement.attribute(AttrTypeLine, ""); - formulaLength = domElement.attribute(AttrLength, ""); - basePointId = domElement.attribute(AttrFirstPoint, "").toUInt(); - secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt(); - } + ReadAttributes(); RefreshGeometry(); if (vis != nullptr) @@ -168,6 +161,16 @@ void VToolAlongLine::SaveOptions(QDomElement &tag, QSharedPointer &obj doc->SetAttribute(tag, AttrSecondPoint, secondPointId); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolAlongLine::ReadToolAttributes(const QDomElement &domElement) +{ + typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine); + lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack); + formulaLength = doc->GetParametrString(domElement, AttrLength, ""); + basePointId = doc->GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR); + secondPointId = doc->GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR); +} + //--------------------------------------------------------------------------------------------------------------------- quint32 VToolAlongLine::GetSecondPointId() const { @@ -232,6 +235,7 @@ void VToolAlongLine::setDialog() SCASSERT(dialogTool != nullptr); const QSharedPointer p = VAbstractTool::data.GeometricObject(id); dialogTool->SetTypeLine(typeLine); + dialogTool->SetLineColor(lineColor); dialogTool->SetFormula(formulaLength); dialogTool->SetFirstPointId(basePointId); dialogTool->SetSecondPointId(secondPointId); diff --git a/src/app/tools/drawTools/vtoolalongline.h b/src/app/tools/drawTools/vtoolalongline.h index f83355a94..1ece5bf76 100644 --- a/src/app/tools/drawTools/vtoolalongline.h +++ b/src/app/tools/drawTools/vtoolalongline.h @@ -64,6 +64,7 @@ protected: virtual void RemoveReferens(); virtual void SaveDialog(QDomElement &domElement); virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj); + virtual void ReadToolAttributes(const QDomElement &domElement); private: /** @brief secondPointId id second point of line. */ quint32 secondPointId; diff --git a/src/app/tools/drawTools/vtoolarc.cpp b/src/app/tools/drawTools/vtoolarc.cpp index 6363d017b..e4509da86 100644 --- a/src/app/tools/drawTools/vtoolarc.cpp +++ b/src/app/tools/drawTools/vtoolarc.cpp @@ -82,6 +82,7 @@ void VToolArc::setDialog() dialogTool->SetF1(arc->GetFormulaF1()); dialogTool->SetF2(arc->GetFormulaF2()); dialogTool->SetRadius(arc->GetFormulaRadius()); + dialogTool->SetColor(lineColor); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/tools/drawTools/vtoolbisector.cpp b/src/app/tools/drawTools/vtoolbisector.cpp index 81d9011af..580a84872 100644 --- a/src/app/tools/drawTools/vtoolbisector.cpp +++ b/src/app/tools/drawTools/vtoolbisector.cpp @@ -113,6 +113,7 @@ void VToolBisector::setDialog() SCASSERT(dialogTool != nullptr); const QSharedPointer p = VAbstractTool::data.GeometricObject(id); dialogTool->SetTypeLine(typeLine); + dialogTool->SetLineColor(lineColor); dialogTool->SetFormula(formulaLength); dialogTool->SetFirstPointId(firstPointId); dialogTool->SetSecondPointId(basePointId); @@ -221,15 +222,7 @@ VToolBisector* VToolBisector::Create(const quint32 _id, QString &formula, const */ void VToolBisector::FullUpdateFromFile() { - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - typeLine = domElement.attribute(AttrTypeLine, ""); - formulaLength = domElement.attribute(AttrLength, ""); - firstPointId = domElement.attribute(AttrFirstPoint, "").toUInt(); - basePointId = domElement.attribute(AttrSecondPoint, "").toUInt(); - thirdPointId = domElement.attribute(AttrThirdPoint, "").toUInt(); - } + ReadAttributes(); RefreshGeometry(); if (vis != nullptr) @@ -322,6 +315,17 @@ void VToolBisector::SaveOptions(QDomElement &tag, QSharedPointer &obj) doc->SetAttribute(tag, AttrThirdPoint, thirdPointId); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolBisector::ReadToolAttributes(const QDomElement &domElement) +{ + typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine); + lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack); + formulaLength = doc->GetParametrString(domElement, AttrLength, ""); + firstPointId = doc->GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR); + basePointId = doc->GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR); + thirdPointId = doc->GetParametrUInt(domElement, AttrThirdPoint, NULL_ID_STR); +} + //--------------------------------------------------------------------------------------------------------------------- quint32 VToolBisector::GetThirdPointId() const { diff --git a/src/app/tools/drawTools/vtoolbisector.h b/src/app/tools/drawTools/vtoolbisector.h index 93aa64302..9d5ab776f 100644 --- a/src/app/tools/drawTools/vtoolbisector.h +++ b/src/app/tools/drawTools/vtoolbisector.h @@ -72,6 +72,7 @@ protected: virtual void RemoveReferens(); virtual void SaveDialog(QDomElement &domElement); virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj); + virtual void ReadToolAttributes(const QDomElement &domElement); private: /** @brief firstPointId id first point of angle. */ quint32 firstPointId; diff --git a/src/app/tools/drawTools/vtoolcurveintersectaxis.cpp b/src/app/tools/drawTools/vtoolcurveintersectaxis.cpp index e3cce5d22..e2953eaf5 100644 --- a/src/app/tools/drawTools/vtoolcurveintersectaxis.cpp +++ b/src/app/tools/drawTools/vtoolcurveintersectaxis.cpp @@ -67,6 +67,7 @@ void VToolCurveIntersectAxis::setDialog() SCASSERT(dialogTool != nullptr); const QSharedPointer p = VAbstractTool::data.GeometricObject(id); dialogTool->SetTypeLine(typeLine); + dialogTool->SetLineColor(lineColor); dialogTool->SetAngle(formulaAngle); dialogTool->SetBasePointId(basePointId); dialogTool->setCurveId(curveId); @@ -250,14 +251,7 @@ void VToolCurveIntersectAxis::ShowVisualization(bool show) //--------------------------------------------------------------------------------------------------------------------- void VToolCurveIntersectAxis::FullUpdateFromFile() { - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - typeLine = domElement.attribute(AttrTypeLine, ""); - basePointId = domElement.attribute(AttrBasePoint, "").toUInt(); - curveId = domElement.attribute(AttrCurve, "").toUInt(); - formulaAngle = domElement.attribute(AttrAngle, ""); - } + ReadAttributes(); RefreshGeometry(); if (vis != nullptr) @@ -313,3 +307,13 @@ void VToolCurveIntersectAxis::SaveOptions(QDomElement &tag, QSharedPointerSetAttribute(tag, AttrBasePoint, basePointId); doc->SetAttribute(tag, AttrCurve, curveId); } + +//--------------------------------------------------------------------------------------------------------------------- +void VToolCurveIntersectAxis::ReadToolAttributes(const QDomElement &domElement) +{ + typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine); + lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack); + basePointId = doc->GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR); + curveId = doc->GetParametrUInt(domElement, AttrCurve, NULL_ID_STR); + formulaAngle = doc->GetParametrString(domElement, AttrAngle, ""); +} diff --git a/src/app/tools/drawTools/vtoolcurveintersectaxis.h b/src/app/tools/drawTools/vtoolcurveintersectaxis.h index bf583f3f5..768fe5ac1 100644 --- a/src/app/tools/drawTools/vtoolcurveintersectaxis.h +++ b/src/app/tools/drawTools/vtoolcurveintersectaxis.h @@ -68,6 +68,7 @@ protected: virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void SaveDialog(QDomElement &domElement); virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj); + virtual void ReadToolAttributes(const QDomElement &domElement); private: Q_DISABLE_COPY(VToolCurveIntersectAxis) QString formulaAngle; diff --git a/src/app/tools/drawTools/vtoolcut.cpp b/src/app/tools/drawTools/vtoolcut.cpp index 78544c8b1..a7ab6c27a 100644 --- a/src/app/tools/drawTools/vtoolcut.cpp +++ b/src/app/tools/drawTools/vtoolcut.cpp @@ -150,5 +150,4 @@ void VToolCut::FullUpdateCurveFromFile(const QString &attrCurve) formula = domElement.attribute(AttrLength, ""); curveCutId = domElement.attribute(attrCurve, "").toUInt(); } - RefreshGeometry(); } diff --git a/src/app/tools/drawTools/vtoolcutarc.cpp b/src/app/tools/drawTools/vtoolcutarc.cpp index b99bad029..fe3c0731e 100644 --- a/src/app/tools/drawTools/vtoolcutarc.cpp +++ b/src/app/tools/drawTools/vtoolcutarc.cpp @@ -220,7 +220,8 @@ void VToolCutArc::ShowVisualization(bool show) */ void VToolCutArc::FullUpdateFromFile() { - FullUpdateCurveFromFile(AttrArc); + ReadAttributes(); + RefreshGeometry(); if (vis != nullptr) { @@ -315,3 +316,10 @@ void VToolCutArc::SaveOptions(QDomElement &tag, QSharedPointer &obj) doc->SetAttribute(tag, AttrLength, formula); doc->SetAttribute(tag, AttrArc, curveCutId); } + +//--------------------------------------------------------------------------------------------------------------------- +void VToolCutArc::ReadToolAttributes(const QDomElement &domElement) +{ + formula = doc->GetParametrString(domElement, AttrLength, ""); + curveCutId = doc->GetParametrUInt(domElement, AttrArc, NULL_ID_STR); +} diff --git a/src/app/tools/drawTools/vtoolcutarc.h b/src/app/tools/drawTools/vtoolcutarc.h index 2e852cdca..e8a5cf75f 100644 --- a/src/app/tools/drawTools/vtoolcutarc.h +++ b/src/app/tools/drawTools/vtoolcutarc.h @@ -61,6 +61,7 @@ protected: virtual void RefreshCurve(VSimpleCurve *curve, quint32 curveId, SimpleCurvePoint curvePosition, PathDirection direction = PathDirection::Hide); virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj); + virtual void ReadToolAttributes(const QDomElement &domElement); private: Q_DISABLE_COPY(VToolCutArc) }; diff --git a/src/app/tools/drawTools/vtoolcutspline.cpp b/src/app/tools/drawTools/vtoolcutspline.cpp index edab6ce3e..f8ced20b6 100644 --- a/src/app/tools/drawTools/vtoolcutspline.cpp +++ b/src/app/tools/drawTools/vtoolcutspline.cpp @@ -231,7 +231,8 @@ void VToolCutSpline::ShowVisualization(bool show) */ void VToolCutSpline::FullUpdateFromFile() { - FullUpdateCurveFromFile(AttrSpline); + ReadAttributes(); + RefreshGeometry(); if (vis != nullptr) { @@ -326,3 +327,10 @@ void VToolCutSpline::SaveOptions(QDomElement &tag, QSharedPointer &obj doc->SetAttribute(tag, AttrLength, formula); doc->SetAttribute(tag, AttrSpline, curveCutId); } + +//--------------------------------------------------------------------------------------------------------------------- +void VToolCutSpline::ReadToolAttributes(const QDomElement &domElement) +{ + formula = doc->GetParametrString(domElement, AttrLength, ""); + curveCutId = doc->GetParametrUInt(domElement, AttrSpline, NULL_ID_STR); +} diff --git a/src/app/tools/drawTools/vtoolcutspline.h b/src/app/tools/drawTools/vtoolcutspline.h index d1b184edc..90e576009 100644 --- a/src/app/tools/drawTools/vtoolcutspline.h +++ b/src/app/tools/drawTools/vtoolcutspline.h @@ -62,6 +62,7 @@ protected: virtual void RefreshCurve(VSimpleCurve *curve, quint32 curveId, SimpleCurvePoint curvePosition, PathDirection direction = PathDirection::Hide); virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj); + virtual void ReadToolAttributes(const QDomElement &domElement); private: Q_DISABLE_COPY(VToolCutSpline) }; diff --git a/src/app/tools/drawTools/vtoolcutsplinepath.cpp b/src/app/tools/drawTools/vtoolcutsplinepath.cpp index 98f1d820f..605e33f17 100644 --- a/src/app/tools/drawTools/vtoolcutsplinepath.cpp +++ b/src/app/tools/drawTools/vtoolcutsplinepath.cpp @@ -280,7 +280,8 @@ void VToolCutSplinePath::ShowVisualization(bool show) */ void VToolCutSplinePath::FullUpdateFromFile() { - FullUpdateCurveFromFile(AttrSplinePath); + ReadAttributes(); + RefreshGeometry(); if (vis != nullptr) { @@ -377,3 +378,10 @@ void VToolCutSplinePath::SaveOptions(QDomElement &tag, QSharedPointer doc->SetAttribute(tag, AttrLength, formula); doc->SetAttribute(tag, AttrSplinePath, curveCutId); } + +//--------------------------------------------------------------------------------------------------------------------- +void VToolCutSplinePath::ReadToolAttributes(const QDomElement &domElement) +{ + formula = doc->GetParametrString(domElement, AttrLength, ""); + curveCutId = doc->GetParametrUInt(domElement, AttrSplinePath, NULL_ID_STR); +} diff --git a/src/app/tools/drawTools/vtoolcutsplinepath.h b/src/app/tools/drawTools/vtoolcutsplinepath.h index 6f5db493c..05cdf22df 100644 --- a/src/app/tools/drawTools/vtoolcutsplinepath.h +++ b/src/app/tools/drawTools/vtoolcutsplinepath.h @@ -64,6 +64,7 @@ protected: virtual void RefreshCurve(VSimpleCurve *curve, quint32 curveId, SimpleCurvePoint curvePosition, PathDirection direction = PathDirection::Hide); virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj); + virtual void ReadToolAttributes(const QDomElement &domElement); private: Q_DISABLE_COPY(VToolCutSplinePath) }; diff --git a/src/app/tools/drawTools/vtoolendline.cpp b/src/app/tools/drawTools/vtoolendline.cpp index 05dd4b4f3..76efe667f 100644 --- a/src/app/tools/drawTools/vtoolendline.cpp +++ b/src/app/tools/drawTools/vtoolendline.cpp @@ -80,6 +80,7 @@ void VToolEndLine::setDialog() SCASSERT(dialogTool != nullptr); const QSharedPointer p = VAbstractTool::data.GeometricObject(id); dialogTool->SetTypeLine(typeLine); + dialogTool->SetLineColor(lineColor); dialogTool->SetFormula(formulaLength); dialogTool->SetAngle(formulaAngle); dialogTool->SetBasePointId(basePointId); @@ -181,14 +182,7 @@ VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName, */ void VToolEndLine::FullUpdateFromFile() { - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - typeLine = domElement.attribute(AttrTypeLine, ""); - formulaLength = domElement.attribute(AttrLength, ""); - basePointId = domElement.attribute(AttrBasePoint, "").toUInt(); - formulaAngle = domElement.attribute(AttrAngle, ""); - } + ReadAttributes(); RefreshGeometry(); if (vis != nullptr) @@ -233,6 +227,7 @@ void VToolEndLine::SaveDialog(QDomElement &domElement) SCASSERT(dialogTool != nullptr); doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine()); + doc->SetAttribute(domElement, AttrLineColor, dialogTool->GetLineColor()); doc->SetAttribute(domElement, AttrLength, dialogTool->GetFormula()); doc->SetAttribute(domElement, AttrAngle, dialogTool->GetAngle()); doc->SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogTool->GetBasePointId())); @@ -251,11 +246,22 @@ void VToolEndLine::SaveOptions(QDomElement &tag, QSharedPointer &obj) doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my())); doc->SetAttribute(tag, AttrTypeLine, typeLine); + doc->SetAttribute(tag, AttrLineColor, lineColor); doc->SetAttribute(tag, AttrLength, formulaLength); doc->SetAttribute(tag, AttrAngle, formulaAngle); doc->SetAttribute(tag, AttrBasePoint, basePointId); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolEndLine::ReadToolAttributes(const QDomElement &domElement) +{ + typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine); + lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack); + formulaLength = doc->GetParametrString(domElement, AttrLength, ""); + basePointId = doc->GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR); + formulaAngle = doc->GetParametrString(domElement, AttrAngle, ""); +} + //--------------------------------------------------------------------------------------------------------------------- VFormula VToolEndLine::GetFormulaAngle() const { diff --git a/src/app/tools/drawTools/vtoolendline.h b/src/app/tools/drawTools/vtoolendline.h index b92500f39..b0529de0a 100644 --- a/src/app/tools/drawTools/vtoolendline.h +++ b/src/app/tools/drawTools/vtoolendline.h @@ -63,6 +63,7 @@ protected: virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void SaveDialog(QDomElement &domElement); virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj); + virtual void ReadToolAttributes(const QDomElement &domElement); private: QString formulaAngle; }; diff --git a/src/app/tools/drawTools/vtoolheight.cpp b/src/app/tools/drawTools/vtoolheight.cpp index 583d5e136..29742d1f3 100644 --- a/src/app/tools/drawTools/vtoolheight.cpp +++ b/src/app/tools/drawTools/vtoolheight.cpp @@ -73,6 +73,7 @@ void VToolHeight::setDialog() SCASSERT(dialogTool != nullptr); const QSharedPointer p = VAbstractTool::data.GeometricObject(id); dialogTool->SetTypeLine(typeLine); + dialogTool->SetLineColor(lineColor); dialogTool->SetBasePointId(basePointId); dialogTool->SetP1LineId(p1LineId); dialogTool->SetP2LineId(p2LineId); @@ -193,14 +194,7 @@ QPointF VToolHeight::FindPoint(const QLineF &line, const QPointF &point) */ void VToolHeight::FullUpdateFromFile() { - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - typeLine = domElement.attribute(AttrTypeLine, ""); - basePointId = domElement.attribute(AttrBasePoint, "").toUInt(); - p1LineId = domElement.attribute(AttrP1Line, "").toUInt(); - p2LineId = domElement.attribute(AttrP2Line, "").toUInt(); - } + ReadAttributes(); RefreshGeometry(); if (vis != nullptr) @@ -268,6 +262,16 @@ void VToolHeight::SaveOptions(QDomElement &tag, QSharedPointer &obj) doc->SetAttribute(tag, AttrP2Line, p2LineId); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolHeight::ReadToolAttributes(const QDomElement &domElement) +{ + typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine); + lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack); + basePointId = doc->GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR); + p1LineId = doc->GetParametrUInt(domElement, AttrP1Line, NULL_ID_STR); + p2LineId = doc->GetParametrUInt(domElement, AttrP2Line, NULL_ID_STR); +} + //--------------------------------------------------------------------------------------------------------------------- quint32 VToolHeight::GetP2LineId() const { diff --git a/src/app/tools/drawTools/vtoolheight.h b/src/app/tools/drawTools/vtoolheight.h index 9fc74299a..846f23ae3 100644 --- a/src/app/tools/drawTools/vtoolheight.h +++ b/src/app/tools/drawTools/vtoolheight.h @@ -67,6 +67,7 @@ protected: virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void SaveDialog(QDomElement &domElement); virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj); + virtual void ReadToolAttributes(const QDomElement &domElement); private: /** @brief p1LineId id first point of line. */ quint32 p1LineId; diff --git a/src/app/tools/drawTools/vtoolline.cpp b/src/app/tools/drawTools/vtoolline.cpp index a4df670d5..17f89f14b 100644 --- a/src/app/tools/drawTools/vtoolline.cpp +++ b/src/app/tools/drawTools/vtoolline.cpp @@ -85,6 +85,7 @@ void VToolLine::setDialog() dialogTool->SetFirstPoint(firstPoint); dialogTool->SetSecondPoint(secondPoint); dialogTool->SetTypeLine(typeLine); + dialogTool->SetLineColor(lineColor); } //--------------------------------------------------------------------------------------------------------------------- @@ -189,6 +190,7 @@ QString VToolLine::getTagName() const */ void VToolLine::FullUpdateFromFile() { + ReadAttributes(); RefreshGeometry(); if (vis != nullptr) @@ -384,6 +386,15 @@ void VToolLine::SaveOptions(QDomElement &tag, QSharedPointer &obj) doc->SetAttribute(tag, AttrTypeLine, typeLine); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolLine::ReadToolAttributes(const QDomElement &domElement) +{ + firstPoint = doc->GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR); + secondPoint = doc->GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR); + typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine); + lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack); +} + //--------------------------------------------------------------------------------------------------------------------- quint32 VToolLine::GetSecondPoint() const { @@ -469,13 +480,6 @@ void VToolLine::SetFirstPoint(const quint32 &value) */ void VToolLine::RefreshGeometry() { - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - firstPoint = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, NULL_ID_STR); - secondPoint = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, NULL_ID_STR); - typeLine = doc->GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine); - } const QSharedPointer first = VAbstractTool::data.GeometricObject(firstPoint); const QSharedPointer second = VAbstractTool::data.GeometricObject(secondPoint); this->setLine(QLineF(first->toQPointF(), second->toQPointF())); diff --git a/src/app/tools/drawTools/vtoolline.h b/src/app/tools/drawTools/vtoolline.h index 7e2d55d17..a98b1766b 100644 --- a/src/app/tools/drawTools/vtoolline.h +++ b/src/app/tools/drawTools/vtoolline.h @@ -76,6 +76,7 @@ protected: virtual void keyReleaseEvent(QKeyEvent * event); virtual void SaveDialog(QDomElement &domElement); virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj); + virtual void ReadToolAttributes(const QDomElement &domElement); private: /** @brief firstPoint id first line point. */ quint32 firstPoint; diff --git a/src/app/tools/drawTools/vtoollineintersect.cpp b/src/app/tools/drawTools/vtoollineintersect.cpp index e87b4df57..beb7805da 100644 --- a/src/app/tools/drawTools/vtoollineintersect.cpp +++ b/src/app/tools/drawTools/vtoollineintersect.cpp @@ -193,14 +193,7 @@ VToolLineIntersect* VToolLineIntersect::Create(const quint32 _id, const quint32 */ void VToolLineIntersect::FullUpdateFromFile() { - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - p1Line1 = domElement.attribute(AttrP1Line1, "").toUInt(); - p2Line1 = domElement.attribute(AttrP2Line1, "").toUInt(); - p1Line2 = domElement.attribute(AttrP1Line2, "").toUInt(); - p2Line2 = domElement.attribute(AttrP2Line2, "").toUInt(); - } + ReadAttributes(); RefreshPointGeometry(*VAbstractTool::data.GeometricObject(id)); if (vis != nullptr) @@ -291,6 +284,15 @@ void VToolLineIntersect::SaveOptions(QDomElement &tag, QSharedPointer doc->SetAttribute(tag, AttrP2Line2, p2Line2); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolLineIntersect::ReadToolAttributes(const QDomElement &domElement) +{ + p1Line1 = doc->GetParametrUInt(domElement, AttrP1Line1, NULL_ID_STR); + p2Line1 = doc->GetParametrUInt(domElement, AttrP2Line1, NULL_ID_STR); + p1Line2 = doc->GetParametrUInt(domElement, AttrP1Line2, NULL_ID_STR); + p2Line2 = doc->GetParametrUInt(domElement, AttrP2Line2, NULL_ID_STR); +} + //--------------------------------------------------------------------------------------------------------------------- quint32 VToolLineIntersect::GetP2Line2() const { diff --git a/src/app/tools/drawTools/vtoollineintersect.h b/src/app/tools/drawTools/vtoollineintersect.h index 2322ed7f1..414edcf15 100644 --- a/src/app/tools/drawTools/vtoollineintersect.h +++ b/src/app/tools/drawTools/vtoollineintersect.h @@ -73,6 +73,7 @@ protected: virtual void RemoveReferens(); virtual void SaveDialog(QDomElement &domElement); virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj); + virtual void ReadToolAttributes(const QDomElement &domElement); private: /** @brief p1Line1 id first point first line. */ quint32 p1Line1; diff --git a/src/app/tools/drawTools/vtoollineintersectaxis.cpp b/src/app/tools/drawTools/vtoollineintersectaxis.cpp index 4290f5007..6d6d37c69 100644 --- a/src/app/tools/drawTools/vtoollineintersectaxis.cpp +++ b/src/app/tools/drawTools/vtoollineintersectaxis.cpp @@ -68,6 +68,7 @@ void VToolLineIntersectAxis::setDialog() SCASSERT(dialogTool != nullptr); const QSharedPointer p = VAbstractTool::data.GeometricObject(id); dialogTool->SetTypeLine(typeLine); + dialogTool->SetLineColor(lineColor); dialogTool->SetAngle(formulaAngle); dialogTool->SetBasePointId(basePointId); dialogTool->SetFirstPointId(firstPointId); @@ -266,15 +267,7 @@ void VToolLineIntersectAxis::ShowVisualization(bool show) //--------------------------------------------------------------------------------------------------------------------- void VToolLineIntersectAxis::FullUpdateFromFile() { - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - typeLine = domElement.attribute(AttrTypeLine, ""); - basePointId = domElement.attribute(AttrBasePoint, "").toUInt(); - firstPointId = domElement.attribute(AttrP1Line, "").toUInt(); - secondPointId = domElement.attribute(AttrP2Line, "").toUInt(); - formulaAngle = domElement.attribute(AttrAngle, ""); - } + ReadAttributes(); RefreshGeometry(); if (vis != nullptr) @@ -333,3 +326,14 @@ void VToolLineIntersectAxis::SaveOptions(QDomElement &tag, QSharedPointerSetAttribute(tag, AttrP1Line, firstPointId); doc->SetAttribute(tag, AttrP2Line, secondPointId); } + +//--------------------------------------------------------------------------------------------------------------------- +void VToolLineIntersectAxis::ReadToolAttributes(const QDomElement &domElement) +{ + typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine); + lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack); + basePointId = doc->GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR); + firstPointId = doc->GetParametrUInt(domElement, AttrP1Line, NULL_ID_STR); + secondPointId = doc->GetParametrUInt(domElement, AttrP2Line, NULL_ID_STR); + formulaAngle = doc->GetParametrString(domElement, AttrAngle, ""); +} diff --git a/src/app/tools/drawTools/vtoollineintersectaxis.h b/src/app/tools/drawTools/vtoollineintersectaxis.h index 9de3f38c4..509aff461 100644 --- a/src/app/tools/drawTools/vtoollineintersectaxis.h +++ b/src/app/tools/drawTools/vtoollineintersectaxis.h @@ -72,6 +72,7 @@ protected: virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void SaveDialog(QDomElement &domElement); virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj); + virtual void ReadToolAttributes(const QDomElement &domElement); private: Q_DISABLE_COPY(VToolLineIntersectAxis) QString formulaAngle; diff --git a/src/app/tools/drawTools/vtoolnormal.cpp b/src/app/tools/drawTools/vtoolnormal.cpp index c09472e2a..74aee8e78 100644 --- a/src/app/tools/drawTools/vtoolnormal.cpp +++ b/src/app/tools/drawTools/vtoolnormal.cpp @@ -200,15 +200,7 @@ QPointF VToolNormal::FindPoint(const QPointF &firstPoint, const QPointF &secondP */ void VToolNormal::FullUpdateFromFile() { - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - typeLine = domElement.attribute(AttrTypeLine, ""); - formulaLength = domElement.attribute(AttrLength, ""); - basePointId = domElement.attribute(AttrFirstPoint, "").toUInt(); - secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt(); - angle = domElement.attribute(AttrAngle, "").toDouble(); - } + ReadAttributes(); RefreshGeometry(); if (vis != nullptr) @@ -300,6 +292,17 @@ void VToolNormal::SaveOptions(QDomElement &tag, QSharedPointer &obj) doc->SetAttribute(tag, AttrSecondPoint, secondPointId); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolNormal::ReadToolAttributes(const QDomElement &domElement) +{ + typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine); + lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack); + formulaLength = doc->GetParametrString(domElement, AttrLength, ""); + basePointId = doc->GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR); + secondPointId = doc->GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR); + angle = doc->GetParametrDouble(domElement, AttrAngle, "0"); +} + //--------------------------------------------------------------------------------------------------------------------- quint32 VToolNormal::GetSecondPointId() const { diff --git a/src/app/tools/drawTools/vtoolnormal.h b/src/app/tools/drawTools/vtoolnormal.h index 02da26909..98ca15d5f 100644 --- a/src/app/tools/drawTools/vtoolnormal.h +++ b/src/app/tools/drawTools/vtoolnormal.h @@ -66,6 +66,7 @@ protected: virtual void RemoveReferens(); virtual void SaveDialog(QDomElement &domElement); virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj); + virtual void ReadToolAttributes(const QDomElement &domElement); private: /** @brief secondPointId id second line point. */ quint32 secondPointId; diff --git a/src/app/tools/drawTools/vtoolpointofcontact.cpp b/src/app/tools/drawTools/vtoolpointofcontact.cpp index 9e1575d03..37042dcf6 100644 --- a/src/app/tools/drawTools/vtoolpointofcontact.cpp +++ b/src/app/tools/drawTools/vtoolpointofcontact.cpp @@ -225,14 +225,7 @@ VToolPointOfContact* VToolPointOfContact::Create(const quint32 _id, QString &rad */ void VToolPointOfContact::FullUpdateFromFile() { - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - arcRadius = domElement.attribute(AttrRadius, ""); - center = domElement.attribute(AttrCenter, "").toUInt(); - firstPointId = domElement.attribute(AttrFirstPoint, "").toUInt(); - secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt(); - } + ReadAttributes(); RefreshPointGeometry(*VAbstractTool::data.GeometricObject(id)); if (vis != nullptr) @@ -322,6 +315,15 @@ void VToolPointOfContact::SaveOptions(QDomElement &tag, QSharedPointer doc->SetAttribute(tag, AttrSecondPoint, secondPointId); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolPointOfContact::ReadToolAttributes(const QDomElement &domElement) +{ + arcRadius = doc->GetParametrString(domElement, AttrRadius, ""); + center = doc->GetParametrUInt(domElement, AttrCenter, NULL_ID_STR); + firstPointId = doc->GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR); + secondPointId = doc->GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR); +} + //--------------------------------------------------------------------------------------------------------------------- quint32 VToolPointOfContact::GetSecondPointId() const { diff --git a/src/app/tools/drawTools/vtoolpointofcontact.h b/src/app/tools/drawTools/vtoolpointofcontact.h index 7c58a9ac7..5f4e13053 100644 --- a/src/app/tools/drawTools/vtoolpointofcontact.h +++ b/src/app/tools/drawTools/vtoolpointofcontact.h @@ -78,6 +78,7 @@ protected: virtual void RemoveReferens(); virtual void SaveDialog(QDomElement &domElement); virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj); + virtual void ReadToolAttributes(const QDomElement &domElement); private: /** @brief radius string with formula radius arc. */ QString arcRadius; diff --git a/src/app/tools/drawTools/vtoolpointofintersection.cpp b/src/app/tools/drawTools/vtoolpointofintersection.cpp index 3e7efe603..e67ee2110 100644 --- a/src/app/tools/drawTools/vtoolpointofintersection.cpp +++ b/src/app/tools/drawTools/vtoolpointofintersection.cpp @@ -165,12 +165,7 @@ VToolPointOfIntersection *VToolPointOfIntersection::Create(const quint32 _id, co */ void VToolPointOfIntersection::FullUpdateFromFile() { - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - firstPointId = domElement.attribute(AttrFirstPoint, "").toUInt(); - secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt(); - } + ReadAttributes(); VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject(id)); if (vis != nullptr) @@ -242,6 +237,13 @@ void VToolPointOfIntersection::SaveOptions(QDomElement &tag, QSharedPointerSetAttribute(tag, AttrSecondPoint, secondPointId); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolPointOfIntersection::ReadToolAttributes(const QDomElement &domElement) +{ + firstPointId = doc->GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR); + secondPointId = doc->GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR); +} + //--------------------------------------------------------------------------------------------------------------------- quint32 VToolPointOfIntersection::GetSecondPointId() const { diff --git a/src/app/tools/drawTools/vtoolpointofintersection.h b/src/app/tools/drawTools/vtoolpointofintersection.h index 66cf84872..876c475bf 100644 --- a/src/app/tools/drawTools/vtoolpointofintersection.h +++ b/src/app/tools/drawTools/vtoolpointofintersection.h @@ -67,6 +67,7 @@ protected: virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void SaveDialog(QDomElement &domElement); virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj); + virtual void ReadToolAttributes(const QDomElement &domElement); private: Q_DISABLE_COPY(VToolPointOfIntersection) /** @brief firstPointId id first line point. */ diff --git a/src/app/tools/drawTools/vtoolshoulderpoint.cpp b/src/app/tools/drawTools/vtoolshoulderpoint.cpp index bc9e5cbeb..9c926387f 100644 --- a/src/app/tools/drawTools/vtoolshoulderpoint.cpp +++ b/src/app/tools/drawTools/vtoolshoulderpoint.cpp @@ -75,6 +75,7 @@ void VToolShoulderPoint::setDialog() SCASSERT(dialogTool != nullptr); const QSharedPointer p = VAbstractTool::data.GeometricObject(id); dialogTool->SetTypeLine(typeLine); + dialogTool->SetLineColor(lineColor); dialogTool->SetFormula(formulaLength); dialogTool->SetP1Line(basePointId); dialogTool->SetP2Line(p2Line); @@ -225,15 +226,7 @@ VToolShoulderPoint* VToolShoulderPoint::Create(const quint32 _id, QString &formu */ void VToolShoulderPoint::FullUpdateFromFile() { - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - typeLine = domElement.attribute(AttrTypeLine, ""); - formulaLength = domElement.attribute(AttrLength, ""); - basePointId = domElement.attribute(AttrP1Line, "").toUInt(); - p2Line = domElement.attribute(AttrP2Line, "").toUInt(); - pShoulder = domElement.attribute(AttrPShoulder, "").toUInt(); - } + ReadAttributes(); RefreshGeometry(); if (vis != nullptr) @@ -326,6 +319,17 @@ void VToolShoulderPoint::SaveOptions(QDomElement &tag, QSharedPointer doc->SetAttribute(tag, AttrPShoulder, pShoulder); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolShoulderPoint::ReadToolAttributes(const QDomElement &domElement) +{ + typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine); + lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack); + formulaLength = doc->GetParametrString(domElement, AttrLength, ""); + basePointId = doc->GetParametrUInt(domElement, AttrP1Line, NULL_ID_STR); + p2Line = doc->GetParametrUInt(domElement, AttrP2Line, NULL_ID_STR); + pShoulder = doc->GetParametrUInt(domElement, AttrPShoulder, NULL_ID_STR); +} + //--------------------------------------------------------------------------------------------------------------------- quint32 VToolShoulderPoint::getPShoulder() const { diff --git a/src/app/tools/drawTools/vtoolshoulderpoint.h b/src/app/tools/drawTools/vtoolshoulderpoint.h index 32bdd257c..82da45e33 100644 --- a/src/app/tools/drawTools/vtoolshoulderpoint.h +++ b/src/app/tools/drawTools/vtoolshoulderpoint.h @@ -70,6 +70,7 @@ protected: virtual void RemoveReferens(); virtual void SaveDialog(QDomElement &domElement); virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj); + virtual void ReadToolAttributes(const QDomElement &domElement); private: /** @brief p2Line id second line point. */ quint32 p2Line; diff --git a/src/app/tools/drawTools/vtoolsinglepoint.cpp b/src/app/tools/drawTools/vtoolsinglepoint.cpp index bb37898ef..003d7b3a5 100644 --- a/src/app/tools/drawTools/vtoolsinglepoint.cpp +++ b/src/app/tools/drawTools/vtoolsinglepoint.cpp @@ -264,6 +264,13 @@ void VToolSinglePoint::SaveOptions(QDomElement &tag, QSharedPointer &o doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my())); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolSinglePoint::ReadToolAttributes(const QDomElement &domElement) +{ + Q_UNUSED(domElement); + // This tool doesn't need read attributes from file. +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief contextMenuEvent handle context menu events. diff --git a/src/app/tools/drawTools/vtoolsinglepoint.h b/src/app/tools/drawTools/vtoolsinglepoint.h index df2727580..833365a9b 100644 --- a/src/app/tools/drawTools/vtoolsinglepoint.h +++ b/src/app/tools/drawTools/vtoolsinglepoint.h @@ -67,6 +67,7 @@ protected: virtual void mousePressEvent( QGraphicsSceneMouseEvent * event ); virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj); + virtual void ReadToolAttributes(const QDomElement &domElement); private: QString namePP; QString mPath; diff --git a/src/app/tools/drawTools/vtoolspline.cpp b/src/app/tools/drawTools/vtoolspline.cpp index 02e86c7c8..5a28e58dc 100644 --- a/src/app/tools/drawTools/vtoolspline.cpp +++ b/src/app/tools/drawTools/vtoolspline.cpp @@ -105,6 +105,7 @@ void VToolSpline::setDialog() dialogTool->SetKAsm1(spl->GetKasm1()); dialogTool->SetKAsm2(spl->GetKasm2()); dialogTool->SetKCurve(spl->GetKcurve()); + dialogTool->SetColor(lineColor); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/tools/drawTools/vtoolsplinepath.cpp b/src/app/tools/drawTools/vtoolsplinepath.cpp index 601ac96b5..fad8c6745 100644 --- a/src/app/tools/drawTools/vtoolsplinepath.cpp +++ b/src/app/tools/drawTools/vtoolsplinepath.cpp @@ -98,6 +98,7 @@ void VToolSplinePath::setDialog() SCASSERT(dialogTool != nullptr); const QSharedPointer splPath = VAbstractTool::data.GeometricObject(id); dialogTool->SetPath(*splPath); + dialogTool->SetColor(lineColor); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/tools/drawTools/vtooltriangle.cpp b/src/app/tools/drawTools/vtooltriangle.cpp index 5d01d3202..6c674121f 100644 --- a/src/app/tools/drawTools/vtooltriangle.cpp +++ b/src/app/tools/drawTools/vtooltriangle.cpp @@ -220,14 +220,7 @@ QPointF VToolTriangle::FindPoint(const QPointF &axisP1, const QPointF &axisP2, c */ void VToolTriangle::FullUpdateFromFile() { - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - axisP1Id = domElement.attribute(AttrAxisP1, "").toUInt(); - axisP2Id = domElement.attribute(AttrAxisP2, "").toUInt(); - firstPointId = domElement.attribute(AttrFirstPoint, "").toUInt(); - secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt(); - } + ReadAttributes(); VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject(id)); if (vis != nullptr) @@ -307,6 +300,15 @@ void VToolTriangle::SaveOptions(QDomElement &tag, QSharedPointer &obj) doc->SetAttribute(tag, AttrSecondPoint, secondPointId); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolTriangle::ReadToolAttributes(const QDomElement &domElement) +{ + axisP1Id = doc->GetParametrUInt(domElement, AttrAxisP1, NULL_ID_STR); + axisP2Id = doc->GetParametrUInt(domElement, AttrAxisP2, NULL_ID_STR); + firstPointId = doc->GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR); + secondPointId = doc->GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR); +} + //--------------------------------------------------------------------------------------------------------------------- quint32 VToolTriangle::GetSecondPointId() const { diff --git a/src/app/tools/drawTools/vtooltriangle.h b/src/app/tools/drawTools/vtooltriangle.h index 678f4da40..4e5696727 100644 --- a/src/app/tools/drawTools/vtooltriangle.h +++ b/src/app/tools/drawTools/vtooltriangle.h @@ -75,6 +75,7 @@ protected: virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void SaveDialog(QDomElement &domElement); virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj); + virtual void ReadToolAttributes(const QDomElement &domElement); private: Q_DISABLE_COPY(VToolTriangle) /** @brief axisP1Id id first axis point. */