54 #include "../vwidgets/vabstractmainwindow.h"
55 #include "../vtools/tools/vdatatool.h"
56 #include "../vtools/tools/pattern_piece_tool.h"
57 #include "../vtools/tools/union_tool.h"
58 #include "../vtools/tools/drawTools/drawtools.h"
59 #include "../vtools/tools/nodeDetails/nodedetails.h"
60 #include "../ifc/exception/vexceptionobjecterror.h"
61 #include "../ifc/exception/vexceptionwrongid.h"
62 #include "../ifc/exception/vexceptionconversionerror.h"
63 #include "../ifc/exception/vexceptionemptyparameter.h"
64 #include "../ifc/exception/vexceptionundo.h"
65 #include "../ifc/xml/vpatternconverter.h"
66 #include "../vmisc/customevents.h"
67 #include "../vmisc/vsettings.h"
68 #include "../vmisc/vmath.h"
69 #include "../vmisc/projectversion.h"
70 #include "../vmisc/vabstractapplication.h"
71 #include "../qmuparser/qmuparsererror.h"
72 #include "../qmuparser/qmutokenparser.h"
73 #include "../vgeometry/varc.h"
74 #include "../vgeometry/vellipticalarc.h"
75 #include "../vgeometry/vsplinepath.h"
76 #include "../vgeometry/vcubicbezier.h"
77 #include "../vgeometry/vcubicbezierpath.h"
78 #include "../core/vapplication.h"
79 #include "../vpatterndb/vpiecenode.h"
80 #include "../vpatterndb/calculator.h"
81 #include "../vpatterndb/floatItemData/vpiecelabeldata.h"
82 #include "../vpatterndb/floatItemData/vpatternlabeldata.h"
83 #include "../vpatterndb/floatItemData/vgrainlinedata.h"
84 #include "../vpatterndb/vpiecepath.h"
85 #include "../vpatterndb/vnodedetail.h"
87 #include <QMessageBox>
100 return QString(
"Pattern created with Seamly2D v%1 (https://seamly.net).").arg(
APP_VERSION_STR);
110 draftScene(draftScene),
111 pieceScene(pieceScene)
124 QDomElement patternElement = this->createElement(
TagPattern);
126 patternElement.appendChild(createComment(
FileComment()));
128 QDomElement version = createElement(
TagVersion);
130 version.appendChild(newNodeText);
131 patternElement.appendChild(version);
133 QDomElement unit = createElement(
TagUnit);
135 unit.appendChild(newNodeText);
136 patternElement.appendChild(unit);
139 patternElement.appendChild(createElement(
TagNotes));
144 this->appendChild(patternElement);
145 insertBefore(createProcessingInstruction(
"xml",
"version=\"1.0\" encoding=\"UTF-8\""), this->firstChild());
162 qCDebug(vXML,
"Parsing pattern.");
166 qCDebug(vXML,
"Full parse.");
169 qCDebug(vXML,
"Lite parse.");
172 qCDebug(vXML,
"Lite draft block parse.");
185 QDomNode domNode = documentElement().firstChild();
186 while (domNode.isNull() ==
false)
188 if (domNode.isElement())
190 const QDomElement domElement = domNode.toElement();
191 if (domElement.isNull() ==
false)
193 switch (tags.indexOf(domElement.tagName()))
196 qCDebug(vXML,
"Tag draw.");
216 qCDebug(vXML,
"Tag increments.");
220 qCDebug(vXML,
"Tag description.");
223 qCDebug(vXML,
"Tag notes.");
226 qCDebug(vXML,
"Tag measurements.");
229 qCDebug(vXML,
"Tag version.");
232 qCDebug(vXML,
"Tag gradation.");
235 qCDebug(vXML,
"Tag image.");
238 qCDebug(vXML,
"Tag unit.");
241 qCDebug(vXML,
"Pattern name.");
244 qCDebug(vXML,
"Pattern number.");
247 qCDebug(vXML,
"Company name.");
250 qCDebug(vXML,
"Customer name.");
253 qCDebug(vXML,
"Pattern label.");
256 qCDebug(vXML,
"Wrong tag name %s", qUtf8Printable(domElement.tagName()));
261 domNode = domNode.nextSibling();
280 qCDebug(vXML,
"Setting current data");
281 qCDebug(vXML,
"Current Draft block name %s", qUtf8Printable(
activeDraftBlock));
287 qCDebug(vXML,
"History is empty!");
290 for (qint32 i = 0; i <
history.size(); ++i)
298 qCDebug(vXML,
"Resoring data from tool with id %u",
id);
301 qCDebug(vXML,
"Could not find record for this current draft block %s",
306 qCDebug(vXML,
"Taking record with id %u from Draft block %s",
id, qUtf8Printable(tool.
getDraftBlockName()));
309 qCDebug(vXML,
"Bad id for last record in history.");
313 if (
tools.size() > 0)
322 qCDebug(vXML,
"List of tools doesn't contain id= %u",
id);
331 qCDebug(vXML,
"Data successfully updated.");
335 qCDebug(vXML,
"List of tools is empty!");
349 Q_ASSERT_X(
id != 0, Q_FUNC_INFO,
"id == 0");
354 tool->VDataTool::setData(
data);
365 QDomElement calcElement;
368 const QDomNode domNode = calcElement.firstChild();
369 if (domNode.isNull() ==
false && domNode.isElement())
371 const QDomElement domElement = domNode.toElement();
372 if (domElement.isNull() ==
false)
388 QDomElement drawElement;
391 const QDomElement elements = drawElement.firstChildElement(
TagPieces);
392 if (!elements.isNull())
394 QDomElement piece = elements.firstChildElement(
TagPiece);
395 while(!piece.isNull())
402 piece = piece.nextSiblingElement(
TagPiece);
418 qCCritical(vXML,
"%s\n\n%s\n\n%s", qUtf8Printable(tr(
"Error not unique id.")),
424 QDomNode commentNode = documentElement().firstChild();
425 if (commentNode.isComment())
427 QDomComment comment = commentNode.toComment();
432 if (saved && QFileInfo(fileName).suffix() != QLatin1String(
"autosave"))
451 if (not tags.isEmpty())
453 const QDomNode domElement = tags.at(0);
454 if (not domElement.isNull())
465 QApplication::postEvent(
this,
new UndoEvent());
470 qCCritical(vXML,
"%s\n\n%s\n\n%s", qUtf8Printable(tr(
"Error parsing file.")),
477 qCCritical(vXML,
"%s\n\n%s\n\n%s", qUtf8Printable(tr(
"Error can't convert value.")),
484 qCCritical(vXML,
"%s\n\n%s\n\n%s", qUtf8Printable(tr(
"Error empty parameter.")),
491 qCCritical(vXML,
"%s\n\n%s\n\n%s", qUtf8Printable(tr(
"Error wrong id.")),
498 qCCritical(vXML,
"%s\n\n%s\n\n%s", qUtf8Printable(tr(
"Error parsing file.")),
503 catch (
const std::bad_alloc &)
505 qCCritical(vXML,
"%s", qUtf8Printable(tr(
"Error parsing file (std::bad_alloc).")));
532 qCWarning(vXML,
"Lite parsing doesn't support full parsing");
543 QApplication::postEvent(
this,
new UndoEvent());
548 qCCritical(vXML,
"%s\n\n%s\n\n%s", qUtf8Printable(tr(
"Error parsing file.")),
559 qCCritical(vXML,
"%s\n\n%s\n\n%s", qUtf8Printable(tr(
"Error can't convert value.")),
570 qCCritical(vXML,
"%s\n\n%s\n\n%s", qUtf8Printable(tr(
"Error empty parameter.")),
581 qCCritical(vXML,
"%s\n\n%s\n\n%s", qUtf8Printable(tr(
"Error wrong id.")),
592 qCCritical(vXML,
"%s\n\n%s\n\n%s", qUtf8Printable(tr(
"Error parsing file.")),
601 catch (
const std::bad_alloc &)
603 qCCritical(vXML,
"%s", qUtf8Printable(tr(
"Error parsing file (std::bad_alloc).")));
620 qCDebug(vXML,
"Scene size updated.");
629 qApp->getUndoStack()->undo();
654 switch (types.indexOf(t))
672 VException e(tr(
"Wrong tag name '%1'.").arg(t));
675 return VNodeDetail(
id, tool, nodeType, mx, my, reverse);
687 QDomNode domNode = node.firstChild();
688 while (domNode.isNull() ==
false)
690 if (domNode.isElement())
692 const QDomElement domElement = domNode.toElement();
693 if (domElement.isNull() ==
false)
695 switch (tags.indexOf(domElement.tagName()))
698 qCDebug(vXML,
"Tag calculation.");
703 qCDebug(vXML,
"Tag modeling.");
707 qCDebug(vXML,
"Tag pieces.");
711 qCDebug(vXML,
"Tag groups.");
715 VException e(tr(
"Wrong tag name '%1'.").arg(domElement.tagName()));
720 domNode = domNode.nextSibling();
744 const QStringList tags = QStringList() <<
TagPoint
752 const QDomNodeList nodeList = node.childNodes();
753 const qint32 num = nodeList.size();
754 for (qint32 i = 0; i < num; ++i)
756 QDomElement domElement = nodeList.at(i).toElement();
757 if (domElement.isNull() ==
false)
759 switch (tags.indexOf(domElement.tagName()))
762 qCDebug(vXML,
"Tag point.");
766 qCDebug(vXML,
"Tag line.");
770 qCDebug(vXML,
"Tag spline.");
774 qCDebug(vXML,
"Tag arc.");
778 qCDebug(vXML,
"Tag tools.");
782 qCDebug(vXML,
"Tag operation.");
786 qCDebug(vXML,
"Tag elliptical arc.");
790 qCDebug(vXML,
"Tag path.");
794 VException e(tr(
"Wrong tag name '%1'.").arg(domElement.tagName()));
809 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
823 QString().setNum(
qApp->Seamly2DSettings()->isHideSeamLine())));
827 QString().setNum(
qApp->Seamly2DSettings()->getForbidPieceFlipping())));
835 const QStringList tags = QStringList() <<
TagNodes
843 const QDomNodeList nodeList = domElement.childNodes();
844 for (qint32 i = 0; i < nodeList.size(); ++i)
846 const QDomElement element = nodeList.at(i).toElement();
847 if (not element.isNull())
849 switch (tags.indexOf(element.tagName()))
856 "Time to refactor the code.");
910 const QDomNodeList nodeList = domElement.childNodes();
911 for (qint32 i = 0; i < nodeList.size(); ++i)
913 const QDomElement element = nodeList.at(i).toElement();
914 if (not element.isNull()
985 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
986 QDomNode domNode = domElement.firstChild();
987 while (domNode.isNull() ==
false)
989 if (domNode.isElement())
991 QDomElement domElement = domNode.toElement();
992 if (domElement.isNull() ==
false)
994 if (domElement.tagName() ==
TagPiece)
1000 domNode = domNode.nextSibling();
1006 bool &isVisible, QString &lineType, QString &lineWeight, QString &lineColor)
1016 qreal &mx, qreal &my,
bool &isVisible)
1041 const Document &parse,
const QString &type)
1044 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
1045 Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO,
"type of point is empty");
1071 switch (points.indexOf(type))
1146 VException e(tr(
"Unknown point type '%1'.").arg(type));
1162 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
1173 VToolLine::Create(
id, firstPoint, secondPoint, lineType, lineWeight, lineColor, scene,
this,
data, parse,
Source::FromFile);
1194 QDomElement domElement;
1206 const QString def = QStringLiteral(
"A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z");
1207 QStringList alphabet;
1208 switch (list.indexOf(
qApp->Seamly2DSettings()->GetLabelLanguage()))
1212 const QString al = QStringLiteral(
"A,Ä,B,C,D,E,F,G,H,I,J,K,L,M,N,O,Ö,P,Q,R,S,ß,T,U,Ü,V,W,X,Y,Z");
1213 alphabet = al.split(
",");
1218 const QString al = QStringLiteral(
"A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z");
1219 alphabet = al.split(
",");
1224 const QString al = QStringLiteral(
"А,Б,В,Г,Д,Е,Ж,З,И,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Э,Ю,Я");
1225 alphabet = al.split(
",");
1230 const QString al = QStringLiteral(
"А,Б,В,Г,Д,Е,Ж,З,І,Ї,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Є,Ю,Я");
1231 alphabet = al.split(
",");
1237 const QString al = QStringLiteral(
"A,B,C,Č,Ć,D,Dž,Ð,E,F,G,H,I,J,K,L,Lj,M,N,Nj,O,P,R,S,Š,T,U,V,Z,Ž");
1238 alphabet = al.split(
",");
1243 const QString al = QStringLiteral(
"А,Б,В,Г,Д,Ђ,Е,Ж,З,И,Ј,К,Л,Љ,М,Н,Њ,О,П,Р,С,Т,Ћ,У,Ф,Х,Ц,Ч,Џ,Ш");
1244 alphabet = al.split(
",");
1250 alphabet = def.split(
",");
1256 const int count = qFloor(index/
static_cast<quint32
>(alphabet.size()));
1257 const int number =
static_cast<int>(index) - alphabet.size() * count;
1261 base.append(alphabet.at(number));
1263 }
while (i < count);
1271 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
1280 bool showPointName =
true;
1294 scene->removeItem(spoint);
1304 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
1315 bool showPointName =
true;
1320 QString f = formula;
1325 QString angleFix = angle;
1327 VToolEndLine::Create(
id, name, lineType, lineWeight, lineColor, f, angleFix, basePointId, mx, my, showPointName, scene,
this,
data,
1330 if (f != formula || angleFix != angle)
1347 excep.
AddMoreInformation(QString(
"Message: " + e.GetMsg() +
"\n"+
"Expression: " + e.GetExpr()));
1356 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
1367 bool showPointName =
true;
1371 QString f = formula;
1375 VToolAlongLine::Create(
id, name, lineType, lineWeight, lineColor, f, firstPointId, secondPointId, mx, my, showPointName, scene,
1394 excep.
AddMoreInformation(QString(
"Message: " + e.GetMsg() +
"\n"+
"Expression: " + e.GetExpr()));
1403 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
1414 bool showPointName =
true;
1418 QString f = formula;
1423 VToolShoulderPoint::Create(
id, f, p1Line, p2Line, pShoulder, lineType, lineWeight, lineColor, name, mx, my,
1442 excep.
AddMoreInformation(QString(
"Message: " + e.GetMsg() +
"\n"+
"Expression: " + e.GetExpr()));
1451 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
1462 bool showPointName =
true;
1466 QString f = formula;
1471 VToolNormal::Create(
id, f, firstPointId, secondPointId, lineType, lineWeight, lineColor, name, angle,
1490 excep.
AddMoreInformation(QString(
"Message: " + e.GetMsg() +
"\n"+
"Expression: " + e.GetExpr()));
1499 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
1510 bool showPointName =
true;
1514 QString f = formula;
1520 lineType, lineWeight, lineColor, name, mx, my, showPointName, scene,
this,
data, parse,
Source::FromFile);
1538 excep.
AddMoreInformation(QString(
"Message: " + e.GetMsg() +
"\n"+
"Expression: " + e.GetExpr()));
1547 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
1555 bool showPointName =
true;
1568 VExceptionObjectError excep(tr(
"Error creating or updating point of line intersection"), domElement);
1578 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
1586 bool showPointName =
true;
1595 VToolPointOfContact::Create(
id, f, center, firstPointId, secondPointId, name, mx, my, showPointName, scene,
this,
1614 excep.
AddMoreInformation(QString(
"Message: " + e.GetMsg() +
"\n"+
"Expression: " + e.GetExpr()));
1622 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
1661 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
1684 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
1695 bool showPointName =
true;
1702 VToolHeight::Create(
id, name, lineType, lineWeight, lineColor, basePointId, p1LineId, p2LineId,
1717 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
1725 bool showPointName =
true;
1733 VToolTriangle::Create(
id, name, axisP1Id, axisP2Id, firstPointId, secondPointId, mx, my, showPointName, scene,
this,
1749 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
1760 bool showPointName =
true;
1781 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
1789 bool showPointName =
true;
1793 QString f = formula;
1796 VToolCutSpline::Create(
id, name, f, splineId, mx, my, showPointName, scene,
this,
data, parse,
Source::FromFile);
1814 excep.
AddMoreInformation(QString(
"Message: " + e.GetMsg() +
"\n"+
"Expression: " + e.GetExpr()));
1823 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
1831 bool showPointName =
true;
1835 QString f = formula;
1839 VToolCutSplinePath::Create(
id, name, f, splinePathId, mx, my, showPointName, scene,
this,
data, parse,
Source::FromFile);
1857 excep.
AddMoreInformation(QString(
"Message: " + e.GetMsg() +
"\n"+
"Expression: " + e.GetExpr()));
1866 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
1874 bool showPointName =
true;
1878 QString f = formula;
1881 VToolCutArc::Create(
id, name, f, arcId, mx, my, showPointName, scene,
this,
data, parse,
Source::FromFile);
1899 excep.
AddMoreInformation(QString(
"Message: " + e.GetMsg() +
"\n"+
"Expression: " + e.GetExpr()));
1909 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
1920 bool showPointName =
true;
1929 QString angleFix = angle;
1934 if (angleFix != angle)
1952 excep.
AddMoreInformation(QString(
"Message: " + e.GetMsg() +
"\n"+
"Expression: " + e.GetExpr()));
1962 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
1973 bool showPointName =
true;
1980 QString angleFix = angle;
1982 VToolCurveIntersectAxis::Create(
id, name, lineType, lineWeight, lineColor, angleFix, basePointId, curveId, mx, my,
1985 if (angleFix != angle)
2003 excep.
AddMoreInformation(QString(
"Message: " + e.GetMsg() +
"\n"+
"Expression: " + e.GetExpr()));
2013 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
2021 bool showPointName =
true;
2035 VExceptionObjectError excep(tr(
"Error creating or updating point of intersection arcs"), domElement);
2046 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
2054 bool showPointName =
true;
2060 QString c1R = c1Radius;
2062 QString c2R = c2Radius;
2069 if (c1R != c1Radius || c2R != c2Radius)
2079 VExceptionObjectError excep(tr(
"Error creating or updating point of intersection circles"), domElement);
2090 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
2098 bool showPointName =
true;
2111 VExceptionObjectError excep(tr(
"Error creating or updating point of intersection curves"), domElement);
2122 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
2130 bool showPointName =
true;
2136 QString cR = cRadius;
2153 VExceptionObjectError excep(tr(
"Error creating or updating point from circle and tangent"), domElement);
2164 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
2172 bool showPointName =
true;
2186 VExceptionObjectError excep(tr(
"Error creating or updating point from arc and tangent"), domElement);
2196 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
2225 baseLineP1Id, baseLineP2Id, dartP1Id, dartP2Id, dartP3Id,
2226 name1, mx1, my1, showPointName1, name2, mx2, my2, showPointName2,
2242 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
2262 auto spline =
new VSpline(*p1, *p4, angle1, angle2, kAsm1, kAsm2, kCurve);
2265 spline->SetDuplicate(duplicate);
2267 spline->setLineColor(color);
2283 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
2294 QString a1 = angle1;
2297 QString a2 = angle2;
2300 QString l1 = length1;
2303 QString l2 = length2;
2310 VToolSpline *spl =
VToolSpline::Create(
id, point1, point4, a1, a2, l1, l2, duplicate, color, penStyle,
2321 if (a1 != angle1 || a2 != angle2 || l1 != length1 || l2 != length2)
2339 VExceptionObjectError excep(tr(
"Error creating or updating simple interactive spline"), domElement);
2340 excep.
AddMoreInformation(QString(
"Message: " + e.GetMsg() +
"\n"+
"Expression: " + e.GetExpr()));
2349 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
2374 spline->SetDuplicate(duplicate);
2376 spline->setLineColor(color);
2377 spline->SetPenStyle(penStyle);
2378 spline->setLineWeight(lineWeight);
2394 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
2407 const QDomNodeList nodeList = domElement.childNodes();
2408 const qint32 num = nodeList.size();
2409 for (qint32 i = 0; i < num; ++i)
2411 const QDomElement element = nodeList.at(i).toElement();
2412 if (element.isNull() ==
false)
2422 QLineF line(0, 0, 100, 0);
2423 line.setAngle(angle+180);
2425 VFSplinePoint splPoint(p, kAsm1, line.angle(), kAsm2, angle);
2426 points.append(splPoint);
2438 path->SetDuplicate(duplicate);
2440 path->setLineColor(color);
2456 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
2474 const QDomNodeList nodeList = domElement.childNodes();
2475 const qint32 num = nodeList.size();
2476 for (qint32 i = 0; i < num; ++i)
2478 const QDomElement element = nodeList.at(i).toElement();
2479 if (not element.isNull() && element.tagName() ==
AttrPathPoint)
2486 points.append(pSpline);
2513 for (qint32 i = 0; i < num; ++i)
2515 QDomElement element = nodeList.at(i).toElement();
2516 if (not element.isNull() && element.tagName() ==
AttrPathPoint)
2518 if (a1.at(count) != angle1.at(count) || a2.at(count) != angle2.at(count) ||
2519 l1.at(count) != length1.at(count) || l2.at(count) != length2.at(count))
2541 excep.
AddMoreInformation(QString(
"Message: " + e.GetMsg() +
"\n"+
"Expression: " + e.GetExpr()));
2550 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
2564 const QDomNodeList nodeList = domElement.childNodes();
2565 const qint32 num = nodeList.size();
2566 for (qint32 i = 0; i < num; ++i)
2568 const QDomElement element = nodeList.at(i).toElement();
2569 if (element.isNull() ==
false)
2587 path->SetDuplicate(duplicate);
2589 path->setLineColor(color);
2590 path->SetPenStyle(penStyle);
2591 path->setLineWeight(lineWeight);
2606 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
2611 quint32 idObject = 0;
2652 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
2657 quint32 idObject = 0;
2698 Q_ASSERT_X(domElement.isNull() ==
false, Q_FUNC_INFO,
"domElement is null");
2716 VToolArc::Create(
id, center, r, f1Fix, f2Fix, color, penStyle, lineWeight, scene,
this,
data,
2719 if (r != radius || f1Fix != f1 || f2Fix != f2)
2737 excep.
AddMoreInformation(QString(
"Message: " + e.GetMsg() +
"\n"+
"Expression: " + e.GetExpr()));
2746 Q_ASSERT_X(domElement.isNull() ==
false, Q_FUNC_INFO,
"domElement is null");
2756 QString r1 = radius1;
2757 QString r2 = radius2;
2763 QString frotationFix = frotation;
2768 VToolEllipticalArc::Create(
id, center, r1, r2, f1Fix, f2Fix, frotationFix, color, penStyle, lineWeight,
2772 if (r1 != radius1 || r2 != radius2 || f1Fix != f1 || f2Fix != f2 || frotationFix != frotation)
2792 excep.
AddMoreInformation(QString(
"Message: " + e.GetMsg() +
"\n"+
"Expression: " + e.GetExpr()));
2800 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
2835 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
2844 VArc *arc =
nullptr;
2871 Q_ASSERT_X(domElement.isNull() ==
false, Q_FUNC_INFO,
"domElement is null");
2884 QString lengthFix = length;
2889 VToolArcWithLength::Create(
id, center, r, f1Fix, lengthFix, color, penStyle, lineWeight, scene,
this,
2893 if (r != radius || f1Fix != f1 || lengthFix != length)
2911 excep.
AddMoreInformation(QString(
"Message: " + e.GetMsg() +
"\n"+
"Expression: " + e.GetExpr()));
2920 Q_ASSERT_X(domElement.isNull() ==
false, Q_FUNC_INFO,
"domElement is null");
2936 VToolRotation::Create(
id, center, a, suffix, source, destination, scene,
this,
data, parse,
Source::FromFile);
2954 excep.
AddMoreInformation(QString(
"Message: " + e.GetMsg() +
"\n"+
"Expression: " + e.GetExpr()));
2963 Q_ASSERT_X(domElement.isNull() ==
false, Q_FUNC_INFO,
"domElement is null");
2978 VToolMirrorByLine::Create(
id, p1, p2, suffix, source, destination, scene,
this,
data, parse,
2983 VExceptionObjectError excep(tr(
"Error creating or updating operation of mirror by line"), domElement);
2993 Q_ASSERT_X(domElement.isNull() ==
false, Q_FUNC_INFO,
"domElement is null");
3008 VToolMirrorByAxis::Create(
id, origin, axisType, suffix, source, destination, scene,
this,
data, parse,
3013 VExceptionObjectError excep(tr(
"Error creating or updating operation of mirror by axis"), domElement);
3023 Q_ASSERT_X(domElement.isNull() ==
false, Q_FUNC_INFO,
"domElement is null");
3033 QString len = length;
3036 QString rot = rotation;
3048 if (a != angle || len != length || rot != rotation)
3066 excep.
AddMoreInformation(QString(
"Message: " + e.GetMsg() +
"\n"+
"Expression: " + e.GetExpr()));
3074 if (formula.isEmpty())
3084 QString f = formula;
3085 f.replace(
"\n",
" ");
3086 QScopedPointer<Calculator> cal(
new Calculator());
3089 (qIsInf(result) || qIsNaN(result)) ? *ok =
false : *ok =
true;
3116 for (
int i=0; i < list.size(); ++i)
3118 const QDomElement domElement = list.at(i).toElement();
3119 if (domElement.isNull() ==
false)
3121 const QString parameter = domElement.attribute(
IncrementName);
3122 if (parameter == name)
3129 return QDomElement();
3135 QDomNodeList modelingList = elementsByTagName(
TagModeling);
3136 for (
int i=0; i < modelingList.size(); ++i)
3138 QDomElement modElement = modelingList.at(i).toElement();
3139 if (not modElement.isNull())
3141 QDomElement modNode = modElement.firstChild().toElement();
3142 while (not modNode.isNull())
3145 QDomElement nextSibling = modNode.nextSibling().toElement();
3156 modElement.removeChild(modNode);
3164 modNode = nextSibling;
3179 const Document &parse,
const QString &type)
3182 Q_ASSERT_X(domElement.isNull() ==
false, Q_FUNC_INFO,
"domElement is null");
3183 Q_ASSERT_X(type.isEmpty() ==
false, Q_FUNC_INFO,
"type of spline is empty");
3193 switch (splines.indexOf(type))
3196 qCDebug(vXML,
"VOldToolSpline.");
3200 qCDebug(vXML,
"VToolSpline.");
3204 qCDebug(vXML,
"VOldToolSplinePath.");
3208 qCDebug(vXML,
"VToolSplinePath.");
3212 qCDebug(vXML,
"VNodeSpline.");
3216 qCDebug(vXML,
"VNodeSplinePath.");
3220 qCDebug(vXML,
"VToolCubicBezier.");
3224 qCDebug(vXML,
"VToolCubicBezierPath.");
3228 VException e(tr(
"Unknown spline type '%1'.").arg(type));
3242 const QString &type)
3245 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
3246 Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO,
"type of arc is empty");
3252 switch (arcs.indexOf(type))
3264 VException e(tr(
"Unknown arc type '%1'.").arg(type));
3278 const QString &type)
3281 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
3282 Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO,
"type of elliptical arc is empty");
3287 switch (arcs.indexOf(type))
3296 VException e(tr(
"Unknown elliptical arc type '%1'.").arg(type));
3310 const Document &parse,
const QString &type)
3313 Q_ASSERT_X(domElement.isNull() ==
false, Q_FUNC_INFO,
"domElement is null");
3314 Q_ASSERT_X(type.isEmpty() ==
false, Q_FUNC_INFO,
"type of spline is empty");
3317 switch (
tools.indexOf(type))
3328 initData.
scene = scene;
3329 initData.
doc =
this;
3331 initData.
parse = parse;
3344 VException e(tr(
"Unknown tools type '%1'.").arg(type));
3351 const QString &type)
3354 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
3355 Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO,
"type of operation is empty");
3362 switch (opers.indexOf(type))
3377 VException e(tr(
"Unknown operation type '%1'.").arg(type));
3386 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
3400 if (not element.isNull())
3428 QDomNode domNode = node.firstChild();
3429 while (domNode.isNull() ==
false)
3431 if (domNode.isElement())
3433 const QDomElement domElement = domNode.toElement();
3434 if (domElement.isNull() ==
false)
3460 domNode = domNode.nextSibling();
3470 list.at(0).appendChild(element);
3482 if (sibling.isNull())
3484 list.at(0).appendChild(element);
3488 list.at(0).insertAfter(element, sibling);
3505 if (not node.isNull())
3507 const QDomElement prSibling = node.previousSiblingElement(
TagIncrement);
3508 if (not prSibling.isNull())
3511 list.at(0).insertBefore(node, prSibling);
3521 if (not node.isNull())
3523 const QDomElement nextSibling = node.nextSiblingElement(
TagIncrement);
3524 if (not nextSibling.isNull())
3527 list.at(0).insertAfter(node, nextSibling);
3537 if (not node.isNull())
3548 if (not node.isNull())
3559 if (not node.isNull())
3569 const int bias = name.length() - newName.length();
3571 for(
int i = 0; i < expressions.size(); ++i)
3573 if (expressions.at(i).expression.indexOf(name) != -1)
3580 QScopedPointer<qmu::QmuTokenParser> cal(
new qmu::QmuTokenParser(expressions.at(i).expression,
false,
3582 tokens = cal->GetTokens();
3591 if (not tValues.contains(name))
3597 QString newFormula = expressions.at(i).expression;
3599 for (
int i = 0; i < tKeys.size(); ++i)
3601 if (tValues.at(i) != name)
3606 newFormula.replace(tKeys.at(i), name.length(), newName);
3611 tKeys = tokens.keys();
3612 tValues = tokens.values();
3616 expressions[i].expression = newFormula;
3617 expressions[i].element.setAttribute(expressions.at(i).attribute, newFormula);
3634 const QDomNodeList blockList = elementsByTagName(
TagDraftBlock);
3639 name =
GetLabelBase(
static_cast<quint32
>(blockList.size() + i));
3650 qCDebug(vXML,
"Point name: %s", qUtf8Printable(name));
3661 name = QString(
"%1%2").arg(labelBase).arg(num);
3667 }
while (
data->
IsUnique(name) ==
false || name == reservedName);
3668 qCDebug(vXML,
"Point name: %s", qUtf8Printable(name));
3671 qCDebug(vXML,
"Got unknown type %d",
static_cast<int>(type));
3684 suffix = QString(
"_%1%2%3").arg(suffixBase).arg(num).arg(type);
3686 for (
int i=0; i < uniqueNames.size(); ++i)
3693 if (i == uniqueNames.size()-1)
3695 qCDebug(vXML,
"Suffix is: %s", qUtf8Printable(suffix));
3713 if (tags.size() == 0)
3718 const QDomNode domNode = tags.at(0);
3719 const QDomElement domElement = domNode.toElement();
3720 if (domElement.isNull() ==
false)
3737 qDebug()<<
"Can't save attribute "<<
AttrCustom<<Q_FUNC_INFO;
3741 QDomNode domNode = tags.at(0);
3742 QDomElement domElement = domNode.toElement();
3743 if (domElement.isNull() ==
false)
3759 qDebug()<<
"Can't save attribute "<<
AttrCustom<<Q_FUNC_INFO;
3769 if (tags.size() == 0)
3774 const QDomNode domNode = tags.at(0);
3775 const QDomElement domElement = domNode.toElement();
3776 if (domElement.isNull() ==
false)
3798 qDebug()<<
"Can't save attribute "<<
AttrDefHeight<<Q_FUNC_INFO;
3802 QDomNode domNode = tags.at(0);
3803 QDomElement domElement = domNode.toElement();
3804 if (domElement.isNull() ==
false)
3818 qDebug()<<
"Can't save attribute "<<
AttrDefHeight<<Q_FUNC_INFO;
3828 if (tags.size() == 0)
3833 const QDomNode domNode = tags.at(0);
3834 const QDomElement domElement = domNode.toElement();
3835 if (domElement.isNull() ==
false)
3857 qDebug()<<
"Can't save attribute "<<
AttrDefSize<<Q_FUNC_INFO;
3861 QDomNode domNode = tags.at(0);
3862 QDomElement domElement = domNode.toElement();
3863 if (domElement.isNull() ==
false)
3877 qDebug()<<
"Can't save attribute "<<
AttrDefSize<<Q_FUNC_INFO;
3884 const QDomElement pattern = documentElement();
3886 if (pattern.isNull())
3897 QDomElement pattern = documentElement();
3899 if (not pattern.isNull())
3957 QT_WARNING_DISABLE_GCC(
"-Wswitch-default")
3966 for (qint32 i = 0; i< history.size(); ++i)
3997 rect = ToolBoundingRect<VToolSinglePoint>(rect, tool.
getId());
4007 rect = ToolBoundingRect<VToolLinePoint>(rect, tool.
getId());
4010 rect = ToolBoundingRect<VToolLine>(rect, tool.
getId());
4019 rect = ToolBoundingRect<VAbstractSpline>(rect, tool.
getId());
4022 rect = ToolBoundingRect<VToolDoublePoint>(rect, tool.
getId());
4028 rect = ToolBoundingRect<VAbstractOperation>(rect, tool.
getId());
4052 template <
typename T>
4055 QRectF toolRect = rect;
4056 if (
tools.contains(
id))
4058 const T *vTool = qobject_cast<T *>(
tools.value(
id));
4061 QRectF childrenRect = vTool->childrenBoundingRect();
4063 childrenRect.translate(vTool->scenePos());
4065 toolRect = toolRect.united(vTool->sceneBoundingRect());
4066 toolRect = toolRect.united(childrenRect);
4070 qDebug()<<
"Can't find tool with id="<<id;
4082 Q_ASSERT_X(
id != 0, Q_FUNC_INFO,
"id == 0");
4096 Q_ASSERT_X(
id != 0, Q_FUNC_INFO,
"id == 0");
The Calculator class for calculation formula.
void SetVisible(bool bVisible)
void SetPos(const QPointF &ptPos)
virtual void ShowToolTip(const QString &toolTip)=0
static const QString AttrIdTool
static void ExtractData(const QDomElement &domElement, QVector< SourceItem > &source, QVector< DestinationItem > &destination)
static const QString TagNode
static const QString AttrLetter
static const QString TagData
static const QString TagSpline
static const QString AttrAnnotation
void FullUpdateFromFile()
FullUpdateFromFile update tool data form file.
static const QString AttrType
static const QString AttrTilt
static const QString TagPieces
static QVector< quint32 > ParsePieceAnchors(const QDomElement &domElement)
static const QString NodeArc
static const QString AttrRotation
static const QString TagDescription
static const QString AttrFoldPosition
int draftBlockCount() const
static const QString NodePoint
static const QString AttrCustom
static const QString TagMeasurements
static const QString IncrementDescription
static const QString TagModeling
static const QString TagArc
static const QString TagPatternName
QString activeDraftBlock
activeBlockName name current pattern peace.
void setActiveDraftBlock(const QString &name)
setActiveDraftBlock set current draft block.
static const QString AttrDefSize
static const QString TagPattern
static const QString AttrOnFold
void haveLiteChange()
haveLiteChange we have unsaved change.
static const QString AttrWidth
static const QString TagNotes
static const QString TagTools
void patternChanged(bool saved)
patternChanged emit if we have unsaved change.
static const QString NodeSplinePath
static const QString TagCustomerName
static const QString TagPatternInfo
QVector< VToolRecord > history
history history records.
static const QString TagElArc
static const QString NodeSpline
static const QString AttrQuantity
static const QString AttrRotationWay
void parseGroups(const QDomElement &domElement)
static QHash< quint32, VDataTool * > tools
tools list with pointer on tools.
static const QString AttrOrientation
static const QString TagPatternLabel
static VPiecePath ParsePathNodes(const QDomElement &domElement)
static const QString TagLine
static const QString TagIncrement
static const QString TagGroups
bool getActiveDraftElement(QDomElement &element) const
getActiveDraftElement return draftBlock element for current draft block.
static const QString TagPatternNum
quint32 cursor
cursor cursor keep id tool after which we will add new tool in file.
void SetEnabledGUI(bool enabled)
static const QString AttrArrows
static const QString TagDraftBlock
static QVector< CustomSARecord > ParsePieceCSARecords(const QDomElement &domElement)
static VPiecePath ParsePieceNodes(const QDomElement &domElement)
static const QString IncrementName
static const QString NodeElArc
static const QString TagOperation
static const QString IncrementFormula
bool getActiveNodeElement(const QString &name, QDomElement &element) const
getActiveNodeElement find element in current draft block by name.
static const QString AttrNodeReverse
static const QString TagPath
static const QString TagPiece
static const QString TagCompanyName
QVector< VDataTool * > toolsOnRemove
QDomElement CheckTagExists(const QString &tag)
static void ToolExists(const quint32 &id)
static const QString TagImage
static const QString TagCalculation
static const QString TagGrainline
static const QString AttrName
static const QString AttrVisible
static const QString TagPoint
static const QString TagGradation
bool modified
modified keep state of the document for cases that do not cover QUndoStack
void changeActiveDraftBlock(const QString &name, const Document &parse=Document::FullParse)
changeActiveDraftBlock set new active draft block name.
static const QString AttrDefHeight
static const QString TagNodes
static const QString TagIncrements
int getActiveDraftBlockIndex() const
QStringList patternPieces
patternPieces list of patern pieces names for combobox
static QVector< quint32 > ParsePieceInternalPaths(const QDomElement &domElement)
void setFill(const QString &value)
void SetForbidFlipping(bool value)
void setColor(const QString &value)
void setHideSeamLine(bool value)
void SetName(const QString &value)
void SetSeamAllowanceBuiltIn(bool value)
void SetSeamAllowance(bool value)
static QStringList LabelLanguages()
VArc class for anticlockwise arc.
The VContainer class container of all variables.
void AddVariable(const QString &name, T *var)
static void ClearUniqueNames()
void RemoveVariable(const QString &name)
void ClearCalculationGObjects()
static bool IsUnique(const QString &name)
void ClearVariables(const VarType &type=VarType::Unknown)
const QHash< QString, QSharedPointer< VInternalVariable > > * DataVariables() const
const QSharedPointer< VGObject > GetGObject(quint32 id) const
GetGObject returns a point by id.
const QSharedPointer< T > GeometricObject(const quint32 &id) const
static QStringList AllUniqueNames()
static void ClearUniqueIncrementNames()
void UpdateGObject(quint32 id, T *obj)
UpdateGObject update GObject by id.
static QString GetParametrString(const QDomElement &domElement, const QString &name, const QString &defValue=QString())
Returns the string value of the given attribute. RENAME: see above.
static quint32 GetParametrUInt(const QDomElement &domElement, const QString &name, const QString &defValue)
Returns the long long value of the given attribute. RENAME: GetParameterLongLong?
static QString GetParametrEmptyString(const QDomElement &domElement, const QString &name)
static bool getParameterBool(const QDomElement &domElement, const QString &name, const QString &defValue)
void TestUniqueId() const
TestUniqueId test exist unique id in pattern file. Each id must be unique.
static void SetParametrUsage(QDomElement &domElement, const QString &name, const NodeUsage &value)
static qreal GetParametrDouble(const QDomElement &domElement, const QString &name, const QString &defValue)
Returns the double value of the given attribute.
static const QString TagVersion
static const QString TagUnit
void SetAttribute(QDomElement &domElement, const QString &name, const T &value) const
SetAttribute set attribute in pattern file. Replace "," by ".".
virtual void setXMLContent(const QString &fileName)
virtual bool SaveDocument(const QString &fileName, QString &error)
static NodeUsage GetParametrUsage(const QDomElement &domElement, const QString &name)
QVector< VLabelTemplateLine > GetLabelTemplate(const QDomElement &element) const
static quint32 getParameterId(const QDomElement &domElement)
getParameterId return value id attribute.
The VExceptionBadId class for exception bad id.
virtual QString ErrorMessage() const Q_DECL_OVERRIDE
ErrorMessage return main error message.
The VExceptionConversionError class for exception of conversion error.
The VExceptionEmptyParameter class for exception empty parameter.
The VExceptionObjectError class for exception object error.
The VExceptionWrongId class for exception wrong id.
virtual QString DetailedInformation() const Q_DECL_OVERRIDE
DetailedInformation return detailed information about error.
virtual QString ErrorMessage() const Q_DECL_OVERRIDE
ErrorMessage return main error message.
The VException class parent for all exception. Could be use for abstract exception.
virtual QString ErrorMessage() const
ErrorMessage return main error message.
void AddMoreInformation(const QString &info)
AddMoreInformation add more information for error.
virtual QString DetailedInformation() const
DetailedInformation return detailed information about error.
The VFSplinePoint class keep information about point in spline path. Each point have two angles and t...
void setMode(const Draw &value)
setMode set mode creation.
void setIdObject(const quint32 &value)
setIdObject set parent id.
quint32 getIdTool() const
The VGrainlineData class holds information about a grainline like position, size, rotation and visibi...
void setBottomAnchorPoint(quint32 bottomAnchorPoint)
void SetRotation(const QString &qsRot)
void SetLength(const QString &qsLen)
void SetArrowType(ArrowType eAT)
void setCenterAnchorPoint(quint32 centerAnchor)
void setTopAnchorPoint(quint32 topAnchorPoint)
The VIncrement class keep data row of increment table.
The VMainGraphicsScene class main scene.
static void NewSceneRect(QGraphicsScene *sc, QGraphicsView *view, QGraphicsItem *item=nullptr)
NewSceneRect calculate scene rect what contains all items and doesn't less that size of scene view.
static void Create(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Document &parse, const Source &typeCreation, const QString &blockName=QString(), const quint32 &idTool=0)
Create help create tool.
static const QString ToolType
The VNodeDetail class keep information about detail node.
static QVector< VPieceNode > Convert(const VContainer *data, const QVector< VNodeDetail > &nodes, qreal width, bool closed)
static void Create(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Document &parse, const Source &typeCreation, const QString &blockName=QString(), const quint32 &idTool=NULL_ID)
static const QString ToolType
static const QString ToolType
static void Create(VAbstractPattern *doc, VContainer *data, VMainGraphicsScene *scene, quint32 id, quint32 idPoint, const Document &parse, const Source &typeCreation, const QString &blockName=QString(), const quint32 &idTool=0)
Create help create tool.
static const QString ToolType
static void Create(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idSpline, const Document &parse, const Source &typeCreation, const QString &blockName=QString(), const quint32 &idTool=0)
Create help create tool.
static VNodeSpline * Create(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idSpline, const Document &parse, const Source &typeCreation, const QString &blockName=QString(), const quint32 &idTool=0)
Create help create tool.
static const QString ToolType
static const QString PatternMaxVerStr
static Q_DECL_CONSTEXPR const int PatternMinVer
The VPatternLabelData class holds the information about pattern info label geometry.
void setBottomRightAnchorPoint(const quint32 &bottomRightAnchorPoint)
void setCenterAnchorPoint(const quint32 ¢erAnchorPoint)
void SetLabelHeight(const QString &dLabelH)
void SetFontSize(int iSize)
void SetRotation(const QString &dRot)
void SetLabelWidth(const QString &dLabelW)
void setTopLeftAnchorPoint(const quint32 &topLeftAnchorPoint)
The VPattern class working with pattern file.
void SetDefCustomSize(int value)
virtual void customEvent(QEvent *event) Q_DECL_OVERRIDE
VMainGraphicsScene * draftScene
mode current draw mode.
void ParseToolEndLine(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
int GetDefCustomSize() const
void MoveDownIncrement(const QString &name)
void ParsePieceDataTag(const QDomElement &domElement, VPiece &piece) const
void ParseNodeArc(const QDomElement &domElement, const Document &parse)
void ParseOperationElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse, const QString &type)
void ParsePiecePatternInfo(const QDomElement &domElement, VPiece &piece) const
QVector< quint32 > getActivePatternPieces() const
QString GetLabelBase(quint32 index) const
VMainGraphicsScene * pieceScene
void replaceNameInFormula(QVector< VFormulaField > &expressions, const QString &name, const QString &newName)
void ParseToolPointOfIntersectionCircles(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
void ParsePathElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
quint32 getActiveBasePoint()
getActiveBasePoint return id base point current draft block.
static const QString AttrReadOnly
void setIncrementDescription(const QString &name, const QString &text)
void ParseIncrementsElement(const QDomNode &node)
ParseIncrementsElement parse increments tag.
Draw * mode
data container with data.
void ParseToolTrueDarts(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
VPattern(VContainer *data, Draw *mode, VMainGraphicsScene *draftScene, VMainGraphicsScene *pieceScene, QObject *parent=nullptr)
void ParseToolPointOfIntersectionCurves(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
void ParseToolPointFromArcAndTangent(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
void ParseAnchorPoint(const QDomElement &domElement, const Document &parse)
void ParseToolHeight(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
void ParseToolBisector(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
void ParseToolCutSplinePath(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
void ToolsCommonAttributes(const QDomElement &domElement, quint32 &id)
int GetDefCustomHeight() const
void ParseNodeSplinePath(const QDomElement &domElement, const Document &parse)
void PrepareForParse(const Document &parse)
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer< CONVERTER_VERSION_CHECK(0, 2, 7), "Time to refactor the code.")
void ParseNodeEllipticalArc(const QDomElement &domElement, const Document &parse)
void ParseToolLineIntersectAxis(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
virtual QString GenerateSuffix(const QString &type) const Q_DECL_OVERRIDE
void parseCurrentDraftBlock()
void ParseToolArcWithLength(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
QRectF ToolBoundingRect(const QRectF &rec, const quint32 &id) const
void ParseToolLineIntersect(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
void ParseToolAlongLine(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
void parsePieceElement(QDomElement &domElement, const Document &parse)
parsePieceElement parse piece tag.
void ParseToolCurveIntersectAxis(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
void ParseNodePoint(const QDomElement &domElement, const Document &parse)
void LiteParseIncrements()
QDomElement FindIncrement(const QString &name) const
void addEmptyCustomVariable(const QString &name)
void ParseToolCubicBezier(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
void ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse, const QString &type)
ParseArcElement parse arc tag.
virtual void DecrementReferens(quint32 id) const Q_DECL_OVERRIDE
DecrementReferens decrement reference parent objects.
void parsePatternPieces(const QDomElement &domElement, const Document &parse)
parsePatternPieces parse pieces tag.
void ParseToolPointOfContact(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
void ParseToolPointFromCircleAndTangent(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
virtual void CreateEmptyFile() Q_DECL_OVERRIDE
CreateEmptyFile create minimal empty file.
void ParseOldToolSplinePath(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
void PointsCommonAttributes(const QDomElement &domElement, quint32 &id, QString &name, qreal &mx, qreal &my, bool &labelVisible, QString &lineType, QString &lineWeight, QString &lineColor)
QDomElement MakeEmptyIncrement(const QString &name)
void ParseNodeSpline(const QDomElement &domElement, const Document &parse)
void ParsePieceGrainline(const QDomElement &domElement, VPiece &piece) const
void SetIncrementFormula(const QString &name, const QString &text)
void ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
void ParseToolArc(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
void ParseToolShoulderPoint(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
virtual QString GenerateLabel(const LabelType &type, const QString &reservedName=QString()) const Q_DECL_OVERRIDE
GenerateLabel create name for draft block basepoint.
void ParseToolMirrorByLine(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
void SetReadOnly(bool rOnly)
void ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse, const QString &type)
ParsePointElement parse point tag.
void MoveUpIncrement(const QString &name)
void ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse, const QString &type)
ParseToolsElement parse tools tag.
void ParseToolEllipticalArc(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
void ParseToolRotation(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
VNodeDetail parsePieceNode(const QDomElement &domElement) const
void setIncrementName(const QString &name, const QString &text)
void SplinesCommonAttributes(const QDomElement &domElement, quint32 &id, quint32 &idObject, quint32 &idTool)
void ParseToolBasePoint(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
void removeCustomVariable(const QString &name)
void ParseToolCutSpline(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
virtual void setXMLContent(const QString &fileName) Q_DECL_OVERRIDE
virtual void UpdateToolData(const quint32 &id, VContainer *data) Q_DECL_OVERRIDE
UpdateToolData update tool in list tools.
void parseIntersectXYTool(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
void ParseToolCutArc(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
virtual bool SaveDocument(const QString &fileName, QString &error) Q_DECL_OVERRIDE
void ParseToolCubicBezierPath(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
virtual void IncrementReferens(quint32 id) const Q_DECL_OVERRIDE
IncrementReferens increment reference parent objects.
void ParseToolNormal(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
void ParseEllipticalArcElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse, const QString &type)
ParseEllipticalArcElement parse elliptical arc tag.
void ParseSplineElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse, const QString &type)
ParseSplineElement parse spline tag.
void parseDraftBlockElement(const QDomNode &node, const Document &parse)
parseDraftBlockElement parse draw tag.
virtual void LiteParseTree(const Document &parse) Q_DECL_OVERRIDE
LiteParseTree lite parse file.
void ParseToolSpline(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
void ParseToolMove(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
void ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
ParseLineElement parse line tag.
void ParseToolTriangle(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
void SetDefCustom(bool value)
void SetDefCustomHeight(int value)
void addEmptyCustomVariableAfter(const QString &after, const QString &name)
void ParseOldToolSpline(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
void Parse(const Document &parse)
Parse parse file.
void setCurrentData()
setCurrentData set current data set.
qreal EvalFormula(VContainer *data, const QString &formula, bool *ok) const
void ParseDrawMode(const QDomNode &node, const Document &parse, const Draw &mode)
ParseDrawMode parse draw tag with draw mode.
void ParseToolPointOfIntersectionArcs(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
void parsePieceNodes(const QDomElement &domElement, VPiece &piece, qreal width, bool closed) const
void ParseToolMirrorByAxis(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
The VPieceLabelData class holds some information about a single piece like letter,...
void SetAnnotation(const QString &val)
void SetOnFold(bool onFold)
void SetLabelTemplate(const QVector< VLabelTemplateLine > &lines)
void SetTilt(const QString &val)
void SetRotationWay(const QString &val)
void SetFoldPosition(const QString &val)
void SetQuantity(int val)
void SetOrientation(const QString &val)
void SetLetter(const QString &qsLetter)
void SetType(PiecePathType type)
void SetCutPath(bool cut)
void SetNodes(const QVector< VPieceNode > &nodes)
void SetPenType(const Qt::PenStyle &type)
void SetName(const QString &name)
void setIsLocked(bool isLocked)
VPieceLabelData & GetPatternPieceData()
Returns full access to the pattern piece data object.
void SetPath(const VPiecePath &path)
void SetInLayout(bool inLayout)
void setAnchors(const QVector< quint32 > &anchors)
void SetCustomSARecords(const QVector< CustomSARecord > &records)
void SetInternalPaths(const QVector< quint32 > &iPaths)
void SetUnited(bool united)
VGrainlineData & GetGrainlineGeometry()
VDetail::GetGrainlineGeometry full access to the grainline geometry object.
VPatternLabelData & GetPatternInfo()
Returns full access to the pattern info geometry object.
VPiecePath GetPath() const
The VPointF class keep data of point.
void setShowPointName(bool show)
The VSplinePath class keep information about splinePath.
VSpline class that implements the spline.
static void BiasTokens(int position, int bias, QMap< int, QString > &tokens)
BiasTokens change position for each token that have position more then "position".
Error class of the parser.
const QEvent::Type LITE_PARSE_EVENT
const QEvent::Type UNDO_EVENT
QString UnitsToStr(const Unit &unit, const bool translate)
UnitsToStr translate unit to string.
@ PointOfIntersectionCurves
@ PointOfIntersectionCircles
@ PointFromCircleAndTangent
@ PointOfIntersectionArcs
const QString AttrBasePoint
const QString AttrC1Radius
const QString AttrDuplicate
const QString AttrPShoulder
const QString AttrLineType
const QString AttrBaseLineP1
const QString AttrSecondPoint
const QString AttrC2Radius
const QString LineTypeSolidLine
const QString AttrFirstPoint
const QString AttrLineWeight
const QString AttrP1Line1
const QString AttrPSpline
const QString AttrShowPointName2
const QString AttrPenStyle
const QString AttrSecondArc
const QString AttrShowPointName1
const QString AttrFirstArc
const QString AttrRadius2
const QString AttrShowPointName
const QString AttrAxisType
const QString AttrC1Center
const QString AttrCrossPoint
const QString AttrTangent
const QString AttrLength2
const QString currentSeamAllowance
const QString AttrPieceLocked
const QString AttrRotationAngle
const QString AttrBaseLineP2
const QString AttrRadius1
const QString AttrHCrossPoint
const QString AttrLength1
const QString AttrInLayout
const QString AttrC2Center
const QString AttrThirdPoint
const QString currentLength
const QString AttrVCrossPoint
const QString AttrCRadius
const QString AttrLineColor
const QString AttrPathPoint
const QString AttrP2Line2
const QString AttrP1Line2
const QString AttrIdObject
const QString AttrP2Line1
const QString AttrCCenter
Qt::PenStyle lineTypeToPenStyle(const QString &lineType)
LineStyle return pen style for current line style.
const QString APP_VERSION_STR
#define CONVERTER_VERSION_CHECK(major, minor, patch)
static const auto V_EX_NOINPUT