Refactoring. NULL_ID_STR.

--HG--
branch : develop
This commit is contained in:
dismine 2014-10-29 13:06:50 +02:00
parent 9ad3285769
commit 309e15acd4
3 changed files with 53 additions and 52 deletions

View File

@ -470,8 +470,8 @@ void VToolLine::RefreshGeometry()
QDomElement domElement = doc->elementById(QString().setNum(id)); QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement()) if (domElement.isElement())
{ {
firstPoint = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); firstPoint = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, NULL_ID_STR);
secondPoint = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); secondPoint = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, NULL_ID_STR);
typeLine = doc->GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine); typeLine = doc->GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine);
} }
const QSharedPointer<VPointF> first = VAbstractTool::data.GeometricObject<VPointF>(firstPoint); const QSharedPointer<VPointF> first = VAbstractTool::data.GeometricObject<VPointF>(firstPoint);

View File

@ -691,7 +691,7 @@ QVector<VDetail> VToolUnionDetails::GetDetailFromFile(VPattern *doc, const QDomE
{ {
if (element.tagName() == VToolUnionDetails::TagNode) if (element.tagName() == VToolUnionDetails::TagNode)
{ {
quint32 id = doc->GetParametrUInt(element, VToolDetail::AttrIdObject, "0"); quint32 id = doc->GetParametrUInt(element, VToolDetail::AttrIdObject, NULL_ID_STR);
qreal mx = qApp->toPixel(doc->GetParametrDouble(element, VAbstractTool::AttrMx, "0.0")); qreal mx = qApp->toPixel(doc->GetParametrDouble(element, VAbstractTool::AttrMx, "0.0"));
qreal my = qApp->toPixel(doc->GetParametrDouble(element, VAbstractTool::AttrMy, "0.0")); qreal my = qApp->toPixel(doc->GetParametrDouble(element, VAbstractTool::AttrMy, "0.0"));
Tool tool = Tool::NodePoint; Tool tool = Tool::NodePoint;

View File

@ -963,7 +963,7 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
{ {
if (element.tagName() == VToolDetail::TagNode) if (element.tagName() == VToolDetail::TagNode)
{ {
const quint32 id = GetParametrUInt(element, VToolDetail::AttrIdObject, "0"); const quint32 id = GetParametrUInt(element, VToolDetail::AttrIdObject, NULL_ID_STR);
const qreal mx = qApp->toPixel(GetParametrDouble(element, VAbstractTool::AttrMx, "0.0")); const qreal mx = qApp->toPixel(GetParametrDouble(element, VAbstractTool::AttrMx, "0.0"));
const qreal my = qApp->toPixel(GetParametrDouble(element, VAbstractTool::AttrMy, "0.0")); const qreal my = qApp->toPixel(GetParametrDouble(element, VAbstractTool::AttrMy, "0.0"));
const NodeDetail nodeType = NodeDetail::Contour; const NodeDetail nodeType = NodeDetail::Contour;
@ -1128,7 +1128,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0");
QString f = formula;//need for saving fixed formula; QString f = formula;//need for saving fixed formula;
const quint32 basePointId = GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, "0"); const quint32 basePointId = GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, NULL_ID_STR);
const QString angle = GetParametrString(domElement, VAbstractTool::AttrAngle, "0.0"); const QString angle = GetParametrString(domElement, VAbstractTool::AttrAngle, "0.0");
QString angleFix = angle; QString angleFix = angle;
@ -1162,8 +1162,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
PointsCommonAttributes(domElement, id, name, mx, my, typeLine); PointsCommonAttributes(domElement, id, name, mx, my, typeLine);
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0");
QString f = formula;//need for saving fixed formula; QString f = formula;//need for saving fixed formula;
const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, NULL_ID_STR);
const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, NULL_ID_STR);
VToolAlongLine::Create(id, name, typeLine, f, firstPointId, secondPointId, mx, my, scene, this, VToolAlongLine::Create(id, name, typeLine, f, firstPointId, secondPointId, mx, my, scene, this,
data, parse, Source::FromFile); data, parse, Source::FromFile);
@ -1193,9 +1193,9 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
PointsCommonAttributes(domElement, id, name, mx, my, typeLine); PointsCommonAttributes(domElement, id, name, mx, my, typeLine);
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0");
QString f = formula;//need for saving fixed formula; QString f = formula;//need for saving fixed formula;
const quint32 p1Line = GetParametrUInt(domElement, VAbstractTool::AttrP1Line, "0"); const quint32 p1Line = GetParametrUInt(domElement, VAbstractTool::AttrP1Line, NULL_ID_STR);
const quint32 p2Line = GetParametrUInt(domElement, VAbstractTool::AttrP2Line, "0"); const quint32 p2Line = GetParametrUInt(domElement, VAbstractTool::AttrP2Line, NULL_ID_STR);
const quint32 pShoulder = GetParametrUInt(domElement, VAbstractTool::AttrPShoulder, "0"); const quint32 pShoulder = GetParametrUInt(domElement, VAbstractTool::AttrPShoulder, NULL_ID_STR);
VToolShoulderPoint::Create(id, f, p1Line, p2Line, pShoulder, typeLine, name, mx, my, scene, this, VToolShoulderPoint::Create(id, f, p1Line, p2Line, pShoulder, typeLine, name, mx, my, scene, this,
data, parse, Source::FromFile); data, parse, Source::FromFile);
@ -1225,8 +1225,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
PointsCommonAttributes(domElement, id, name, mx, my, typeLine); PointsCommonAttributes(domElement, id, name, mx, my, typeLine);
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0");
QString f = formula;//need for saving fixed formula; QString f = formula;//need for saving fixed formula;
const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, NULL_ID_STR);
const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, NULL_ID_STR);
const qreal angle = GetParametrDouble(domElement, VAbstractTool::AttrAngle, "0.0"); const qreal angle = GetParametrDouble(domElement, VAbstractTool::AttrAngle, "0.0");
VToolNormal::Create(id, f, firstPointId, secondPointId, typeLine, name, angle, mx, my, scene, VToolNormal::Create(id, f, firstPointId, secondPointId, typeLine, name, angle, mx, my, scene,
@ -1257,9 +1257,9 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
PointsCommonAttributes(domElement, id, name, mx, my, typeLine); PointsCommonAttributes(domElement, id, name, mx, my, typeLine);
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0");
QString f = formula;//need for saving fixed formula; QString f = formula;//need for saving fixed formula;
const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, NULL_ID_STR);
const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, NULL_ID_STR);
const quint32 thirdPointId = GetParametrUInt(domElement, VAbstractTool::AttrThirdPoint, "0"); const quint32 thirdPointId = GetParametrUInt(domElement, VAbstractTool::AttrThirdPoint, NULL_ID_STR);
VToolBisector::Create(id, f, firstPointId, secondPointId, thirdPointId, VToolBisector::Create(id, f, firstPointId, secondPointId, thirdPointId,
typeLine, name, mx, my, scene, this, data, parse, Source::FromFile); typeLine, name, mx, my, scene, this, data, parse, Source::FromFile);
@ -1287,10 +1287,10 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
try try
{ {
PointsCommonAttributes(domElement, id, name, mx, my); PointsCommonAttributes(domElement, id, name, mx, my);
const quint32 p1Line1Id = GetParametrUInt(domElement, VAbstractTool::AttrP1Line1, "0"); const quint32 p1Line1Id = GetParametrUInt(domElement, VAbstractTool::AttrP1Line1, NULL_ID_STR);
const quint32 p2Line1Id = GetParametrUInt(domElement, VAbstractTool::AttrP2Line1, "0"); const quint32 p2Line1Id = GetParametrUInt(domElement, VAbstractTool::AttrP2Line1, NULL_ID_STR);
const quint32 p1Line2Id = GetParametrUInt(domElement, VAbstractTool::AttrP1Line2, "0"); const quint32 p1Line2Id = GetParametrUInt(domElement, VAbstractTool::AttrP1Line2, NULL_ID_STR);
const quint32 p2Line2Id = GetParametrUInt(domElement, VAbstractTool::AttrP2Line2, "0"); const quint32 p2Line2Id = GetParametrUInt(domElement, VAbstractTool::AttrP2Line2, NULL_ID_STR);
VToolLineIntersect::Create(id, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, name, VToolLineIntersect::Create(id, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, name,
mx, my, scene, this, data, parse, Source::FromFile); mx, my, scene, this, data, parse, Source::FromFile);
@ -1308,9 +1308,9 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
PointsCommonAttributes(domElement, id, name, mx, my); PointsCommonAttributes(domElement, id, name, mx, my);
const QString radius = GetParametrString(domElement, VAbstractTool::AttrRadius, "0"); const QString radius = GetParametrString(domElement, VAbstractTool::AttrRadius, "0");
QString f = radius;//need for saving fixed formula; QString f = radius;//need for saving fixed formula;
const quint32 center = GetParametrUInt(domElement, VAbstractTool::AttrCenter, "0"); const quint32 center = GetParametrUInt(domElement, VAbstractTool::AttrCenter, NULL_ID_STR);
const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, NULL_ID_STR);
const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, NULL_ID_STR);
VToolPointOfContact::Create(id, f, center, firstPointId, secondPointId, name, mx, my, scene, this, VToolPointOfContact::Create(id, f, center, firstPointId, secondPointId, name, mx, my, scene, this,
data, parse, Source::FromFile); data, parse, Source::FromFile);
@ -1338,8 +1338,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
try try
{ {
PointsCommonAttributes(domElement, id, mx, my); PointsCommonAttributes(domElement, id, mx, my);
const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0"); const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, NULL_ID_STR);
const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0"); const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, NULL_ID_STR);
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(idObject ); const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(idObject );
data->UpdateGObject(id, new VPointF(point->toQPointF(), point->name(), mx, my, idObject, data->UpdateGObject(id, new VPointF(point->toQPointF(), point->name(), mx, my, idObject,
Draw::Modeling)); Draw::Modeling));
@ -1356,9 +1356,9 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
try try
{ {
PointsCommonAttributes(domElement, id, name, mx, my, typeLine); PointsCommonAttributes(domElement, id, name, mx, my, typeLine);
const quint32 basePointId = GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, "0"); const quint32 basePointId = GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, NULL_ID_STR);
const quint32 p1LineId = GetParametrUInt(domElement, VAbstractTool::AttrP1Line, "0"); const quint32 p1LineId = GetParametrUInt(domElement, VAbstractTool::AttrP1Line, NULL_ID_STR);
const quint32 p2LineId = GetParametrUInt(domElement, VAbstractTool::AttrP2Line, "0"); const quint32 p2LineId = GetParametrUInt(domElement, VAbstractTool::AttrP2Line, NULL_ID_STR);
VToolHeight::Create(id, name, typeLine, basePointId, p1LineId, p2LineId, VToolHeight::Create(id, name, typeLine, basePointId, p1LineId, p2LineId,
mx, my, scene, this, data, parse, Source::FromFile); mx, my, scene, this, data, parse, Source::FromFile);
@ -1374,10 +1374,10 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
try try
{ {
PointsCommonAttributes(domElement, id, name, mx, my); PointsCommonAttributes(domElement, id, name, mx, my);
const quint32 axisP1Id = GetParametrUInt(domElement, VAbstractTool::AttrAxisP1, "0"); const quint32 axisP1Id = GetParametrUInt(domElement, VAbstractTool::AttrAxisP1, NULL_ID_STR);
const quint32 axisP2Id = GetParametrUInt(domElement, VAbstractTool::AttrAxisP2, "0"); const quint32 axisP2Id = GetParametrUInt(domElement, VAbstractTool::AttrAxisP2, NULL_ID_STR);
const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, NULL_ID_STR);
const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, NULL_ID_STR);
VToolTriangle::Create(id, name, axisP1Id, axisP2Id, firstPointId, secondPointId, mx, my, scene, this, VToolTriangle::Create(id, name, axisP1Id, axisP2Id, firstPointId, secondPointId, mx, my, scene, this,
data, parse, Source::FromFile); data, parse, Source::FromFile);
@ -1393,8 +1393,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
try try
{ {
PointsCommonAttributes(domElement, id, name, mx, my); PointsCommonAttributes(domElement, id, name, mx, my);
const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, NULL_ID_STR);
const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, NULL_ID_STR);
VToolPointOfIntersection::Create(id, name, firstPointId, secondPointId, mx, my, scene, this, data, VToolPointOfIntersection::Create(id, name, firstPointId, secondPointId, mx, my, scene, this, data,
parse, Source::FromFile); parse, Source::FromFile);
@ -1412,7 +1412,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
PointsCommonAttributes(domElement, id, name, mx, my); PointsCommonAttributes(domElement, id, name, mx, my);
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0"); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0");
QString f = formula;//need for saving fixed formula; QString f = formula;//need for saving fixed formula;
const quint32 splineId = GetParametrUInt(domElement, VToolCutSpline::AttrSpline, "0"); const quint32 splineId = GetParametrUInt(domElement, VToolCutSpline::AttrSpline, NULL_ID_STR);
VToolCutSpline::Create(id, name, f, splineId, mx, my, scene, this, data, parse, Source::FromFile); VToolCutSpline::Create(id, name, f, splineId, mx, my, scene, this, data, parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula. //Rewrite attribute formula. Need for situation when we have wrong formula.
@ -1441,7 +1441,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
PointsCommonAttributes(domElement, id, name, mx, my); PointsCommonAttributes(domElement, id, name, mx, my);
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0"); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0");
QString f = formula;//need for saving fixed formula; QString f = formula;//need for saving fixed formula;
const quint32 splinePathId = GetParametrUInt(domElement, VToolCutSplinePath::AttrSplinePath, "0"); const quint32 splinePathId = GetParametrUInt(domElement, VToolCutSplinePath::AttrSplinePath,
NULL_ID_STR);
VToolCutSplinePath::Create(id, name, f, splinePathId, mx, my, scene, this, data, parse, VToolCutSplinePath::Create(id, name, f, splinePathId, mx, my, scene, this, data, parse,
Source::FromFile); Source::FromFile);
@ -1471,7 +1472,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
PointsCommonAttributes(domElement, id, name, mx, my); PointsCommonAttributes(domElement, id, name, mx, my);
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0"); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0");
QString f = formula;//need for saving fixed formula; QString f = formula;//need for saving fixed formula;
const quint32 arcId = GetParametrUInt(domElement, VToolCutArc::AttrArc, "0"); const quint32 arcId = GetParametrUInt(domElement, VToolCutArc::AttrArc, NULL_ID_STR);
VToolCutArc::Create(id, name, f, arcId, mx, my, scene, this, data, parse, Source::FromFile); VToolCutArc::Create(id, name, f, arcId, mx, my, scene, this, data, parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula. //Rewrite attribute formula. Need for situation when we have wrong formula.
@ -1499,9 +1500,9 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
{ {
PointsCommonAttributes(domElement, id, name, mx, my, typeLine); PointsCommonAttributes(domElement, id, name, mx, my, typeLine);
const quint32 basePointId = GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, "0"); const quint32 basePointId = GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, NULL_ID_STR);
const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrP1Line, "0"); const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrP1Line, NULL_ID_STR);
const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrP2Line, "0"); const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrP2Line, NULL_ID_STR);
const QString angle = GetParametrString(domElement, VAbstractTool::AttrAngle, "0.0"); const QString angle = GetParametrString(domElement, VAbstractTool::AttrAngle, "0.0");
QString angleFix = angle; QString angleFix = angle;
@ -1535,8 +1536,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
{ {
PointsCommonAttributes(domElement, id, name, mx, my, typeLine); PointsCommonAttributes(domElement, id, name, mx, my, typeLine);
const quint32 basePointId = GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, "0"); const quint32 basePointId = GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, NULL_ID_STR);
const quint32 curveId = GetParametrUInt(domElement, VAbstractTool::AttrCurve, "0"); const quint32 curveId = GetParametrUInt(domElement, VAbstractTool::AttrCurve, NULL_ID_STR);
const QString angle = GetParametrString(domElement, VAbstractTool::AttrAngle, "0.0"); const QString angle = GetParametrString(domElement, VAbstractTool::AttrAngle, "0.0");
QString angleFix = angle; QString angleFix = angle;
@ -1586,8 +1587,8 @@ void VPattern::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &do
try try
{ {
ToolsCommonAttributes(domElement, id); ToolsCommonAttributes(domElement, id);
const quint32 firstPoint = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); const quint32 firstPoint = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, NULL_ID_STR);
const quint32 secondPoint = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); const quint32 secondPoint = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, NULL_ID_STR);
const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine,
VAbstractTool::TypeLineLine); VAbstractTool::TypeLineLine);
@ -1605,8 +1606,8 @@ void VPattern::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &do
void VPattern::SplinesCommonAttributes(const QDomElement &domElement, quint32 &id, quint32 &idObject, quint32 &idTool) void VPattern::SplinesCommonAttributes(const QDomElement &domElement, quint32 &id, quint32 &idObject, quint32 &idTool)
{ {
ToolsCommonAttributes(domElement, id); ToolsCommonAttributes(domElement, id);
idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0"); idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, NULL_ID_STR);
idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0"); idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, NULL_ID_STR);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -1795,8 +1796,8 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &
try try
{ {
ToolsCommonAttributes(domElement, id); ToolsCommonAttributes(domElement, id);
const quint32 point1 = GetParametrUInt(domElement, VAbstractTool::AttrPoint1, "0"); const quint32 point1 = GetParametrUInt(domElement, VAbstractTool::AttrPoint1, NULL_ID_STR);
const quint32 point4 = GetParametrUInt(domElement, VAbstractTool::AttrPoint4, "0"); const quint32 point4 = GetParametrUInt(domElement, VAbstractTool::AttrPoint4, NULL_ID_STR);
const qreal angle1 = GetParametrDouble(domElement, VAbstractTool::AttrAngle1, "270.0"); const qreal angle1 = GetParametrDouble(domElement, VAbstractTool::AttrAngle1, "270.0");
const qreal angle2 = GetParametrDouble(domElement, VAbstractTool::AttrAngle2, "90.0"); const qreal angle2 = GetParametrDouble(domElement, VAbstractTool::AttrAngle2, "90.0");
const qreal kAsm1 = GetParametrDouble(domElement, VAbstractTool::AttrKAsm1, "1.0"); const qreal kAsm1 = GetParametrDouble(domElement, VAbstractTool::AttrKAsm1, "1.0");
@ -1832,7 +1833,7 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &
const qreal kAsm1 = GetParametrDouble(element, VAbstractTool::AttrKAsm1, "1.0"); const qreal kAsm1 = GetParametrDouble(element, VAbstractTool::AttrKAsm1, "1.0");
const qreal angle = GetParametrDouble(element, VAbstractTool::AttrAngle, "0"); const qreal angle = GetParametrDouble(element, VAbstractTool::AttrAngle, "0");
const qreal kAsm2 = GetParametrDouble(element, VAbstractTool::AttrKAsm2, "1.0"); const qreal kAsm2 = GetParametrDouble(element, VAbstractTool::AttrKAsm2, "1.0");
const quint32 pSpline = GetParametrUInt(element, VAbstractTool::AttrPSpline, "0"); const quint32 pSpline = GetParametrUInt(element, VAbstractTool::AttrPSpline, NULL_ID_STR);
const VPointF p = *data->GeometricObject<VPointF>(pSpline); const VPointF p = *data->GeometricObject<VPointF>(pSpline);
QLineF line(0, 0, 100, 0); QLineF line(0, 0, 100, 0);
@ -1921,7 +1922,7 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElemen
try try
{ {
ToolsCommonAttributes(domElement, id); ToolsCommonAttributes(domElement, id);
const quint32 center = GetParametrUInt(domElement, VAbstractTool::AttrCenter, "0"); const quint32 center = GetParametrUInt(domElement, VAbstractTool::AttrCenter, NULL_ID_STR);
const QString radius = GetParametrString(domElement, VAbstractTool::AttrRadius, "10"); const QString radius = GetParametrString(domElement, VAbstractTool::AttrRadius, "10");
QString r = radius;//need for saving fixed formula; QString r = radius;//need for saving fixed formula;
const QString f1 = GetParametrString(domElement, VAbstractTool::AttrAngle1, "180"); const QString f1 = GetParametrString(domElement, VAbstractTool::AttrAngle1, "180");
@ -1956,8 +1957,8 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElemen
try try
{ {
ToolsCommonAttributes(domElement, id); ToolsCommonAttributes(domElement, id);
const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0"); const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, NULL_ID_STR);
const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0"); const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, NULL_ID_STR);
VArc *arc = new VArc(*data->GeometricObject<VArc>(idObject)); VArc *arc = new VArc(*data->GeometricObject<VArc>(idObject));
arc->setIdObject(idObject); arc->setIdObject(idObject);
arc->setMode(Draw::Modeling); arc->setMode(Draw::Modeling);
@ -2069,7 +2070,7 @@ quint32 VPattern::GetParametrId(const QDomElement &domElement) const
QString message = tr("Got wrong parameter id. Need only id > 0."); QString message = tr("Got wrong parameter id. Need only id > 0.");
try try
{ {
id = GetParametrUInt(domElement, VDomDocument::AttrId, "0"); id = GetParametrUInt(domElement, VDomDocument::AttrId, NULL_ID_STR);
if (id <= 0) if (id <= 0)
{ {
throw VExceptionWrongId(message, domElement); throw VExceptionWrongId(message, domElement);