diff --git a/tools/drawTools/vdrawtool.cpp b/tools/drawTools/vdrawtool.cpp
index 933dbdba2..b6290d45a 100644
--- a/tools/drawTools/vdrawtool.cpp
+++ b/tools/drawTools/vdrawtool.cpp
@@ -92,7 +92,7 @@ void VDrawTool::AddToCalculation(const QDomElement &domElement){
}
}
} else {
- qCritical()<<"Can't find tag Calculation"<< Q_FUNC_INFO;
+ qCritical()<
elementById(QString().setNum(id));
if(domElement.isElement()){
- typeLine = domElement.attribute("typeLine", "");
- formula = domElement.attribute("length", "");
- basePointId = domElement.attribute("firstPoint", "").toLongLong();
- secondPointId = domElement.attribute("secondPoint", "").toLongLong();
+ typeLine = domElement.attribute(AttrTypeLine, "");
+ formula = domElement.attribute(AttrLength, "");
+ basePointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
+ secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
}
RefreshGeometry();
}
@@ -49,11 +51,11 @@ void VToolAlongLine::FullUpdateFromGui(int result){
if(result == QDialog::Accepted){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("name", dialogAlongLine->getPointName());
- domElement.setAttribute("typeLine", dialogAlongLine->getTypeLine());
- domElement.setAttribute("length", dialogAlongLine->getFormula());
- domElement.setAttribute("firstPoint", QString().setNum(dialogAlongLine->getFirstPointId()));
- domElement.setAttribute("secondPoint", QString().setNum(dialogAlongLine->getSecondPointId()));
+ 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()));
emit FullUpdateTree();
}
}
@@ -71,18 +73,18 @@ void VToolAlongLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
void VToolAlongLine::AddToFile(){
VPointF point = VAbstractTool::data.GetPoint(id);
- QDomElement domElement = doc->createElement("point");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "alongLine");
- AddAttribute(domElement, "name", point.name());
- AddAttribute(domElement, "mx", toMM(point.mx()));
- AddAttribute(domElement, "my", toMM(point.my()));
+ 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()));
- AddAttribute(domElement, "typeLine", typeLine);
- AddAttribute(domElement, "length", formula);
- AddAttribute(domElement, "firstPoint", basePointId);
- AddAttribute(domElement, "secondPoint", secondPointId);
+ AddAttribute(domElement, AttrTypeLine, typeLine);
+ AddAttribute(domElement, AttrLength, formula);
+ AddAttribute(domElement, AttrFirstPoint, basePointId);
+ AddAttribute(domElement, AttrSecondPoint, secondPointId);
AddToCalculation(domElement);
}
diff --git a/tools/drawTools/vtoolalongline.h b/tools/drawTools/vtoolalongline.h
index b9a1e16e9..35734aab9 100644
--- a/tools/drawTools/vtoolalongline.h
+++ b/tools/drawTools/vtoolalongline.h
@@ -38,6 +38,7 @@ public:
const qint64 &firstPointId, const qint64 &secondPointId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation);
+ static const QString ToolType;
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
diff --git a/tools/drawTools/vtoolarc.cpp b/tools/drawTools/vtoolarc.cpp
index f73d8f4bc..149560c3d 100644
--- a/tools/drawTools/vtoolarc.cpp
+++ b/tools/drawTools/vtoolarc.cpp
@@ -22,6 +22,9 @@
#include "vtoolarc.h"
#include "container/calculator.h"
+const QString VToolArc::TagName = QStringLiteral("arc");
+const QString VToolArc::ToolType = QStringLiteral("simple");
+
VToolArc::VToolArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation,
QGraphicsItem *parent):VDrawTool(doc, data, id), QGraphicsPathItem(parent),
dialogArc(QSharedPointer()){
@@ -114,10 +117,10 @@ void VToolArc::FullUpdateFromGui(int result){
if(result == QDialog::Accepted){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("center", QString().setNum(dialogArc->GetCenter()));
- domElement.setAttribute("radius", dialogArc->GetRadius());
- domElement.setAttribute("angle1", dialogArc->GetF1());
- domElement.setAttribute("angle2", dialogArc->GetF2());
+ domElement.setAttribute(AttrCenter, QString().setNum(dialogArc->GetCenter()));
+ domElement.setAttribute(AttrRadius, dialogArc->GetRadius());
+ domElement.setAttribute(AttrAngle1, dialogArc->GetF1());
+ domElement.setAttribute(AttrAngle2, dialogArc->GetF2());
emit FullUpdateTree();
}
}
@@ -154,14 +157,14 @@ void VToolArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
void VToolArc::AddToFile(){
VArc arc = VAbstractTool::data.GetArc(id);
- QDomElement domElement = doc->createElement("arc");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "simple");
- AddAttribute(domElement, "center", arc.GetCenter());
- AddAttribute(domElement, "radius", arc.GetFormulaRadius());
- AddAttribute(domElement, "angle1", arc.GetFormulaF1());
- AddAttribute(domElement, "angle2", arc.GetFormulaF2());
+ AddAttribute(domElement, AttrId, id);
+ AddAttribute(domElement, AttrType, ToolType);
+ AddAttribute(domElement, AttrCenter, arc.GetCenter());
+ AddAttribute(domElement, AttrRadius, arc.GetFormulaRadius());
+ AddAttribute(domElement, AttrAngle1, arc.GetFormulaF1());
+ AddAttribute(domElement, AttrAngle2, arc.GetFormulaF2());
AddToCalculation(domElement);
}
diff --git a/tools/drawTools/vtoolarc.h b/tools/drawTools/vtoolarc.h
index fb99e11ed..a743b96e1 100644
--- a/tools/drawTools/vtoolarc.h
+++ b/tools/drawTools/vtoolarc.h
@@ -38,6 +38,8 @@ public:
static void Create(const qint64 _id, const qint64 ¢er, const QString &radius, const QString &f1,
const QString &f2, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation);
+ static const QString TagName;
+ static const QString ToolType;
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
diff --git a/tools/drawTools/vtoolbisector.cpp b/tools/drawTools/vtoolbisector.cpp
index 5be60dd00..9e21737ab 100644
--- a/tools/drawTools/vtoolbisector.cpp
+++ b/tools/drawTools/vtoolbisector.cpp
@@ -22,6 +22,8 @@
#include "vtoolbisector.h"
#include
+const QString VToolBisector::ToolType = QStringLiteral("bisector");
+
VToolBisector::VToolBisector(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula, const qint64 &firstPointId,
const qint64 &secondPointId, const qint64 &thirdPointId, Tool::Sources typeCreation,
@@ -121,11 +123,11 @@ void VToolBisector::Create(const qint64 _id, const QString &formula, const qint6
void VToolBisector::FullUpdateFromFile(){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- typeLine = domElement.attribute("typeLine", "");
- formula = domElement.attribute("length", "");
- firstPointId = domElement.attribute("firstPoint", "").toLongLong();
- basePointId = domElement.attribute("secondPoint", "").toLongLong();
- thirdPointId = domElement.attribute("thirdPoint", "").toLongLong();
+ typeLine = domElement.attribute(AttrTypeLine, "");
+ formula = domElement.attribute(AttrLength, "");
+ firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
+ basePointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
+ thirdPointId = domElement.attribute(AttrThirdPoint, "").toLongLong();
}
RefreshGeometry();
}
@@ -134,12 +136,12 @@ void VToolBisector::FullUpdateFromGui(int result){
if(result == QDialog::Accepted){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("name", dialogBisector->getPointName());
- domElement.setAttribute("typeLine", dialogBisector->getTypeLine());
- domElement.setAttribute("length", dialogBisector->getFormula());
- domElement.setAttribute("firstPoint", QString().setNum(dialogBisector->getFirstPointId()));
- domElement.setAttribute("secondPoint", QString().setNum(dialogBisector->getSecondPointId()));
- domElement.setAttribute("thirdPoint", QString().setNum(dialogBisector->getThirdPointId()));
+ 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()));
emit FullUpdateTree();
}
}
@@ -157,19 +159,19 @@ void VToolBisector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
void VToolBisector::AddToFile(){
VPointF point = VAbstractTool::data.GetPoint(id);
- QDomElement domElement = doc->createElement("point");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "bisector");
- AddAttribute(domElement, "name", point.name());
- AddAttribute(domElement, "mx", toMM(point.mx()));
- AddAttribute(domElement, "my", toMM(point.my()));
+ 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()));
- AddAttribute(domElement, "typeLine", typeLine);
- AddAttribute(domElement, "length", formula);
- AddAttribute(domElement, "firstPoint", firstPointId);
- AddAttribute(domElement, "secondPoint", basePointId);
- AddAttribute(domElement, "thirdPoint", thirdPointId);
+ AddAttribute(domElement, AttrTypeLine, typeLine);
+ AddAttribute(domElement, AttrLength, formula);
+ AddAttribute(domElement, AttrFirstPoint, firstPointId);
+ AddAttribute(domElement, AttrSecondPoint, basePointId);
+ AddAttribute(domElement, AttrThirdPoint, thirdPointId);
AddToCalculation(domElement);
}
diff --git a/tools/drawTools/vtoolbisector.h b/tools/drawTools/vtoolbisector.h
index 90fd1a7f6..6e0603f01 100644
--- a/tools/drawTools/vtoolbisector.h
+++ b/tools/drawTools/vtoolbisector.h
@@ -40,6 +40,7 @@ public:
const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
Tool::Sources typeCreation);
+ static const QString ToolType;
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
diff --git a/tools/drawTools/vtoolendline.cpp b/tools/drawTools/vtoolendline.cpp
index d73906144..d2b58d931 100644
--- a/tools/drawTools/vtoolendline.cpp
+++ b/tools/drawTools/vtoolendline.cpp
@@ -23,6 +23,8 @@
#include "widgets/vmaingraphicsscene.h"
#include
+const QString VToolEndLine::ToolType = QStringLiteral("endLine");
+
VToolEndLine::VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
const QString &formula, const qreal &angle, const qint64 &basePointId,
Tool::Sources typeCreation, QGraphicsItem *parent):
@@ -96,10 +98,10 @@ void VToolEndLine::Create(const qint64 _id, const QString &pointName, const QStr
void VToolEndLine::FullUpdateFromFile(){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- typeLine = domElement.attribute("typeLine", "");
- formula = domElement.attribute("length", "");
- basePointId = domElement.attribute("basePoint", "").toLongLong();
- angle = domElement.attribute("angle", "").toInt();
+ typeLine = domElement.attribute(AttrTypeLine, "");
+ formula = domElement.attribute(AttrLength, "");
+ basePointId = domElement.attribute(AttrBasePoint, "").toLongLong();
+ angle = domElement.attribute(AttrAngle, "").toInt();
}
RefreshGeometry();
}
@@ -112,11 +114,11 @@ void VToolEndLine::FullUpdateFromGui(int result){
if(result == QDialog::Accepted){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("name", dialogEndLine->getPointName());
- domElement.setAttribute("typeLine", dialogEndLine->getTypeLine());
- domElement.setAttribute("length", dialogEndLine->getFormula());
- domElement.setAttribute("angle", QString().setNum(dialogEndLine->getAngle()));
- domElement.setAttribute("basePoint", QString().setNum(dialogEndLine->getBasePointId()));
+ 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()));
emit FullUpdateTree();
}
}
@@ -125,18 +127,18 @@ void VToolEndLine::FullUpdateFromGui(int result){
void VToolEndLine::AddToFile(){
VPointF point = VAbstractTool::data.GetPoint(id);
- QDomElement domElement = doc->createElement("point");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "endLine");
- AddAttribute(domElement, "name", point.name());
- AddAttribute(domElement, "mx", toMM(point.mx()));
- AddAttribute(domElement, "my", toMM(point.my()));
+ 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()));
- AddAttribute(domElement, "typeLine", typeLine);
- AddAttribute(domElement, "length", formula);
- AddAttribute(domElement, "angle", angle);
- AddAttribute(domElement, "basePoint", basePointId);
+ AddAttribute(domElement, AttrTypeLine, typeLine);
+ AddAttribute(domElement, AttrLength, formula);
+ AddAttribute(domElement, AttrAngle, angle);
+ AddAttribute(domElement, AttrBasePoint, basePointId);
AddToCalculation(domElement);
}
diff --git a/tools/drawTools/vtoolendline.h b/tools/drawTools/vtoolendline.h
index 38e637544..75ce3cfeb 100644
--- a/tools/drawTools/vtoolendline.h
+++ b/tools/drawTools/vtoolendline.h
@@ -38,6 +38,7 @@ public:
const QString &formula, const qreal &angle, const qint64 &basePointId, const qreal &mx,
const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation);
+ static const QString ToolType;
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
diff --git a/tools/drawTools/vtoolheight.cpp b/tools/drawTools/vtoolheight.cpp
index 3779eebfe..0ab9ff998 100644
--- a/tools/drawTools/vtoolheight.cpp
+++ b/tools/drawTools/vtoolheight.cpp
@@ -1,5 +1,7 @@
#include "vtoolheight.h"
+const QString VToolHeight::ToolType = QStringLiteral("height");
+
VToolHeight::VToolHeight(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId,
Tool::Sources typeCreation, QGraphicsItem * parent)
@@ -90,10 +92,10 @@ 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("typeLine", "");
- basePointId = domElement.attribute("basePoint", "").toLongLong();
- p1LineId = domElement.attribute("p1Line", "").toLongLong();
- p2LineId = domElement.attribute("p2Line", "").toLongLong();
+ typeLine = domElement.attribute(AttrTypeLine, "");
+ basePointId = domElement.attribute(AttrBasePoint, "").toLongLong();
+ p1LineId = domElement.attribute(AttrP1Line, "").toLongLong();
+ p2LineId = domElement.attribute(AttrP2Line, "").toLongLong();
}
RefreshGeometry();
@@ -103,11 +105,11 @@ void VToolHeight::FullUpdateFromGui(int result){
if(result == QDialog::Accepted){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("name", dialogHeight->getPointName());
- domElement.setAttribute("typeLine", dialogHeight->getTypeLine());
- domElement.setAttribute("basePoint", QString().setNum(dialogHeight->getBasePointId()));
- domElement.setAttribute("p1Line", QString().setNum(dialogHeight->getP1LineId()));
- domElement.setAttribute("p2Line", QString().setNum(dialogHeight->getP2LineId()));
+ 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()));
emit FullUpdateTree();
}
}
@@ -120,18 +122,18 @@ void VToolHeight::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
void VToolHeight::AddToFile(){
VPointF point = VAbstractTool::data.GetPoint(id);
- QDomElement domElement = doc->createElement("point");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "height");
- AddAttribute(domElement, "name", point.name());
- AddAttribute(domElement, "mx", toMM(point.mx()));
- AddAttribute(domElement, "my", toMM(point.my()));
+ 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()));
- AddAttribute(domElement, "typeLine", typeLine);
- AddAttribute(domElement, "basePoint", basePointId);
- AddAttribute(domElement, "p1Line", p1LineId);
- AddAttribute(domElement, "p2Line", p2LineId);
+ AddAttribute(domElement, AttrTypeLine, typeLine);
+ AddAttribute(domElement, AttrBasePoint, basePointId);
+ AddAttribute(domElement, AttrP1Line, p1LineId);
+ AddAttribute(domElement, AttrP2Line, p2LineId);
AddToCalculation(domElement);
diff --git a/tools/drawTools/vtoolheight.h b/tools/drawTools/vtoolheight.h
index 197909888..06158aca4 100644
--- a/tools/drawTools/vtoolheight.h
+++ b/tools/drawTools/vtoolheight.h
@@ -39,6 +39,7 @@ public:
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc,
VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation);
static QPointF FindPoint(const QLineF &line, const QPointF &point);
+ static const QString ToolType;
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
diff --git a/tools/drawTools/vtoolline.cpp b/tools/drawTools/vtoolline.cpp
index 62236ecca..98d24fb94 100644
--- a/tools/drawTools/vtoolline.cpp
+++ b/tools/drawTools/vtoolline.cpp
@@ -21,6 +21,8 @@
#include "vtoolline.h"
+const QString VToolLine::TagName = QStringLiteral("line");
+
VToolLine::VToolLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, qint64 secondPoint,
Tool::Sources typeCreation, QGraphicsItem *parent):VDrawTool(doc, data, id),
QGraphicsLineItem(parent), firstPoint(firstPoint), secondPoint(secondPoint),
@@ -91,8 +93,8 @@ void VToolLine::FullUpdateFromGui(int result){
if(result == QDialog::Accepted){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("firstPoint", QString().setNum(dialogLine->getFirstPoint()));
- domElement.setAttribute("secondPoint", QString().setNum(dialogLine->getSecondPoint()));
+ domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogLine->getFirstPoint()));
+ domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogLine->getSecondPoint()));
emit FullUpdateTree();
}
}
@@ -127,10 +129,10 @@ void VToolLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
}
void VToolLine::AddToFile(){
- QDomElement domElement = doc->createElement("line");
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "firstPoint", firstPoint);
- AddAttribute(domElement, "secondPoint", secondPoint);
+ QDomElement domElement = doc->createElement(TagName);
+ AddAttribute(domElement, AttrId, id);
+ AddAttribute(domElement, AttrFirstPoint, firstPoint);
+ AddAttribute(domElement, AttrSecondPoint, secondPoint);
AddToCalculation(domElement);
}
@@ -153,8 +155,8 @@ void VToolLine::RemoveReferens(){
void VToolLine::RefreshGeometry(){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- firstPoint = domElement.attribute("firstPoint", "").toLongLong();
- secondPoint = domElement.attribute("secondPoint", "").toLongLong();
+ firstPoint = domElement.attribute(AttrFirstPoint, "").toLongLong();
+ secondPoint = domElement.attribute(AttrSecondPoint, "").toLongLong();
}
VPointF first = VAbstractTool::data.GetPoint(firstPoint);
VPointF second = VAbstractTool::data.GetPoint(secondPoint);
diff --git a/tools/drawTools/vtoolline.h b/tools/drawTools/vtoolline.h
index e7ccbfe9f..c88e6fb21 100644
--- a/tools/drawTools/vtoolline.h
+++ b/tools/drawTools/vtoolline.h
@@ -37,6 +37,7 @@ public:
static void Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation);
+ static const QString TagName;
public slots:
virtual void FullUpdateFromFile();
virtual void ChangedActivDraw(const QString newName);
diff --git a/tools/drawTools/vtoollineintersect.cpp b/tools/drawTools/vtoollineintersect.cpp
index 38e3cf305..b0eb6696a 100644
--- a/tools/drawTools/vtoollineintersect.cpp
+++ b/tools/drawTools/vtoollineintersect.cpp
@@ -21,6 +21,8 @@
#include "vtoollineintersect.h"
+const QString VToolLineIntersect::ToolType = QStringLiteral("lineIntersect");
+
VToolLineIntersect::VToolLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id,
const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2,
const qint64 &p2Line2, Tool::Sources typeCreation,
@@ -109,10 +111,10 @@ void VToolLineIntersect::Create(const qint64 _id, const qint64 &p1Line1Id, const
void VToolLineIntersect::FullUpdateFromFile(){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- p1Line1 = domElement.attribute("p1Line1", "").toLongLong();
- p2Line1 = domElement.attribute("p2Line1", "").toLongLong();
- p1Line2 = domElement.attribute("p1Line2", "").toLongLong();
- p2Line2 = domElement.attribute("p2Line2", "").toLongLong();
+ p1Line1 = domElement.attribute(AttrP1Line1, "").toLongLong();
+ p2Line1 = domElement.attribute(AttrP2Line1, "").toLongLong();
+ p1Line2 = domElement.attribute(AttrP1Line2, "").toLongLong();
+ p2Line2 = domElement.attribute(AttrP2Line2, "").toLongLong();
}
RefreshPointGeometry(VAbstractTool::data.GetPoint(id));
}
@@ -121,11 +123,11 @@ void VToolLineIntersect::FullUpdateFromGui(int result){
if(result == QDialog::Accepted){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("name", dialogLineIntersect->getPointName());
- domElement.setAttribute("p1Line1", QString().setNum(dialogLineIntersect->getP1Line1()));
- domElement.setAttribute("p2Line1", QString().setNum(dialogLineIntersect->getP2Line1()));
- domElement.setAttribute("p1Line2", QString().setNum(dialogLineIntersect->getP1Line2()));
- domElement.setAttribute("p2Line2", QString().setNum(dialogLineIntersect->getP2Line2()));
+ 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()));
emit FullUpdateTree();
}
}
@@ -143,18 +145,18 @@ void VToolLineIntersect::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
void VToolLineIntersect::AddToFile(){
VPointF point = VAbstractTool::data.GetPoint(id);
- QDomElement domElement = doc->createElement("point");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "lineIntersect");
- AddAttribute(domElement, "name", point.name());
- AddAttribute(domElement, "mx", toMM(point.mx()));
- AddAttribute(domElement, "my", toMM(point.my()));
+ 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()));
- AddAttribute(domElement, "p1Line1", p1Line1);
- AddAttribute(domElement, "p2Line1", p2Line1);
- AddAttribute(domElement, "p1Line2", p1Line2);
- AddAttribute(domElement, "p2Line2", p2Line2);
+ AddAttribute(domElement, AttrP1Line1, p1Line1);
+ AddAttribute(domElement, AttrP2Line1, p2Line1);
+ AddAttribute(domElement, AttrP1Line2, p1Line2);
+ AddAttribute(domElement, AttrP2Line2, p2Line2);
AddToCalculation(domElement);
}
diff --git a/tools/drawTools/vtoollineintersect.h b/tools/drawTools/vtoollineintersect.h
index e42cca66c..2cea55c28 100644
--- a/tools/drawTools/vtoollineintersect.h
+++ b/tools/drawTools/vtoollineintersect.h
@@ -38,6 +38,7 @@ public:
const qint64 &p2Line2Id, const QString &pointName, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation);
+ static const QString ToolType;
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
diff --git a/tools/drawTools/vtoollinepoint.cpp b/tools/drawTools/vtoollinepoint.cpp
index e7742599e..3c5c11785 100644
--- a/tools/drawTools/vtoollinepoint.cpp
+++ b/tools/drawTools/vtoollinepoint.cpp
@@ -32,7 +32,7 @@ VToolLinePoint::VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64
mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this);
mainLine->setPen(QPen(Qt::black, widthHairLine/factor));
mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
- if(typeLine == "none"){
+ if(typeLine == TypeLineNone){
mainLine->setVisible(false);
} else {
mainLine->setVisible(true);
@@ -55,7 +55,7 @@ void VToolLinePoint::RefreshGeometry(){
QPointF point = VDrawTool::data.GetPoint(id).toQPointF();
QPointF basePoint = VDrawTool::data.GetPoint(basePointId).toQPointF();
mainLine->setLine(QLineF(basePoint - point, QPointF()));
- if(typeLine == "none"){
+ if(typeLine == TypeLineNone){
mainLine->setVisible(false);
} else {
mainLine->setVisible(true);
diff --git a/tools/drawTools/vtoolnormal.cpp b/tools/drawTools/vtoolnormal.cpp
index 25915ee63..0dd4fd809 100644
--- a/tools/drawTools/vtoolnormal.cpp
+++ b/tools/drawTools/vtoolnormal.cpp
@@ -22,6 +22,8 @@
#include "vtoolnormal.h"
#include
+const QString VToolNormal::ToolType = QStringLiteral("normal");
+
VToolNormal::VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
const QString &formula, const qreal &angle, const qint64 &firstPointId,
const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem *parent):
@@ -110,11 +112,11 @@ 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("typeLine", "");
- formula = domElement.attribute("length", "");
- basePointId = domElement.attribute("firstPoint", "").toLongLong();
- secondPointId = domElement.attribute("secondPoint", "").toLongLong();
- angle = domElement.attribute("angle", "").toDouble();
+ typeLine = domElement.attribute(AttrTypeLine, "");
+ formula = domElement.attribute(AttrLength, "");
+ basePointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
+ secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
+ angle = domElement.attribute(AttrAngle, "").toDouble();
}
RefreshGeometry();
}
@@ -123,12 +125,12 @@ void VToolNormal::FullUpdateFromGui(int result){
if(result == QDialog::Accepted){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("name", dialogNormal->getPointName());
- domElement.setAttribute("typeLine", dialogNormal->getTypeLine());
- domElement.setAttribute("length", dialogNormal->getFormula());
- domElement.setAttribute("angle", QString().setNum(dialogNormal->getAngle()));
- domElement.setAttribute("firstPoint", QString().setNum(dialogNormal->getFirstPointId()));
- domElement.setAttribute("secondPoint", QString().setNum(dialogNormal->getSecondPointId()));
+ 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()));
emit FullUpdateTree();
}
}
@@ -146,19 +148,19 @@ void VToolNormal::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
void VToolNormal::AddToFile(){
VPointF point = VAbstractTool::data.GetPoint(id);
- QDomElement domElement = doc->createElement("point");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "normal");
- AddAttribute(domElement, "name", point.name());
- AddAttribute(domElement, "mx", toMM(point.mx()));
- AddAttribute(domElement, "my", toMM(point.my()));
+ 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()));
- AddAttribute(domElement, "typeLine", typeLine);
- AddAttribute(domElement, "length", formula);
- AddAttribute(domElement, "angle", angle);
- AddAttribute(domElement, "firstPoint", basePointId);
- AddAttribute(domElement, "secondPoint", secondPointId);
+ AddAttribute(domElement, AttrTypeLine, typeLine);
+ AddAttribute(domElement, AttrLength, formula);
+ AddAttribute(domElement, AttrAngle, angle);
+ AddAttribute(domElement, AttrFirstPoint, basePointId);
+ AddAttribute(domElement, AttrSecondPoint, secondPointId);
AddToCalculation(domElement);
}
diff --git a/tools/drawTools/vtoolnormal.h b/tools/drawTools/vtoolnormal.h
index 4ac03cff7..3370d2c90 100644
--- a/tools/drawTools/vtoolnormal.h
+++ b/tools/drawTools/vtoolnormal.h
@@ -41,6 +41,7 @@ public:
Tool::Sources typeCreation);
static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const qreal &length,
const qreal &angle = 0);
+ static const QString ToolType;
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
diff --git a/tools/drawTools/vtoolpoint.cpp b/tools/drawTools/vtoolpoint.cpp
index eb53afb10..fc94cd91a 100644
--- a/tools/drawTools/vtoolpoint.cpp
+++ b/tools/drawTools/vtoolpoint.cpp
@@ -21,6 +21,8 @@
#include "vtoolpoint.h"
+const QString VToolPoint::TagName = QStringLiteral("point");
+
VToolPoint::VToolPoint(VDomDocument *doc, VContainer *data, qint64 id,
QGraphicsItem *parent):VDrawTool(doc, data, id),
QGraphicsEllipseItem(parent), radius(toPixel(2)), namePoint(0), lineName(0){
@@ -47,8 +49,8 @@ void VToolPoint::NameChangePosition(const QPointF pos){
void VToolPoint::UpdateNamePosition(qreal mx, qreal my){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("mx", QString().setNum(toMM(mx)));
- domElement.setAttribute("my", QString().setNum(toMM(my)));
+ domElement.setAttribute(AttrMx, QString().setNum(toMM(mx)));
+ domElement.setAttribute(AttrMy, QString().setNum(toMM(my)));
emit toolhaveChange();
}
}
diff --git a/tools/drawTools/vtoolpoint.h b/tools/drawTools/vtoolpoint.h
index ddbc0159e..924f5c593 100644
--- a/tools/drawTools/vtoolpoint.h
+++ b/tools/drawTools/vtoolpoint.h
@@ -30,6 +30,7 @@ class VToolPoint: public VDrawTool, public QGraphicsEllipseItem{
public:
VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem * parent = 0);
virtual ~VToolPoint(){}
+ static const QString TagName;
public slots:
void NameChangePosition(const QPointF pos);
virtual void ChangedActivDraw(const QString newName);
diff --git a/tools/drawTools/vtoolpointofcontact.cpp b/tools/drawTools/vtoolpointofcontact.cpp
index a6213071b..f068aecb2 100644
--- a/tools/drawTools/vtoolpointofcontact.cpp
+++ b/tools/drawTools/vtoolpointofcontact.cpp
@@ -22,6 +22,8 @@
#include "vtoolpointofcontact.h"
#include
+const QString VToolPointOfContact::ToolType = QStringLiteral("pointOfContact");
+
VToolPointOfContact::VToolPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &radius, const qint64 ¢er,
const qint64 &firstPointId, const qint64 &secondPointId,
@@ -128,10 +130,10 @@ void VToolPointOfContact::Create(const qint64 _id, const QString &radius, const
void VToolPointOfContact::FullUpdateFromFile(){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- radius = domElement.attribute("radius", "");
- center = domElement.attribute("center", "").toLongLong();
- firstPointId = domElement.attribute("firstPoint", "").toLongLong();
- secondPointId = domElement.attribute("secondPoint", "").toLongLong();
+ radius = domElement.attribute(AttrRadius, "");
+ center = domElement.attribute(AttrCenter, "").toLongLong();
+ firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
+ secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
}
RefreshPointGeometry(VAbstractTool::data.GetPoint(id));
}
@@ -140,11 +142,11 @@ void VToolPointOfContact::FullUpdateFromGui(int result){
if(result == QDialog::Accepted){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("name", dialogPointOfContact->getPointName());
- domElement.setAttribute("radius", dialogPointOfContact->getRadius());
- domElement.setAttribute("center", QString().setNum(dialogPointOfContact->getCenter()));
- domElement.setAttribute("firstPoint", QString().setNum(dialogPointOfContact->getFirstPoint()));
- domElement.setAttribute("secondPoint", QString().setNum(dialogPointOfContact->getSecondPoint()));
+ 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()));
emit FullUpdateTree();
}
}
@@ -162,18 +164,18 @@ void VToolPointOfContact::contextMenuEvent(QGraphicsSceneContextMenuEvent *event
void VToolPointOfContact::AddToFile(){
VPointF point = VAbstractTool::data.GetPoint(id);
- QDomElement domElement = doc->createElement("point");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "pointOfContact");
- AddAttribute(domElement, "name", point.name());
- AddAttribute(domElement, "mx", toMM(point.mx()));
- AddAttribute(domElement, "my", toMM(point.my()));
+ 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()));
- AddAttribute(domElement, "radius", radius);
- AddAttribute(domElement, "center", center);
- AddAttribute(domElement, "firstPoint", firstPointId);
- AddAttribute(domElement, "secondPoint", secondPointId);
+ AddAttribute(domElement, AttrRadius, radius);
+ AddAttribute(domElement, AttrCenter, center);
+ AddAttribute(domElement, AttrFirstPoint, firstPointId);
+ AddAttribute(domElement, AttrSecondPoint, secondPointId);
AddToCalculation(domElement);
}
diff --git a/tools/drawTools/vtoolpointofcontact.h b/tools/drawTools/vtoolpointofcontact.h
index d7720cddc..852329aa5 100644
--- a/tools/drawTools/vtoolpointofcontact.h
+++ b/tools/drawTools/vtoolpointofcontact.h
@@ -40,6 +40,7 @@ public:
const qint64 &firstPointId, const qint64 &secondPointId, const QString &pointName,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc,
VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation);
+ static const QString ToolType;
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
diff --git a/tools/drawTools/vtoolpointofintersection.cpp b/tools/drawTools/vtoolpointofintersection.cpp
index 10ef3c214..ceff574c3 100644
--- a/tools/drawTools/vtoolpointofintersection.cpp
+++ b/tools/drawTools/vtoolpointofintersection.cpp
@@ -1,5 +1,7 @@
#include "vtoolpointofintersection.h"
+const QString VToolPointOfIntersection::ToolType = QStringLiteral("pointOfIntersection");
+
VToolPointOfIntersection::VToolPointOfIntersection(VDomDocument *doc, VContainer *data, const qint64 &id,
const qint64 &firstPointId, const qint64 &secondPointId,
Tool::Sources typeCreation, QGraphicsItem *parent)
@@ -61,8 +63,8 @@ void VToolPointOfIntersection::Create(const qint64 _id, const QString &pointName
void VToolPointOfIntersection::FullUpdateFromFile(){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- firstPointId = domElement.attribute("firstPoint", "").toLongLong();
- secondPointId = domElement.attribute("secondPoint", "").toLongLong();
+ firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
+ secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
}
VToolPoint::RefreshPointGeometry(VDrawTool::data.GetPoint(id));
}
@@ -71,9 +73,9 @@ void VToolPointOfIntersection::FullUpdateFromGui(int result){
if(result == QDialog::Accepted){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("name", dialogPointOfIntersection->getPointName());
- domElement.setAttribute("firstPoint", QString().setNum(dialogPointOfIntersection->getFirstPointId()));
- domElement.setAttribute("secondPoint", QString().setNum(dialogPointOfIntersection->getSecondPointId()));
+ domElement.setAttribute(AttrName, dialogPointOfIntersection->getPointName());
+ domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogPointOfIntersection->getFirstPointId()));
+ domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogPointOfIntersection->getSecondPointId()));
emit FullUpdateTree();
}
}
@@ -91,16 +93,16 @@ void VToolPointOfIntersection::contextMenuEvent(QGraphicsSceneContextMenuEvent *
void VToolPointOfIntersection::AddToFile(){
VPointF point = VAbstractTool::data.GetPoint(id);
- QDomElement domElement = doc->createElement("point");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "pointOfIntersection");
- AddAttribute(domElement, "name", point.name());
- AddAttribute(domElement, "mx", toMM(point.mx()));
- AddAttribute(domElement, "my", toMM(point.my()));
+ 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()));
- AddAttribute(domElement, "firstPoint", firstPointId);
- AddAttribute(domElement, "secondPoint", secondPointId);
+ AddAttribute(domElement, AttrFirstPoint, firstPointId);
+ AddAttribute(domElement, AttrSecondPoint, secondPointId);
AddToCalculation(domElement);
}
diff --git a/tools/drawTools/vtoolpointofintersection.h b/tools/drawTools/vtoolpointofintersection.h
index 7737d45a5..6aa69cd3c 100644
--- a/tools/drawTools/vtoolpointofintersection.h
+++ b/tools/drawTools/vtoolpointofintersection.h
@@ -17,6 +17,7 @@ public:
const qint64 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
Tool::Sources typeCreation);
+ static const QString ToolType;
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
diff --git a/tools/drawTools/vtoolshoulderpoint.cpp b/tools/drawTools/vtoolshoulderpoint.cpp
index ec4749c51..77b2510e9 100644
--- a/tools/drawTools/vtoolshoulderpoint.cpp
+++ b/tools/drawTools/vtoolshoulderpoint.cpp
@@ -20,9 +20,10 @@
****************************************************************************/
#include "vtoolshoulderpoint.h"
-#include
#include
+const QString VToolShoulderPoint::ToolType = QStringLiteral("shoulder");
+
VToolShoulderPoint::VToolShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula, const qint64 &p1Line,
const qint64 &p2Line, const qint64 &pShoulder, Tool::Sources typeCreation,
@@ -129,11 +130,11 @@ void VToolShoulderPoint::Create(const qint64 _id, const QString &formula, const
void VToolShoulderPoint::FullUpdateFromFile(){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- typeLine = domElement.attribute("typeLine", "");
- formula = domElement.attribute("length", "");
- basePointId = domElement.attribute("p1Line", "").toLongLong();
- p2Line = domElement.attribute("p2Line", "").toLongLong();
- pShoulder = domElement.attribute("pShoulder", "").toLongLong();
+ typeLine = domElement.attribute(AttrTypeLine, "");
+ formula = domElement.attribute(AttrLength, "");
+ basePointId = domElement.attribute(AttrP1Line, "").toLongLong();
+ p2Line = domElement.attribute(AttrP2Line, "").toLongLong();
+ pShoulder = domElement.attribute(AttrPShoulder, "").toLongLong();
}
RefreshGeometry();
}
@@ -142,12 +143,12 @@ void VToolShoulderPoint::FullUpdateFromGui(int result){
if(result == QDialog::Accepted){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("name", dialogShoulderPoint->getPointName());
- domElement.setAttribute("typeLine", dialogShoulderPoint->getTypeLine());
- domElement.setAttribute("length", dialogShoulderPoint->getFormula());
- domElement.setAttribute("p1Line", QString().setNum(dialogShoulderPoint->getP1Line()));
- domElement.setAttribute("p2Line", QString().setNum(dialogShoulderPoint->getP2Line()));
- domElement.setAttribute("pShoulder", QString().setNum(dialogShoulderPoint->getPShoulder()));
+ 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()));
emit FullUpdateTree();
}
}
@@ -165,19 +166,19 @@ void VToolShoulderPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
void VToolShoulderPoint::AddToFile(){
VPointF point = VAbstractTool::data.GetPoint(id);
- QDomElement domElement = doc->createElement("point");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "shoulder");
- AddAttribute(domElement, "name", point.name());
- AddAttribute(domElement, "mx", toMM(point.mx()));
- AddAttribute(domElement, "my", toMM(point.my()));
+ 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()));
- AddAttribute(domElement, "typeLine", typeLine);
- AddAttribute(domElement, "length", formula);
- AddAttribute(domElement, "p1Line", basePointId);
- AddAttribute(domElement, "p2Line", p2Line);
- AddAttribute(domElement, "pShoulder", pShoulder);
+ AddAttribute(domElement, AttrTypeLine, typeLine);
+ AddAttribute(domElement, AttrLength, formula);
+ AddAttribute(domElement, AttrP1Line, basePointId);
+ AddAttribute(domElement, AttrP2Line, p2Line);
+ AddAttribute(domElement, AttrPShoulder, pShoulder);
AddToCalculation(domElement);
}
diff --git a/tools/drawTools/vtoolshoulderpoint.h b/tools/drawTools/vtoolshoulderpoint.h
index 913fff10c..c56277620 100644
--- a/tools/drawTools/vtoolshoulderpoint.h
+++ b/tools/drawTools/vtoolshoulderpoint.h
@@ -39,6 +39,7 @@ public:
const qint64 &pShoulder, const QString &typeLine, const QString &pointName, const qreal &mx,
const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation);
+ static const QString ToolType;
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
diff --git a/tools/drawTools/vtoolsinglepoint.cpp b/tools/drawTools/vtoolsinglepoint.cpp
index 98cd0bd4f..79f39759e 100644
--- a/tools/drawTools/vtoolsinglepoint.cpp
+++ b/tools/drawTools/vtoolsinglepoint.cpp
@@ -21,6 +21,8 @@
#include "vtoolsinglepoint.h"
+const QString VToolSinglePoint::ToolType = QStringLiteral("single");
+
VToolSinglePoint::VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation,
QGraphicsItem * parent ):VToolPoint(doc, data, id, parent),
dialogSinglePoint(QSharedPointer()){
@@ -42,15 +44,15 @@ void VToolSinglePoint::setDialog(){
void VToolSinglePoint::AddToFile(){
VPointF point = VAbstractTool::data.GetPoint(id);
- QDomElement domElement = doc->createElement("point");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "single");
- AddAttribute(domElement, "name", point.name());
- AddAttribute(domElement, "x", toMM(point.x()));
- AddAttribute(domElement, "y", toMM(point.y()));
- AddAttribute(domElement, "mx", toMM(point.mx()));
- AddAttribute(domElement, "my", toMM(point.my()));
+ 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()));
AddToCalculation(domElement);
}
@@ -72,8 +74,8 @@ QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change,
QPointF newPos = value.toPointF();
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("x", QString().setNum(toMM(newPos.x())));
- domElement.setAttribute("y", QString().setNum(toMM(newPos.y())));
+ domElement.setAttribute(AttrX, QString().setNum(toMM(newPos.x())));
+ domElement.setAttribute(AttrY, QString().setNum(toMM(newPos.y())));
//I don't now why but signal does not work.
doc->FullUpdateTree();
}
@@ -101,9 +103,9 @@ void VToolSinglePoint::FullUpdateFromGui(int result){
QString name = dialogSinglePoint->getName();
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("name", name);
- domElement.setAttribute("x", QString().setNum(toMM(p.x())));
- domElement.setAttribute("y", QString().setNum(toMM(p.y())));
+ domElement.setAttribute(AttrName, name);
+ domElement.setAttribute(AttrX, QString().setNum(toMM(p.x())));
+ domElement.setAttribute(AttrY, QString().setNum(toMM(p.y())));
//I don't now why but signal does not work.
doc->FullUpdateTree();
}
diff --git a/tools/drawTools/vtoolsinglepoint.h b/tools/drawTools/vtoolsinglepoint.h
index 4571757af..65b9365cc 100644
--- a/tools/drawTools/vtoolsinglepoint.h
+++ b/tools/drawTools/vtoolsinglepoint.h
@@ -31,6 +31,7 @@ public:
VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation,
QGraphicsItem * parent = 0 );
virtual void setDialog();
+ static const QString ToolType;
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
diff --git a/tools/drawTools/vtoolspline.cpp b/tools/drawTools/vtoolspline.cpp
index a38b40740..60ed17a35 100644
--- a/tools/drawTools/vtoolspline.cpp
+++ b/tools/drawTools/vtoolspline.cpp
@@ -20,9 +20,10 @@
****************************************************************************/
#include "vtoolspline.h"
-#include
#include "geometry/vspline.h"
+const QString VToolSpline::TagName = QStringLiteral("spline");
+const QString VToolSpline::ToolType = QStringLiteral("simple");
VToolSpline::VToolSpline(VDomDocument *doc, VContainer *data, qint64 id,
Tool::Sources typeCreation,
@@ -141,13 +142,13 @@ void VToolSpline::FullUpdateFromGui(int result){
controlPoints[1]->pos(), dialogSpline->getP4(), dialogSpline->getKCurve());
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("point1", QString().setNum(spl.GetP1()));
- domElement.setAttribute("point4", QString().setNum(spl.GetP4()));
- domElement.setAttribute("angle1", QString().setNum(spl.GetAngle1()));
- domElement.setAttribute("angle2", QString().setNum(spl.GetAngle2()));
- domElement.setAttribute("kAsm1", QString().setNum(spl.GetKasm1()));
- domElement.setAttribute("kAsm2", QString().setNum(spl.GetKasm2()));
- domElement.setAttribute("kCurve", QString().setNum(spl.GetKcurve()));
+ 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()));
emit FullUpdateTree();
}
}
@@ -165,11 +166,11 @@ void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, SplinePo
}
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("angle1", QString().setNum(spl.GetAngle1()));
- domElement.setAttribute("angle2", QString().setNum(spl.GetAngle2()));
- domElement.setAttribute("kAsm1", QString().setNum(spl.GetKasm1()));
- domElement.setAttribute("kAsm2", QString().setNum(spl.GetKasm2()));
- domElement.setAttribute("kCurve", QString().setNum(spl.GetKcurve()));
+ 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()));
emit FullUpdateTree();
}
}
@@ -180,17 +181,17 @@ void VToolSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
void VToolSpline::AddToFile(){
VSpline spl = VAbstractTool::data.GetSpline(id);
- QDomElement domElement = doc->createElement("spline");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "simple");
- AddAttribute(domElement, "point1", spl.GetP1());
- AddAttribute(domElement, "point4", spl.GetP4());
- AddAttribute(domElement, "angle1", spl.GetAngle1());
- AddAttribute(domElement, "angle2", spl.GetAngle2());
- AddAttribute(domElement, "kAsm1", spl.GetKasm1());
- AddAttribute(domElement, "kAsm2", spl.GetKasm2());
- AddAttribute(domElement, "kCurve", spl.GetKcurve());
+ AddAttribute(domElement, AttrId, id);
+ AddAttribute(domElement, AttrType, ToolType);
+ AddAttribute(domElement, AttrPoint1, spl.GetP1());
+ AddAttribute(domElement, AttrPoint4, spl.GetP4());
+ 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());
AddToCalculation(domElement);
}
diff --git a/tools/drawTools/vtoolspline.h b/tools/drawTools/vtoolspline.h
index ead6779a0..a298b7ae4 100644
--- a/tools/drawTools/vtoolspline.h
+++ b/tools/drawTools/vtoolspline.h
@@ -40,6 +40,8 @@ public:
const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation);
+ static const QString TagName;
+ static const QString ToolType;
signals:
void RefreshLine ( const qint32 &indexSpline, SplinePoint::Position position, const QPointF &controlPoint,
const QPointF &splinePoint );
diff --git a/tools/drawTools/vtoolsplinepath.cpp b/tools/drawTools/vtoolsplinepath.cpp
index 301dc0520..3e8cb0bee 100644
--- a/tools/drawTools/vtoolsplinepath.cpp
+++ b/tools/drawTools/vtoolsplinepath.cpp
@@ -21,6 +21,9 @@
#include "vtoolsplinepath.h"
+const QString VToolSplinePath::TagName = QStringLiteral("spline");
+const QString VToolSplinePath::ToolType = QStringLiteral("path");
+
VToolSplinePath::VToolSplinePath(VDomDocument *doc, VContainer *data, qint64 id,
Tool::Sources typeCreation,
QGraphicsItem *parent):VDrawTool(doc, data, id),
@@ -129,7 +132,7 @@ void VToolSplinePath::FullUpdateFromGui(int result){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("kCurve", QString().setNum(splPath.getKCurve()));
+ domElement.setAttribute(AttrKCurve, QString().setNum(splPath.getKCurve()));
UpdatePathPoint(domElement, splPath);
emit FullUpdateTree();
}
@@ -152,7 +155,7 @@ void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, Spli
CorectControlPoints(spl, splPath, indexSpline);
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("kCurve", QString().setNum(splPath.getKCurve()));
+ domElement.setAttribute(AttrKCurve, QString().setNum(splPath.getKCurve()));
UpdatePathPoint(domElement, splPath);
emit FullUpdateTree();
}
@@ -178,10 +181,10 @@ void VToolSplinePath::UpdatePathPoint(QDomNode& node, VSplinePath &path){
QDomElement domElement = nodeList.at(i).toElement();
if(!domElement.isNull()){
VSplinePoint p = path[i];
- domElement.setAttribute("pSpline", QString().setNum(p.P()));
- domElement.setAttribute("kAsm1", QString().setNum(p.KAsm1()));
- domElement.setAttribute("kAsm2", QString().setNum(p.KAsm2()));
- domElement.setAttribute("angle", QString().setNum(p.Angle2()));
+ domElement.setAttribute(AttrPSpline, QString().setNum(p.P()));
+ domElement.setAttribute(AttrKAsm1, QString().setNum(p.KAsm1()));
+ domElement.setAttribute(AttrKAsm2, QString().setNum(p.KAsm2()));
+ domElement.setAttribute(AttrAngle, QString().setNum(p.Angle2()));
}
}
}
@@ -217,11 +220,11 @@ void VToolSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
void VToolSplinePath::AddToFile(){
VSplinePath splPath = VAbstractTool::data.GetSplinePath(id);
- QDomElement domElement = doc->createElement("spline");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "path");
- AddAttribute(domElement, "kCurve", splPath.getKCurve());
+ AddAttribute(domElement, AttrId, id);
+ AddAttribute(domElement, AttrType, ToolType);
+ AddAttribute(domElement, AttrKCurve, splPath.getKCurve());
for(qint32 i = 0; i < splPath.CountPoint(); ++i){
AddPathPoint(domElement, splPath[i]);
@@ -231,12 +234,12 @@ void VToolSplinePath::AddToFile(){
}
void VToolSplinePath::AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint){
- QDomElement pathPoint = doc->createElement("pathPoint");
+ QDomElement pathPoint = doc->createElement(AttrPathPoint);
- AddAttribute(pathPoint, "pSpline", splPoint.P());
- AddAttribute(pathPoint, "kAsm1", splPoint.KAsm1());
- AddAttribute(pathPoint, "kAsm2", splPoint.KAsm2());
- AddAttribute(pathPoint, "angle", splPoint.Angle2());
+ AddAttribute(pathPoint, AttrPSpline, splPoint.P());
+ AddAttribute(pathPoint, AttrKAsm1, splPoint.KAsm1());
+ AddAttribute(pathPoint, AttrKAsm2, splPoint.KAsm2());
+ AddAttribute(pathPoint, AttrAngle, splPoint.Angle2());
domElement.appendChild(pathPoint);
}
diff --git a/tools/drawTools/vtoolsplinepath.h b/tools/drawTools/vtoolsplinepath.h
index 3fbec5490..3bc9974e5 100644
--- a/tools/drawTools/vtoolsplinepath.h
+++ b/tools/drawTools/vtoolsplinepath.h
@@ -38,6 +38,8 @@ public:
static void Create(const qint64 _id, const VSplinePath &path, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
Tool::Sources typeCreation);
+ static const QString TagName;
+ static const QString ToolType;
signals:
void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos,
const QPointF &controlPoint, const QPointF &splinePoint);
diff --git a/tools/drawTools/vtooltriangle.cpp b/tools/drawTools/vtooltriangle.cpp
index 260961412..6c9c74b3b 100644
--- a/tools/drawTools/vtooltriangle.cpp
+++ b/tools/drawTools/vtooltriangle.cpp
@@ -1,5 +1,7 @@
#include "vtooltriangle.h"
+const QString VToolTriangle::ToolType = QStringLiteral("triangle");
+
VToolTriangle::VToolTriangle(VDomDocument *doc, VContainer *data, const qint64 &id,
const qint64 &axisP1Id, const qint64 &axisP2Id, const qint64 &firstPointId,
const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem *parent)
@@ -104,10 +106,10 @@ QPointF VToolTriangle::FindPoint(const QPointF axisP1, const QPointF axisP2, con
void VToolTriangle::FullUpdateFromFile(){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- axisP1Id = domElement.attribute("axisP1", "").toLongLong();
- axisP2Id = domElement.attribute("axisP2", "").toLongLong();
- firstPointId = domElement.attribute("firstPoint", "").toLongLong();
- secondPointId = domElement.attribute("secondPoint", "").toLongLong();
+ axisP1Id = domElement.attribute(AttrAxisP1, "").toLongLong();
+ axisP2Id = domElement.attribute(AttrAxisP2, "").toLongLong();
+ firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
+ secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
}
VToolPoint::RefreshPointGeometry(VDrawTool::data.GetPoint(id));
}
@@ -116,11 +118,11 @@ void VToolTriangle::FullUpdateFromGui(int result){
if(result == QDialog::Accepted){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("name", dialogTriangle->getPointName());
- domElement.setAttribute("axisP1", QString().setNum(dialogTriangle->getAxisP1Id()));
- domElement.setAttribute("axisP2", QString().setNum(dialogTriangle->getAxisP2Id()));
- domElement.setAttribute("firstPoint", QString().setNum(dialogTriangle->getFirstPointId()));
- domElement.setAttribute("secondPoint", QString().setNum(dialogTriangle->getSecondPointId()));
+ 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()));
emit FullUpdateTree();
}
@@ -141,18 +143,18 @@ void VToolTriangle::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
void VToolTriangle::AddToFile(){
VPointF point = VAbstractTool::data.GetPoint(id);
- QDomElement domElement = doc->createElement("point");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "triangle");
- AddAttribute(domElement, "name", point.name());
- AddAttribute(domElement, "mx", toMM(point.mx()));
- AddAttribute(domElement, "my", toMM(point.my()));
+ 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()));
- AddAttribute(domElement, "axisP1", axisP1Id);
- AddAttribute(domElement, "axisP2", axisP2Id);
- AddAttribute(domElement, "firstPoint", firstPointId);
- AddAttribute(domElement, "secondPoint", secondPointId);
+ AddAttribute(domElement, AttrAxisP1, axisP1Id);
+ AddAttribute(domElement, AttrAxisP2, axisP2Id);
+ AddAttribute(domElement, AttrFirstPoint, firstPointId);
+ AddAttribute(domElement, AttrSecondPoint, secondPointId);
AddToCalculation(domElement);
}
diff --git a/tools/drawTools/vtooltriangle.h b/tools/drawTools/vtooltriangle.h
index 9cf84d9ca..63b07c06a 100644
--- a/tools/drawTools/vtooltriangle.h
+++ b/tools/drawTools/vtooltriangle.h
@@ -40,6 +40,7 @@ public:
const Document::Documents &parse, Tool::Sources typeCreation);
static QPointF FindPoint(const QPointF axisP1, const QPointF axisP2, const QPointF firstPoint,
const QPointF secondPoint);
+ static const QString ToolType;
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
diff --git a/tools/modelingTools/vmodelingalongline.cpp b/tools/modelingTools/vmodelingalongline.cpp
index 8678c20b6..30da7536d 100644
--- a/tools/modelingTools/vmodelingalongline.cpp
+++ b/tools/modelingTools/vmodelingalongline.cpp
@@ -22,6 +22,8 @@
#include "vmodelingalongline.h"
#include "container/calculator.h"
+const QString VModelingAlongLine::ToolType = QStringLiteral("alongLine");
+
VModelingAlongLine::VModelingAlongLine(VDomDocument *doc, VContainer *data, qint64 id,
const QString &formula, const qint64 &firstPointId,
const qint64 &secondPointId, const QString &typeLine,
@@ -37,10 +39,10 @@ VModelingAlongLine::VModelingAlongLine(VDomDocument *doc, VContainer *data, qint
void VModelingAlongLine::FullUpdateFromFile(){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- typeLine = domElement.attribute("typeLine", "");
- formula = domElement.attribute("length", "");
- basePointId = domElement.attribute("firstPoint", "").toLongLong();
- secondPointId = domElement.attribute("secondPoint", "").toLongLong();
+ typeLine = domElement.attribute(AttrTypeLine, "");
+ formula = domElement.attribute(AttrLength, "");
+ basePointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
+ secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
}
RefreshGeometry();
}
@@ -49,11 +51,11 @@ void VModelingAlongLine::FullUpdateFromGui(int result){
if(result == QDialog::Accepted){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("name", dialogAlongLine->getPointName());
- domElement.setAttribute("typeLine", dialogAlongLine->getTypeLine());
- domElement.setAttribute("length", dialogAlongLine->getFormula());
- domElement.setAttribute("firstPoint", QString().setNum(dialogAlongLine->getFirstPointId()));
- domElement.setAttribute("secondPoint", QString().setNum(dialogAlongLine->getSecondPointId()));
+ 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()));
emit FullUpdateTree();
}
@@ -67,18 +69,18 @@ void VModelingAlongLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
void VModelingAlongLine::AddToFile(){
VPointF point = VAbstractTool::data.GetModelingPoint(id);
- QDomElement domElement = doc->createElement("point");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "alongLine");
- AddAttribute(domElement, "name", point.name());
- AddAttribute(domElement, "mx", toMM(point.mx()));
- AddAttribute(domElement, "my", toMM(point.my()));
+ 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()));
- AddAttribute(domElement, "typeLine", typeLine);
- AddAttribute(domElement, "length", formula);
- AddAttribute(domElement, "firstPoint", basePointId);
- AddAttribute(domElement, "secondPoint", secondPointId);
+ AddAttribute(domElement, AttrTypeLine, typeLine);
+ AddAttribute(domElement, AttrLength, formula);
+ AddAttribute(domElement, AttrFirstPoint, basePointId);
+ AddAttribute(domElement, AttrSecondPoint, secondPointId);
AddToModeling(domElement);
}
diff --git a/tools/modelingTools/vmodelingalongline.h b/tools/modelingTools/vmodelingalongline.h
index 5f47e88d9..eceb805b3 100644
--- a/tools/modelingTools/vmodelingalongline.h
+++ b/tools/modelingTools/vmodelingalongline.h
@@ -38,6 +38,7 @@ public:
const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId,
const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation);
+ static const QString ToolType;
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
diff --git a/tools/modelingTools/vmodelingarc.cpp b/tools/modelingTools/vmodelingarc.cpp
index 575dbcf7e..6181db5c7 100644
--- a/tools/modelingTools/vmodelingarc.cpp
+++ b/tools/modelingTools/vmodelingarc.cpp
@@ -22,6 +22,9 @@
#include "vmodelingarc.h"
#include "container/calculator.h"
+const QString VModelingArc::TagName = QStringLiteral("arc");
+const QString VModelingArc::ToolType = QStringLiteral("simple");
+
VModelingArc::VModelingArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation,
QGraphicsItem *parent):VModelingTool(doc, data, id), QGraphicsPathItem(parent),
dialogArc(QSharedPointer()){
@@ -106,10 +109,10 @@ void VModelingArc::FullUpdateFromGui(int result){
if(result == QDialog::Accepted){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("center", QString().setNum(dialogArc->GetCenter()));
- domElement.setAttribute("radius", dialogArc->GetRadius());
- domElement.setAttribute("angle1", dialogArc->GetF1());
- domElement.setAttribute("angle2", dialogArc->GetF2());
+ domElement.setAttribute(AttrCenter, QString().setNum(dialogArc->GetCenter()));
+ domElement.setAttribute(AttrRadius, dialogArc->GetRadius());
+ domElement.setAttribute(AttrAngle1, dialogArc->GetF1());
+ domElement.setAttribute(AttrAngle2, dialogArc->GetF2());
emit FullUpdateTree();
}
}
@@ -122,14 +125,14 @@ void VModelingArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
void VModelingArc::AddToFile(){
VArc arc = VAbstractTool::data.GetModelingArc(id);
- QDomElement domElement = doc->createElement("arc");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "simple");
- AddAttribute(domElement, "center", arc.GetCenter());
- AddAttribute(domElement, "radius", arc.GetFormulaRadius());
- AddAttribute(domElement, "angle1", arc.GetFormulaF1());
- AddAttribute(domElement, "angle2", arc.GetFormulaF2());
+ AddAttribute(domElement, AttrId, id);
+ AddAttribute(domElement, AttrType, ToolType);
+ AddAttribute(domElement, AttrCenter, arc.GetCenter());
+ AddAttribute(domElement, AttrRadius, arc.GetFormulaRadius());
+ AddAttribute(domElement, AttrAngle1, arc.GetFormulaF1());
+ AddAttribute(domElement, AttrAngle2, arc.GetFormulaF2());
AddToModeling(domElement);
}
diff --git a/tools/modelingTools/vmodelingarc.h b/tools/modelingTools/vmodelingarc.h
index e7d0f1401..18c20f897 100644
--- a/tools/modelingTools/vmodelingarc.h
+++ b/tools/modelingTools/vmodelingarc.h
@@ -37,6 +37,8 @@ public:
static VModelingArc* Create(const qint64 _id, const qint64 ¢er, const QString &radius, const QString &f1,
const QString &f2, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation);
+ static const QString TagName;
+ static const QString ToolType;
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
diff --git a/tools/modelingTools/vmodelingbisector.cpp b/tools/modelingTools/vmodelingbisector.cpp
index 9a2a2349b..fa84f937b 100644
--- a/tools/modelingTools/vmodelingbisector.cpp
+++ b/tools/modelingTools/vmodelingbisector.cpp
@@ -23,6 +23,8 @@
#include "../drawTools/vtoolbisector.h"
#include
+const QString VModelingBisector::ToolType = QStringLiteral("bisector");
+
VModelingBisector::VModelingBisector(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula, const qint64 &firstPointId,
const qint64 &secondPointId, const qint64 &thirdPointId, Tool::Sources typeCreation,
@@ -104,11 +106,11 @@ VModelingBisector *VModelingBisector::Create(const qint64 _id, const QString &fo
void VModelingBisector::FullUpdateFromFile(){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- typeLine = domElement.attribute("typeLine", "");
- formula = domElement.attribute("length", "");
- firstPointId = domElement.attribute("firstPoint", "").toLongLong();
- basePointId = domElement.attribute("secondPoint", "").toLongLong();
- thirdPointId = domElement.attribute("thirdPoint", "").toLongLong();
+ typeLine = domElement.attribute(AttrTypeLine, "");
+ formula = domElement.attribute(AttrLength, "");
+ firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
+ basePointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
+ thirdPointId = domElement.attribute(AttrThirdPoint, "").toLongLong();
}
RefreshGeometry();
}
@@ -117,12 +119,12 @@ void VModelingBisector::FullUpdateFromGui(int result){
if(result == QDialog::Accepted){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("name", dialogBisector->getPointName());
- domElement.setAttribute("typeLine", dialogBisector->getTypeLine());
- domElement.setAttribute("length", dialogBisector->getFormula());
- domElement.setAttribute("firstPoint", QString().setNum(dialogBisector->getFirstPointId()));
- domElement.setAttribute("secondPoint", QString().setNum(dialogBisector->getSecondPointId()));
- domElement.setAttribute("thirdPoint", QString().setNum(dialogBisector->getThirdPointId()));
+ 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()));
emit FullUpdateTree();
}
}
@@ -135,19 +137,19 @@ void VModelingBisector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
void VModelingBisector::AddToFile(){
VPointF point = VAbstractTool::data.GetModelingPoint(id);
- QDomElement domElement = doc->createElement("point");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "bisector");
- AddAttribute(domElement, "name", point.name());
- AddAttribute(domElement, "mx", toMM(point.mx()));
- AddAttribute(domElement, "my", toMM(point.my()));
+ 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()));
- AddAttribute(domElement, "typeLine", typeLine);
- AddAttribute(domElement, "length", formula);
- AddAttribute(domElement, "firstPoint", firstPointId);
- AddAttribute(domElement, "secondPoint", basePointId);
- AddAttribute(domElement, "thirdPoint", thirdPointId);
+ AddAttribute(domElement, AttrTypeLine, typeLine);
+ AddAttribute(domElement, AttrLength, formula);
+ AddAttribute(domElement, AttrFirstPoint, firstPointId);
+ AddAttribute(domElement, AttrSecondPoint, basePointId);
+ AddAttribute(domElement, AttrThirdPoint, thirdPointId);
AddToModeling(domElement);
}
diff --git a/tools/modelingTools/vmodelingbisector.h b/tools/modelingTools/vmodelingbisector.h
index f672e9c55..2a84ac1fc 100644
--- a/tools/modelingTools/vmodelingbisector.h
+++ b/tools/modelingTools/vmodelingbisector.h
@@ -39,6 +39,7 @@ public:
const qint64 &secondPointId, const qint64 &thirdPointId, const QString &typeLine,
const QString &pointName, const qreal &mx, const qreal &my, VDomDocument *doc,
VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation);
+ static const QString ToolType;
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
diff --git a/tools/modelingTools/vmodelingendline.cpp b/tools/modelingTools/vmodelingendline.cpp
index 475ec9b3c..fa4b51f5f 100644
--- a/tools/modelingTools/vmodelingendline.cpp
+++ b/tools/modelingTools/vmodelingendline.cpp
@@ -22,6 +22,8 @@
#include "vmodelingendline.h"
#include
+const QString VModelingEndLine::ToolType = QStringLiteral("endLine");
+
VModelingEndLine::VModelingEndLine(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula, const qreal &angle,
const qint64 &basePointId, Tool::Sources typeCreation,
@@ -91,10 +93,10 @@ VModelingEndLine *VModelingEndLine::Create(const qint64 _id, const QString &poin
void VModelingEndLine::FullUpdateFromFile(){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- typeLine = domElement.attribute("typeLine", "");
- formula = domElement.attribute("length", "");
- basePointId = domElement.attribute("basePoint", "").toLongLong();
- angle = domElement.attribute("angle", "").toDouble();
+ typeLine = domElement.attribute(AttrTypeLine, "");
+ formula = domElement.attribute(AttrLength, "");
+ basePointId = domElement.attribute(AttrBasePoint, "").toLongLong();
+ angle = domElement.attribute(AttrAngle, "").toDouble();
}
RefreshGeometry();
}
@@ -107,11 +109,11 @@ void VModelingEndLine::FullUpdateFromGui(int result){
if(result == QDialog::Accepted){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("name", dialogEndLine->getPointName());
- domElement.setAttribute("typeLine", dialogEndLine->getTypeLine());
- domElement.setAttribute("length", dialogEndLine->getFormula());
- domElement.setAttribute("angle", QString().setNum(dialogEndLine->getAngle()));
- domElement.setAttribute("basePoint", QString().setNum(dialogEndLine->getBasePointId()));
+ 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()));
emit FullUpdateTree();
}
}
@@ -120,18 +122,18 @@ void VModelingEndLine::FullUpdateFromGui(int result){
void VModelingEndLine::AddToFile(){
VPointF point = VAbstractTool::data.GetModelingPoint(id);
- QDomElement domElement = doc->createElement("point");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "endLine");
- AddAttribute(domElement, "name", point.name());
- AddAttribute(domElement, "mx", toMM(point.mx()));
- AddAttribute(domElement, "my", toMM(point.my()));
+ 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()));
- AddAttribute(domElement, "typeLine", typeLine);
- AddAttribute(domElement, "length", formula);
- AddAttribute(domElement, "angle", angle);
- AddAttribute(domElement, "basePoint", basePointId);
+ AddAttribute(domElement, AttrTypeLine, typeLine);
+ AddAttribute(domElement, AttrLength, formula);
+ AddAttribute(domElement, AttrAngle, angle);
+ AddAttribute(domElement, AttrBasePoint, basePointId);
AddToModeling(domElement);
}
diff --git a/tools/modelingTools/vmodelingendline.h b/tools/modelingTools/vmodelingendline.h
index fd81cd062..edf57b266 100644
--- a/tools/modelingTools/vmodelingendline.h
+++ b/tools/modelingTools/vmodelingendline.h
@@ -38,6 +38,7 @@ public:
const QString &formula, const qreal &angle, const qint64 &basePointId,
const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation);
+ static const QString ToolType;
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
diff --git a/tools/modelingTools/vmodelingheight.cpp b/tools/modelingTools/vmodelingheight.cpp
index 46e3d3565..cbf87545f 100644
--- a/tools/modelingTools/vmodelingheight.cpp
+++ b/tools/modelingTools/vmodelingheight.cpp
@@ -1,6 +1,8 @@
#include "vmodelingheight.h"
#include "../drawTools/vtoolheight.h"
+const QString VModelingHeight::ToolType = QStringLiteral("height");
+
VModelingHeight::VModelingHeight(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const qint64 &basePointId, const qint64 &p1LineId,
const qint64 &p2LineId, Tool::Sources typeCreation,
@@ -71,10 +73,10 @@ VModelingHeight *VModelingHeight::Create(const qint64 _id, const QString &pointN
void VModelingHeight::FullUpdateFromFile(){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- typeLine = domElement.attribute("typeLine", "");
- basePointId = domElement.attribute("basePoint", "").toLongLong();
- p1LineId = domElement.attribute("p1Line", "").toLongLong();
- p2LineId = domElement.attribute("p2Line", "").toLongLong();
+ typeLine = domElement.attribute(AttrTypeLine, "");
+ basePointId = domElement.attribute(AttrBasePoint, "").toLongLong();
+ p1LineId = domElement.attribute(AttrP1Line, "").toLongLong();
+ p2LineId = domElement.attribute(AttrP2Line, "").toLongLong();
}
RefreshGeometry();
}
@@ -83,11 +85,11 @@ void VModelingHeight::FullUpdateFromGui(int result){
if(result == QDialog::Accepted){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("name", dialogHeight->getPointName());
- domElement.setAttribute("typeLine", dialogHeight->getTypeLine());
- domElement.setAttribute("basePoint", QString().setNum(dialogHeight->getBasePointId()));
- domElement.setAttribute("p1Line", QString().setNum(dialogHeight->getP1LineId()));
- domElement.setAttribute("p2Line", QString().setNum(dialogHeight->getP2LineId()));
+ 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()));
emit FullUpdateTree();
}
}
@@ -100,18 +102,18 @@ void VModelingHeight::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
void VModelingHeight::AddToFile(){
VPointF point = VAbstractTool::data.GetModelingPoint(id);
- QDomElement domElement = doc->createElement("point");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "endLine");
- AddAttribute(domElement, "name", point.name());
- AddAttribute(domElement, "mx", toMM(point.mx()));
- AddAttribute(domElement, "my", toMM(point.my()));
+ 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()));
- AddAttribute(domElement, "typeLine", typeLine);
- AddAttribute(domElement, "basePoint", basePointId);
- AddAttribute(domElement, "p1Line", p1LineId);
- AddAttribute(domElement, "p2Line", p2LineId);
+ AddAttribute(domElement, AttrTypeLine, typeLine);
+ AddAttribute(domElement, AttrBasePoint, basePointId);
+ AddAttribute(domElement, AttrP1Line, p1LineId);
+ AddAttribute(domElement, AttrP2Line, p2LineId);
AddToModeling(domElement);
}
diff --git a/tools/modelingTools/vmodelingheight.h b/tools/modelingTools/vmodelingheight.h
index f9fbdd7ab..7ad09f6e3 100644
--- a/tools/modelingTools/vmodelingheight.h
+++ b/tools/modelingTools/vmodelingheight.h
@@ -38,6 +38,7 @@ public:
const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId,
const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation);
+ static const QString ToolType;
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
diff --git a/tools/modelingTools/vmodelingline.cpp b/tools/modelingTools/vmodelingline.cpp
index 92e556189..6acd7cdd7 100644
--- a/tools/modelingTools/vmodelingline.cpp
+++ b/tools/modelingTools/vmodelingline.cpp
@@ -21,6 +21,8 @@
#include "vmodelingline.h"
+const QString VModelingLine::TagName = QStringLiteral("line");
+
VModelingLine::VModelingLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint,
qint64 secondPoint, Tool::Sources typeCreation, QGraphicsItem *parent):
VModelingTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint),
@@ -79,8 +81,8 @@ VModelingLine *VModelingLine::Create(const qint64 &_id, const qint64 &firstPoint
void VModelingLine::FullUpdateFromFile(){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- firstPoint = domElement.attribute("firstPoint", "").toLongLong();
- secondPoint = domElement.attribute("secondPoint", "").toLongLong();
+ firstPoint = domElement.attribute(AttrFirstPoint, "").toLongLong();
+ secondPoint = domElement.attribute(AttrSecondPoint, "").toLongLong();
}
VPointF first = VAbstractTool::data.GetModelingPoint(firstPoint);
VPointF second = VAbstractTool::data.GetModelingPoint(secondPoint);
@@ -91,8 +93,8 @@ void VModelingLine::FullUpdateFromGui(int result){
if(result == QDialog::Accepted){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("firstPoint", QString().setNum(dialogLine->getFirstPoint()));
- domElement.setAttribute("secondPoint", QString().setNum(dialogLine->getSecondPoint()));
+ domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogLine->getFirstPoint()));
+ domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogLine->getSecondPoint()));
emit FullUpdateTree();
}
}
@@ -104,10 +106,10 @@ void VModelingLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
}
void VModelingLine::AddToFile(){
- QDomElement domElement = doc->createElement("line");
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "firstPoint", firstPoint);
- AddAttribute(domElement, "secondPoint", secondPoint);
+ QDomElement domElement = doc->createElement(TagName);
+ AddAttribute(domElement, AttrId, id);
+ AddAttribute(domElement, AttrFirstPoint, firstPoint);
+ AddAttribute(domElement, AttrSecondPoint, secondPoint);
AddToModeling(domElement);
}
diff --git a/tools/modelingTools/vmodelingline.h b/tools/modelingTools/vmodelingline.h
index 98ec7041f..8bee26207 100644
--- a/tools/modelingTools/vmodelingline.h
+++ b/tools/modelingTools/vmodelingline.h
@@ -36,6 +36,8 @@ public:
static VModelingLine* Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint,
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
Tool::Sources typeCreation);
+ static const QString TagName;
+ static const QString ToolType;
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
diff --git a/tools/modelingTools/vmodelinglineintersect.cpp b/tools/modelingTools/vmodelinglineintersect.cpp
index 611749379..af78014b6 100644
--- a/tools/modelingTools/vmodelinglineintersect.cpp
+++ b/tools/modelingTools/vmodelinglineintersect.cpp
@@ -21,6 +21,8 @@
#include "vmodelinglineintersect.h"
+const QString VModelingLineIntersect::ToolType = QStringLiteral("lineIntersect");
+
VModelingLineIntersect::VModelingLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id,
const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2,
const qint64 &p2Line2, Tool::Sources typeCreation, QGraphicsItem *parent):
@@ -101,10 +103,10 @@ VModelingLineIntersect *VModelingLineIntersect::Create(const qint64 _id, const q
void VModelingLineIntersect::FullUpdateFromFile(){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- p1Line1 = domElement.attribute("p1Line1", "").toLongLong();
- p2Line1 = domElement.attribute("p2Line1", "").toLongLong();
- p1Line2 = domElement.attribute("p1Line2", "").toLongLong();
- p2Line2 = domElement.attribute("p2Line2", "").toLongLong();
+ p1Line1 = domElement.attribute(AttrP1Line1, "").toLongLong();
+ p2Line1 = domElement.attribute(AttrP2Line1, "").toLongLong();
+ p1Line2 = domElement.attribute(AttrP1Line2, "").toLongLong();
+ p2Line2 = domElement.attribute(AttrP2Line2, "").toLongLong();
}
RefreshPointGeometry(VAbstractTool::data.GetModelingPoint(id));
}
@@ -113,11 +115,11 @@ void VModelingLineIntersect::FullUpdateFromGui(int result){
if(result == QDialog::Accepted){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("name", dialogLineIntersect->getPointName());
- domElement.setAttribute("p1Line1", QString().setNum(dialogLineIntersect->getP1Line1()));
- domElement.setAttribute("p2Line1", QString().setNum(dialogLineIntersect->getP2Line1()));
- domElement.setAttribute("p1Line2", QString().setNum(dialogLineIntersect->getP1Line2()));
- domElement.setAttribute("p2Line2", QString().setNum(dialogLineIntersect->getP2Line2()));
+ 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()));
emit FullUpdateTree();
}
}
@@ -130,18 +132,18 @@ void VModelingLineIntersect::contextMenuEvent(QGraphicsSceneContextMenuEvent *ev
void VModelingLineIntersect::AddToFile(){
VPointF point = VAbstractTool::data.GetModelingPoint(id);
- QDomElement domElement = doc->createElement("point");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "lineIntersect");
- AddAttribute(domElement, "name", point.name());
- AddAttribute(domElement, "mx", toMM(point.mx()));
- AddAttribute(domElement, "my", toMM(point.my()));
+ 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()));
- AddAttribute(domElement, "p1Line1", p1Line1);
- AddAttribute(domElement, "p2Line1", p2Line1);
- AddAttribute(domElement, "p1Line2", p1Line2);
- AddAttribute(domElement, "p2Line2", p2Line2);
+ AddAttribute(domElement, AttrP1Line1, p1Line1);
+ AddAttribute(domElement, AttrP2Line1, p2Line1);
+ AddAttribute(domElement, AttrP1Line2, p1Line2);
+ AddAttribute(domElement, AttrP2Line2, p2Line2);
AddToModeling(domElement);
}
diff --git a/tools/modelingTools/vmodelinglineintersect.h b/tools/modelingTools/vmodelinglineintersect.h
index b090e5a2e..7051104d1 100644
--- a/tools/modelingTools/vmodelinglineintersect.h
+++ b/tools/modelingTools/vmodelinglineintersect.h
@@ -39,6 +39,7 @@ public:
const qint64 &p1Line2Id, const qint64 &p2Line2Id, const QString &pointName,
const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation);
+ static const QString ToolType;
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
diff --git a/tools/modelingTools/vmodelinglinepoint.cpp b/tools/modelingTools/vmodelinglinepoint.cpp
index 361144935..e8c05adb2 100644
--- a/tools/modelingTools/vmodelinglinepoint.cpp
+++ b/tools/modelingTools/vmodelinglinepoint.cpp
@@ -32,7 +32,7 @@ VModelingLinePoint::VModelingLinePoint(VDomDocument *doc, VContainer *data, cons
mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this);
mainLine->setPen(QPen(Qt::black, widthHairLine));
mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
- if(typeLine == "none"){
+ if(typeLine == TypeLineNone){
mainLine->setVisible(false);
} else {
mainLine->setVisible(true);
@@ -44,7 +44,7 @@ void VModelingLinePoint::RefreshGeometry(){
QPointF point = VModelingTool::data.GetModelingPoint(id).toQPointF();
QPointF basePoint = VModelingTool::data.GetModelingPoint(basePointId).toQPointF();
mainLine->setLine(QLineF(basePoint - point, QPointF()));
- if(typeLine == "none"){
+ if(typeLine == TypeLineNone){
mainLine->setVisible(false);
} else {
mainLine->setVisible(true);
diff --git a/tools/modelingTools/vmodelingnormal.cpp b/tools/modelingTools/vmodelingnormal.cpp
index 72ebc2b65..c9a9c2cad 100644
--- a/tools/modelingTools/vmodelingnormal.cpp
+++ b/tools/modelingTools/vmodelingnormal.cpp
@@ -23,6 +23,8 @@
#include "../drawTools/vtoolnormal.h"
#include
+const QString VModelingNormal::ToolType = QStringLiteral("normal");
+
VModelingNormal::VModelingNormal(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine,
const QString &formula, const qreal &angle, const qint64 &firstPointId,
@@ -99,11 +101,11 @@ VModelingNormal *VModelingNormal::Create(const qint64 _id, const QString &formul
void VModelingNormal::FullUpdateFromFile(){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- typeLine = domElement.attribute("typeLine", "");
- formula = domElement.attribute("length", "");
- basePointId = domElement.attribute("firstPoint", "").toLongLong();
- secondPointId = domElement.attribute("secondPoint", "").toLongLong();
- angle = domElement.attribute("angle", "").toInt();
+ typeLine = domElement.attribute(AttrTypeLine, "");
+ formula = domElement.attribute(AttrLength, "");
+ basePointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
+ secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
+ angle = domElement.attribute(AttrAngle, "").toInt();
}
RefreshGeometry();
}
@@ -112,12 +114,12 @@ void VModelingNormal::FullUpdateFromGui(int result){
if(result == QDialog::Accepted){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("name", dialogNormal->getPointName());
- domElement.setAttribute("typeLine", dialogNormal->getTypeLine());
- domElement.setAttribute("length", dialogNormal->getFormula());
- domElement.setAttribute("angle", QString().setNum(dialogNormal->getAngle()));
- domElement.setAttribute("firstPoint", QString().setNum(dialogNormal->getFirstPointId()));
- domElement.setAttribute("secondPoint", QString().setNum(dialogNormal->getSecondPointId()));
+ 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()));
emit FullUpdateTree();
}
}
@@ -130,19 +132,19 @@ void VModelingNormal::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
void VModelingNormal::AddToFile(){
VPointF point = VAbstractTool::data.GetModelingPoint(id);
- QDomElement domElement = doc->createElement("point");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "normal");
- AddAttribute(domElement, "name", point.name());
- AddAttribute(domElement, "mx", toMM(point.mx()));
- AddAttribute(domElement, "my", toMM(point.my()));
+ 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()));
- AddAttribute(domElement, "typeLine", typeLine);
- AddAttribute(domElement, "length", formula);
- AddAttribute(domElement, "angle", angle);
- AddAttribute(domElement, "firstPoint", basePointId);
- AddAttribute(domElement, "secondPoint", secondPointId);
+ AddAttribute(domElement, AttrTypeLine, typeLine);
+ AddAttribute(domElement, AttrLength, formula);
+ AddAttribute(domElement, AttrAngle, angle);
+ AddAttribute(domElement, AttrFirstPoint, basePointId);
+ AddAttribute(domElement, AttrSecondPoint, secondPointId);
AddToModeling(domElement);
}
diff --git a/tools/modelingTools/vmodelingnormal.h b/tools/modelingTools/vmodelingnormal.h
index 4e21102d5..c1ef9c146 100644
--- a/tools/modelingTools/vmodelingnormal.h
+++ b/tools/modelingTools/vmodelingnormal.h
@@ -38,6 +38,7 @@ public:
const qint64 &secondPointId, const QString typeLine, const QString pointName,
const qreal angle, const qreal &mx, const qreal &my, VDomDocument *doc,
VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation);
+ static const QString ToolType;
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
diff --git a/tools/modelingTools/vmodelingpoint.cpp b/tools/modelingTools/vmodelingpoint.cpp
index cfa4ec3f9..4bb1741fa 100644
--- a/tools/modelingTools/vmodelingpoint.cpp
+++ b/tools/modelingTools/vmodelingpoint.cpp
@@ -22,6 +22,8 @@
#include "vmodelingpoint.h"
#include "container/vpointf.h"
+const QString VModelingPoint::TagName = QStringLiteral("point");
+
VModelingPoint::VModelingPoint(VDomDocument *doc, VContainer *data, qint64 id,
QGraphicsItem *parent):VModelingTool(doc, data, id),
QGraphicsEllipseItem(parent), radius(toPixel(1.5)), namePoint(0), lineName(0){
@@ -49,8 +51,8 @@ void VModelingPoint::NameChangePosition(const QPointF pos){
void VModelingPoint::UpdateNamePosition(qreal mx, qreal my){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("mx", QString().setNum(toMM(mx)));
- domElement.setAttribute("my", QString().setNum(toMM(my)));
+ domElement.setAttribute(AttrMx, QString().setNum(toMM(mx)));
+ domElement.setAttribute(AttrMy, QString().setNum(toMM(my)));
emit toolhaveChange();
}
}
diff --git a/tools/modelingTools/vmodelingpoint.h b/tools/modelingTools/vmodelingpoint.h
index 6a68b5d80..03a8abe6c 100644
--- a/tools/modelingTools/vmodelingpoint.h
+++ b/tools/modelingTools/vmodelingpoint.h
@@ -30,6 +30,7 @@ class VModelingPoint: public VModelingTool, public QGraphicsEllipseItem{
public:
VModelingPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem * parent = 0);
virtual ~VModelingPoint() {}
+ static const QString TagName;
public slots:
void NameChangePosition(const QPointF pos);
virtual void FullUpdateFromGui(int result) = 0;
diff --git a/tools/modelingTools/vmodelingpointofcontact.cpp b/tools/modelingTools/vmodelingpointofcontact.cpp
index 9ea8c6935..11e9bd5ac 100644
--- a/tools/modelingTools/vmodelingpointofcontact.cpp
+++ b/tools/modelingTools/vmodelingpointofcontact.cpp
@@ -23,6 +23,8 @@
#include "../drawTools/vtoolpointofcontact.h"
#include
+const QString VModelingPointOfContact::ToolType = QStringLiteral("pointOfContact");
+
VModelingPointOfContact::VModelingPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &radius, const qint64 ¢er,
const qint64 &firstPointId, const qint64 &secondPointId,
@@ -100,10 +102,10 @@ VModelingPointOfContact *VModelingPointOfContact::Create(const qint64 _id, const
void VModelingPointOfContact::FullUpdateFromFile(){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- radius = domElement.attribute("radius", "");
- center = domElement.attribute("center", "").toLongLong();
- firstPointId = domElement.attribute("firstPoint", "").toLongLong();
- secondPointId = domElement.attribute("secondPoint", "").toLongLong();
+ radius = domElement.attribute(AttrRadius, "");
+ center = domElement.attribute(AttrCenter, "").toLongLong();
+ firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
+ secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
}
RefreshPointGeometry(VAbstractTool::data.GetModelingPoint(id));
}
@@ -112,11 +114,11 @@ void VModelingPointOfContact::FullUpdateFromGui(int result){
if(result == QDialog::Accepted){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("name", dialogPointOfContact->getPointName());
- domElement.setAttribute("radius", dialogPointOfContact->getRadius());
- domElement.setAttribute("center", QString().setNum(dialogPointOfContact->getCenter()));
- domElement.setAttribute("firstPoint", QString().setNum(dialogPointOfContact->getFirstPoint()));
- domElement.setAttribute("secondPoint", QString().setNum(dialogPointOfContact->getSecondPoint()));
+ 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()));
emit FullUpdateTree();
}
}
@@ -129,18 +131,18 @@ void VModelingPointOfContact::contextMenuEvent(QGraphicsSceneContextMenuEvent *e
void VModelingPointOfContact::AddToFile(){
VPointF point = VAbstractTool::data.GetModelingPoint(id);
- QDomElement domElement = doc->createElement("point");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "pointOfContact");
- AddAttribute(domElement, "name", point.name());
- AddAttribute(domElement, "mx", toMM(point.mx()));
- AddAttribute(domElement, "my", toMM(point.my()));
+ 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()));
- AddAttribute(domElement, "radius", radius);
- AddAttribute(domElement, "center", center);
- AddAttribute(domElement, "firstPoint", firstPointId);
- AddAttribute(domElement, "secondPoint", secondPointId);
+ AddAttribute(domElement, AttrRadius, radius);
+ AddAttribute(domElement, AttrCenter, center);
+ AddAttribute(domElement, AttrFirstPoint, firstPointId);
+ AddAttribute(domElement, AttrSecondPoint, secondPointId);
AddToModeling(domElement);
}
diff --git a/tools/modelingTools/vmodelingpointofcontact.h b/tools/modelingTools/vmodelingpointofcontact.h
index 0f1516a67..6eebac9ec 100644
--- a/tools/modelingTools/vmodelingpointofcontact.h
+++ b/tools/modelingTools/vmodelingpointofcontact.h
@@ -40,6 +40,7 @@ public:
const QString &pointName, const qreal &mx, const qreal &my,
VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation);
+ static const QString ToolType;
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
diff --git a/tools/modelingTools/vmodelingpointofintersection.cpp b/tools/modelingTools/vmodelingpointofintersection.cpp
index 70d4db79d..e22e97c7b 100644
--- a/tools/modelingTools/vmodelingpointofintersection.cpp
+++ b/tools/modelingTools/vmodelingpointofintersection.cpp
@@ -1,5 +1,7 @@
#include "vmodelingpointofintersection.h"
+const QString VModelingPointOfIntersection::ToolType = QStringLiteral("pointOfIntersection");
+
VModelingPointOfIntersection::VModelingPointOfIntersection(VDomDocument *doc, VContainer *data, const qint64 &id,
const qint64 &firstPointId, const qint64 &secondPointId,
Tool::Sources typeCreation, QGraphicsItem *parent)
@@ -60,8 +62,8 @@ VModelingPointOfIntersection *VModelingPointOfIntersection::Create(const qint64
void VModelingPointOfIntersection::FullUpdateFromFile(){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- firstPointId = domElement.attribute("firstPoint", "").toLongLong();
- secondPointId = domElement.attribute("secondPoint", "").toLongLong();
+ firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
+ secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
}
VModelingPoint::RefreshPointGeometry(VModelingTool::data.GetPoint(id));
}
@@ -70,9 +72,9 @@ void VModelingPointOfIntersection::FullUpdateFromGui(int result){
if(result == QDialog::Accepted){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("name", dialogPointOfIntersection->getPointName());
- domElement.setAttribute("firstPoint", QString().setNum(dialogPointOfIntersection->getFirstPointId()));
- domElement.setAttribute("secondPoint", QString().setNum(dialogPointOfIntersection->getSecondPointId()));
+ domElement.setAttribute(AttrName, dialogPointOfIntersection->getPointName());
+ domElement.setAttribute(AttrFirstPoint, QString().setNum(dialogPointOfIntersection->getFirstPointId()));
+ domElement.setAttribute(AttrSecondPoint, QString().setNum(dialogPointOfIntersection->getSecondPointId()));
emit FullUpdateTree();
}
}
@@ -90,16 +92,16 @@ void VModelingPointOfIntersection::contextMenuEvent(QGraphicsSceneContextMenuEve
void VModelingPointOfIntersection::AddToFile(){
VPointF point = VAbstractTool::data.GetPoint(id);
- QDomElement domElement = doc->createElement("point");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "pointOfIntersection");
- AddAttribute(domElement, "name", point.name());
- AddAttribute(domElement, "mx", toMM(point.mx()));
- AddAttribute(domElement, "my", toMM(point.my()));
+ 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()));
- AddAttribute(domElement, "firstPoint", firstPointId);
- AddAttribute(domElement, "secondPoint", secondPointId);
+ AddAttribute(domElement, AttrFirstPoint, firstPointId);
+ AddAttribute(domElement, AttrSecondPoint, secondPointId);
AddToModeling(domElement);
}
diff --git a/tools/modelingTools/vmodelingpointofintersection.h b/tools/modelingTools/vmodelingpointofintersection.h
index 1c4c94397..b2c00f4f2 100644
--- a/tools/modelingTools/vmodelingpointofintersection.h
+++ b/tools/modelingTools/vmodelingpointofintersection.h
@@ -18,6 +18,7 @@ public:
const qreal &mx, const qreal &my, VDomDocument *doc,
VContainer *data, const Document::Documents &parse,
Tool::Sources typeCreation);
+ static const QString ToolType;
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
diff --git a/tools/modelingTools/vmodelingshoulderpoint.cpp b/tools/modelingTools/vmodelingshoulderpoint.cpp
index ebb6e38df..d0f32ebfb 100644
--- a/tools/modelingTools/vmodelingshoulderpoint.cpp
+++ b/tools/modelingTools/vmodelingshoulderpoint.cpp
@@ -23,6 +23,8 @@
#include "../drawTools/vtoolshoulderpoint.h"
#include
+const QString VModelingShoulderPoint::ToolType = QStringLiteral("shoulder");
+
VModelingShoulderPoint::VModelingShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula, const qint64 &p1Line,
const qint64 &p2Line, const qint64 &pShoulder, Tool::Sources typeCreation,
@@ -104,11 +106,11 @@ VModelingShoulderPoint *VModelingShoulderPoint::Create(const qint64 _id, const Q
void VModelingShoulderPoint::FullUpdateFromFile(){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- typeLine = domElement.attribute("typeLine", "");
- formula = domElement.attribute("length", "");
- basePointId = domElement.attribute("p1Line", "").toLongLong();
- p2Line = domElement.attribute("p2Line", "").toLongLong();
- pShoulder = domElement.attribute("pShoulder", "").toLongLong();
+ typeLine = domElement.attribute(AttrTypeLine, "");
+ formula = domElement.attribute(AttrLength, "");
+ basePointId = domElement.attribute(AttrP1Line, "").toLongLong();
+ p2Line = domElement.attribute(AttrP2Line, "").toLongLong();
+ pShoulder = domElement.attribute(AttrPShoulder, "").toLongLong();
}
RefreshGeometry();
}
@@ -117,12 +119,12 @@ void VModelingShoulderPoint::FullUpdateFromGui(int result){
if(result == QDialog::Accepted){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("name", dialogShoulderPoint->getPointName());
- domElement.setAttribute("typeLine", dialogShoulderPoint->getTypeLine());
- domElement.setAttribute("length", dialogShoulderPoint->getFormula());
- domElement.setAttribute("p1Line", QString().setNum(dialogShoulderPoint->getP1Line()));
- domElement.setAttribute("p2Line", QString().setNum(dialogShoulderPoint->getP2Line()));
- domElement.setAttribute("pShoulder", QString().setNum(dialogShoulderPoint->getPShoulder()));
+ 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()));
emit FullUpdateTree();
}
}
@@ -135,19 +137,19 @@ void VModelingShoulderPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *ev
void VModelingShoulderPoint::AddToFile(){
VPointF point = VAbstractTool::data.GetModelingPoint(id);
- QDomElement domElement = doc->createElement("point");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "shoulder");
- AddAttribute(domElement, "name", point.name());
- AddAttribute(domElement, "mx", toMM(point.mx()));
- AddAttribute(domElement, "my", toMM(point.my()));
+ 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()));
- AddAttribute(domElement, "typeLine", typeLine);
- AddAttribute(domElement, "length", formula);
- AddAttribute(domElement, "p1Line", basePointId);
- AddAttribute(domElement, "p2Line", p2Line);
- AddAttribute(domElement, "pShoulder", pShoulder);
+ AddAttribute(domElement, AttrTypeLine, typeLine);
+ AddAttribute(domElement, AttrLength, formula);
+ AddAttribute(domElement, AttrP1Line, basePointId);
+ AddAttribute(domElement, AttrP2Line, p2Line);
+ AddAttribute(domElement, AttrPShoulder, pShoulder);
AddToModeling(domElement);
}
diff --git a/tools/modelingTools/vmodelingshoulderpoint.h b/tools/modelingTools/vmodelingshoulderpoint.h
index 679d5e85c..a9cee71cd 100644
--- a/tools/modelingTools/vmodelingshoulderpoint.h
+++ b/tools/modelingTools/vmodelingshoulderpoint.h
@@ -40,6 +40,7 @@ public:
const QString &pointName, const qreal &mx, const qreal &my, VDomDocument *doc,
VContainer *data, const Document::Documents &parse,
const Tool::Sources &typeCreation);
+ static const QString ToolType;
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
diff --git a/tools/modelingTools/vmodelingspline.cpp b/tools/modelingTools/vmodelingspline.cpp
index b2df795d0..4cd48e3c8 100644
--- a/tools/modelingTools/vmodelingspline.cpp
+++ b/tools/modelingTools/vmodelingspline.cpp
@@ -22,9 +22,11 @@
#include "vmodelingspline.h"
#include "geometry/vspline.h"
-VModelingSpline::VModelingSpline(VDomDocument *doc, VContainer *data, qint64 id,
- Tool::Sources typeCreation,
- QGraphicsItem *parent):VModelingTool(doc, data, id), QGraphicsPathItem(parent),
+const QString VModelingSpline::TagName = QStringLiteral("spline");
+const QString VModelingSpline::ToolType = QStringLiteral("simple");
+
+VModelingSpline::VModelingSpline(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation,
+ QGraphicsItem *parent):VModelingTool(doc, data, id), QGraphicsPathItem(parent),
dialogSpline(QSharedPointer()), controlPoints(QVector()){
ignoreFullUpdate = true;
VSpline spl = data->GetModelingSpline(id);
@@ -135,13 +137,13 @@ void VModelingSpline::FullUpdateFromGui(int result){
dialogSpline->getKCurve());
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("point1", QString().setNum(spl.GetP1()));
- domElement.setAttribute("point4", QString().setNum(spl.GetP4()));
- domElement.setAttribute("angle1", QString().setNum(spl.GetAngle1()));
- domElement.setAttribute("angle2", QString().setNum(spl.GetAngle2()));
- domElement.setAttribute("kAsm1", QString().setNum(spl.GetKasm1()));
- domElement.setAttribute("kAsm2", QString().setNum(spl.GetKasm2()));
- domElement.setAttribute("kCurve", QString().setNum(spl.GetKcurve()));
+ 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()));
emit FullUpdateTree();
}
}
@@ -159,11 +161,11 @@ void VModelingSpline::ControlPointChangePosition(const qint32 &indexSpline, Spli
}
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("angle1", QString().setNum(spl.GetAngle1()));
- domElement.setAttribute("angle2", QString().setNum(spl.GetAngle2()));
- domElement.setAttribute("kAsm1", QString().setNum(spl.GetKasm1()));
- domElement.setAttribute("kAsm2", QString().setNum(spl.GetKasm2()));
- domElement.setAttribute("kCurve", QString().setNum(spl.GetKcurve()));
+ 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()));
emit FullUpdateTree();
}
}
@@ -174,17 +176,17 @@ void VModelingSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
void VModelingSpline::AddToFile(){
VSpline spl = VAbstractTool::data.GetModelingSpline(id);
- QDomElement domElement = doc->createElement("spline");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "simple");
- AddAttribute(domElement, "point1", spl.GetP1());
- AddAttribute(domElement, "point4", spl.GetP4());
- AddAttribute(domElement, "angle1", spl.GetAngle1());
- AddAttribute(domElement, "angle2", spl.GetAngle2());
- AddAttribute(domElement, "kAsm1", spl.GetKasm1());
- AddAttribute(domElement, "kAsm2", spl.GetKasm2());
- AddAttribute(domElement, "kCurve", spl.GetKcurve());
+ AddAttribute(domElement, AttrId, id);
+ AddAttribute(domElement, AttrType, ToolType);
+ AddAttribute(domElement, AttrPoint1, spl.GetP1());
+ AddAttribute(domElement, AttrPoint4, spl.GetP4());
+ 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());
AddToModeling(domElement);
}
diff --git a/tools/modelingTools/vmodelingspline.h b/tools/modelingTools/vmodelingspline.h
index 49e9f3da8..b4417fb66 100644
--- a/tools/modelingTools/vmodelingspline.h
+++ b/tools/modelingTools/vmodelingspline.h
@@ -39,6 +39,8 @@ public:
const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve,
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
Tool::Sources typeCreation);
+ static const QString TagName;
+ static const QString ToolType;
signals:
void RefreshLine (const qint32 &indexSpline, SplinePoint::Position position,
const QPointF &controlPoint, const QPointF &splinePoint );
diff --git a/tools/modelingTools/vmodelingsplinepath.cpp b/tools/modelingTools/vmodelingsplinepath.cpp
index 0c95438fc..04e1d5c01 100644
--- a/tools/modelingTools/vmodelingsplinepath.cpp
+++ b/tools/modelingTools/vmodelingsplinepath.cpp
@@ -21,6 +21,9 @@
#include "vmodelingsplinepath.h"
+const QString VModelingSplinePath::TagName = QStringLiteral("spline");
+const QString VModelingSplinePath::ToolType = QStringLiteral("path");
+
VModelingSplinePath::VModelingSplinePath(VDomDocument *doc, VContainer *data, qint64 id,
Tool::Sources typeCreation,
QGraphicsItem *parent):VModelingTool(doc, data, id),
@@ -125,7 +128,7 @@ void VModelingSplinePath::FullUpdateFromGui(int result){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("kCurve", QString().setNum(splPath.getKCurve()));
+ domElement.setAttribute(AttrKCurve, QString().setNum(splPath.getKCurve()));
UpdatePathPoint(domElement, splPath);
emit FullUpdateTree();
}
@@ -148,7 +151,7 @@ void VModelingSplinePath::ControlPointChangePosition(const qint32 &indexSpline,
CorectControlPoints(spl, splPath, indexSpline);
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("kCurve", QString().setNum(splPath.getKCurve()));
+ domElement.setAttribute(AttrKCurve, QString().setNum(splPath.getKCurve()));
UpdatePathPoint(domElement, splPath);
emit FullUpdateTree();
}
@@ -174,10 +177,10 @@ void VModelingSplinePath::UpdatePathPoint(QDomNode& node, VSplinePath &path){
QDomElement domElement = nodeList.at(i).toElement();
if(!domElement.isNull()){
VSplinePoint p = path[i];
- domElement.setAttribute("pSpline", QString().setNum(p.P()));
- domElement.setAttribute("kAsm1", QString().setNum(p.KAsm1()));
- domElement.setAttribute("kAsm2", QString().setNum(p.KAsm2()));
- domElement.setAttribute("angle", QString().setNum(p.Angle2()));
+ domElement.setAttribute(AttrPSpline, QString().setNum(p.P()));
+ domElement.setAttribute(AttrKAsm1, QString().setNum(p.KAsm1()));
+ domElement.setAttribute(AttrKAsm2, QString().setNum(p.KAsm2()));
+ domElement.setAttribute(AttrAngle, QString().setNum(p.Angle2()));
}
}
}
@@ -188,11 +191,11 @@ void VModelingSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event
void VModelingSplinePath::AddToFile(){
VSplinePath splPath = VAbstractTool::data.GetModelingSplinePath(id);
- QDomElement domElement = doc->createElement("spline");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "path");
- AddAttribute(domElement, "kCurve", splPath.getKCurve());
+ AddAttribute(domElement, AttrId, id);
+ AddAttribute(domElement, AttrType, ToolType);
+ AddAttribute(domElement, AttrKCurve, splPath.getKCurve());
for(qint32 i = 0; i < splPath.CountPoint(); ++i){
AddPathPoint(domElement, splPath[i]);
@@ -202,12 +205,12 @@ void VModelingSplinePath::AddToFile(){
}
void VModelingSplinePath::AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint){
- QDomElement pathPoint = doc->createElement("pathPoint");
+ QDomElement pathPoint = doc->createElement(AttrPathPoint);
- AddAttribute(pathPoint, "pSpline", splPoint.P());
- AddAttribute(pathPoint, "kAsm1", splPoint.KAsm1());
- AddAttribute(pathPoint, "kAsm2", splPoint.KAsm2());
- AddAttribute(pathPoint, "angle", splPoint.Angle2());
+ AddAttribute(pathPoint, AttrPSpline, splPoint.P());
+ AddAttribute(pathPoint, AttrKAsm1, splPoint.KAsm1());
+ AddAttribute(pathPoint, AttrKAsm2, splPoint.KAsm2());
+ AddAttribute(pathPoint, AttrAngle, splPoint.Angle2());
domElement.appendChild(pathPoint);
}
diff --git a/tools/modelingTools/vmodelingsplinepath.h b/tools/modelingTools/vmodelingsplinepath.h
index 4cb25f16d..19f44235f 100644
--- a/tools/modelingTools/vmodelingsplinepath.h
+++ b/tools/modelingTools/vmodelingsplinepath.h
@@ -36,6 +36,8 @@ public:
static VModelingSplinePath* Create(QSharedPointer &dialog, VDomDocument *doc, VContainer *data);
static VModelingSplinePath* Create(const qint64 _id, const VSplinePath &path, VDomDocument *doc,
VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation);
+ static const QString TagName;
+ static const QString ToolType;
signals:
void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos, const QPointF &controlPoint,
const QPointF &splinePoint);
diff --git a/tools/modelingTools/vmodelingtriangle.cpp b/tools/modelingTools/vmodelingtriangle.cpp
index feeb7c1c5..7a3d91838 100644
--- a/tools/modelingTools/vmodelingtriangle.cpp
+++ b/tools/modelingTools/vmodelingtriangle.cpp
@@ -1,15 +1,15 @@
#include "vmodelingtriangle.h"
#include "../drawTools/vtooltriangle.h"
-VModelingTriangle::VModelingTriangle(VDomDocument *doc, VContainer *data, const qint64 &id,
- const qint64 &axisP1Id, const qint64 &axisP2Id,
- const qint64 &firstPointId, const qint64 &secondPointId,
+const QString VModelingTriangle::ToolType = QStringLiteral("triangle");
+
+VModelingTriangle::VModelingTriangle(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &axisP1Id,
+ const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId,
Tool::Sources typeCreation, QGraphicsItem *parent)
- :VModelingPoint(doc, data, id, parent), axisP1Id(axisP1Id), axisP2Id(axisP2Id),
- firstPointId(firstPointId), secondPointId(secondPointId),
- dialogTriangle(QSharedPointer()) {
+ :VModelingPoint(doc, data, id, parent), axisP1Id(axisP1Id), axisP2Id(axisP2Id), firstPointId(firstPointId),
+ secondPointId(secondPointId), dialogTriangle(QSharedPointer()) {
if(typeCreation == Tool::FromGui){
- AddToFile();
+ AddToFile();
}
}
@@ -30,15 +30,14 @@ VModelingTriangle *VModelingTriangle::Create(QSharedPointer &dia
qint64 firstPointId = dialog->getFirstPointId();
qint64 secondPointId = dialog->getSecondPointId();
QString pointName = dialog->getPointName();
- return Create(0, pointName, axisP1Id, axisP2Id, firstPointId, secondPointId, 5, 10, doc, data,
- Document::FullParse, Tool::FromGui);
+ return Create(0, pointName, axisP1Id, axisP2Id, firstPointId, secondPointId, 5, 10, doc, data, Document::FullParse,
+ Tool::FromGui);
}
-VModelingTriangle *VModelingTriangle::Create(const qint64 _id, const QString &pointName,
- const qint64 &axisP1Id, const qint64 &axisP2Id,
- const qint64 &firstPointId, const qint64 &secondPointId,
- const qreal &mx, const qreal &my, VDomDocument *doc,
- VContainer *data, const Document::Documents &parse,
+VModelingTriangle *VModelingTriangle::Create(const qint64 _id, const QString &pointName, const qint64 &axisP1Id,
+ const qint64 &axisP2Id, const qint64 &firstPointId,
+ const qint64 &secondPointId, const qreal &mx, const qreal &my,
+ VDomDocument *doc, VContainer *data, const Document::Documents &parse,
Tool::Sources typeCreation){
VModelingTriangle *tool = 0;
VPointF axisP1 = data->GetPoint(axisP1Id);
@@ -58,8 +57,7 @@ VModelingTriangle *VModelingTriangle::Create(const qint64 _id, const QString &po
}
}
if(parse == Document::FullParse){
- tool = new VModelingTriangle(doc, data, id, axisP1Id, axisP2Id, firstPointId,
- secondPointId, typeCreation);
+ tool = new VModelingTriangle(doc, data, id, axisP1Id, axisP2Id, firstPointId, secondPointId, typeCreation);
doc->AddTool(id, tool);
doc->IncrementReferens(axisP1Id);
doc->IncrementReferens(axisP2Id);
@@ -72,10 +70,10 @@ VModelingTriangle *VModelingTriangle::Create(const qint64 _id, const QString &po
void VModelingTriangle::FullUpdateFromFile(){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- axisP1Id = domElement.attribute("axisP1", "").toLongLong();
- axisP2Id = domElement.attribute("axisP2", "").toLongLong();
- firstPointId = domElement.attribute("firstPoint", "").toLongLong();
- secondPointId = domElement.attribute("secondPoint", "").toLongLong();
+ axisP1Id = domElement.attribute(AttrAxisP1, "").toLongLong();
+ axisP2Id = domElement.attribute(AttrAxisP2, "").toLongLong();
+ firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong();
+ secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong();
}
VModelingPoint::RefreshPointGeometry(VModelingTool::data.GetPoint(id));
}
@@ -84,11 +82,11 @@ void VModelingTriangle::FullUpdateFromGui(int result){
if(result == QDialog::Accepted){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("name", dialogTriangle->getPointName());
- domElement.setAttribute("axisP1", QString().setNum(dialogTriangle->getAxisP1Id()));
- domElement.setAttribute("axisP2", QString().setNum(dialogTriangle->getAxisP2Id()));
- domElement.setAttribute("firstPoint", QString().setNum(dialogTriangle->getFirstPointId()));
- domElement.setAttribute("secondPoint", QString().setNum(dialogTriangle->getSecondPointId()));
+ 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()));
emit FullUpdateTree();
}
@@ -109,18 +107,18 @@ void VModelingTriangle::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
void VModelingTriangle::AddToFile(){
VPointF point = VAbstractTool::data.GetPoint(id);
- QDomElement domElement = doc->createElement("point");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "triangle");
- AddAttribute(domElement, "name", point.name());
- AddAttribute(domElement, "mx", toMM(point.mx()));
- AddAttribute(domElement, "my", toMM(point.my()));
+ 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()));
- AddAttribute(domElement, "axisP1", axisP1Id);
- AddAttribute(domElement, "axisP2", axisP2Id);
- AddAttribute(domElement, "firstPoint", firstPointId);
- AddAttribute(domElement, "secondPoint", secondPointId);
+ AddAttribute(domElement, AttrAxisP1, axisP1Id);
+ AddAttribute(domElement, AttrAxisP2, axisP2Id);
+ AddAttribute(domElement, AttrFirstPoint, firstPointId);
+ AddAttribute(domElement, AttrSecondPoint, secondPointId);
AddToModeling(domElement);
}
diff --git a/tools/modelingTools/vmodelingtriangle.h b/tools/modelingTools/vmodelingtriangle.h
index a9f5176ec..069544bd7 100644
--- a/tools/modelingTools/vmodelingtriangle.h
+++ b/tools/modelingTools/vmodelingtriangle.h
@@ -38,6 +38,7 @@ public:
const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId,
const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation);
+ static const QString ToolType;
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
diff --git a/tools/nodeDetails/vabstractnode.cpp b/tools/nodeDetails/vabstractnode.cpp
index 1f4bab332..2e671ea9d 100644
--- a/tools/nodeDetails/vabstractnode.cpp
+++ b/tools/nodeDetails/vabstractnode.cpp
@@ -22,9 +22,14 @@
#include "vabstractnode.h"
#include
-VAbstractNode::VAbstractNode(VDomDocument *doc, VContainer *data, qint64 id, qint64 idNode,
- Draw::Draws typeobject, QObject *parent) :
- VAbstractTool(doc, data, id, parent), idNode(idNode), typeobject(typeobject){
+const QString VAbstractNode::AttrIdObject = QStringLiteral("idObject");
+const QString VAbstractNode::AttrTypeObject = QStringLiteral("typeObject");
+const QString VAbstractNode::TypeObjectCalculation = QStringLiteral("Calculation");
+const QString VAbstractNode::TypeObjectModeling = QStringLiteral("Modeling");
+
+VAbstractNode::VAbstractNode(VDomDocument *doc, VContainer *data, qint64 id, qint64 idNode, Draw::Draws typeobject,
+ QObject *parent) : VAbstractTool(doc, data, id, parent), idNode(idNode),
+ typeobject(typeobject){
_referens = 0;
}
@@ -34,7 +39,7 @@ void VAbstractNode::AddToModeling(const QDomElement &domElement){
if(ok){
modelingElement.appendChild(domElement);
} else {
- qCritical()<<"Can't find tag Modeling"<< Q_FUNC_INFO;
+ qCritical()<createElement("arc");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "modeling");
- AddAttribute(domElement, "idObject", idNode);
+ AddAttribute(domElement, AttrId, id);
+ AddAttribute(domElement, AttrType, ToolType);
+ AddAttribute(domElement, AttrIdObject, idNode);
if(typeobject == Draw::Calculation){
- AddAttribute(domElement, "typeObject", "Calculation");
+ AddAttribute(domElement, AttrTypeObject, TypeObjectCalculation);
} else {
- AddAttribute(domElement, "typeObject", "Modeling");
+ AddAttribute(domElement, AttrTypeObject, ToolType );
}
AddToModeling(domElement);
diff --git a/tools/nodeDetails/vnodearc.h b/tools/nodeDetails/vnodearc.h
index e4a214928..e206e2c6a 100644
--- a/tools/nodeDetails/vnodearc.h
+++ b/tools/nodeDetails/vnodearc.h
@@ -32,6 +32,8 @@ public:
Tool::Sources typeCreation, QGraphicsItem * parent = 0);
static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc,
Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation);
+ static const QString TagName;
+ static const QString ToolType;
public slots:
virtual void FullUpdateFromFile();
protected:
diff --git a/tools/nodeDetails/vnodepoint.cpp b/tools/nodeDetails/vnodepoint.cpp
index b5d568743..c5b1056f8 100644
--- a/tools/nodeDetails/vnodepoint.cpp
+++ b/tools/nodeDetails/vnodepoint.cpp
@@ -21,6 +21,9 @@
#include "vnodepoint.h"
+const QString VNodePoint::TagName = QStringLiteral("point");
+const QString VNodePoint::ToolType = QStringLiteral("modeling");
+
VNodePoint::VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint,
Draw::Draws typeobject, Tool::Sources typeCreation, QGraphicsItem *parent)
:VAbstractNode(doc, data, id, idPoint, typeobject), QGraphicsEllipseItem(parent),
@@ -57,18 +60,18 @@ void VNodePoint::FullUpdateFromFile(){
void VNodePoint::AddToFile(){
VPointF point = VAbstractTool::data.GetModelingPoint(id);
- QDomElement domElement = doc->createElement("point");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "modeling");
- AddAttribute(domElement, "idObject", idNode);
+ AddAttribute(domElement, AttrId, id);
+ AddAttribute(domElement, AttrType, ToolType);
+ AddAttribute(domElement, AttrIdObject, idNode);
if(typeobject == Draw::Calculation){
- AddAttribute(domElement, "typeObject", "Calculation");
+ AddAttribute(domElement, AttrTypeObject, TypeObjectCalculation);
} else {
- AddAttribute(domElement, "typeObject", "Modeling");
+ AddAttribute(domElement, AttrTypeObject, TypeObjectModeling);
}
- AddAttribute(domElement, "mx", toMM(point.mx()));
- AddAttribute(domElement, "my", toMM(point.my()));
+ AddAttribute(domElement, AttrMx, toMM(point.mx()));
+ AddAttribute(domElement, AttrMy, toMM(point.my()));
AddToModeling(domElement);
}
@@ -104,8 +107,8 @@ void VNodePoint::NameChangePosition(const QPointF pos){
void VNodePoint::UpdateNamePosition(qreal mx, qreal my){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("mx", QString().setNum(toMM(mx)));
- domElement.setAttribute("my", QString().setNum(toMM(my)));
+ domElement.setAttribute(AttrMx, QString().setNum(toMM(mx)));
+ domElement.setAttribute(AttrMy, QString().setNum(toMM(my)));
emit toolhaveChange();
}
}
diff --git a/tools/nodeDetails/vnodepoint.h b/tools/nodeDetails/vnodepoint.h
index 783023fee..e1a6d75e0 100644
--- a/tools/nodeDetails/vnodepoint.h
+++ b/tools/nodeDetails/vnodepoint.h
@@ -32,6 +32,8 @@ public:
Tool::Sources typeCreation, QGraphicsItem * parent = 0 );
static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, Draw::Draws typeobject,
const Document::Documents &parse, Tool::Sources typeCreation);
+ static const QString TagName;
+ static const QString ToolType;
public slots:
virtual void FullUpdateFromFile();
void NameChangePosition(const QPointF pos);
diff --git a/tools/nodeDetails/vnodespline.cpp b/tools/nodeDetails/vnodespline.cpp
index 2614ab2f3..cf6092c73 100644
--- a/tools/nodeDetails/vnodespline.cpp
+++ b/tools/nodeDetails/vnodespline.cpp
@@ -21,6 +21,9 @@
#include "vnodespline.h"
+const QString VNodeSpline::TagName = QStringLiteral("spline");
+const QString VNodeSpline::ToolType = QStringLiteral("modelingSpline");
+
VNodeSpline::VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline,
Draw::Draws typeobject, Tool::Sources typeCreation, QGraphicsItem * parent) :
VAbstractNode(doc, data, id, idSpline, typeobject), QGraphicsPathItem(parent){
@@ -53,15 +56,15 @@ void VNodeSpline::FullUpdateFromFile(){
}
void VNodeSpline::AddToFile(){
- QDomElement domElement = doc->createElement("spline");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "modelingSpline");
- AddAttribute(domElement, "idObject", idNode);
+ AddAttribute(domElement, AttrId, id);
+ AddAttribute(domElement, AttrType, ToolType);
+ AddAttribute(domElement, AttrIdObject, idNode);
if(typeobject == Draw::Calculation){
- AddAttribute(domElement, "typeObject", "Calculation");
+ AddAttribute(domElement, AttrTypeObject, TypeObjectCalculation);
} else {
- AddAttribute(domElement, "typeObject", "Modeling");
+ AddAttribute(domElement, AttrTypeObject, TypeObjectModeling);
}
AddToModeling(domElement);
diff --git a/tools/nodeDetails/vnodespline.h b/tools/nodeDetails/vnodespline.h
index 47513764e..3e1d381bc 100644
--- a/tools/nodeDetails/vnodespline.h
+++ b/tools/nodeDetails/vnodespline.h
@@ -32,6 +32,8 @@ public:
Tool::Sources typeCreation, QGraphicsItem * parent = 0);
static VNodeSpline *Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Draws typeobject,
const Document::Documents &parse, Tool::Sources typeCreation);
+ static const QString TagName;
+ static const QString ToolType;
public slots:
virtual void FullUpdateFromFile ();
protected:
diff --git a/tools/nodeDetails/vnodesplinepath.cpp b/tools/nodeDetails/vnodesplinepath.cpp
index 8dd7f4e37..07ac92b53 100644
--- a/tools/nodeDetails/vnodesplinepath.cpp
+++ b/tools/nodeDetails/vnodesplinepath.cpp
@@ -21,6 +21,9 @@
#include "vnodesplinepath.h"
+const QString VNodeSplinePath::TagName = QStringLiteral("spline");
+const QString VNodeSplinePath::ToolType = QStringLiteral("modelingPath");
+
VNodeSplinePath::VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline,
Draw::Draws typeobject, Tool::Sources typeCreation,
QGraphicsItem * parent) :
@@ -57,15 +60,15 @@ void VNodeSplinePath::FullUpdateFromFile(){
}
void VNodeSplinePath::AddToFile(){
- QDomElement domElement = doc->createElement("spline");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "type", "modelingPath");
- AddAttribute(domElement, "idObject", idNode);
+ AddAttribute(domElement, AttrId, id);
+ AddAttribute(domElement, AttrType, ToolType);
+ AddAttribute(domElement, AttrIdObject, idNode);
if(typeobject == Draw::Calculation){
- AddAttribute(domElement, "typeObject", "Calculation");
+ AddAttribute(domElement, AttrTypeObject, TypeObjectCalculation);
} else {
- AddAttribute(domElement, "typeObject", "Modeling");
+ AddAttribute(domElement, AttrTypeObject, TypeObjectModeling);
}
AddToModeling(domElement);
diff --git a/tools/nodeDetails/vnodesplinepath.h b/tools/nodeDetails/vnodesplinepath.h
index 40d85b582..5e623b65c 100644
--- a/tools/nodeDetails/vnodesplinepath.h
+++ b/tools/nodeDetails/vnodesplinepath.h
@@ -32,6 +32,8 @@ public:
Draw::Draws typeobject, Tool::Sources typeCreation, QGraphicsItem * parent = 0);
static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Draws typeobject,
const Document::Documents &parse, Tool::Sources typeCreation);
+ static const QString TagName;
+ static const QString ToolType;
public slots:
virtual void FullUpdateFromFile();
protected:
diff --git a/tools/vabstracttool.cpp b/tools/vabstracttool.cpp
index f932b0e06..42677bc56 100644
--- a/tools/vabstracttool.cpp
+++ b/tools/vabstracttool.cpp
@@ -21,6 +21,43 @@
#include "vabstracttool.h"
+const QString VAbstractTool::AttrId = QStringLiteral("id");
+const QString VAbstractTool::AttrType = QStringLiteral("type");
+const QString VAbstractTool::AttrMx = QStringLiteral("mx");
+const QString VAbstractTool::AttrMy = QStringLiteral("my");
+const QString VAbstractTool::AttrName = QStringLiteral("name");
+const QString VAbstractTool::AttrX = QStringLiteral("x");
+const QString VAbstractTool::AttrY = QStringLiteral("y");
+const QString VAbstractTool::AttrTypeLine = QStringLiteral("typeLine");
+const QString VAbstractTool::AttrLength = QStringLiteral("length");
+const QString VAbstractTool::AttrBasePoint = QStringLiteral("basePoint");
+const QString VAbstractTool::AttrFirstPoint = QStringLiteral("firstPoint");
+const QString VAbstractTool::AttrSecondPoint = QStringLiteral("secondPoint");
+const QString VAbstractTool::AttrThirdPoint = QStringLiteral("thirdPoint");
+const QString VAbstractTool::AttrCenter = QStringLiteral("center");
+const QString VAbstractTool::AttrRadius = QStringLiteral("radius");
+const QString VAbstractTool::AttrAngle = QStringLiteral("angle");
+const QString VAbstractTool::AttrAngle1 = QStringLiteral("angle1");
+const QString VAbstractTool::AttrAngle2 = QStringLiteral("angle2");
+const QString VAbstractTool::AttrP1Line = QStringLiteral("p1Line");
+const QString VAbstractTool::AttrP2Line = QStringLiteral("p2Line");
+const QString VAbstractTool::AttrP1Line1 = QStringLiteral("p1Line1");
+const QString VAbstractTool::AttrP2Line1 = QStringLiteral("p2Line1");
+const QString VAbstractTool::AttrP1Line2 = QStringLiteral("p1Line2");
+const QString VAbstractTool::AttrP2Line2 = QStringLiteral("p2Line2");
+const QString VAbstractTool::AttrPShoulder = QStringLiteral("pShoulder");
+const QString VAbstractTool::AttrPoint1 = QStringLiteral("point1");
+const QString VAbstractTool::AttrPoint4 = QStringLiteral("point4");
+const QString VAbstractTool::AttrKAsm1 = QStringLiteral("kAsm1");
+const QString VAbstractTool::AttrKAsm2 = QStringLiteral("kAsm2");
+const QString VAbstractTool::AttrKCurve = QStringLiteral("kCurve");
+const QString VAbstractTool::AttrPathPoint = QStringLiteral("pathPoint");
+const QString VAbstractTool::AttrPSpline = QStringLiteral("pSpline");
+const QString VAbstractTool::AttrAxisP1 = QStringLiteral("axisP1");
+const QString VAbstractTool::AttrAxisP2 = QStringLiteral("axisP2");
+const QString VAbstractTool::TypeLineNone = QStringLiteral("none");
+const QString VAbstractTool::TypeLineLine = QStringLiteral("hair");
+
VAbstractTool::VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent):
VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), currentColor(Qt::black){
@@ -29,33 +66,6 @@ VAbstractTool::VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QOb
connect(this, &VAbstractTool::FullUpdateTree, this->doc, &VDomDocument::FullUpdateTree);
}
-void VAbstractTool::AddAttribute(QDomElement &domElement, const QString &name, const qint64 &value){
- QDomAttr domAttr = doc->createAttribute(name);
- domAttr.setValue(QString().setNum(value));
- domElement.setAttributeNode(domAttr);
-}
-
-void VAbstractTool::AddAttribute(QDomElement &domElement, const QString &name, const qint32 &value){
- QDomAttr domAttr = doc->createAttribute(name);
- domAttr.setValue(QString().setNum(value));
- domElement.setAttributeNode(domAttr);
-}
-
-void VAbstractTool::AddAttribute(QDomElement &domElement, const QString &name, const qreal &value){
- QDomAttr domAttr = doc->createAttribute(name);
- domAttr.setValue(QString().setNum(value));
- domElement.setAttributeNode(domAttr);
-}
-
-void VAbstractTool::AddAttribute(QDomElement &domElement, const QString &name, const QString &value){
- QDomAttr domAttr = doc->createAttribute(name);
- domAttr.setValue(value);
- domElement.setAttributeNode(domAttr);
-}
-
-VAbstractTool::~VAbstractTool(){
-}
-
QPointF VAbstractTool::LineIntersectRect(QRectF rec, QLineF line){
qreal x1, y1, x2, y2;
rec.getCoords(&x1, &y1, &x2, &y2);
@@ -76,7 +86,7 @@ QPointF VAbstractTool::LineIntersectRect(QRectF rec, QLineF line){
if ( type == QLineF::BoundedIntersection ){
return point;
}
- Q_ASSERT_X(type != QLineF::BoundedIntersection, Q_FUNC_INFO, "Немає точки перетину.");
+ Q_ASSERT_X(type != QLineF::BoundedIntersection, Q_FUNC_INFO, "There is no point of intersection.");
return point;
}
diff --git a/tools/vabstracttool.h b/tools/vabstracttool.h
index a57b5f254..0b25f29f9 100644
--- a/tools/vabstracttool.h
+++ b/tools/vabstracttool.h
@@ -29,13 +29,49 @@ class VAbstractTool: public VDataTool{
Q_OBJECT
public:
VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent = 0);
- virtual ~VAbstractTool();
+ virtual ~VAbstractTool() {}
static QPointF LineIntersectRect(QRectF rec, QLineF line);
static qint32 LineIntersectCircle(QPointF center, qreal radius, QLineF line, QPointF &p1, QPointF &p2);
static QPointF ClosestPoint(QLineF line, QPointF p);
static QPointF addVector (QPointF p, QPointF p1, QPointF p2, qreal k);
inline qint64 getId() const {return id;}
static void LineCoefficients(const QLineF &line, qreal *a, qreal *b, qreal *c);
+ static const QString AttrId;
+ static const QString AttrType;
+ static const QString AttrMx;
+ static const QString AttrMy;
+ static const QString AttrName;
+ static const QString AttrX;
+ static const QString AttrY;
+ static const QString AttrTypeLine;
+ static const QString AttrLength;
+ static const QString AttrBasePoint;
+ static const QString AttrFirstPoint;
+ static const QString AttrSecondPoint;
+ static const QString AttrThirdPoint;
+ static const QString AttrCenter;
+ static const QString AttrRadius;
+ static const QString AttrAngle;
+ static const QString AttrAngle1;
+ static const QString AttrAngle2;
+ static const QString AttrP1Line;
+ static const QString AttrP2Line;
+ static const QString AttrP1Line1;
+ static const QString AttrP2Line1;
+ static const QString AttrP1Line2;
+ static const QString AttrP2Line2;
+ static const QString AttrPShoulder;
+ static const QString AttrPoint1;
+ static const QString AttrPoint4;
+ static const QString AttrKAsm1;
+ static const QString AttrKAsm2;
+ static const QString AttrKCurve;
+ static const QString AttrPathPoint;
+ static const QString AttrPSpline;
+ static const QString AttrAxisP1;
+ static const QString AttrAxisP2;
+ static const QString TypeLineNone;
+ static const QString TypeLineLine;
public slots:
virtual void FullUpdateFromFile()=0;
signals:
@@ -48,14 +84,23 @@ protected:
const Qt::GlobalColor baseColor;
Qt::GlobalColor currentColor;
virtual void AddToFile()=0;
- void AddAttribute(QDomElement &domElement, const QString &name, const qint64 &value);
- void AddAttribute(QDomElement &domElement, const QString &name, const qint32 &value);
- void AddAttribute(QDomElement &domElement, const QString &name, const qreal &value);
- void AddAttribute(QDomElement &domElement, const QString &name, const QString &value);
inline const VContainer *getData() const {return &data;}
virtual void RemoveReferens(){}
void RemoveAllChild(QDomElement &domElement);
+ template
+ void AddAttribute(QDomElement &domElement, const QString &name, const T &value){
+ QDomAttr domAttr = doc->createAttribute(name);
+ domAttr.setValue(QString().setNum(value));
+ domElement.setAttributeNode(domAttr);
+ }
private:
Q_DISABLE_COPY(VAbstractTool)
};
+
+template <>
+inline void VAbstractTool::AddAttribute(QDomElement &domElement, const QString &name, const QString &value){
+ QDomAttr domAttr = doc->createAttribute(name);
+ domAttr.setValue(value);
+ domElement.setAttributeNode(domAttr);
+}
#endif // VABSTRACTTOOL_H
diff --git a/tools/vtooldetail.cpp b/tools/vtooldetail.cpp
index 3129d847b..36dd521f6 100644
--- a/tools/vtooldetail.cpp
+++ b/tools/vtooldetail.cpp
@@ -24,6 +24,16 @@
#include "modelingTools/vmodelingtool.h"
#include "modelingTools/modelingtools.h"
+const QString VToolDetail::TagName = QStringLiteral("detail");
+const QString VToolDetail::TagNode = QStringLiteral("node");
+const QString VToolDetail::AttrSupplement = QStringLiteral("supplement");
+const QString VToolDetail::AttrClosed = QStringLiteral("closed");
+const QString VToolDetail::AttrWidth = QStringLiteral("width");
+const QString VToolDetail::AttrIdObject = QStringLiteral("idObject");
+const QString VToolDetail::AttrNodeType = QStringLiteral("nodeType");
+const QString VToolDetail::NodeTypeContour = QStringLiteral("Contour");
+const QString VToolDetail::NodeTypeModeling = QStringLiteral("Modeling");
+
VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, Tool::Sources typeCreation,
VMainGraphicsScene *scene, QGraphicsItem *parent) :VAbstractTool(doc, data, id),
QGraphicsPathItem(parent), dialogDetail(QSharedPointer()), sceneDetails(scene){
@@ -290,10 +300,10 @@ void VToolDetail::FullUpdateFromGui(int result){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
VDetail det = dialogDetail->getDetails();
- domElement.setAttribute("name", det.getName());
- domElement.setAttribute("supplement", QString().setNum(det.getSupplement()));
- domElement.setAttribute("closed", QString().setNum(det.getClosed()));
- domElement.setAttribute("width", QString().setNum(det.getWidth()));
+ 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(qint32 i = 0; i < det.CountNode(); ++i){
AddNode(domElement, det[i]);
@@ -306,15 +316,15 @@ void VToolDetail::FullUpdateFromGui(int result){
void VToolDetail::AddToFile(){
VDetail detail = VAbstractTool::data.GetDetail(id);
- QDomElement domElement = doc->createElement("detail");
+ QDomElement domElement = doc->createElement(TagName);
- AddAttribute(domElement, "id", id);
- AddAttribute(domElement, "name", detail.getName());
- AddAttribute(domElement, "mx", toMM(detail.getMx()));
- AddAttribute(domElement, "my", toMM(detail.getMy()));
- AddAttribute(domElement, "supplement", detail.getSupplement());
- AddAttribute(domElement, "closed", detail.getClosed());
- AddAttribute(domElement, "width", detail.getWidth());
+ 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());
for(qint32 i = 0; i < detail.CountNode(); ++i){
AddNode(domElement, detail[i]);
@@ -334,8 +344,8 @@ QVariant VToolDetail::itemChange(QGraphicsItem::GraphicsItemChange change, const
//qDebug()<elementById(QString().setNum(id));
if(domElement.isElement()){
- domElement.setAttribute("mx", QString().setNum(toMM(newPos.x())));
- domElement.setAttribute("my", QString().setNum(toMM(newPos.y())));
+ domElement.setAttribute(AttrMx, QString().setNum(toMM(newPos.x())));
+ domElement.setAttribute(AttrMy, QString().setNum(toMM(newPos.y())));
//I don't now why but signal does not work.
doc->FullUpdateTree();
}
@@ -398,70 +408,70 @@ void VToolDetail::RemoveReferens(){
}
void VToolDetail::AddNode(QDomElement &domElement, VNodeDetail &node){
- QDomElement nod = doc->createElement("node");
+ QDomElement nod = doc->createElement(TagNode);
- AddAttribute(nod, "idObject", node.getId());
- AddAttribute(nod, "mx", toMM(node.getMx()));
- AddAttribute(nod, "my", toMM(node.getMy()));
+ AddAttribute(nod, AttrIdObject, node.getId());
+ AddAttribute(nod, AttrMx, toMM(node.getMx()));
+ AddAttribute(nod, AttrMy, toMM(node.getMy()));
if(node.getTypeNode() == NodeDetail::Contour){
- AddAttribute(nod, "nodeType", "Contour");
+ AddAttribute(nod, AttrNodeType, NodeTypeContour);
} else {
- AddAttribute(nod, "nodeType", "Modeling");
+ AddAttribute(nod, AttrNodeType, NodeTypeModeling);
}
switch(node.getTypeTool()){
case(Tool::AlongLineTool):
- AddAttribute(nod, "type", "AlongLineTool");
+ AddAttribute(nod, AttrType, QStringLiteral("AlongLineTool"));
break;
case(Tool::ArcTool):
- AddAttribute(nod, "type", "ArcTool");
+ AddAttribute(nod, AttrType, QStringLiteral("ArcTool"));
break;
case(Tool::BisectorTool):
- AddAttribute(nod, "type", "BisectorTool");
+ AddAttribute(nod, AttrType, QStringLiteral("BisectorTool"));
break;
case(Tool::EndLineTool):
- AddAttribute(nod, "type", "EndLineTool");
+ AddAttribute(nod, AttrType, QStringLiteral("EndLineTool"));
break;
case(Tool::LineIntersectTool):
- AddAttribute(nod, "type", "LineIntersectTool");
+ AddAttribute(nod, AttrType, QStringLiteral("LineIntersectTool"));
break;
case(Tool::LineTool):
- AddAttribute(nod, "type", "LineTool");
+ AddAttribute(nod, AttrType, QStringLiteral("LineTool"));
break;
case(Tool::NodeArc):
- AddAttribute(nod, "type", "NodeArc");
+ AddAttribute(nod, AttrType, QStringLiteral("NodeArc"));
break;
case(Tool::NodePoint):
- AddAttribute(nod, "type", "NodePoint");
+ AddAttribute(nod, AttrType, QStringLiteral("NodePoint"));
break;
case(Tool::NodeSpline):
- AddAttribute(nod, "type", "NodeSpline");
+ AddAttribute(nod, AttrType, QStringLiteral("NodeSpline"));
break;
case(Tool::NodeSplinePath):
- AddAttribute(nod, "type", "NodeSplinePath");
+ AddAttribute(nod, AttrType, QStringLiteral("NodeSplinePath"));
break;
case(Tool::NormalTool):
- AddAttribute(nod, "type", "NormalTool");
+ AddAttribute(nod, AttrType, QStringLiteral("NormalTool"));
break;
case(Tool::PointOfContact):
- AddAttribute(nod, "type", "PointOfContact");
+ AddAttribute(nod, AttrType, QStringLiteral("PointOfContact"));
break;
case(Tool::ShoulderPointTool):
- AddAttribute(nod, "type", "ShoulderPointTool");
+ AddAttribute(nod, AttrType, QStringLiteral("ShoulderPointTool"));
break;
case(Tool::SplinePathTool):
- AddAttribute(nod, "type", "SplinePathTool");
+ AddAttribute(nod, AttrType, QStringLiteral("SplinePathTool"));
break;
case(Tool::SplineTool):
- AddAttribute(nod, "type", "SplineTool");
+ AddAttribute(nod, AttrType, QStringLiteral("SplineTool"));
break;
case(Tool::Height):
- AddAttribute(nod, "type", "Height");
+ AddAttribute(nod, AttrType, QStringLiteral("Height"));
break;
case(Tool::Triangle):
- AddAttribute(nod, "type", "Triangle");
+ AddAttribute(nod, AttrType, QStringLiteral("Triangle"));
break;
case(Tool::PointOfIntersection):
- AddAttribute(nod, "type", "PointOfIntersection");
+ AddAttribute(nod, AttrType, QStringLiteral("PointOfIntersection"));
break;
default:
qWarning()<<"May be wrong tool type!!! Ignoring."<