56 #include <QDomNodeList>
60 #include <QMessageLogger>
61 #include <QSharedPointer>
62 #include <QStaticStringData>
63 #include <QStringData>
64 #include <QStringDataPtr>
79 #include "../dialogs/tools/dialogtool.h"
80 #include "../dialogs/tools/union_dialog.h"
81 #include "../ifc/xml/vabstractconverter.h"
82 #include "../ifc/xml/vdomdocument.h"
83 #include "../ifc/xml/vlabeltemplateconverter.h"
84 #include "../ifc/xml/vpatternconverter.h"
85 #include "../vformat/vlabeltemplate.h"
86 #include "../vgeometry/varc.h"
87 #include "../vgeometry/vellipticalarc.h"
88 #include "../vgeometry/vsplinepath.h"
89 #include "../vgeometry/vabstractcubicbezier.h"
90 #include "../vgeometry/vabstractcubicbezierpath.h"
91 #include "../vgeometry/vgeometrydef.h"
92 #include "../vgeometry/vpointf.h"
93 #include "../vgeometry/vspline.h"
94 #include "../vgeometry/vsplinepoint.h"
95 #include "../vmisc/vcommonsettings.h"
96 #include "../vmisc/diagnostic.h"
97 #include "../vmisc/logging.h"
98 #include "../vmisc/vabstractapplication.h"
99 #include "../vpatterndb/vcontainer.h"
100 #include "../vpatterndb/vpiecepath.h"
101 #include "../vpatterndb/vpiecenode.h"
102 #include "../vpatterndb/floatItemData/vgrainlinedata.h"
103 #include "../vpatterndb/floatItemData/vpatternlabeldata.h"
104 #include "../vpatterndb/floatItemData/vpiecelabeldata.h"
119 QT_WARNING_DISABLE_CLANG(
"-Wmissing-prototypes")
120 QT_WARNING_DISABLE_INTEL(1418)
122 Q_LOGGING_CATEGORY(vToolUnion, "v.toolUnion")
134 VException e(QString(
"Can't get tool by id='%1'.").arg(
id));
138 const QDomNodeList nodesList = tool.childNodes();
139 for (qint32 i = 0; i < nodesList.size(); ++i)
141 const QDomElement element = nodesList.at(i).toElement();
144 const QDomNodeList pieceList = element.childNodes();
145 for (qint32 j = 0; j < pieceList.size(); ++j)
147 const QDomElement element = pieceList.at(j).toElement();
177 VException e(QString(
"Can't get tool by id='%1'.").arg(
id));
181 const QDomNodeList nodesList = tool.childNodes();
182 for (qint32 i = 0; i < nodesList.size(); ++i)
184 const QDomElement element = nodesList.at(i).toElement();
187 const QDomNodeList pieceList = element.childNodes();
188 for (qint32 j = 0; j < pieceList.size(); ++j)
190 const QDomElement element = pieceList.at(j).toElement();
208 VException e(QString(
"Can't get tool by id='%1'.").arg(
id));
212 const QDomNodeList nodesList = tool.childNodes();
213 for (qint32 i = 0; i < nodesList.size(); ++i)
215 const QDomElement element = nodesList.at(i).toElement();
218 const QDomNodeList pieceList = element.childNodes();
219 for (qint32 j = 0; j < pieceList.size(); ++j)
221 const QDomElement element = pieceList.at(j).toElement();
239 VException e(QString(
"Can't get tool by id='%1'.").arg(
id));
243 const QDomNodeList nodesList = tool.childNodes();
244 for (qint32 i = 0; i < nodesList.size(); ++i)
246 const QDomElement element = nodesList.at(i).toElement();
249 const QDomNodeList pieceList = element.childNodes();
250 for (qint32 j = 0; j < pieceList.size(); ++j)
252 const QDomElement element = pieceList.at(j).toElement();
279 const QDomElement block1 = piece1.parentNode().parentNode().toElement();
285 const QDomElement block2 = piece2.parentNode().parentNode().toElement();
294 if (block1Name == block2Name)
299 const QDomElement pattern = block1.parentNode().toElement();
300 if (pattern.isNull())
305 int piece1_Index = 0;
306 int piece2_Index = 0;
308 for (
int i=0; i < blockList.size(); ++i)
310 const QDomElement draftBlockElement = blockList.at(i).toElement();
311 if (draftBlockElement == block1)
316 if (draftBlockElement == block2)
322 if (piece1_Index >= piece2_Index)
343 point->
setX(point->
x()+dx);
344 point->
setY(point->
y()+dy);
345 QLineF line(pRotate,
static_cast<QPointF
>(*point));
346 line.setAngle(line.angle()+angle);
347 point->
setX(line.p2().x());
348 point->
setY(line.p2().y());
356 path.
NodeOnEdge(index, piece2_Pt1, piece2_Pt2);
363 VPieceNode &piece1_Pt1, qreal &dx, qreal &dy, qreal &angle)
377 dx = point1.
x() - point4.
x();
378 dy = point1.
y() - point4.
y();
380 point3.
setX(point3.
x()+dx);
381 point3.
setY(point3.
y()+dy);
383 point4.
setX(point4.
x()+dx);
384 point4.
setY(point4.
y()+dy);
386 const QLineF p4p3 = QLineF(
static_cast<QPointF
>(point4),
static_cast<QPointF
>(point3));
387 const QLineF p1p2 = QLineF(
static_cast<QPointF
>(point1),
static_cast<QPointF
>(point2));
389 angle = p4p3.angleTo(p1p2);
395 quint32 pRotate, qreal angle)
400 if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate !=
NULL_ID)
406 QScopedPointer<VPointF> point1(
new VPointF(*point));
409 children.append(objectId);
419 const QString &blockName, qreal dx, qreal dy, quint32 pRotate, qreal angle)
424 if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate !=
NULL_ID)
430 QScopedPointer<VPointF> point1(
new VPointF(*point));
433 children.append(objectId);
435 const quint32 anchorId = initData.
data->
AddGObject(point1.take());
444 quint32 pRotate, qreal angle)
449 QScopedPointer<VPointF> center(
new VPointF(arc->GetCenter()));
451 if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate !=
NULL_ID)
460 QLineF l1(
static_cast<QPointF
>(*center),
static_cast<QPointF
>(p1));
461 QLineF l2(
static_cast<QPointF
>(*center),
static_cast<QPointF
>(p2));
463 VPointF *tmpCenter = center.take();
466 QScopedPointer<VArc> arc1(
new VArc(*tmpCenter, arc->GetRadius(), arc->GetFormulaRadius(), l1.angle(),
467 QString().setNum(l1.angle()), l2.angle(), QString().setNum(l2.angle())));
470 QScopedPointer<VArc>arc2(
new VArc(*arc1));
473 children.append(objectId);
486 quint32 pRotate, qreal angle)
491 QScopedPointer<VPointF> center(
new VPointF(arc->GetCenter()));
493 if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate !=
NULL_ID)
502 QLineF l1(
static_cast<QPointF
>(*center),
static_cast<QPointF
>(p1));
503 QLineF l2(
static_cast<QPointF
>(*center),
static_cast<QPointF
>(p2));
505 VPointF *tmpCenter = center.take();
508 QScopedPointer<VEllipticalArc> arc1(
new VEllipticalArc (*tmpCenter, arc->GetRadius1(), arc->GetRadius2(),
509 arc->GetFormulaRadius1(), arc->GetFormulaRadius2(),
510 l1.angle(), QString().setNum(l1.angle()), l2.angle(),
511 QString().setNum(l2.angle()), 0,
"0"));
517 children.append(objectId);
530 quint32 pRotate, qreal angle)
535 QScopedPointer<VPointF> p1(
new VPointF(spline->GetP1()));
538 QScopedPointer<VPointF> p4(
new VPointF(spline->GetP4()));
540 if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate !=
NULL_ID)
552 children.append(objectId);
565 quint32 pRotate, qreal angle)
567 QScopedPointer<VSplinePath> path(
new VSplinePath());
571 for (qint32 i = 1; i <= splinePath->CountSubSpl(); ++i)
573 const VSpline spline = splinePath->GetSpline(i);
575 QScopedPointer<VPointF> p1(
new VPointF(spline.
GetP1()));
578 QScopedPointer<VPointF> p4(
new VPointF(spline.
GetP4()));
579 if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate !=
NULL_ID)
589 VSpline spl =
VSpline(*p1,
static_cast<QPointF
>(p2),
static_cast<QPointF
>(p3), *p4);
593 const QString angle1F = QString().number(angle1);
600 const QString angle2F = QString().number(angle2);
603 if (i+1 <= splinePath->CountSubSpl())
605 const VSpline nextSpline = splinePath->GetSpline(i+1);
613 QScopedPointer<VSplinePath> path1(
new VSplinePath(*path));
616 children.append(objectId);
631 quint32 idTool,
QVector<quint32> &children,
const QString &blockName, qreal dx = 0, qreal dy = 0,
632 quint32 pRotate =
NULL_ID, qreal angle = 0);
635 quint32 idTool,
QVector<quint32> &children,
const QString &blockName, qreal dx, qreal dy,
636 quint32 pRotate, qreal angle)
642 id =
AddNodePoint(node, initData, idTool, children, blockName, dx, dy, pRotate, angle);
645 id =
AddNodeArc(node, initData, idTool, children, blockName, dx, dy, pRotate, angle);
648 id =
AddNodeElArc(node, initData, idTool, children, blockName, dx, dy, pRotate, angle);
651 id =
AddNodeSpline(node, initData, idTool, children, blockName, dx, dy, pRotate, angle);
654 id =
AddNodeSplinePath(node, initData, idTool, children, blockName, dx, dy, pRotate, angle);
657 qDebug()<<
"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
668 if (piece2Points == 0)
672 piece2Path.
NodeOnEdge(piece2_Index, node1, node2);
691 if (toolUnion.isNull())
693 VException e(QString(
"Can't get tool by id='%1'.").arg(
id));
699 if (tagChildren.isNull())
702 toolUnion.appendChild(tagChildren);
711 if (children.size() > 0)
713 for (
int i=0; i<children.size(); ++i)
716 tagChild.appendChild(doc->createTextNode(QString().setNum(children.at(i))));
717 section.appendChild(tagChild);
752 if (toolUnion.isNull())
758 if (tagChildren.isNull())
763 const QDomElement tagNodes = tagChildren.firstChildElement(tagName);
764 if (tagNodes.isNull())
771 for (
int i=0; i < listChildren.size(); ++i)
773 const QDomElement domElement = listChildren.at(i).toElement();
774 if (not domElement.isNull())
776 childrenId.append(domElement.text().toUInt());
810 if (not children.isEmpty())
812 idChild = children.takeFirst();
823 quint32 pRotate, qreal angle)
827 if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate !=
NULL_ID)
836 quint32 pRotate, qreal angle)
841 QScopedPointer<VPointF> center(
new VPointF(arc->GetCenter()));
843 if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate !=
NULL_ID)
852 QLineF l1(
static_cast<QPointF
>(*center),
static_cast<QPointF
>(p1));
853 QLineF l2(
static_cast<QPointF
>(*center),
static_cast<QPointF
>(p2));
855 QScopedPointer<VArc> arc1(
new VArc(*center, arc->GetRadius(), arc->GetFormulaRadius(), l1.angle(),
856 QString().setNum(l1.angle()), l2.angle(), QString().setNum(l2.angle())));
863 quint32 pRotate, qreal angle)
868 QScopedPointer<VPointF> center(
new VPointF(arc->GetCenter()));
870 if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate !=
NULL_ID)
879 QLineF l1(
static_cast<QPointF
>(*center),
static_cast<QPointF
>(p1));
880 QLineF l2(
static_cast<QPointF
>(*center),
static_cast<QPointF
>(p2));
882 QScopedPointer<VEllipticalArc> arc1(
new VEllipticalArc (*center, arc->GetRadius1(), arc->GetRadius2(),
883 arc->GetFormulaRadius1(), arc->GetFormulaRadius2(),
884 l1.angle(), QString().setNum(l1.angle()), l2.angle(),
885 QString().setNum(l2.angle()), 0,
"0"));
892 quint32 pRotate, qreal angle)
897 QScopedPointer<VPointF> p1(
new VPointF(spline->GetP1()));
900 QScopedPointer<VPointF> p4(
new VPointF(spline->GetP4()));
902 if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate !=
NULL_ID)
912 QScopedPointer<VSpline> spl(
new VSpline(*p1,
static_cast<QPointF
>(p2),
static_cast<QPointF
>(p3), *p4, 0,
919 quint32 pRotate, qreal angle)
921 QScopedPointer<VSplinePath> path(
new VSplinePath());
926 for (qint32 i = 1; i <= splinePath->CountSubSpl(); ++i)
928 const VSpline spline = splinePath->GetSpline(i);
930 QScopedPointer<VPointF> p1(
new VPointF(spline.
GetP1()));
933 QScopedPointer<VPointF> p4(
new VPointF(spline.
GetP4()));
935 if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate !=
NULL_ID)
945 VSpline spl =
VSpline(*p1,
static_cast<QPointF
>(p2),
static_cast<QPointF
>(p3), *p4);
949 const QString angle1F = QString().number(angle1);
956 const QString angle2F = QString().number(angle2);
960 if (i+1 <= splinePath->CountSubSpl())
962 const VSpline nextSpline = splinePath->GetSpline(i+1);
985 qreal dx = 0, qreal dy = 0, quint32 pRotate =
NULL_ID, qreal angle = 0);
987 quint32 pRotate, qreal angle)
1007 qDebug()<<
"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
1014 const UnionToolInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle)
1019 const qint32 piece1NodeCount = piece1Path.
CountNodes();
1020 const qint32 piece2NodeCount = piece2Path.
CountNodes();
1022 qint32 piece2Points = 0;
1031 if (i > piece1_Pt1_Index && piece2Points < piece2NodeCount-1)
1037 if (j >= piece2NodeCount)
1041 AddNodeToNewPath(initData, newPath, piece2Path.
at(j),
id, children, blockName, dx, dy, pRotate, angle);
1044 }
while (piece2Points < piece2NodeCount-1);
1046 }
while (i < piece1NodeCount);
1056 const QString &blockName,
const UnionToolInitData &initData, qreal dx, qreal dy,
1057 quint32 pRotate, qreal angle)
1068 AddNodeToNewPath(initData, newPath, path.
at(i),
id, nodeChildren, blockName, dx, dy, pRotate, angle);
1073 record.
path = idPath;
1075 nodeChildren.prepend(idPath);
1077 children += nodeChildren;
1082 const UnionToolInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle)
1090 createCSAUnion(newPiece, piece2, children,
id, blockName, initData, dx, dy, pRotate, angle);
1097 qreal dy, quint32 pRotate, qreal angle)
1108 AddNodeToNewPath(initData, newPath, path.
at(i),
id, nodeChildren, blockName, dx, dy, pRotate, angle);
1114 nodeChildren.prepend(idPath);
1116 children += nodeChildren;
1121 const QString &blockName,
const UnionToolInitData &initData, qreal dx, qreal dy,
1122 quint32 pRotate, qreal angle)
1137 const QString &blockName,
const UnionToolInitData &initData, qreal dx, qreal dy,
1138 quint32 pRotate, qreal angle)
1143 const quint32
id =
AddAnchorPoint(d.
getAnchors().at(i), initData, idTool, children, blockName, dx, dy, pRotate, angle);
1145 nodeChildren.prepend(
id);
1147 children += nodeChildren;
1152 const UnionToolInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle)
1154 for (
int i = 0; i < piece1.
getAnchors().size(); ++i)
1160 createUnionAnchors(newPiece, piece2, children,
id, blockName, initData, dx, dy, pRotate, angle);
1174 const qint32 piece1NodeCount = piece1REPath.
CountNodes();
1175 const qint32 piece2NodeCount = piece2REPath.
CountNodes();
1178 if (not children.isEmpty())
1183 "Time to refactor the code.");
1184 if (children.size() == piece1NodeCount + piece2NodeCount-1)
1186 qint32 piece2Points = 0;
1188 const int indexOfNode = piece1Path.
indexOfNode(pRotate);
1193 if (i > indexOfNode && piece2Points < piece2NodeCount-1)
1199 if (j >= piece2NodeCount)
1206 }
while (piece2Points < piece2NodeCount-1);
1208 }
while (i<piece1NodeCount);
1212 qint32 piece2Points = 0;
1214 const int indexOfNode = piece1Path.
indexOfNode(pRotate);
1218 if (i > indexOfNode)
1220 const int childrenCount = children.size();
1225 if (j >= piece2NodeCount)
1232 }
while (piece2Points < childrenCount);
1235 }
while (i<piece1NodeCount);
1244 for (
int i=0; i < records.size(); ++i)
1247 const quint32 updatedId =
TakeNextId(children);
1250 updatedPath.
Clear();
1269 for (
int i = 0; i < records.size(); ++i)
1271 idRecords.append(records.at(i).path);
1289 for (
int i = 0; i < records.size(); ++i)
1293 if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate !=
NULL_ID)
1314 CreateUnitedNodes(newPiece, piece1, piece2,
id, blockName, initData, dx, dy, pRotate, angle);
1315 CreateUnitedCSA(newPiece, piece1, piece2,
id, blockName, initData, dx, dy, pRotate, angle);
1317 createUnitedAnchors(newPiece, piece1, piece2,
id, blockName, initData, dx, dy, pRotate, angle);
1320 const QRectF rect = QPolygonF(path.
PathPoints(initData.
data)).boundingRect();
1322 newPiece.
SetName(QObject::tr(
"Union piece"));
1329 qreal xPos = rect.left() + (rect.width()/2.0 - width)/2.0;
1330 qreal yPos = rect.center().y() - height/2.0;
1336 QString filename =
qApp->Settings()->getDefaultPieceTemplate();
1337 if (QFileInfo(filename).exists())
1346 xPos = rect.center().x() + (rect.width()/2.0 - width)/2.0;
1347 yPos = rect.center().y() - height/2.0;
1353 xPos = rect.center().x();
1354 yPos = rect.center().y();
1365 auto removeUnionPiece = [initData](quint32 id)
1428 , piece1_Id(initData.piece1_Id)
1429 , piece2_Id(initData.piece2_Id)
1430 , piece1_Index(initData.piece1_Index)
1431 , piece2_Index(initData.piece2_Index)
1456 for(
int i = 0; i < objects.size(); ++i)
1462 if (domElement.isElement())
1476 for(
int i = 0; i < objects.size(); ++i)
1482 if (domElement.isElement())
1511 initData.
piece1_Id = dialogTool->getPiece1Id();
1512 initData.piece2_Id = dialogTool->getPiece2Id();
1513 initData.piece1_Index =
static_cast<quint32
>(dialogTool->getPiece1Index());
1514 initData.piece2_Index =
static_cast<quint32
>(dialogTool->getPiece2Index());
1515 initData.scene = scene;
1517 initData.data =
data;
1520 initData.retainPieces = dialogTool->retainPieces();
1522 qApp->getUndoStack()->beginMacro(tr(
"union pieces"));
1524 qApp->getUndoStack()->endMacro();
1600 domElement.appendChild(element);
1614 if (not modeling.isNull())
1616 modeling.appendChild(domElement);
1640 const QDomNodeList nodesList = tool.childNodes();
1641 for (qint32 i = 0; i < nodesList.size(); ++i)
1643 const QDomElement element = nodesList.at(i).toElement();
1646 const QDomNodeList pieceList = element.childNodes();
1647 for (qint32 j = 0; j < pieceList.size(); ++j)
1649 const QDomElement element = pieceList.at(j).toElement();
1650 if (not element.isNull())
1652 switch (parts.indexOf(element.tagName()))
1664 const QDomNodeList children = element.childNodes();
1665 for (qint32 i = 0; i < children.size(); ++i)
1667 const QDomElement record = children.at(i).toElement();
1670 list.append(record.text().toUInt());
1687 const QString &attribute)
const
1691 const QDomNodeList list = root.childNodes();
1692 for (qint32 i = 0; i < list.size(); ++i)
1694 const QDomElement element = list.at(i).toElement();
1695 if (not element.isNull() && element.tagName() == tag)
The UnionDialog class dialog for Union Tool.
void SetVisible(bool bVisible)
void SetPos(const QPointF &ptPos)
void AddToolOnRemove(VDataTool *tool)
static QVector< quint32 > ParsePieceAnchors(const QDomElement &domElement)
virtual void UpdateToolData(const quint32 &id, VContainer *data)=0
static const QString TagModeling
virtual void IncrementReferens(quint32 id) const =0
QDomElement getDraftBlockElement(const QString &name)
static void AddTool(quint32 id, VDataTool *tool)
AddTool add tool to list tools.
static const QString TagTools
static const QString AttrPath
static VDataTool * getTool(quint32 id)
getTool return tool from tool list.
static void RemoveTool(quint32 id)
static const QString TagDraftBlock
static QVector< CustomSARecord > ParsePieceCSARecords(const QDomElement &domElement)
static VPiecePath ParsePieceNodes(const QDomElement &domElement)
static const QString TagPiece
static const QString AttrName
virtual void DecrementReferens(quint32 id) const =0
static const QString TagNodes
static QVector< quint32 > ParsePieceInternalPaths(const QDomElement &domElement)
void SetName(const QString &value)
void SetSeamAllowance(bool value)
VArc class for anticlockwise arc.
The VContainer class container of all variables.
void RemovePiece(quint32 id)
static quint32 getNextId()
getNextId generate next unique id
void UpdatePiecePath(quint32 id, const VPiecePath &path)
const QSharedPointer< T > GeometricObject(const quint32 &id) const
VPiecePath GetPiecePath(quint32 id) const
quint32 AddGObject(VGObject *obj)
AddGObject add new GObject to container.
quint32 AddPiecePath(const VPiecePath &path)
void UpdateGObject(quint32 id, T *obj)
UpdateGObject update GObject by id.
VPiece GetPiece(quint32 id) const
QDomElement elementById(quint32 id, const QString &tagName=QString())
static quint32 GetParametrUInt(const QDomElement &domElement, const QString &name, const QString &defValue)
Returns the long long value of the given attribute. RENAME: GetParameterLongLong?
static void SetParametrUsage(QDomElement &domElement, const QString &name, const NodeUsage &value)
void SetAttribute(QDomElement &domElement, const QString &name, const T &value) const
SetAttribute set attribute in pattern file. Replace "," by ".".
static const QString AttrId
virtual void setXMLContent(const QString &fileName)
The VException class parent for all exception. Could be use for abstract exception.
void setMode(const Draw &value)
setMode set mode creation.
void SetLength(const QString &qsLen)
QString GetLength() const
QVector< VLabelTemplateLine > ReadLines() const
The VMainGraphicsScene class main scene.
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 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 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 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 Q_DECL_CONSTEXPR const int PatternMinVer
void SetLabelHeight(const QString &dLabelH)
QString GetLabelWidth() const
void SetLabelWidth(const QString &dLabelW)
QString GetLabelHeight() const
void SetLabelTemplate(const QVector< VLabelTemplateLine > &lines)
QVector< QPointF > PathPoints(const VContainer *data) const
qint32 CountNodes() const
void NodeOnEdge(quint32 index, VPieceNode &p1, VPieceNode &p2) const
NodeOnEdge return nodes located on edge with index.
void Append(const VPieceNode &node)
VPiecePath RemoveEdge(quint32 index) const
RemoveEdge return path without edge with index.
const VPieceNode & at(int indx) const
int indexOfNode(quint32 id) const
VPieceLabelData & GetPatternPieceData()
Returns full access to the pattern piece data object.
QVector< CustomSARecord > GetCustomSARecords() const
QString getSeamAllowanceWidthFormula() const
QVector< quint32 > GetInternalPaths() const
void SetPath(const VPiecePath &path)
QVector< quint32 > getAnchors() const
void setSeamAllowanceWidthFormula(const QString &formula, qreal value)
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 setX(const qreal &value)
setX set x coordinate
void setY(const qreal &value)
setY set y coordinate
qreal y() const
y return y coordinate
qreal x() const
x return x coordinate
The VSplinePath class keep information about splinePath.
The VSplinePoint class keep information about point in spline path. Each point have two angles and tw...
VSpline class that implements the spline.
virtual qreal GetC2Length() const Q_DECL_OVERRIDE
virtual VPointF GetP4() const Q_DECL_OVERRIDE
GetP4 return last spline point.
QString GetC1LengthFormula() const
virtual qreal GetStartAngle() const Q_DECL_OVERRIDE
GetAngle1 return first angle control line.
virtual VPointF GetP1() const Q_DECL_OVERRIDE
GetP1 return first spline point.
virtual VPointF GetP2() const Q_DECL_OVERRIDE
GetP2 return first control point.
QString GetStartAngleFormula() const
QString GetEndAngleFormula() const
virtual qreal GetC1Length() const Q_DECL_OVERRIDE
virtual VPointF GetP3() const Q_DECL_OVERRIDE
GetP3 return second control point.
QString GetC2LengthFormula() const
virtual qreal GetEndAngle() const Q_DECL_OVERRIDE
GetAngle2 return second angle control line.
void SaveInternalPathsChildren(VAbstractPattern *doc, quint32 id, const QVector< quint32 > &children)
void updateUnion(quint32 id, const UnionToolInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle)
void UpdateNodeSpline(VContainer *data, const VPieceNode &node, QVector< quint32 > &children, qreal dx, qreal dy, quint32 pRotate, qreal angle)
void UpdateNodeArc(VContainer *data, const VPieceNode &node, QVector< quint32 > &children, qreal dx, qreal dy, quint32 pRotate, qreal angle)
VPiecePath GetPiece2MainPath(VAbstractPattern *doc, quint32 id)
void unitePieces(quint32 id, const UnionToolInitData &initData)
QVector< CustomSARecord > GetPiece2CSAPaths(VAbstractPattern *doc, quint32 id)
void createCSAUnion(VPiece &newPiece, const VPiece &d, QVector< quint32 > &children, quint32 id, const QString &blockName, const UnionToolInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle)
void SaveCSAChildren(VAbstractPattern *doc, quint32 id, const QVector< quint32 > &children)
void UpdatePathNode(VContainer *data, const VPieceNode &node, QVector< quint32 > &children, qreal dx=0, qreal dy=0, quint32 pRotate=NULL_ID, qreal angle=0)
UpdateNodes update nodes of union.
void createUnionInternalPaths(VPiece &newPiece, const VPiece &d, QVector< quint32 > &children, quint32 id, const QString &blockName, const UnionToolInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle)
quint32 AddAnchorPoint(quint32 id, const UnionToolInitData &initData, quint32 idTool, QVector< quint32 > &children, const QString &blockName, qreal dx, qreal dy, quint32 pRotate, qreal angle)
QVector< quint32 > GetInternalPathsChildren(VAbstractPattern *doc, quint32 id)
quint32 AddNodePoint(const VPieceNode &node, const UnionToolInitData &initData, quint32 idTool, QVector< quint32 > &children, const QString &blockName, qreal dx, qreal dy, quint32 pRotate, qreal angle)
void updateUnionAnchors(quint32 id, const UnionToolInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle, const QVector< quint32 > &records)
VPiecePath GetPiecePath(int piece, VAbstractPattern *doc, quint32 id)
QString getBlockName(VAbstractPattern *doc, quint32 piece1_Id, quint32 piece2_Id)
QVector< quint32 > GetCSAChildren(VAbstractPattern *doc, quint32 id)
void createUnion(quint32 id, const UnionToolInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle)
void AddNodeToNewPath(const UnionToolInitData &initData, VPiecePath &newPath, VPieceNode node, quint32 idTool, QVector< quint32 > &children, const QString &blockName, qreal dx=0, qreal dy=0, quint32 pRotate=NULL_ID, qreal angle=0)
AddNodeToNewPath create union adding one node at a time.
VPiecePath GetPiece1MainPath(VAbstractPattern *doc, quint32 id)
QVector< quint32 > GetChildren(VAbstractPattern *doc, quint32 id, const QString &tagName)
void createUnionPaths(const UnionToolInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle, const QVector< quint32 > &records, QVector< quint32 > children)
void UnionInitParameters(const UnionToolInitData &initData, const VPiecePath &piece1Path, const VPiecePath &piece2Path, VPieceNode &piece1_Pt1, qreal &dx, qreal &dy, qreal &angle)
void UpdateUnitedNodes(quint32 id, const UnionToolInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle)
quint32 AddNodeArc(const VPieceNode &node, const UnionToolInitData &initData, quint32 idTool, QVector< quint32 > &children, const QString &blockName, qreal dx, qreal dy, quint32 pRotate, qreal angle)
QVector< quint32 > GetPiece2Anchors(VAbstractPattern *doc, quint32 id)
void SaveNodesChildren(VAbstractPattern *doc, quint32 id, const QVector< quint32 > &children)
void PointsOnEdge(const VPiecePath &path, quint32 index, VPointF &p1, VPointF &p2, VContainer *data)
void updateUnionCSA(quint32 id, const UnionToolInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle, const QVector< CustomSARecord > &records)
void createUnionAnchors(VPiece &newPiece, const VPiece &d, QVector< quint32 > &children, quint32 idTool, const QString &blockName, const UnionToolInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle)
void UpdateNodeElArc(VContainer *data, const VPieceNode &node, QVector< quint32 > &children, qreal dx, qreal dy, quint32 pRotate, qreal angle)
QDomElement GetTagChildren(VAbstractPattern *doc, quint32 id)
QVector< quint32 > getAnchorChildren(VAbstractPattern *doc, quint32 id)
void CreateUnitedInternalPaths(VPiece &newPiece, const VPiece &piece1, const VPiece &piece2, quint32 id, const QString &blockName, const UnionToolInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle)
QVector< quint32 > GetPiece2InternalPaths(VAbstractPattern *doc, quint32 id)
quint32 TakeNextId(QVector< quint32 > &children)
quint32 AddNodeSplinePath(const VPieceNode &node, const UnionToolInitData &initData, quint32 idTool, QVector< quint32 > &children, const QString &blockName, qreal dx, qreal dy, quint32 pRotate, qreal angle)
void UpdateNodePoint(VContainer *data, const VPieceNode &node, QVector< quint32 > &children, qreal dx, qreal dy, quint32 pRotate, qreal angle)
void CreateUnitedNodes(VPiece &newPiece, const VPiece &piece1, const VPiece &piece2, quint32 id, const QString &blockName, const UnionToolInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle)
QVector< quint32 > GetNodesChildren(VAbstractPattern *doc, quint32 id)
void FindIndexJ(qint32 piece2Points, const VPiecePath &piece2Path, quint32 piece2_Index, qint32 &j)
quint32 AddNodeSpline(const VPieceNode &node, const UnionToolInitData &initData, quint32 idTool, QVector< quint32 > &children, const QString &blockName, qreal dx, qreal dy, quint32 pRotate, qreal angle)
quint32 AddNodeElArc(const VPieceNode &node, const UnionToolInitData &initData, quint32 idTool, QVector< quint32 > &children, const QString &blockName, qreal dx, qreal dy, quint32 pRotate, qreal angle)
void CreateUnitedCSA(VPiece &newPiece, const VPiece &piece1, const VPiece &piece2, quint32 id, const QString &blockName, const UnionToolInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle)
void createUnitedAnchors(VPiece &newPiece, const VPiece &piece1, const VPiece &piece2, quint32 id, const QString &blockName, const UnionToolInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle)
void updateUnionInternalPaths(quint32 id, const UnionToolInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle, const QVector< quint32 > &records)
void SaveChildren(VAbstractPattern *doc, quint32 id, QDomElement section, const QVector< quint32 > &children)
void SaveAnchorsChildren(VAbstractPattern *doc, quint32 id, const QVector< quint32 > &children)
void BiasRotatePoint(VPointF *point, qreal dx, qreal dy, const QPointF &pRotate, qreal angle)
BiasRotatePoint bias and rotate point.
void UpdateNodeSplinePath(VContainer *data, const VPieceNode &node, QVector< quint32 > &children, qreal dx, qreal dy, quint32 pRotate, qreal angle)
The CustomSA struct contains record about custom seam allowanse (SA).
#define CONVERTER_VERSION_CHECK(major, minor, patch)