56 #include <QDomNodeList>
57 #include <QLatin1String>
59 #include <QMessageBox>
60 #include <QMessageLogger>
62 #include <QStaticStringData>
63 #include <QStringData>
64 #include <QStringDataPtr>
70 #include "../exception/vexceptionemptyparameter.h"
71 #include "../exception/vexceptionobjecterror.h"
72 #include "../exception/vexceptionconversionerror.h"
73 #include "../ifc/exception/vexceptionbadid.h"
74 #include "../ifc/ifcdef.h"
75 #include "../vmisc/vabstractapplication.h"
76 #include "../vmisc/vcommonsettings.h"
77 #include "../vpatterndb/vcontainer.h"
78 #include "../vpatterndb/vpiecenode.h"
79 #include "../qmuparser/qmutokenparser.h"
80 #include "../vtools/tools/vdatatool.h"
252 expressions.append(formula);
260 , activeDraftBlock(QString())
261 , m_DefaultLineColor(
qApp->Settings()->getDefaultLineColor())
262 , m_DefaultLineWeight(
qApp->Settings()->getDefaultLineWeight())
263 , m_DefaultLineType(
qApp->Settings()->getDefaultLineType())
264 , lastSavedExportFormat(QString())
268 , patternPieces(QStringList())
275 QSet<QString> measurements;
276 QSet<QString> others;
279 for (
int i=0; i < increments.size(); ++i)
281 others.insert(increments.at(i));
285 for (
int i=0; i < expressions.size(); ++i)
288 QScopedPointer<qmu::QmuTokenParser> cal(
new qmu::QmuTokenParser(expressions.at(i).expression,
false,
false));
293 for (
int j = 0; j < tValues.size(); ++j)
295 if (tValues.at(j) == QChar(
'-'))
300 if (measurements.contains(tValues.at(j)))
305 if (others.contains(tValues.at(j)))
312 others.insert(tValues.at(j));
316 measurements.insert(tValues.at(j));
321 return QStringList(measurements.values());
332 Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO,
"name draft block is empty");
363 const QDomNodeList elements = this->documentElement().elementsByTagName(
TagDraftBlock);
364 if (elements.size() == 0)
368 for ( qint32 i = 0; i < elements.count(); i++ )
370 element = elements.at( i ).toElement();
371 if (element.isNull() ==
false)
373 const QString fieldName = element.attribute(
AttrName );
380 element = QDomElement();
393 Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO,
"draft block name is empty");
394 const QDomNodeList elements = this->documentElement().elementsByTagName(
TagDraftBlock);
395 if (elements.size() == 0)
399 for ( qint32 i = 0; i < elements.count(); i++ )
401 const QDomElement elem = elements.at( i ).toElement();
402 if (elem.isNull() ==
false)
422 Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO,
"draft block name is empty");
423 QDomElement draftBlockElement;
426 const QDomNodeList listElement = draftBlockElement.elementsByTagName(name);
427 if (listElement.size() != 1)
431 element = listElement.at( 0 ).toElement();
432 if (element.isNull() ==
false)
447 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
452 QDomNode domNode = domElement.firstChild();
453 while (domNode.isNull() ==
false)
455 if (domNode.isElement())
457 const QDomElement domElement = domNode.toElement();
458 if (domElement.isNull() ==
false)
460 if (domElement.tagName() ==
TagGroup)
464 const QPair<bool, QMap<quint32, quint32> > groupData =
parseItemElement(domElement);
466 auto i = group.constBegin();
467 while (i != group.constEnd())
469 if (not itemTool.contains(i.key()))
471 itemTool.insert(i.key(), i.value());
474 const bool previous = itemVisibility.value(i.key(),
false);
475 itemVisibility.insert(i.key(), previous || groupData.first);
481 domNode = domNode.nextSibling();
484 auto i = itemTool.constBegin();
485 while (i != itemTool.constEnd())
487 if (
tools.contains(i.value()))
499 const QDomElement rootElement = this->documentElement();
500 if (rootElement.isNull())
511 if (name.isEmpty() ==
false)
513 const QDomNodeList elements = this->documentElement().elementsByTagName(
TagDraftBlock);
514 if (elements.size() == 0)
516 return QDomElement();
518 for ( qint32 i = 0; i < elements.count(); i++ )
520 QDomElement element = elements.at( i ).toElement();
521 if (element.isNull() ==
false)
523 if ( element.attribute(
AttrName ) == name )
530 return QDomElement();
542 Q_ASSERT_X(not newName.isEmpty(), Q_FUNC_INFO,
"new name draft block is empty");
543 Q_ASSERT_X(not oldName.isEmpty(), Q_FUNC_INFO,
"old name draft block is empty");
547 qDebug()<<
"Do not exist draft block with name"<<oldName;
553 qDebug()<<
"Already exist draft block with name"<<newName;
558 if (ppElement.isElement())
564 ppElement.setAttribute(
AttrName, newName);
571 qDebug()<<
"Can't find draft block node with name"<<oldName<<Q_FUNC_INFO;
587 Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO,
"name draft block is empty");
652 return tools.value(
id);
663 Q_ASSERT_X(
id != 0, Q_FUNC_INFO,
"id == 0");
665 tools.insert(
id, tool);
678 const QDomNodeList nodeList = domElement.childNodes();
679 for (qint32 i = 0; i < nodeList.size(); ++i)
681 const QDomElement element = nodeList.
at(i).toElement();
682 if (not element.isNull())
694 const QDomNodeList nodeList = domElement.childNodes();
695 for (qint32 i = 0; i < nodeList.size(); ++i)
697 const QDomElement element = nodeList.at(i).toElement();
698 if (not element.isNull())
708 records.append(record);
718 const QDomNodeList nodeList = domElement.childNodes();
719 for (qint32 i = 0; i < nodeList.size(); ++i)
721 const QDomElement element = nodeList.at(i).toElement();
722 if (not element.isNull())
727 records.append(path);
738 const QDomNodeList nodeList = domElement.childNodes();
739 for (qint32 i = 0; i < nodeList.size(); ++i)
741 const QDomElement element = nodeList.at(i).toElement();
742 if (not element.isNull())
744 const quint32 path = element.text().toUInt();
747 records.append(path);
777 QString::number(
qApp->Settings()->getDefaultNotchLength()));
779 QString::number(
qApp->Settings()->getDefaultNotchWidth()));
793 switch (types.indexOf(t))
811 VException e(QObject::tr(
"Wrong tag name '%1'.").arg(t));
852 for (qint32 i = 0; i<
history.size(); ++i)
859 draftBlockHistory.append(tool);
861 return draftBlockHistory;
868 for (qint32 i = 0; i<
history.size(); ++i)
877 return draftBlockHistory;
896 qDebug()<<
"Can't save path to measurements"<<Q_FUNC_INFO;
906 for (qint32 i = 0; i <
history.size(); ++i)
909 if (nodeId == tool.
getId())
917 for (qint32 j = i; j > 0; --j)
931 siblingId = tool.
getId();
982 if (tags.size() == 0)
988 QDomNode domNode = tags.at(0).firstChild();
989 while (domNode.isNull() ==
false)
991 if (domNode.isElement())
993 const QDomElement domElement = domNode.toElement();
994 if (domElement.isNull() ==
false)
996 const QString defValue =
trueStr;
997 switch (gTags.indexOf(domElement.tagName()))
1042 domNode = domNode.nextSibling();
1054 qDebug()<<
"Can't save tag "<<
TagGradation<<Q_FUNC_INFO;
1059 QDomNode domNode = tags.at(0).firstChild();
1060 while (domNode.isNull() ==
false)
1062 if (domNode.isElement())
1064 QDomElement domElement = domNode.toElement();
1065 if (domElement.isNull() ==
false)
1067 switch (gTags.indexOf(domElement.tagName()))
1073 domElement.removeAttribute(
AttrH50);
1074 domElement.removeAttribute(
AttrH56);
1075 domElement.removeAttribute(
AttrH62);
1076 domElement.removeAttribute(
AttrH68);
1077 domElement.removeAttribute(
AttrH74);
1078 domElement.removeAttribute(
AttrH80);
1079 domElement.removeAttribute(
AttrH86);
1080 domElement.removeAttribute(
AttrH92);
1081 domElement.removeAttribute(
AttrH98);
1082 domElement.removeAttribute(
AttrH104);
1083 domElement.removeAttribute(
AttrH110);
1084 domElement.removeAttribute(
AttrH116);
1085 domElement.removeAttribute(
AttrH122);
1086 domElement.removeAttribute(
AttrH128);
1087 domElement.removeAttribute(
AttrH134);
1088 domElement.removeAttribute(
AttrH140);
1089 domElement.removeAttribute(
AttrH146);
1090 domElement.removeAttribute(
AttrH152);
1091 domElement.removeAttribute(
AttrH158);
1092 domElement.removeAttribute(
AttrH164);
1093 domElement.removeAttribute(
AttrH170);
1094 domElement.removeAttribute(
AttrH176);
1095 domElement.removeAttribute(
AttrH182);
1096 domElement.removeAttribute(
AttrH188);
1097 domElement.removeAttribute(
AttrH194);
1098 domElement.removeAttribute(
AttrH200);
1139 domNode = domNode.nextSibling();
1176 if (tags.size() == 0)
1182 QDomNode domNode = tags.at(0).firstChild();
1183 while (domNode.isNull() ==
false)
1185 if (domNode.isElement())
1187 const QDomElement domElement = domNode.toElement();
1188 if (domElement.isNull() ==
false)
1190 const QString defValue =
trueStr;
1191 switch (gTags.indexOf(domElement.tagName()))
1236 domNode = domNode.nextSibling();
1248 qDebug()<<
"Can't save tag "<<
TagGradation<<Q_FUNC_INFO;
1253 QDomNode domNode = tags.at(0).firstChild();
1254 while (domNode.isNull() ==
false)
1256 if (domNode.isElement())
1258 QDomElement domElement = domNode.toElement();
1259 if (domElement.isNull() ==
false)
1261 switch (gTags.indexOf(domElement.tagName()))
1267 domElement.removeAttribute(
AttrS22);
1268 domElement.removeAttribute(
AttrS24);
1269 domElement.removeAttribute(
AttrS26);
1270 domElement.removeAttribute(
AttrS28);
1271 domElement.removeAttribute(
AttrS30);
1272 domElement.removeAttribute(
AttrS32);
1273 domElement.removeAttribute(
AttrS34);
1274 domElement.removeAttribute(
AttrS36);
1275 domElement.removeAttribute(
AttrS38);
1276 domElement.removeAttribute(
AttrS40);
1277 domElement.removeAttribute(
AttrS42);
1278 domElement.removeAttribute(
AttrS44);
1279 domElement.removeAttribute(
AttrS46);
1280 domElement.removeAttribute(
AttrS48);
1281 domElement.removeAttribute(
AttrS50);
1282 domElement.removeAttribute(
AttrS52);
1283 domElement.removeAttribute(
AttrS54);
1284 domElement.removeAttribute(
AttrS56);
1285 domElement.removeAttribute(
AttrS58);
1286 domElement.removeAttribute(
AttrS60);
1287 domElement.removeAttribute(
AttrS62);
1288 domElement.removeAttribute(
AttrS64);
1289 domElement.removeAttribute(
AttrS66);
1290 domElement.removeAttribute(
AttrS68);
1291 domElement.removeAttribute(
AttrS70);
1292 domElement.removeAttribute(
AttrS72);
1333 domNode = domNode.nextSibling();
1434 QString globalLabelDateFormat =
qApp->Settings()->GetLabelDateFormat();
1439 return globalLabelDateFormat;
1442 QDomElement tag = list.at(0).toElement();
1459 QString globalLabelTimeFormat =
qApp->Settings()->GetLabelTimeFormat();
1464 return globalLabelTimeFormat;
1467 QDomElement tag = list.at(0).toElement();
1531 const QString defExt = QStringLiteral(
"PNG");
1532 const QDomNodeList nodeList = this->elementsByTagName(
TagImage);
1533 if (nodeList.isEmpty())
1539 const QDomNode domNode = nodeList.at(0);
1540 if (domNode.isNull() ==
false && domNode.isElement())
1542 const QDomElement domElement = domNode.toElement();
1543 if (domElement.isNull() ==
false)
1545 const QString ext = domElement.attribute(
AttrExtension, defExt);
1566 QDomElement pattern = documentElement();
1596 const QDomElement domElement =
elementById(toolId);
1597 const QDomNodeList nodeList = domElement.childNodes();
1598 for (qint32 i = 0; i < nodeList.size(); ++i)
1600 const QDomElement dataElement = nodeList.at(i).toElement();
1601 if (!dataElement.isNull() && dataElement.tagName() == itemType)
1603 const QDomNodeList srcList = dataElement.childNodes();
1604 for (qint32 j = 0; j < srcList.size(); ++j)
1606 const QDomElement element = srcList.at(j).toElement();
1607 if (!element.isNull())
1610 items.append(objId);
1624 const QDomElement domElement =
elementById(toolId);
1627 items.append(objId);
1630 items.append(objId);
1671 if (
tools.contains(
id) ==
false)
1681 const QDomNodeList nodeList = domElement.childNodes();
1682 for (qint32 i = 0; i < nodeList.size(); ++i)
1684 const QDomElement element = nodeList.
at(i).toElement();
1700 Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO,
"name draft block is empty");
1708 const QDomNodeList list = elementsByTagName(tag);
1709 QDomElement element;
1715 switch (tags.indexOf(tag))
1730 QDomElement heights = createElement(
TagHeights);
1731 heights.setAttribute(
AttrAll, QLatin1String(
"true"));
1732 element.appendChild(heights);
1734 QDomElement sizes = createElement(
TagSizes);
1735 sizes.setAttribute(
AttrAll, QLatin1String(
"true"));
1736 element.appendChild(sizes);
1756 return QDomElement();
1761 return list.at(0).toElement();
1767 QDomElement pattern = documentElement();
1768 for (
int i = tags.indexOf(element.tagName())-1; i >= 0; --i)
1770 const QDomNodeList list = elementsByTagName(tags.at(i));
1771 if (not list.isEmpty())
1773 pattern.insertAfter(element, list.at(0));
1783 const QDomNodeList blockList = elementsByTagName(
TagDraftBlock);
1786 if (not blockList.isEmpty())
1788 for (
int i = 0; i < blockList.size(); ++i)
1790 QDomElement node = blockList.at(i).toElement();
1805 QStringList increments;
1806 const QDomNodeList list = elementsByTagName(
TagIncrement);
1807 for (
int i=0; i < list.size(); ++i)
1809 const QDomElement dom = list.at(i).toElement();
1853 const QDomNodeList list = elementsByTagName(
TagPoint);
1854 for (
int i=0; i < list.size(); ++i)
1856 const QDomElement dom = list.at(i).toElement();
1879 const QDomNodeList list = elementsByTagName(
TagArc);
1880 for (
int i=0; i < list.size(); ++i)
1882 const QDomElement dom = list.at(i).toElement();
1903 const QDomNodeList list = elementsByTagName(
TagElArc);
1904 for (
int i=0; i < list.size(); ++i)
1906 const QDomElement dom = list.at(i).toElement();
1937 for (
int i=0; i < list.size(); ++i)
1939 const QDomElement dom = list.at(i).toElement();
1954 const QDomNodeList list = elementsByTagName(
TagIncrement);
1955 for (
int i=0; i < list.size(); ++i)
1957 const QDomElement dom = list.at(i).toElement();
1974 const QDomNodeList list = elementsByTagName(
TagOperation);
1975 for (
int i=0; i < list.size(); ++i)
1977 const QDomElement dom = list.at(i).toElement();
1997 const QDomNodeList nodeList = nodes.childNodes();
1998 for (qint32 i = 0; i < nodeList.size(); ++i)
2000 const QDomElement element = nodeList.at(i).toElement();
2019 const QDomNodeList list = elementsByTagName(
TagPath);
2020 for (
int i=0; i < list.size(); ++i)
2022 const QDomElement dom = list.at(i).toElement();
2038 if (not element.isNull())
2057 const QDomNodeList list = elementsByTagName(
TagPiece);
2058 for (
int i=0; i < list.size(); ++i)
2060 const QDomElement dom = list.at(i).toElement();
2128 Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO,
"domElement is null");
2136 const QDomNodeList nodeList = domElement.childNodes();
2137 const qint32 num = nodeList.size();
2138 for (qint32 i = 0; i < num; ++i)
2140 const QDomElement element = nodeList.at(i).toElement();
2141 if (not element.isNull() && element.tagName() ==
TagGroupItem)
2145 items.insert(
object, tool);
2149 QPair<bool, QMap<quint32, quint32> > group;
2150 group.first = visible;
2151 group.second = items;
2182 QDomElement draftBlock;
2185 QDomElement groups = draftBlock.firstChildElement(
TagGroups);
2187 if (groups.isNull())
2190 draftBlock.appendChild(groups);
2195 return QDomElement();
2204 return QDomElement();
2208 QDomElement group = createElement(
TagGroup);
2218 if (!groupData.isEmpty())
2220 auto i = groupData.constBegin();
2221 while (i != groupData.constEnd())
2225 item.setAttribute(
AttrTool, i.value());
2226 group.appendChild(item);
2243 return QDomElement();
2250 if (!groupData.isEmpty())
2252 auto i = groupData.constBegin();
2253 while (i != groupData.constEnd())
2257 item.setAttribute(
AttrTool, i.value());
2258 group.appendChild(item);
2273 QString name = tr(
"New group");
2275 if (not groups.isNull())
2278 if (group.isElement())
2285 if (groups.childNodes().isEmpty())
2287 QDomNode parent = groups.parentNode();
2288 parent.removeChild(groups);
2291 qDebug(
"Can't get group by id = %u.",
id);
2297 qDebug(
"Can't get tag Groups.");
2306 if (not groups.isNull())
2309 if (group.isElement())
2311 group.setAttribute(
AttrName, name);
2317 if (groups.childNodes().isEmpty())
2319 QDomNode parent = groups.parentNode();
2320 parent.removeChild(groups);
2323 qDebug(
"Can't get group by id = %u.",
id);
2328 qDebug(
"Can't get tag Groups.");
2341 if (not groups.isNull())
2343 QDomNode domNode = groups.firstChild();
2344 while (domNode.isNull() ==
false)
2346 if (domNode.isElement())
2348 const QDomElement group = domNode.toElement();
2349 if (group.isNull() ==
false)
2361 groupData.
name = name;
2363 groupData.
locked = locked;
2364 groupData.
color = color;
2367 data.insert(
id, groupData);
2371 domNode = domNode.nextSibling();
2378 qDebug(
"Can't get tag Groups.");
2399 QStringList groupList;
2403 if (not groups.isNull())
2405 QDomNode domNode = groups.firstChild();
2406 if (domNode.isNull() ==
false)
2408 while (domNode.isNull() ==
false)
2410 if (domNode.isElement())
2412 const QDomElement group = domNode.toElement();
2413 if (group.isNull() ==
false)
2422 domNode = domNode.nextSibling();
2429 qDebug(
"Can't get tag Groups.");
2451 if (not groups.isNull())
2453 QDomNode domNode = groups.firstChild();
2454 if (domNode.isNull() ==
false)
2456 while (domNode.isNull() ==
false)
2458 if (domNode.isElement())
2460 const QDomElement group = domNode.toElement();
2461 if (group.isNull() ==
false)
2466 if (groupName == name)
2473 domNode = domNode.nextSibling();
2480 qDebug(
"Can't get tag Groups.");
2495 if (not groups.isNull())
2497 QDomNode domNode = groups.firstChild();
2498 if (domNode.isNull() ==
false)
2500 while (domNode.isNull() ==
false)
2502 if (domNode.isElement())
2504 const QDomElement group = domNode.toElement();
2505 if (group.isNull() ==
false)
2510 if (groupName == name)
2518 domNode = domNode.nextSibling();
2523 qDebug(
"Can't get tag Groups.");
2547 if (not groups.isNull())
2549 QDomNode domNode = groups.firstChild();
2550 while (domNode.isNull() ==
false)
2552 if (domNode.isElement())
2554 const QDomElement group = domNode.toElement();
2555 if (group.isNull() ==
false)
2559 bool groupHasItem =
hasGroupItem(group, toolId, objectId);
2560 if((containsItem && groupHasItem) || (not containsItem && not groupHasItem))
2564 data.insert(groupId, name);
2569 domNode = domNode.nextSibling();
2574 qDebug(
"Can't get tag Groups.");
2589 bool result =
false;
2591 QDomNode itemNode = groupDomElement.firstChild();
2592 while (itemNode.isNull() ==
false)
2594 if (itemNode.isElement())
2596 const QDomElement item = itemNode.toElement();
2597 if (item.isNull() ==
false)
2602 if(toolIdIterate == toolId && objectIdIterate == objectId)
2609 itemNode = itemNode.nextSibling();
2621 QStringList list = QStringList(groupsContainingItem.values());
2622 QString listGroupName = list.value(0);
2623 quint32 groupId = groupsContainingItem.key(listGroupName);
2649 QStringList list = QStringList(groupsContainingItem.values());
2650 QString listGroupName = list.value(0);
2651 groupId = groupsContainingItem.key(listGroupName);
2657 list = QStringList(groupsNotContainingItem.values());
2659 for(
int i=0; i<list.count(); ++i)
2661 const QString listGroupName = list.value(i);
2662 if (groupName == listGroupName)
2664 const quint32 groupId = groupsNotContainingItem.key(list[i]);
2665 QDomElement group =
addGroupItem(toolId, objectId, groupId);
2670 if (not groups.isNull())
2693 return QDomElement();
2698 if (!group.isNull())
2706 item.setAttribute(
AttrTool, toolId);
2708 group.appendChild(item);
2716 if (not groups.isNull())
2725 qDebug() <<
"The group of id " << groupId <<
" doesn't exist";
2728 return QDomElement();
2745 return QDomElement();
2748 if (!group.isNull())
2755 QDomNode itemNode = group.firstChild();
2756 while (itemNode.isNull() ==
false)
2758 if (itemNode.isElement())
2760 const QDomElement item = itemNode.toElement();
2761 if (item.isNull() ==
false)
2766 if(toolIdIterate == toolId && objectIdIterate == objectId)
2768 group.removeChild(itemNode);
2779 if (not groups.isNull())
2788 itemNode = itemNode.nextSibling();
2793 qDebug() <<
"The group of id " << groupId <<
" doesn't exist";
2796 return QDomElement();
2809 if (group.isNull() ==
false)
2811 return not group.hasChildNodes();
2815 qDebug() <<
"The group of id " <<
id <<
" doesn't exist";
2824 if (group.isElement())
2830 qDebug(
"Can't get group by id = %u.",
id);
2839 if (group.isElement())
2846 if (not groups.isNull())
2853 qDebug(
"Can't get group by id = %u.",
id);
2868 if (group.isElement())
2874 qDebug(
"Can't get group by id = %u.",
id);
2883 if (group.isElement())
2891 if (not groups.isNull())
2898 qDebug(
"Can't get group by id = %u.",
id);
2913 if (group.isElement())
2921 qDebug(
"Can't get group by id = %u.",
id);
2930 if (group.isElement())
2938 qDebug(
"Can't get group by id = %u.",
id);
2953 if (group.isElement())
2961 qDebug(
"Can't get group by id = %u.",
id);
2970 if (group.isElement())
2978 qDebug(
"Can't get group by id = %u.",
id);
2993 if (group.isElement())
3001 qDebug(
"Can't get group by id = %u.",
id);
3010 if (group.isElement())
3018 qDebug(
"Can't get group by id = %u.",
id);
3030 bool exists = groupList.contains(groupName, Qt::CaseInsensitive);
3037 QStringList list = QStringList(groupsContainingItem.values());
3038 QString groupName = list.value(0);
3043 quint32 objectId = toolId;
3061 QStringList list = QStringList(groupsContainingItem.values());
3062 QString groupName = list.value(0);
3067 quint32 objectId = toolId;
3074 return groupLineType;
3085 QStringList list = QStringList(groupsContainingItem.values());
3086 QString groupName = list.value(0);
3088 quint32 objectId = toolId;
3093 return groupLineWeight;
static const QString AttrTimeFormat
qreal m_DefaultLineWeight
void setGroupLock(quint32 id, bool locked)
void SetPatternNumber(const QString &qsNum)
void updatePieceList(quint32 id)
static const QString AttrS28
static const QString TagNode
void SetGradationHeights(const QMap< GHeights, bool > &options)
static const QString AttrLetter
static const QString AttrObject
bool getGroupLock(quint32 id)
static const QString AttrEnd
static const QString AttrS66
bool IsFunction(const QString &token) const
void SetImage(const QString &text, const QString &extension)
static const QString TagData
void setGroupColor(quint32 id, QString color)
QMap< quint32, GroupAttributes > getGroups()
bool GetPatternWasChanged() const
QVector< VFormulaField > ListArcExpressions() const
static const QString TagSpline
void setGroupLineWeight(quint32 id, QString weight)
void deleteToolFromGroup(quint32 toolId)
Deletes an item from the group containing the toolId.
void AddToolOnRemove(VDataTool *tool)
VAbstractPattern(QObject *parent=nullptr)
static QVector< VLabelTemplateLine > patternLabelLines
patternLabelLines list to speed up reading a template by many pieces.
QString GetCompanyName() const
static const QString AttrS70
static const QString AttrS60
static const QString AttrS50
void draftBlockNameChanged(const QString &oldName, const QString &newName)
draftBlockNameChanged save new name draft block.
static const QString AttrS36
QVector< VLabelTemplateLine > getPatternLabelTemplate() const
static const QString AttrAnnotation
QDomElement createGroups()
static const QString AttrS56
static const QString AttrType
void UpdateInLayoutList(quint32 id)
static const QString AttrH50
static const QString AttrH182
static const QString AttrS54
static const QString AttrGroupColor
QDomElement removeGroupItem(quint32 toolId, quint32 objectId, quint32 groupId)
Removes the item of given toolId and objectId from the group of given groupId.
static const QString AttrH158
bool IsPostfixOperator(const QString &token) const
QDomElement getGroupByName(const QString &name)
QStringList groupListByName()
static const QString AttrTilt
QPair< bool, QMap< quint32, quint32 > > parseItemElement(const QDomElement &domElement)
static const QString TagPieces
bool isGroupEmpty(quint32 id)
Returns true if the given group is empty.
void ChangedCursor(quint32 id)
ChangedCursor change cursor position.
static QVector< quint32 > ParsePieceAnchors(const QDomElement &domElement)
static const QString NodeArc
static const QString AttrRotation
QString GetLabelDateFormat() const
QVector< quint32 > getDartItems(const quint32 &toolId)
static const QString AttrNodeNotchType
static const QString TagDescription
static const QString AttrS34
void SetModified(bool modified)
bool renameDraftBlock(const QString &oldName, const QString &newName)
renameDraftBlock change draft block name.
static const QString AttrS52
static const QString AttrFoldPosition
static const QString AttrStart
int draftBlockCount() const
static const QString NodePoint
static const QString AttrCustom
static const QString AttrExtension
QString useGroupColor(quint32 toolId, QString color)
static const QString AttrS26
static const QString TagMeasurements
static const QString IncrementDescription
static const QString AttrS62
static const QString AttrAll
QString GetPatternName() const
QString GetPatternNumber() const
static const QString AttrH134
QString m_DefaultLineType
QStringList getPatternPieces() const
static const QString AttrH68
static const QString TagModeling
quint32 SiblingNodeId(const quint32 &nodeId) const
static const QString TagArc
void SetPatternWasChanged(bool changed)
static const QString TagPatternName
QString m_DefaultLineColor
QString activeDraftBlock
activeBlockName name current pattern peace.
bool draftBlockNameExists(const QString &name) const
draftBlockNameExists check if draft block with this name exists.
QString GetImageExtension() const
quint32 getGroupIdByName(const QString &name)
void setActiveDraftBlock(const QString &name)
setActiveDraftBlock set current draft block.
static const QString AttrH128
static const QString AttrDefSize
static const QString TagPattern
QVector< quint32 > getOpItems(const quint32 &toolId, const QString &itemType)
getOpItems get vector of operation tool obects.
static const QString AttrOnFold
static const QString AttrH140
void SetPatternName(const QString &qsName)
void haveLiteChange()
haveLiteChange we have unsaved change.
void addToolToGroup(quint32 toolId, quint32 objectId, const QString &groupName)
Adds an item to the given group with the given toolId and objectId.
QDomElement getDraftBlockElement(const QString &name)
static const QString AttrS58
static void AddTool(quint32 id, VDataTool *tool)
AddTool add tool to list tools.
bool appendDraftBlock(const QString &name)
appendDraftBlock add new draft block.
QDomElement addGroupItem(quint32 toolId, quint32 objectId, quint32 groupId)
Adds an item to the given group with the given toolId and objectId.
void setPatternLabelTemplate(const QVector< VLabelTemplateLine > &lines)
static const QString AttrWidth
static const QString TagNotes
static const QString AttrH92
void activeDraftBlockChanged(const QString &newName)
activeDraftBlockChanged change active draft block.
static const QString TagTools
QString getGroupName(quint32 id)
static const QString AttrH80
void patternChanged(bool saved)
patternChanged emit if we have unsaved change.
static const QString TagGroupItem
static const QString AttrH86
void SetCustomerName(const QString &qsName)
static const QString AttrS40
QString GetVersion() const
static const QString TagGroup
static const QString AttrNodeNotchSubType
QDomElement addGroupItems(const QString &name, const QMap< quint32, quint32 > &groupData)
static const QString AttrH74
QString GetDescription() const
static const QString NodeSplinePath
static const QString AttrPath
static const QString TagCustomerName
static const QString AttrGroupLocked
static const QString AttrH194
static const QString TagPatternInfo
static const QString AttrS32
QDomElement createGroup(quint32 id, const QString &name, const QString &color, const QString &type, const QString &weight, const QMap< quint32, quint32 > &groupData)
static const QString TagHeights
static const QString AttrH56
QVector< VToolRecord > history
history history records.
static const QString TagElArc
static const QString AttrH110
QVector< VFormulaField > ListOperationExpressions() const
static const QString NodeSpline
static const QString AttrH146
bool getGroupVisibility(quint32 id)
static const QString AttrNodeShowSecondNotch
static const QString AttrQuantity
QVector< VFormulaField > ListGrainlineExpressions(const QDomElement &element) const
static const QString AttrS44
QVector< VFormulaField > ListPathPointExpressions() const
static const QString AttrRotationWay
void parseGroups(const QDomElement &domElement)
static QHash< quint32, VDataTool * > tools
tools list with pointer on tools.
QString getGroupLineWeight(quint32 id)
static const QString AttrH164
QMap< GHeights, bool > GetGradationHeights() const
static const QString AttrOrientation
static const QString AttrSAAfter
QVector< VFormulaField > ListElArcExpressions() const
static const QString TagPatternLabel
void selectedPiece(quint32 id)
static const QString AttrTool
static const QString AttrH188
static VPiecePath ParsePathNodes(const QDomElement &domElement)
QVector< VToolRecord > getBlockHistory() const
static const QString AttrS46
static const QString TagLine
void setGroupName(quint32 id, const QString &name)
static VDataTool * getTool(quint32 id)
getTool return tool from tool list.
static const QString TagIncrement
static const QString AttrNodeNotchLength
static const QString TagGroups
bool getActiveDraftElement(QDomElement &element) const
getActiveDraftElement return draftBlock element for current draft block.
static const QString TagPatternNum
static void RemoveTool(quint32 id)
quint32 cursor
cursor cursor keep id tool after which we will add new tool in file.
void setDefaultPen(Pen pen)
static const QString AttrNodeNotchCount
static const QString AttrSABefore
static const QString AttrH98
static VPieceNode ParseSANode(const QDomElement &domElement)
static const QString AttrArrows
static const QString AttrS22
static const QString AttrS38
static const QString AttrH62
QStringList ListMeasurements() const
static const QString TagDraftBlock
static QVector< CustomSARecord > ParsePieceCSARecords(const QDomElement &domElement)
QString GetCustomerName() const
QStringList ListIncrements() const
void setGroupLineType(quint32 id, QString type)
QMap< GSizes, bool > GetGradationSizes() const
QString getGroupLineType(quint32 id)
static VPiecePath ParsePieceNodes(const QDomElement &domElement)
bool IsVariable(const QString &token) const
static const QString IncrementName
static const QString NodeElArc
void InsertTag(const QStringList &tags, const QDomElement &element)
static const QString AttrS30
QString useGroupLineWeight(quint32 toolId, QString weight)
QMap< quint32, Tool > getGroupObjHistory() const
static const QString TagOperation
static const QString AttrS64
static const QString AttrIncludeAs
void showPiece(quint32 id)
void setCursor(const quint32 &value)
static const QString AttrH104
QString getDefaultLineType() const
static const QString AttrH200
void SetNotes(const QString &text)
static const QString IncrementFormula
static const QString AttrH176
bool getActiveNodeElement(const QString &name, QDomElement &element) const
getActiveNodeElement find element in current draft block by name.
void SetCompanyName(const QString &qsName)
QString useGroupLineType(quint32 toolId, QString type)
void SetLabelDateFormat(const QString &format)
static const QString AttrH152
static const QString AttrNodeReverse
QString getActiveDraftBlockName() const
getActiveDraftBlockName return current draft block name.
static const QString AttrS48
QMap< quint32, QString > getGroupsContainingItem(quint32 toolId, quint32 objectId, bool containsItem)
Returns the groups that contain or do not contain the item identified by the toolid and the objectid.
QVector< VFormulaField > ListExpressions() const
quint32 getCursor() const
static const QString AttrNodeExcluded
bool groupNameExists(const QString &groupName)
static const QString TagPath
static const QString TagPiece
static const QString TagCompanyName
static const QString AttrH116
QVector< VDataTool * > toolsOnRemove
QVector< VFormulaField > ListIncrementExpressions() const
static const QString AttrH122
void SetGradationSizes(const QMap< GSizes, bool > &options)
QDomElement CheckTagExists(const QString &tag)
static const QString AttrS24
bool hasGroupItem(const QDomElement &domElement, quint32 toolId, quint32 objectId)
Checks if the given group has the item with the given toolId and objectId.
static void ToolExists(const quint32 &id)
static const QString TagImage
static const QString AttrS42
QVector< VFormulaField > ListPointExpressions() const
static const QString AttrDateFormat
static const QString TagCalculation
QVector< VFormulaField > ListNodesExpressions(const QDomElement &nodes) const
QString getGroupColor(quint32 id)
static const QString AttrH170
static const QString TagGrainline
void setGroupVisibility(quint32 id, bool visible)
QString GetLabelTimeFormat() const
static const QString AttrName
QVector< VFormulaField > ListPieceExpressions() const
static const QString AttrNodeNotchAngle
static const QString AttrNodeIsNotch
qreal getDefaultLineWeight() const
void SetLabelTimeFormat(const QString &format)
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
QString getDefaultLineColor() const
void changeActiveDraftBlock(const QString &name, const Document &parse=Document::FullParse)
changeActiveDraftBlock set new active draft block name.
static const QString AttrS68
static const QString AttrS72
static const QString AttrNodeNotchWidth
static const QString AttrDefHeight
QVector< VToolRecord > * getHistory()
getHistory return list with list of history records.
static const QString TagNodes
static const QString AttrNodeShowNotch
QVector< VFormulaField > ListSplineExpressions() const
static bool patternLabelWasChanged
static const QString TagIncrements
int getActiveDraftBlockIndex() const
void SetMPath(const QString &path)
void SetDescription(const QString &text)
void patternHasGroups(bool value)
QStringList patternPieces
patternPieces list of patern pieces names for combobox
static const QString TagSizes
static QVector< quint32 > ParsePieceInternalPaths(const QDomElement &domElement)
QVector< VFormulaField > ListPathExpressions() const
static void UpdateId(quint32 newId)
UpdateId update id. If new id bigger when current save new like current.
The VDomDocument class represents a Seamly2D document (.val file).
QDomElement elementById(quint32 id, const QString &tagName=QString())
static QString GetParametrString(const QDomElement &domElement, const QString &name, const QString &defValue=QString())
Returns the string value of the given attribute. RENAME: see above.
void SetLabelTemplate(QDomElement &element, const QVector< VLabelTemplateLine > &lines)
static quint32 GetParametrUInt(const QDomElement &domElement, const QString &name, const QString &defValue)
Returns the long long value of the given attribute. RENAME: GetParameterLongLong?
static bool getParameterBool(const QDomElement &domElement, const QString &name, const QString &defValue)
bool setTagText(const QString &tag, const QString &text)
QHash< quint32, QDomElement > map
Map used for finding element by id.
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
QString UniqueTagText(const QString &tagName, const QString &defVal=QString()) const
void SetAttribute(QDomElement &domElement, const QString &name, const T &value) const
SetAttribute set attribute in pattern file. Replace "," by ".".
static const QString AttrId
static void RemoveAllChildren(QDomElement &domElement)
RemoveAllChildren remove all children from file.
QVector< VLabelTemplateLine > GetLabelTemplate(const QDomElement &element) const
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 VException class parent for all exception. Could be use for abstract exception.
void AddMoreInformation(const QString &info)
AddMoreInformation add more information for error.
static const QString PatternMaxVerStr
void setBeforeSAFormula(const QString &formula)
void setShowNotch(bool value)
void setNotchCount(int notchCount)
void SetExcluded(bool exclude)
void setNotch(bool notch)
void setNotchType(NotchType notchType)
void setAfterSAFormula(const QString &formula)
void setNotchLength(qreal notchLength)
void setNotchWidth(qreal notchWidth)
void setShowSeamlineNotch(bool value)
void SetAngleType(PieceNodeAngle type)
void setNotchAngle(qreal notchAngle)
void setNotchSubType(NotchSubType notchSubType)
void Append(const VPieceNode &node)
const VPieceNode & at(int indx) const
const QStringList builInFunctions
const QString strStraightforward
const QStringList builInPostfixOperators
NotchType stringToNotchType(const QString &value)
NotchSubType stringToNotchSubType(const QString &value)
const QString AttrC1Radius
const QString LineTypeByGroup
const QString AttrLineType
const QString AttrC2Radius
const QString LineTypeSolidLine
const QString AttrLineWeight
const QString AttrRadius2
const QString currentSeamAllowance
const QString AttrRotationAngle
const QString AttrRadius1
const QString currentLength
const QStringList builInVariables
const QString AttrCRadius
const QString AttrPathPoint
const QString AttrIdObject
const QString ColorByGroup
const QString LineWeightByGroup
void ReadExpressionAttribute(QVector< VFormulaField > &expressions, const QDomElement &element, const QString &attribute)
The CustomSA struct contains record about custom seam allowanse (SA).
PiecePathIncludeType includeType