Merge with feature.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-03-22 12:06:12 +02:00
commit 6ec97f90c0
48 changed files with 1831 additions and 144 deletions

View File

@ -76,7 +76,7 @@ void VToolOptionsPropertyBrowser::ClearPropertyBrowser()
void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item)
{
// This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used in switch.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 53, "Not all tools were used in switch.");
switch (item->type())
{
@ -203,7 +203,7 @@ void VToolOptionsPropertyBrowser::UpdateOptions()
}
// This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used in switch.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 53, "Not all tools were used in switch.");
switch (currentItem->type())
{
@ -348,7 +348,7 @@ void VToolOptionsPropertyBrowser::userChangedData(VPE::VProperty *property)
}
// This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used in switch.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 53, "Not all tools were used in switch.");
switch (currentItem->type())
{

View File

@ -212,7 +212,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
QString DialogHistory::Record(const VToolRecord &tool)
{
// This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used in history.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 53, "Not all tools were used in history.");
const QDomElement domElem = doc->elementById(tool.getId());
if (domElem.isElement() == false)
@ -406,6 +406,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
case Tool::Move:
case Tool::PiecePath:
case Tool::Pin:
case Tool::InsertNode:
return QString();
}
}

View File

@ -574,6 +574,7 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons
break;
case Tool::PiecePath:
case Tool::Pin:
case Tool::InsertNode:
dialogTool->SetPiecesList(doc->GetActivePPPieces());
break;
default:
@ -1162,6 +1163,20 @@ void MainWindow::ClosedDialogPin(int result)
doc->LiteParseTree(Document::LiteParse);
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ClosedDialogInsertNode(int result)
{
SCASSERT(dialogTool != nullptr);
if (result == QDialog::Accepted)
{
DialogInsertNode *dTool = qobject_cast<DialogInsertNode*>(dialogTool);
SCASSERT(dTool != nullptr);
VToolSeamAllowance::InsertNode(dTool->GetNode(), dTool->GetPieceId(), sceneDetails, pattern, doc);
}
ArrowTool();
doc->LiteParseTree(Document::LiteParse);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ToolCutArc handler tool cutArc.
@ -1286,6 +1301,14 @@ void MainWindow::ToolTrueDarts(bool checked)
&MainWindow::ApplyDrawDialog<VToolTrueDarts>);
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolInsertNode(bool checked)
{
ToolSelectAllDrawObjects();
SetToolButton<DialogInsertNode>(checked, Tool::InsertNode, "://cursor/insert_node_cursor.png",
tr("Select an item to insert"), &MainWindow::ClosedDialogInsertNode);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ShowTool highlight tool.Tip show tools tooltip.
@ -1801,7 +1824,7 @@ void MainWindow::InitToolButtons()
}
// This check helps to find missed tools
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Check if all tools were connected.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 53, "Check if all tools were connected.");
connect(ui->toolButtonEndLine, &QToolButton::clicked, this, &MainWindow::ToolEndLine);
connect(ui->toolButtonLine, &QToolButton::clicked, this, &MainWindow::ToolLine);
@ -1848,6 +1871,7 @@ void MainWindow::InitToolButtons()
connect(ui->toolButtonLayoutExportAs, &QToolButton::clicked, this, &MainWindow::ExportLayoutAs);
connect(ui->toolButtonEllipticalArc, &QToolButton::clicked, this, &MainWindow::ToolEllipticalArc);
connect(ui->toolButtonPin, &QToolButton::clicked, this, &MainWindow::ToolPin);
connect(ui->toolButtonInsertNode, &QToolButton::clicked, this, &MainWindow::ToolInsertNode);
}
//---------------------------------------------------------------------------------------------------------------------
@ -1875,7 +1899,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
void MainWindow::CancelTool()
{
// This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were handled.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 53, "Not all tools were handled.");
qCDebug(vMainWindow, "Canceling tool.");
delete dialogTool;
@ -2034,6 +2058,9 @@ void MainWindow::CancelTool()
case Tool::Pin:
ui->toolButtonPin->setChecked(false);
break;
case Tool::InsertNode:
ui->toolButtonInsertNode->setChecked(false);
break;
}
// Crash: using CRTL+Z while using line tool.
@ -3152,7 +3179,7 @@ void MainWindow::SetEnableTool(bool enable)
}
// This check helps to find missed tools
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were handled.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 53, "Not all tools were handled.");
//Drawing Tools
ui->toolButtonEndLine->setEnabled(drawTools);
@ -3194,6 +3221,7 @@ void MainWindow::SetEnableTool(bool enable)
ui->toolButtonMidpoint->setEnabled(drawTools);
ui->toolButtonEllipticalArc->setEnabled(drawTools);
ui->toolButtonPin->setEnabled(drawTools);
ui->toolButtonInsertNode->setEnabled(drawTools);
ui->actionLast_tool->setEnabled(drawTools);
@ -3475,7 +3503,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
void MainWindow::LastUsedTool()
{
// This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were handled.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 53, "Not all tools were handled.");
if (currentTool == lastUsedTool)
{
@ -3666,6 +3694,10 @@ void MainWindow::LastUsedTool()
ui->toolButtonPin->setChecked(true);
ToolPin(true);
break;
case Tool::InsertNode:
ui->toolButtonInsertNode->setChecked(true);
ToolInsertNode(true);
break;
}
}

View File

@ -158,6 +158,7 @@ private slots:
void ToolPointFromArcAndTangent(bool checked);
void ToolArcWithLength(bool checked);
void ToolTrueDarts(bool checked);
void ToolInsertNode(bool checked);
void ActionDraw(bool checked);
void ActionDetails(bool checked);
@ -172,6 +173,7 @@ private slots:
void ClosedDialogGroup(int result);
void ClosedDialogPiecePath(int result);
void ClosedDialogPin(int result);
void ClosedDialogInsertNode(int result);
void LoadIndividual();
void LoadStandard();

View File

@ -55,7 +55,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>117</width>
<width>100</width>
<height>358</height>
</rect>
</property>
@ -427,7 +427,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>130</width>
<width>100</width>
<height>110</height>
</rect>
</property>
@ -536,7 +536,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>130</width>
<width>100</width>
<height>248</height>
</rect>
</property>
@ -798,7 +798,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>130</width>
<width>100</width>
<height>248</height>
</rect>
</property>
@ -1063,7 +1063,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>130</width>
<width>100</width>
<height>58</height>
</rect>
</property>
@ -1143,8 +1143,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>130</width>
<height>326</height>
<width>100</width>
<height>196</height>
</rect>
</property>
<attribute name="icon">
@ -1322,7 +1322,7 @@
<x>0</x>
<y>0</y>
<width>130</width>
<height>150</height>
<height>196</height>
</rect>
</property>
<property name="sizePolicy">
@ -1475,6 +1475,32 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QToolButton" name="toolButtonInsertNode">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Insert node tool</string>
</property>
<property name="text">
<string notr="true">...</string>
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/insert_node.png</normaloff>:/toolicon/32x32/insert_node.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutPage">
@ -1482,8 +1508,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>130</width>
<height>326</height>
<width>100</width>
<height>58</height>
</rect>
</property>
<attribute name="icon">

View File

@ -82,5 +82,7 @@
<file>cursor/path_cursor@2x.png</file>
<file>cursor/pin_cursor.png</file>
<file>cursor/pin_cursor@2x.png</file>
<file>cursor/insert_node_cursor.png</file>
<file>cursor/insert_node_cursor@2x.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -80,5 +80,7 @@
<file>toolicon/32x32/path@2x.png</file>
<file>toolicon/32x32/pin.png</file>
<file>toolicon/32x32/pin@2x.png</file>
<file>toolicon/32x32/insert_node.png</file>
<file>toolicon/32x32/insert_node@2x.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 665 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Capa_1"
x="0px"
y="0px"
width="446.615px"
height="446.616px"
viewBox="0 0 446.615 446.616"
style="enable-background:new 0 0 446.615 446.616;"
xml:space="preserve"
sodipodi:docname="insert_node.svg"
inkscape:export-filename="/home/dismine/CAD/Valentina_insert/valentina/src/app/valentina/share/resources/toolicon/svg/insert_node@2x.png"
inkscape:export-xdpi="13.756784"
inkscape:export-ydpi="13.756784"
inkscape:version="0.92.1 unknown"><metadata
id="metadata49"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
id="defs47" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1314"
inkscape:window-height="849"
id="namedview45"
showgrid="false"
inkscape:zoom="0.52841815"
inkscape:cx="-159.91174"
inkscape:cy="223.308"
inkscape:window-x="75"
inkscape:window-y="34"
inkscape:window-maximized="0"
inkscape:current-layer="Capa_1" /><g
id="g12"><g
id="g10"><g
id="g6"><path
d="M191.852,260.427l-60.628,60.62c-22.054,22.048-59.52,20.479-83.508-3.505c-23.991-23.998-25.569-61.446-3.51-83.517 l68.694-68.69c22.057-22.057,59.52-20.479,83.511,3.505c10.214,10.212,16.321,22.859,18.313,35.727 c8.889-0.929,17.271-4.569,23.795-11.089l2.53-2.53c-4.052-15.396-12.125-30.14-24.37-42.377 c-35.171-35.171-90.824-36.744-124.056-3.505l-68.69,68.69c-33.239,33.229-31.662,88.889,3.507,124.061 c35.168,35.166,90.821,36.739,124.06,3.505l68.69-68.69c3.89-3.888,7.269-8.116,10.207-12.563 C217.798,262.658,204.711,262.714,191.852,260.427z"
id="path2" /><path
d="M210.06,27.633l-68.7,68.695c-3.899,3.901-7.273,8.13-10.218,12.578c12.603-2.581,25.694-2.66,38.545-0.359 l60.642-60.639c22.052-22.057,59.52-20.479,83.508,3.509c23.994,23.994,25.571,61.452,3.51,83.508l-68.689,68.695 c-22.057,22.057-59.515,20.483-83.511-3.51c-10.214-10.212-16.321-22.869-18.314-35.731c-8.888,0.92-17.275,4.583-23.795,11.094 l-2.527,2.53c4.051,15.401,12.123,30.14,24.367,42.381c35.171,35.172,90.824,36.739,124.059,3.51l68.685-68.69 c33.239-33.239,31.662-88.889-3.505-124.056C298.954-4.023,243.294-5.605,210.06,27.633z"
id="path4" /></g><path
d="M351.038,251.742c-52.794,0-95.581,42.797-95.581,95.582c0,52.789,42.787,95.591,95.581,95.591 c52.79,0,95.577-42.802,95.577-95.591C446.615,294.539,403.828,251.742,351.038,251.742z M407.192,367.018h-35.348v35.503 c0,11.164-9.055,20.199-20.214,20.199s-20.208-9.035-20.208-20.199v-35.503h-35.358c-11.149,0-20.198-9.054-20.198-20.208 s9.049-20.208,20.198-20.208h35.358v-35.214c0-11.154,9.049-20.203,20.208-20.203s20.214,9.049,20.214,20.203v35.214h35.348 c11.159,0,20.213,9.054,20.213,20.208C427.401,357.974,418.352,367.018,407.192,367.018z"
id="path8" /></g></g><g
id="g14" /><g
id="g16" /><g
id="g18" /><g
id="g20" /><g
id="g22" /><g
id="g24" /><g
id="g26" /><g
id="g28" /><g
id="g30" /><g
id="g32" /><g
id="g34" /><g
id="g36" /><g
id="g38" /><g
id="g40" /><g
id="g42" /></svg>

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -3747,7 +3747,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
QRectF VPattern::ActiveDrawBoundingRect() const
{
// This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 53, "Not all tools were used.");
QRectF rec;
@ -3882,6 +3882,7 @@ QRectF VPattern::ActiveDrawBoundingRect() const
case Tool::Group:
case Tool::PiecePath:
case Tool::Pin:
case Tool::InsertNode:
break;
}
}

View File

@ -28,6 +28,7 @@
<file>schema/pattern/v0.4.2.xsd</file>
<file>schema/pattern/v0.4.3.xsd</file>
<file>schema/pattern/v0.4.4.xsd</file>
<file>schema/pattern/v0.4.5.xsd</file>
<file>schema/standard_measurements/v0.3.0.xsd</file>
<file>schema/standard_measurements/v0.4.0.xsd</file>
<file>schema/standard_measurements/v0.4.1.xsd</file>

View File

@ -0,0 +1,876 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- XML Schema Generated from XML Document-->
<xs:element name="pattern">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="version" type="formatVersion"/>
<xs:element name="unit" type="units"/>
<xs:element name="image" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="extension" type="imageExtension"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="author" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="notes" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="gradation" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="heights">
<xs:complexType>
<xs:attribute name="all" type="xs:boolean" use="required"/>
<xs:attribute name="h50" type="xs:boolean"/>
<xs:attribute name="h56" type="xs:boolean"/>
<xs:attribute name="h62" type="xs:boolean"/>
<xs:attribute name="h68" type="xs:boolean"/>
<xs:attribute name="h74" type="xs:boolean"/>
<xs:attribute name="h80" type="xs:boolean"/>
<xs:attribute name="h86" type="xs:boolean"/>
<xs:attribute name="h92" type="xs:boolean"/>
<xs:attribute name="h98" type="xs:boolean"/>
<xs:attribute name="h104" type="xs:boolean"/>
<xs:attribute name="h110" type="xs:boolean"/>
<xs:attribute name="h116" type="xs:boolean"/>
<xs:attribute name="h122" type="xs:boolean"/>
<xs:attribute name="h128" type="xs:boolean"/>
<xs:attribute name="h134" type="xs:boolean"/>
<xs:attribute name="h140" type="xs:boolean"/>
<xs:attribute name="h146" type="xs:boolean"/>
<xs:attribute name="h152" type="xs:boolean"/>
<xs:attribute name="h158" type="xs:boolean"/>
<xs:attribute name="h164" type="xs:boolean"/>
<xs:attribute name="h170" type="xs:boolean"/>
<xs:attribute name="h176" type="xs:boolean"/>
<xs:attribute name="h182" type="xs:boolean"/>
<xs:attribute name="h188" type="xs:boolean"/>
<xs:attribute name="h194" type="xs:boolean"/>
<xs:attribute name="h200" type="xs:boolean"/>
</xs:complexType>
</xs:element>
<xs:element name="sizes">
<xs:complexType>
<xs:attribute name="all" type="xs:boolean" use="required"/>
<xs:attribute name="s22" type="xs:boolean"/>
<xs:attribute name="s24" type="xs:boolean"/>
<xs:attribute name="s26" type="xs:boolean"/>
<xs:attribute name="s28" type="xs:boolean"/>
<xs:attribute name="s30" type="xs:boolean"/>
<xs:attribute name="s32" type="xs:boolean"/>
<xs:attribute name="s34" type="xs:boolean"/>
<xs:attribute name="s36" type="xs:boolean"/>
<xs:attribute name="s38" type="xs:boolean"/>
<xs:attribute name="s40" type="xs:boolean"/>
<xs:attribute name="s42" type="xs:boolean"/>
<xs:attribute name="s44" type="xs:boolean"/>
<xs:attribute name="s46" type="xs:boolean"/>
<xs:attribute name="s48" type="xs:boolean"/>
<xs:attribute name="s50" type="xs:boolean"/>
<xs:attribute name="s52" type="xs:boolean"/>
<xs:attribute name="s54" type="xs:boolean"/>
<xs:attribute name="s56" type="xs:boolean"/>
<xs:attribute name="s58" type="xs:boolean"/>
<xs:attribute name="s60" type="xs:boolean"/>
<xs:attribute name="s62" type="xs:boolean"/>
<xs:attribute name="s64" type="xs:boolean"/>
<xs:attribute name="s66" type="xs:boolean"/>
<xs:attribute name="s68" type="xs:boolean"/>
<xs:attribute name="s70" type="xs:boolean"/>
<xs:attribute name="s72" type="xs:boolean"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="custom" type="xs:boolean"/>
<xs:attribute name="defHeight" type="baseHeight"/>
<xs:attribute name="defSize" type="baseSize"/>
</xs:complexType>
</xs:element>
<xs:element name="patternName" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="patternNumber" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="company" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="customer" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="size" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="showDate" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
<xs:element name="showMeasurements" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
<xs:element name="measurements" type="xs:string"/>
<xs:element name="increments" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="increment" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="description" type="xs:string" use="required"/>
<xs:attribute name="name" type="shortName" use="required"/>
<xs:attribute name="formula" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="incrementName">
<xs:selector xpath="increment"/>
<xs:field xpath="@name"/>
</xs:unique>
</xs:element>
<xs:element name="draw" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="calculation" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="point" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
<xs:attribute name="x" type="xs:double"/>
<xs:attribute name="y" type="xs:double"/>
<xs:attribute name="mx" type="xs:double"/>
<xs:attribute name="my" type="xs:double"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="name" type="shortName"/>
<xs:attribute name="firstPoint" type="xs:unsignedInt"/>
<xs:attribute name="secondPoint" type="xs:unsignedInt"/>
<xs:attribute name="thirdPoint" type="xs:unsignedInt"/>
<xs:attribute name="basePoint" type="xs:unsignedInt"/>
<xs:attribute name="pShoulder" type="xs:unsignedInt"/>
<xs:attribute name="p1Line" type="xs:unsignedInt"/>
<xs:attribute name="p2Line" type="xs:unsignedInt"/>
<xs:attribute name="length" type="xs:string"/>
<xs:attribute name="angle" type="xs:string"/>
<xs:attribute name="typeLine" type="xs:string"/>
<xs:attribute name="splinePath" type="xs:unsignedInt"/>
<xs:attribute name="spline" type="xs:unsignedInt"/>
<xs:attribute name="p1Line1" type="xs:unsignedInt"/>
<xs:attribute name="p1Line2" type="xs:unsignedInt"/>
<xs:attribute name="p2Line1" type="xs:unsignedInt"/>
<xs:attribute name="p2Line2" type="xs:unsignedInt"/>
<xs:attribute name="center" type="xs:unsignedInt"/>
<xs:attribute name="radius" type="xs:string"/>
<xs:attribute name="axisP1" type="xs:unsignedInt"/>
<xs:attribute name="axisP2" type="xs:unsignedInt"/>
<xs:attribute name="arc" type="xs:unsignedInt"/>
<xs:attribute name="elArc" type="xs:unsignedInt"/>
<xs:attribute name="curve" type="xs:unsignedInt"/>
<xs:attribute name="curve1" type="xs:unsignedInt"/>
<xs:attribute name="curve2" type="xs:unsignedInt"/>
<xs:attribute name="lineColor" type="colors"/>
<xs:attribute name="color" type="colors"/>
<xs:attribute name="firstArc" type="xs:unsignedInt"/>
<xs:attribute name="secondArc" type="xs:unsignedInt"/>
<xs:attribute name="crossPoint" type="crossType"/>
<xs:attribute name="vCrossPoint" type="crossType"/>
<xs:attribute name="hCrossPoint" type="crossType"/>
<xs:attribute name="c1Center" type="xs:unsignedInt"/>
<xs:attribute name="c2Center" type="xs:unsignedInt"/>
<xs:attribute name="c1Radius" type="xs:string"/>
<xs:attribute name="c2Radius" type="xs:string"/>
<xs:attribute name="cRadius" type="xs:string"/>
<xs:attribute name="tangent" type="xs:unsignedInt"/>
<xs:attribute name="cCenter" type="xs:unsignedInt"/>
<xs:attribute name="name1" type="shortName"/>
<xs:attribute name="mx1" type="xs:double"/>
<xs:attribute name="my1" type="xs:double"/>
<xs:attribute name="name2" type="shortName"/>
<xs:attribute name="mx2" type="xs:double"/>
<xs:attribute name="my2" type="xs:double"/>
<xs:attribute name="point1" type="xs:unsignedInt"/>
<xs:attribute name="point2" type="xs:unsignedInt"/>
<xs:attribute name="dartP1" type="xs:unsignedInt"/>
<xs:attribute name="dartP2" type="xs:unsignedInt"/>
<xs:attribute name="dartP3" type="xs:unsignedInt"/>
<xs:attribute name="baseLineP1" type="xs:unsignedInt"/>
<xs:attribute name="baseLineP2" type="xs:unsignedInt"/>
</xs:complexType>
</xs:element>
<xs:element name="line" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
<xs:attribute name="firstPoint" type="xs:unsignedInt"/>
<xs:attribute name="secondPoint" type="xs:unsignedInt"/>
<xs:attribute name="typeLine" type="xs:string"/>
<xs:attribute name="lineColor" type="colors"/>
</xs:complexType>
</xs:element>
<xs:element name="operation" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="source" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="item" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="idObject" type="xs:unsignedInt" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="destination" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="item" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="idObject" type="xs:unsignedInt" use="required"/>
<xs:attribute name="mx" type="xs:double"/>
<xs:attribute name="my" type="xs:double"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
<xs:attribute name="center" type="xs:unsignedInt"/>
<xs:attribute name="angle" type="xs:string"/>
<xs:attribute name="length" type="xs:string"/>
<xs:attribute name="suffix" type="xs:string"/>
<xs:attribute name="type" type="xs:string" use="required"/>
<xs:attribute name="p1Line" type="xs:unsignedInt"/>
<xs:attribute name="p2Line" type="xs:unsignedInt"/>
<xs:attribute name="axisType" type="axisType"/>
</xs:complexType>
</xs:element>
<xs:element name="arc" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="angle1" type="xs:string"/>
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
<xs:attribute name="angle2" type="xs:string"/>
<xs:attribute name="radius" type="xs:string"/>
<xs:attribute name="center" type="xs:unsignedInt"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="color" type="colors"/>
<xs:attribute name="length" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="elArc" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="angle1" type="xs:string"/>
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
<xs:attribute name="angle2" type="xs:string"/>
<xs:attribute name="rotationAngle" type="xs:string"/>
<xs:attribute name="radius1" type="xs:string"/>
<xs:attribute name="radius2" type="xs:string"/>
<xs:attribute name="center" type="xs:unsignedInt"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="color" type="colors"/>
<xs:attribute name="length" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="spline" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="pathPoint" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="kAsm2" type="xs:string"/>
<xs:attribute name="pSpline" type="xs:unsignedInt"/>
<xs:attribute name="angle" type="xs:string"/>
<xs:attribute name="angle1" type="xs:string"/>
<xs:attribute name="angle2" type="xs:string"/>
<xs:attribute name="length1" type="xs:string"/>
<xs:attribute name="length2" type="xs:string"/>
<xs:attribute name="kAsm1" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
<xs:attribute name="kCurve" type="xs:double"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="kAsm1" type="xs:double"/>
<xs:attribute name="kAsm2" type="xs:double"/>
<xs:attribute name="angle1" type="xs:string"/>
<xs:attribute name="angle2" type="xs:string"/>
<xs:attribute name="length1" type="xs:string"/>
<xs:attribute name="length2" type="xs:string"/>
<xs:attribute name="point1" type="xs:unsignedInt"/>
<xs:attribute name="point2" type="xs:unsignedInt"/>
<xs:attribute name="point3" type="xs:unsignedInt"/>
<xs:attribute name="point4" type="xs:unsignedInt"/>
<xs:attribute name="color" type="colors"/>
<xs:attribute name="duplicate" type="xs:unsignedInt"/>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="modeling" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="point" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
<xs:attribute name="idObject" type="xs:unsignedInt"/>
<xs:attribute name="mx" type="xs:double"/>
<xs:attribute name="my" type="xs:double"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="idTool" type="xs:unsignedInt"/>
<xs:attribute name="inUse" type="xs:boolean"/>
</xs:complexType>
</xs:element>
<xs:element name="arc" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
<xs:attribute name="idObject" type="xs:unsignedInt"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="idTool" type="xs:unsignedInt"/>
<xs:attribute name="inUse" type="xs:boolean"/>
</xs:complexType>
</xs:element>
<xs:element name="elArc" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
<xs:attribute name="idObject" type="xs:unsignedInt"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="idTool" type="xs:unsignedInt"/>
<xs:attribute name="inUse" type="xs:boolean"/>
</xs:complexType>
</xs:element>
<xs:element name="spline" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
<xs:attribute name="idObject" type="xs:unsignedInt"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="idTool" type="xs:unsignedInt"/>
<xs:attribute name="inUse" type="xs:boolean"/>
</xs:complexType>
</xs:element>
<xs:element name="path" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="nodes" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="node" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="type" type="xs:string" use="required"/>
<xs:attribute name="idObject" type="xs:unsignedInt" use="required"/>
<xs:attribute name="reverse" type="xs:unsignedInt"/>
<xs:attribute name="before" type="xs:double"/>
<xs:attribute name="after" type="xs:double"/>
<xs:attribute name="angle" type="nodeAngle"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
<xs:attribute name="type" type="piecePathType"/>
<xs:attribute name="idTool" type="xs:unsignedInt"/>
<xs:attribute name="inUse" type="xs:boolean"/>
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="typeLine" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="tools" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="det" minOccurs="2" maxOccurs="2">
<xs:complexType>
<xs:sequence>
<xs:element name="nodes" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="node" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="type" type="xs:string" use="required"/>
<xs:attribute name="idObject" type="xs:unsignedInt" use="required"/>
<xs:attribute name="reverse" type="xs:unsignedInt"/>
<xs:attribute name="excluded" type="xs:boolean"/>
<xs:attribute name="before" type="xs:string"/>
<xs:attribute name="after" type="xs:string"/>
<xs:attribute name="angle" type="nodeAngle"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="csa" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="record" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="start" type="xs:unsignedInt"/>
<xs:attribute name="path" type="xs:unsignedInt" use="required"/>
<xs:attribute name="end" type="xs:unsignedInt"/>
<xs:attribute name="reverse" type="xs:boolean"/>
<xs:attribute name="includeAs" type="piecePathIncludeType"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="iPaths" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="record" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="path" type="xs:unsignedInt" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="pins" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="record" type="xs:unsignedInt" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="children" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="nodes" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="child" type="xs:unsignedInt" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="csa" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="child" type="xs:unsignedInt" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="iPaths" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="child" type="xs:unsignedInt" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="pins" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="child" type="xs:unsignedInt" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="indexD1" type="xs:unsignedInt"/>
<xs:attribute name="indexD2" type="xs:unsignedInt"/>
<xs:attribute name="inUse" type="xs:boolean"/>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="details" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="detail" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="data" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="mcp" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="cutNumber" type="xs:unsignedInt"/>
<xs:attribute name="userDef" type="xs:string"/>
<xs:attribute name="material" type="materialType"/>
<xs:attribute name="placement" type="placementType"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="letter" type="xs:string"/>
<xs:attribute name="visible" type="xs:boolean"/>
<xs:attribute name="fontSize" type="xs:unsignedInt"/>
<xs:attribute name="mx" type="xs:double"/>
<xs:attribute name="my" type="xs:double"/>
<xs:attribute name="width" type="xs:string"/>
<xs:attribute name="height" type="xs:string"/>
<xs:attribute name="rotation" type="xs:string"/>
<xs:attribute name="centerPin" type="xs:unsignedInt"/>
<xs:attribute name="topLeftPin" type="xs:unsignedInt"/>
<xs:attribute name="bottomRightPin" type="xs:unsignedInt"/>
</xs:complexType>
</xs:element>
<xs:element name="patternInfo" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="visible" type="xs:boolean"/>
<xs:attribute name="fontSize" type="xs:unsignedInt"/>
<xs:attribute name="mx" type="xs:double"/>
<xs:attribute name="my" type="xs:double"/>
<xs:attribute name="width" type="xs:string"/>
<xs:attribute name="height" type="xs:string"/>
<xs:attribute name="rotation" type="xs:string"/>
<xs:attribute name="centerPin" type="xs:unsignedInt"/>
<xs:attribute name="topLeftPin" type="xs:unsignedInt"/>
<xs:attribute name="bottomRightPin" type="xs:unsignedInt"/>
</xs:complexType>
</xs:element>
<xs:element name="grainline" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="visible" type="xs:boolean"/>
<xs:attribute name="mx" type="xs:double"/>
<xs:attribute name="my" type="xs:double"/>
<xs:attribute name="length" type="xs:string"/>
<xs:attribute name="rotation" type="xs:string"/>
<xs:attribute name="arrows" type="arrowType"/>
<xs:attribute name="centerPin" type="xs:unsignedInt"/>
<xs:attribute name="topPin" type="xs:unsignedInt"/>
<xs:attribute name="bottomPin" type="xs:unsignedInt"/>
</xs:complexType>
</xs:element>
<xs:element name="nodes" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="node" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="type" type="xs:string" use="required"/>
<xs:attribute name="idObject" type="xs:unsignedInt" use="required"/>
<xs:attribute name="reverse" type="xs:unsignedInt"/>
<xs:attribute name="excluded" type="xs:boolean"/>
<xs:attribute name="before" type="xs:string"/>
<xs:attribute name="after" type="xs:string"/>
<xs:attribute name="angle" type="nodeAngle"/>
<xs:attribute name="mx" type="xs:double"/>
<xs:attribute name="my" type="xs:double"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="csa" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="record" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="start" type="xs:unsignedInt"/>
<xs:attribute name="path" type="xs:unsignedInt" use="required"/>
<xs:attribute name="end" type="xs:unsignedInt"/>
<xs:attribute name="reverse" type="xs:boolean"/>
<xs:attribute name="includeAs" type="piecePathIncludeType"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="iPaths" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="record" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="path" type="xs:unsignedInt" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="pins" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="record" type="xs:unsignedInt" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
<xs:attribute name="version" type="pieceVersion"/>
<xs:attribute name="mx" type="xs:double"/>
<xs:attribute name="my" type="xs:double"/>
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="inLayout" type="xs:boolean"/>
<xs:attribute name="forbidFlipping" type="xs:boolean"/>
<xs:attribute name="width" type="xs:string"/>
<xs:attribute name="seamAllowance" type="xs:boolean"/>
<xs:attribute name="united" type="xs:boolean"/>
<xs:attribute name="closed" type="xs:unsignedInt"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="groups" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="group" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="item" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="object" type="xs:unsignedInt"/>
<xs:attribute name="tool" type="xs:unsignedInt"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="visible" type="xs:boolean"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="readOnly" type="xs:boolean"/>
</xs:complexType>
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="^([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^\-()+=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^\-()+=?:;\&quot;]){0,}$"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">
<xs:restriction base="xs:string">
<xs:enumeration value="mm"/>
<xs:enumeration value="cm"/>
<xs:enumeration value="inch"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="measurementsTypes">
<xs:restriction base="xs:string">
<xs:enumeration value="standard"/>
<xs:enumeration value="individual"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="formatVersion">
<xs:restriction base="xs:string">
<xs:pattern value="^(0|([1-9][0-9]*))\.(0|([1-9][0-9]*))\.(0|([1-9][0-9]*))$"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="imageExtension">
<xs:restriction base="xs:string">
<xs:enumeration value="PNG"/>
<xs:enumeration value="JPG"/>
<xs:enumeration value="BMP"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="colors">
<xs:restriction base="xs:string">
<xs:enumeration value="black"/>
<xs:enumeration value="green"/>
<xs:enumeration value="blue"/>
<xs:enumeration value="darkRed"/>
<xs:enumeration value="darkGreen"/>
<xs:enumeration value="darkBlue"/>
<xs:enumeration value="yellow"/>
<xs:enumeration value="lightsalmon"/>
<xs:enumeration value="goldenrod"/>
<xs:enumeration value="orange"/>
<xs:enumeration value="deeppink"/>
<xs:enumeration value="violet"/>
<xs:enumeration value="darkviolet"/>
<xs:enumeration value="mediumseagreen"/>
<xs:enumeration value="lime"/>
<xs:enumeration value="deepskyblue"/>
<xs:enumeration value="cornflowerblue"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="baseHeight">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="50"/>
<xs:enumeration value="56"/>
<xs:enumeration value="62"/>
<xs:enumeration value="68"/>
<xs:enumeration value="74"/>
<xs:enumeration value="80"/>
<xs:enumeration value="86"/>
<xs:enumeration value="92"/>
<xs:enumeration value="98"/>
<xs:enumeration value="104"/>
<xs:enumeration value="110"/>
<xs:enumeration value="116"/>
<xs:enumeration value="122"/>
<xs:enumeration value="128"/>
<xs:enumeration value="134"/>
<xs:enumeration value="140"/>
<xs:enumeration value="146"/>
<xs:enumeration value="152"/>
<xs:enumeration value="158"/>
<xs:enumeration value="164"/>
<xs:enumeration value="170"/>
<xs:enumeration value="176"/>
<xs:enumeration value="182"/>
<xs:enumeration value="188"/>
<xs:enumeration value="194"/>
<xs:enumeration value="200"/>
<xs:enumeration value="500"/>
<xs:enumeration value="560"/>
<xs:enumeration value="620"/>
<xs:enumeration value="680"/>
<xs:enumeration value="740"/>
<xs:enumeration value="800"/>
<xs:enumeration value="860"/>
<xs:enumeration value="920"/>
<xs:enumeration value="980"/>
<xs:enumeration value="1040"/>
<xs:enumeration value="1100"/>
<xs:enumeration value="1160"/>
<xs:enumeration value="1220"/>
<xs:enumeration value="1280"/>
<xs:enumeration value="1340"/>
<xs:enumeration value="1400"/>
<xs:enumeration value="1460"/>
<xs:enumeration value="1520"/>
<xs:enumeration value="1580"/>
<xs:enumeration value="1640"/>
<xs:enumeration value="1700"/>
<xs:enumeration value="1760"/>
<xs:enumeration value="1820"/>
<xs:enumeration value="1880"/>
<xs:enumeration value="1940"/>
<xs:enumeration value="2000"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="baseSize">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="22"/>
<xs:enumeration value="24"/>
<xs:enumeration value="26"/>
<xs:enumeration value="28"/>
<xs:enumeration value="30"/>
<xs:enumeration value="32"/>
<xs:enumeration value="34"/>
<xs:enumeration value="36"/>
<xs:enumeration value="38"/>
<xs:enumeration value="40"/>
<xs:enumeration value="42"/>
<xs:enumeration value="44"/>
<xs:enumeration value="46"/>
<xs:enumeration value="48"/>
<xs:enumeration value="50"/>
<xs:enumeration value="52"/>
<xs:enumeration value="54"/>
<xs:enumeration value="56"/>
<xs:enumeration value="58"/>
<xs:enumeration value="60"/>
<xs:enumeration value="62"/>
<xs:enumeration value="64"/>
<xs:enumeration value="66"/>
<xs:enumeration value="68"/>
<xs:enumeration value="70"/>
<xs:enumeration value="72"/>
<xs:enumeration value="220"/>
<xs:enumeration value="240"/>
<xs:enumeration value="260"/>
<xs:enumeration value="280"/>
<xs:enumeration value="300"/>
<xs:enumeration value="320"/>
<xs:enumeration value="340"/>
<xs:enumeration value="360"/>
<xs:enumeration value="380"/>
<xs:enumeration value="400"/>
<xs:enumeration value="420"/>
<xs:enumeration value="440"/>
<xs:enumeration value="460"/>
<xs:enumeration value="480"/>
<xs:enumeration value="500"/>
<xs:enumeration value="520"/>
<xs:enumeration value="540"/>
<xs:enumeration value="560"/>
<xs:enumeration value="580"/>
<xs:enumeration value="600"/>
<xs:enumeration value="620"/>
<xs:enumeration value="640"/>
<xs:enumeration value="660"/>
<xs:enumeration value="680"/>
<xs:enumeration value="700"/>
<xs:enumeration value="720"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="crossType">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="1"/>
<xs:enumeration value="2"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="axisType">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="1"/>
<xs:enumeration value="2"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="materialType">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="0"/>
<!--Fabric-->
<xs:enumeration value="1"/>
<!--Lining-->
<xs:enumeration value="2"/>
<!--Interfacing-->
<xs:enumeration value="3"/>
<!--Interlining-->
<xs:enumeration value="4"/>
<!--UserDefined-->
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="placementType">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="0"/>
<!--No placement-->
<xs:enumeration value="1"/>
<!--Cut on Fold-->
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="arrowType">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="0"/>
<!--Both-->
<xs:enumeration value="1"/>
<!--Front-->
<xs:enumeration value="2"/>
<!--Rear-->
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="pieceVersion">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="1"/>
<!--Old version-->
<xs:enumeration value="2"/>
<!--New version-->
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="nodeAngle">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="0"/>
<!--by length-->
<xs:enumeration value="1"/>
<!--by points intersections-->
<xs:enumeration value="2"/>
<!--by second edge symmetry-->
<xs:enumeration value="3"/>
<!--by first edge symmetry-->
<xs:enumeration value="4"/>
<!--by first edge right angle-->
<xs:enumeration value="5"/>
<!--by first edge right angle-->
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="piecePathType">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="1"/>
<!--custom seam allowance-->
<xs:enumeration value="2"/>
<!--internal path-->
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="piecePathIncludeType">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="0"/>
<!--as main path-->
<xs:enumeration value="1"/>
<!--as custom seam allowance-->
</xs:restriction>
</xs:simpleType>
</xs:schema>

View File

@ -107,6 +107,7 @@ const QString VAbstractPattern::AttrCutNumber = QStringLiteral("cutNumber"
const QString VAbstractPattern::AttrPlacement = QStringLiteral("placement");
const QString VAbstractPattern::AttrArrows = QStringLiteral("arrows");
const QString VAbstractPattern::AttrNodeReverse = QStringLiteral("reverse");
const QString VAbstractPattern::AttrNodeExcluded = QStringLiteral("excluded");
const QString VAbstractPattern::AttrSABefore = QStringLiteral("before");
const QString VAbstractPattern::AttrSAAfter = QStringLiteral("after");
const QString VAbstractPattern::AttrStart = QStringLiteral("start");
@ -665,6 +666,7 @@ VPieceNode VAbstractPattern::ParseSANode(const QDomElement &domElement)
{
const quint32 id = VDomDocument::GetParametrUInt(domElement, AttrIdObject, NULL_ID_STR);
const bool reverse = VDomDocument::GetParametrUInt(domElement, VAbstractPattern::AttrNodeReverse, "0");
const bool excluded = VDomDocument::GetParametrBool(domElement, VAbstractPattern::AttrNodeExcluded, falseStr);
const QString saBefore = VDomDocument::GetParametrString(domElement, VAbstractPattern::AttrSABefore,
currentSeamAllowance);
const QString saAfter = VDomDocument::GetParametrString(domElement, VAbstractPattern::AttrSAAfter,
@ -705,6 +707,7 @@ VPieceNode VAbstractPattern::ParseSANode(const QDomElement &domElement)
node.SetFormulaSABefore(saBefore);
node.SetFormulaSAAfter(saAfter);
node.SetAngleType(angle);
node.SetExcluded(excluded);
return node;
}
@ -1637,7 +1640,7 @@ QStringList VAbstractPattern::ListPointExpressions() const
// Check if new tool doesn't bring new attribute with a formula.
// If no just increment a number.
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52);
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 53);
QStringList expressions;
const QDomNodeList list = elementsByTagName(TagPoint);
@ -1709,7 +1712,7 @@ QStringList VAbstractPattern::ListArcExpressions() const
// Check if new tool doesn't bring new attribute with a formula.
// If no just increment number.
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52);
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 53);
QStringList expressions;
const QDomNodeList list = elementsByTagName(TagArc);
@ -1763,7 +1766,7 @@ QStringList VAbstractPattern::ListElArcExpressions() const
// Check if new tool doesn't bring new attribute with a formula.
// If no just increment number.
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52);
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 53);
QStringList expressions;
const QDomNodeList list = elementsByTagName(TagElArc);
@ -1834,7 +1837,7 @@ QStringList VAbstractPattern::ListPathPointExpressions() const
// Check if new tool doesn't bring new attribute with a formula.
// If no just increment number.
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52);
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 53);
QStringList expressions;
const QDomNodeList list = elementsByTagName(AttrPathPoint);
@ -1901,7 +1904,7 @@ QStringList VAbstractPattern::ListOperationExpressions() const
// Check if new tool doesn't bring new attribute with a formula.
// If no just increment number.
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52);
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 53);
QStringList expressions;
const QDomNodeList list = elementsByTagName(TagOperation);
@ -1956,7 +1959,7 @@ QStringList VAbstractPattern::ListPathExpressions() const
// Check if new tool doesn't bring new attribute with a formula.
// If no just increment number.
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52);
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 53);
QStringList expressions;
const QDomNodeList list = elementsByTagName(TagPath);
@ -2009,7 +2012,7 @@ QStringList VAbstractPattern::ListPieceExpressions() const
// Check if new tool doesn't bring new attribute with a formula.
// If no just increment number.
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52);
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 53);
QStringList expressions;
const QDomNodeList list = elementsByTagName(TagDetail);

View File

@ -217,6 +217,7 @@ public:
static const QString AttrPlacement;
static const QString AttrArrows;
static const QString AttrNodeReverse;
static const QString AttrNodeExcluded;
static const QString AttrSABefore;
static const QString AttrSAAfter;
static const QString AttrStart;

View File

@ -58,8 +58,8 @@ class QDomElement;
*/
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.4.4");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.4.4.xsd");
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.4.5");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.4.5.xsd");
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
@ -207,6 +207,8 @@ QString VPatternConverter::XSDSchema(int ver) const
case (0x000403):
return QStringLiteral("://schema/pattern/v0.4.3.xsd");
case (0x000404):
return QStringLiteral("://schema/pattern/v0.4.4.xsd");
case (0x000405):
return CurrentSchema;
default:
InvalidVersion(ver);
@ -329,6 +331,10 @@ void VPatternConverter::ApplyPatches()
ValidateXML(XSDSchema(0x000404), m_convertedFileName);
V_FALLTHROUGH
case (0x000404):
ToV0_4_5();
ValidateXML(XSDSchema(0x000405), m_convertedFileName);
V_FALLTHROUGH
case (0x000405):
break;
default:
InvalidVersion(m_ver);
@ -347,7 +353,7 @@ void VPatternConverter::DowngradeToCurrentMaxVersion()
bool VPatternConverter::IsReadOnly() const
{
// Check if attribute readOnly was not changed in file format
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 4, 4),
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 4, 5),
"Check attribute readOnly.");
// Possibly in future attribute readOnly will change position etc.
@ -676,6 +682,16 @@ void VPatternConverter::ToV0_4_4()
Save();
}
//---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::ToV0_4_5()
{
// TODO. Delete if minimal supported version is 0.4.5
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 4, 5),
"Time to refactor the code.");
SetVersion(QStringLiteral("0.4.5"));
Save();
}
//---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::TagUnitToV0_2_0()
{

View File

@ -55,10 +55,10 @@ public:
// GCC 4.6 doesn't allow constexpr and const together
#if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) <= 406
static Q_DECL_CONSTEXPR int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0);
static Q_DECL_CONSTEXPR int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 4);
static Q_DECL_CONSTEXPR int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 5);
#else
static Q_DECL_CONSTEXPR const int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0);
static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 4);
static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 5);
#endif
protected:
@ -105,6 +105,7 @@ private:
void ToV0_4_2();
void ToV0_4_3();
void ToV0_4_4();
void ToV0_4_5();
void TagUnitToV0_2_0();
void TagIncrementToV0_2_0();

View File

@ -152,6 +152,7 @@ enum class Tool : ToolVisHolderType
Midpoint,
EllipticalArc,
Pin,
InsertNode,
LAST_ONE_DO_NOT_USE //add new stuffs above this, this constant must be last and never used
};

View File

@ -121,9 +121,9 @@ QVector<QPointF> VPiece::MainPathPoints(const VContainer *data) const
}
//---------------------------------------------------------------------------------------------------------------------
QVector<VPointF> VPiece::MainPathNodePoints(const VContainer *data) const
QVector<VPointF> VPiece::MainPathNodePoints(const VContainer *data, bool showExcluded) const
{
return GetPath().PathNodePoints(data);
return GetPath().PathNodePoints(data, showExcluded);
}
//---------------------------------------------------------------------------------------------------------------------
@ -146,6 +146,11 @@ QVector<QPointF> VPiece::SeamAllowancePoints(const VContainer *data) const
for (int i = 0; i< d->m_path.CountNodes(); ++i)
{
const VPieceNode &node = d->m_path.at(i);
if (node.IsExcluded())
{
continue;// skip excluded node
}
switch (node.GetTypeTool())
{
case (Tool::NodePoint):
@ -491,12 +496,16 @@ QVector<CustomSARecord> VPiece::GetValidRecords() const
for (int i = 0; i < d->m_customSARecords.size(); ++i)
{
const CustomSARecord &record = d->m_customSARecords.at(i);
const int indexStartPoint = d->m_path.indexOfNode(record.startPoint);
const int indexEndPoint = d->m_path.indexOfNode(record.endPoint);
if (record.startPoint > NULL_ID
&& record.path > NULL_ID
&& record.endPoint > NULL_ID
&& d->m_path.indexOfNode(record.startPoint) != -1
&& d->m_path.indexOfNode(record.endPoint) != -1)
&& indexStartPoint != -1
&& not d->m_path.at(indexStartPoint).IsExcluded()
&& indexEndPoint != -1
&& not d->m_path.at(indexEndPoint).IsExcluded())
{
records.append(record);
}

View File

@ -59,7 +59,7 @@ public:
void SetPath(const VPiecePath &path);
QVector<QPointF> MainPathPoints(const VContainer *data) const;
QVector<VPointF> MainPathNodePoints(const VContainer *data) const;
QVector<VPointF> MainPathNodePoints(const VContainer *data, bool showExcluded = false) const;
QVector<QPointF> SeamAllowancePoints(const VContainer *data) const;
QPainterPath MainPathPath(const VContainer *data) const;

View File

@ -235,3 +235,15 @@ QDataStream& operator>>(QDataStream& in, VPieceNode& p)
in >> p.d->m_reverse;
return in;
}
//---------------------------------------------------------------------------------------------------------------------
bool VPieceNode::IsExcluded() const
{
return d->m_excluded;
}
//---------------------------------------------------------------------------------------------------------------------
void VPieceNode::SetExcluded(bool exclude)
{
d->m_excluded = exclude;
}

View File

@ -59,6 +59,9 @@ public:
bool GetReverse() const;
void SetReverse(bool reverse);
bool IsExcluded() const;
void SetExcluded(bool exclude);
qreal GetSABefore(const VContainer *data) const;
qreal GetSABefore(const VContainer *data, Unit unit) const;

View File

@ -43,6 +43,7 @@ public:
: m_id(NULL_ID),
m_typeTool(Tool::NodePoint),
m_reverse(false),
m_excluded(false),
m_saBefore(-1),
m_saAfter(-1),
m_formulaWidthBefore(currentSeamAllowance),
@ -54,6 +55,7 @@ public:
: m_id(id),
m_typeTool(typeTool),
m_reverse(reverse),
m_excluded(false),
m_saBefore(-1),
m_saAfter(-1),
m_formulaWidthBefore(currentSeamAllowance),
@ -71,6 +73,7 @@ public:
m_id(node.m_id),
m_typeTool(node.m_typeTool),
m_reverse(node.m_reverse),
m_excluded(node.m_excluded),
m_saBefore(node.m_saBefore),
m_saAfter(node.m_saAfter),
m_formulaWidthBefore(node.m_formulaWidthBefore),
@ -89,6 +92,10 @@ public:
/** @brief reverse true if need reverse points list for node. */
bool m_reverse;
/** @brief m_excluded true if item excluded from main path. Excluded item is not visible and also will not has
* affect on main path. Also include to exist path items automatically setted excluded. */
bool m_excluded;
qreal m_saBefore;
qreal m_saAfter;

View File

@ -243,6 +243,11 @@ QVector<QPointF> VPiecePath::PathPoints(const VContainer *data) const
QVector<QPointF> points;
for (int i = 0; i < CountNodes(); ++i)
{
if (at(i).IsExcluded())
{
continue;// skip excluded node
}
switch (at(i).GetTypeTool())
{
case (Tool::NodePoint):
@ -274,7 +279,7 @@ QVector<QPointF> VPiecePath::PathPoints(const VContainer *data) const
}
//---------------------------------------------------------------------------------------------------------------------
QVector<VPointF> VPiecePath::PathNodePoints(const VContainer *data) const
QVector<VPointF> VPiecePath::PathNodePoints(const VContainer *data, bool showExcluded) const
{
QVector<VPointF> points;
for (int i = 0; i < CountNodes(); ++i)
@ -282,10 +287,13 @@ QVector<VPointF> VPiecePath::PathNodePoints(const VContainer *data) const
switch (at(i).GetTypeTool())
{
case Tool::NodePoint:
{
if (showExcluded || not at(i).IsExcluded())
{
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(at(i).GetId());
points.append(*point);
}
}
break;
case Tool::NodeArc:
case Tool::NodeElArc:

View File

@ -71,7 +71,7 @@ public:
void SetPenType(const Qt::PenStyle &type);
QVector<QPointF> PathPoints(const VContainer *data) const;
QVector<VPointF> PathNodePoints(const VContainer *data) const;
QVector<VPointF> PathNodePoints(const VContainer *data, bool showExcluded = true) const;
QVector<VSAPoint> SeamAllowancePoints(const VContainer *data, qreal width, bool reverse) const;
QPainterPath PainterPath(const VContainer *data) const;

View File

@ -44,7 +44,8 @@ HEADERS += \
$$PWD/tools/dialogellipticalarc.h \
$$PWD/tools/piece/dialogseamallowance.h \
$$PWD/tools/dialogpiecepath.h \
$$PWD/tools/dialogpin.h
$$PWD/tools/dialogpin.h \
$$PWD/tools/dialoginsertnode.h
SOURCES += \
$$PWD/tools/dialogalongline.cpp \
@ -88,7 +89,8 @@ SOURCES += \
$$PWD/tools/dialogellipticalarc.cpp \
$$PWD/tools/piece/dialogseamallowance.cpp \
$$PWD/tools/dialogpiecepath.cpp \
$$PWD/tools/dialogpin.cpp
$$PWD/tools/dialogpin.cpp \
$$PWD/tools/dialoginsertnode.cpp
FORMS += \
$$PWD/tools/dialogalongline.ui \
@ -135,4 +137,5 @@ FORMS += \
$$PWD/tools/piece/tabs/tabpaths.ui \
$$PWD/tools/piece/tabs/tablabels.ui \
$$PWD/tools/piece/tabs/tabgrainline.ui \
$$PWD/tools/piece/tabs/tabpins.ui
$$PWD/tools/piece/tabs/tabpins.ui \
$$PWD/tools/dialoginsertnode.ui

View File

@ -68,6 +68,7 @@
#include "tools/dialogellipticalarc.h"
#include "tools/dialogpiecepath.h"
#include "tools/dialogpin.h"
#include "tools/dialoginsertnode.h"
#include "support/dialogeditwrongformula.h"
#include "support/dialogundo.h"

View File

@ -11,7 +11,11 @@
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>Elliptical arc</string>
</property>
<property name="windowIcon">
<iconset resource="../../../vmisc/share/resources/icon.qrc">
<normaloff>:/icon/64x64/icon64x64.png</normaloff>:/icon/64x64/icon64x64.png</iconset>
</property>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">

View File

@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>Flipping by axis</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>

View File

@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>Flipping by line</string>
</property>
<property name="windowIcon">
<iconset resource="../../../vmisc/share/resources/icon.qrc">

View File

@ -0,0 +1,194 @@
/************************************************************************
**
** @file dialoginsertnode.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 21 3, 2017
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2017 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#include "dialoginsertnode.h"
#include "ui_dialoginsertnode.h"
//---------------------------------------------------------------------------------------------------------------------
DialogInsertNode::DialogInsertNode(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
ui(new Ui::DialogInsertNode),
m_node(),
m_flagItem(false)
{
ui->setupUi(this);
InitOkCancel(ui);
CheckPieces();
CheckItem();
}
//---------------------------------------------------------------------------------------------------------------------
DialogInsertNode::~DialogInsertNode()
{
delete ui;
}
//---------------------------------------------------------------------------------------------------------------------
void DialogInsertNode::SetPiecesList(const QVector<quint32> &list)
{
for (int i=0; i < list.size(); ++i)
{
const VPiece piece = data->GetPiece(list.at(i));
ui->comboBoxPiece->addItem(piece.GetName(), list.at(i));
}
CheckPieces();
}
//---------------------------------------------------------------------------------------------------------------------
quint32 DialogInsertNode::GetPieceId() const
{
return getCurrentObjectId(ui->comboBoxPiece);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogInsertNode::SetPieceId(quint32 id)
{
if (ui->comboBoxPiece->count() <= 0)
{
const VPiece piece = data->GetPiece(id);
ui->comboBoxPiece->addItem(piece.GetName(), id);
}
else
{
const qint32 index = ui->comboBoxPiece->findData(id);
if (index != -1)
{
ui->comboBoxPiece->setCurrentIndex(index);
}
else
{
ui->comboBoxPiece->setCurrentIndex(0);
}
}
CheckPieces();
}
//---------------------------------------------------------------------------------------------------------------------
VPieceNode DialogInsertNode::GetNode() const
{
return m_node;
}
//---------------------------------------------------------------------------------------------------------------------
void DialogInsertNode::SetNode(const VPieceNode &node)
{
m_node = node;
m_flagItem = true;
QString name = tr("Uknown");
try
{
name = qApp->TrVars()->InternalVarToUser(data->GetGObject(m_node.GetId())->name());
}
catch (const VExceptionBadId &)
{
m_flagItem = false;
// Broken id
}
ui->labelItemName->setText(name);
ui->labelItemName->setToolTip(name);
CheckItem();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogInsertNode::ChosenObject(quint32 id, const SceneObject &type)
{
if (not prepare)
{
VPieceNode node;
switch (type)
{
case SceneObject::Arc:
node = VPieceNode(id, Tool::NodeArc);
break;
case SceneObject::ElArc:
node = VPieceNode(id, Tool::NodeElArc);
break;
case SceneObject::Point:
node = VPieceNode(id, Tool::NodePoint);
break;
case SceneObject::Spline:
node = VPieceNode(id, Tool::NodeSpline);
break;
case SceneObject::SplinePath:
node = VPieceNode(id, Tool::NodeSplinePath);
break;
case (SceneObject::Line):
case (SceneObject::Detail):
case (SceneObject::Unknown):
default:
qDebug() << "Got wrong scene object. Ignore.";
return;
}
node.SetExcluded(true);
SetNode(node);
prepare = true;
this->setModal(true);
this->show();
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogInsertNode::CheckState()
{
SCASSERT(bOk != nullptr);
bOk->setEnabled(m_flagItem && flagError);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogInsertNode::CheckPieces()
{
QColor color = okColor;
if (ui->comboBoxPiece->count() <= 0)
{
flagError = false;
color = errorColor;
}
else
{
flagError = true;
color = okColor;
}
ChangeColor(ui->labelPiece, color);
CheckState();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogInsertNode::CheckItem()
{
QColor color = okColor;
m_flagItem ? color = okColor : color = errorColor;
ChangeColor(ui->labelItem, color);
CheckState();
}

View File

@ -0,0 +1,73 @@
/************************************************************************
**
** @file dialoginsertnode.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 21 3, 2017
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2017 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef DIALOGINSERTNODE_H
#define DIALOGINSERTNODE_H
#include "dialogtool.h"
#include "../vpatterndb/vpiecenode.h"
namespace Ui
{
class DialogInsertNode;
}
class DialogInsertNode : public DialogTool
{
Q_OBJECT
public:
explicit DialogInsertNode(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
virtual ~DialogInsertNode();
virtual void SetPiecesList(const QVector<quint32> &list) Q_DECL_OVERRIDE;
quint32 GetPieceId() const;
void SetPieceId(quint32 id);
VPieceNode GetNode() const;
void SetNode(const VPieceNode &node);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
protected:
virtual void CheckState() Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(DialogInsertNode)
Ui::DialogInsertNode *ui;
VPieceNode m_node;
bool m_flagItem;
void CheckPieces();
void CheckItem();
};
#endif // DIALOGINSERTNODE_H

View File

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogInsertNode</class>
<widget class="QDialog" name="DialogInsertNode">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>244</width>
<height>103</height>
</rect>
</property>
<property name="windowTitle">
<string>Insert node</string>
</property>
<property name="windowIcon">
<iconset resource="../../../vmisc/share/resources/icon.qrc">
<normaloff>:/icon/64x64/icon64x64.png</normaloff>:/icon/64x64/icon64x64.png</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelItem">
<property name="text">
<string>Item:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="labelItemName">
<property name="text">
<string notr="true">item name</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelPiece">
<property name="text">
<string>Piece:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxPiece"/>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../../../vmisc/share/resources/icon.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DialogInsertNode</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>DialogInsertNode</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>Move</string>
</property>
<property name="windowIcon">
<iconset resource="../../../vmisc/share/resources/icon.qrc">

View File

@ -11,7 +11,11 @@
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>Pin</string>
</property>
<property name="windowIcon">
<iconset resource="../../../vmisc/share/resources/icon.qrc">
<normaloff>:/icon/64x64/icon64x64.png</normaloff>:/icon/64x64/icon64x64.png</iconset>
</property>
<property name="toolTip">
<string>Pin tool</string>
@ -53,7 +57,9 @@
</item>
</layout>
</widget>
<resources/>
<resources>
<include location="../../../vmisc/share/resources/icon.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>

View File

@ -79,6 +79,25 @@ Q_LOGGING_CATEGORY(vDialog, "v.dialog")
#define DIALOG_MAX_FORMULA_HEIGHT 64
namespace
{
//---------------------------------------------------------------------------------------------------------------------
quint32 RowId(QListWidget *listWidget, int i)
{
SCASSERT(listWidget != nullptr);
if (i < 0 || i >= listWidget->count())
{
return NULL_ID;
}
const QListWidgetItem *rowItem = listWidget->item(i);
SCASSERT(rowItem != nullptr);
const VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
return rowNode.GetId();
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogTool create dialog
@ -411,13 +430,65 @@ quint32 DialogTool::DNumber(const QString &baseName) const
}
//---------------------------------------------------------------------------------------------------------------------
quint32 DialogTool::RowId(QListWidget *listWidget, int i)
quint32 DialogTool::FindNotExcludedNodeDown(QListWidget *listWidget, int candidate)
{
SCASSERT(listWidget != nullptr);
quint32 id = NULL_ID;
if (candidate < 0 || candidate >= listWidget->count())
{
return id;
}
int i = candidate;
VPieceNode rowNode;
do
{
const QListWidgetItem *rowItem = listWidget->item(i);
SCASSERT(rowItem != nullptr);
const VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
return rowNode.GetId();
rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
if (not rowNode.IsExcluded())
{
id = rowNode.GetId();
}
++i;
}
while (rowNode.IsExcluded() && i < listWidget->count());
return id;
}
//---------------------------------------------------------------------------------------------------------------------
quint32 DialogTool::FindNotExcludedNodeUp(QListWidget *listWidget, int candidate)
{
SCASSERT(listWidget != nullptr);
quint32 id = NULL_ID;
if (candidate < 0 || candidate >= listWidget->count())
{
return id;
}
int i = candidate;
VPieceNode rowNode;
do
{
const QListWidgetItem *rowItem = listWidget->item(i);
SCASSERT(rowItem != nullptr);
rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
if (not rowNode.IsExcluded())
{
id = rowNode.GetId();
}
--i;
}
while (rowNode.IsExcluded() && i > -1);
return id;
}
//---------------------------------------------------------------------------------------------------------------------
@ -426,7 +497,9 @@ bool DialogTool::FirstPointEqualLast(QListWidget *listWidget)
SCASSERT(listWidget != nullptr);
if (listWidget->count() > 1)
{
return RowId(listWidget, 0) == RowId(listWidget, listWidget->count()-1);
const quint32 topId = FindNotExcludedNodeDown(listWidget, 0);
const quint32 bottomId = FindNotExcludedNodeUp(listWidget, listWidget->count()-1);
return topId == bottomId;
}
return false;
}
@ -437,7 +510,10 @@ bool DialogTool::DoublePoints(QListWidget *listWidget)
SCASSERT(listWidget != nullptr);
for (int i=0, sz = listWidget->count()-1; i<sz; ++i)
{
if (RowId(listWidget, i) == RowId(listWidget, i+1))
const quint32 firstId = FindNotExcludedNodeDown(listWidget, i);
const quint32 secondId = FindNotExcludedNodeDown(listWidget, firstId+1);
if (firstId == secondId)
{
return true;
}
@ -459,6 +535,14 @@ QString DialogTool::DialogWarningIcon()
return url;
}
//---------------------------------------------------------------------------------------------------------------------
QFont DialogTool::NodeFont(bool nodeExcluded)
{
QFont font("Times", 12, QFont::Bold);
font.setStrikeOut(nodeExcluded);
return font;
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogTool::GetNodeName(const VPieceNode &node) const
{
@ -516,7 +600,7 @@ void DialogTool::NewNodeItem(QListWidget *listWidget, const VPieceNode &node)
if(canAddNewPoint)
{
QListWidgetItem *item = new QListWidgetItem(name);
item->setFont(QFont("Times", 12, QFont::Bold));
item->setFont(NodeFont(node.IsExcluded()));
item->setData(Qt::UserRole, QVariant::fromValue(node));
listWidget->addItem(item);
listWidget->setCurrentRow(listWidget->count()-1);

View File

@ -266,10 +266,12 @@ protected:
virtual bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
quint32 DNumber(const QString &baseName) const;
static quint32 RowId(QListWidget *listWidget, int i);
static quint32 FindNotExcludedNodeDown(QListWidget *listWidget, int candidate);
static quint32 FindNotExcludedNodeUp(QListWidget *listWidget, int candidate);
static bool FirstPointEqualLast(QListWidget *listWidget);
static bool DoublePoints(QListWidget *listWidget);
static QString DialogWarningIcon();
static QFont NodeFont(bool nodeExcluded);
QString GetNodeName(const VPieceNode &node) const;
void NewNodeItem(QListWidget *listWidget, const VPieceNode &node);

View File

@ -587,6 +587,10 @@ void DialogSeamAllowance::ShowMainPathContextMenu(const QPoint &pos)
actionReverse->setChecked(rowNode.GetReverse());
}
QAction *actionExcluded = menu->addAction(tr("Excluded"));
actionExcluded->setCheckable(true);
actionExcluded->setChecked(rowNode.IsExcluded());
QAction *actionDelete = menu->addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
QAction *selectedAction = menu->exec(uiTabPaths->listWidgetMainPath->viewport()->mapToGlobal(pos));
@ -602,6 +606,14 @@ void DialogSeamAllowance::ShowMainPathContextMenu(const QPoint &pos)
rowItem->setText(GetNodeName(rowNode));
ValidObjects(MainPathIsValid());
}
else if (selectedAction == actionExcluded)
{
rowNode.SetExcluded(not rowNode.IsExcluded());
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
rowItem->setText(GetNodeName(rowNode));
rowItem->setFont(NodeFont(rowNode.IsExcluded()));
ValidObjects(MainPathIsValid());
}
ListChanged();
}
@ -1989,12 +2001,13 @@ QString DialogSeamAllowance::GetPathName(quint32 path, bool reverse) const
bool DialogSeamAllowance::MainPathIsValid() const
{
QString url = DialogWarningIcon();
bool valid = true;
if(CreatePiece().MainPathPoints(data).count() < 3)
{
url += tr("You need more points!");
uiTabPaths->helpLabel->setText(url);
return false;
valid = false;
}
else
{
@ -2002,23 +2015,33 @@ bool DialogSeamAllowance::MainPathIsValid() const
{
url += tr("You have to choose points in a clockwise direction!");
uiTabPaths->helpLabel->setText(url);
return false;
valid = false;
}
if (FirstPointEqualLast(uiTabPaths->listWidgetMainPath))
{
url += tr("First point cannot be equal to the last point!");
uiTabPaths->helpLabel->setText(url);
return false;
valid = false;
}
else if (DoublePoints(uiTabPaths->listWidgetMainPath))
{
url += tr("You have double points!");
uiTabPaths->helpLabel->setText(url);
return false;
valid = false;
}
}
if (valid)
{
m_ftb->SetTabText(TabOrder::Paths, tr("Paths"));
uiTabPaths->helpLabel->setText(tr("Ready!"));
return true;
}
else
{
m_ftb->SetTabText(TabOrder::Paths, tr("Paths") + QLatin1String("*"));
}
return valid;
}
//---------------------------------------------------------------------------------------------------------------------
@ -2059,7 +2082,7 @@ void DialogSeamAllowance::InitNodesList()
for (int i = 0; i < nodes.size(); ++i)
{
const VPieceNode node = nodes.at(i);
if (node.GetTypeTool() == Tool::NodePoint)
if (node.GetTypeTool() == Tool::NodePoint && not node.IsExcluded())
{
const QString name = GetNodeName(node);
@ -2283,7 +2306,7 @@ void DialogSeamAllowance::InitCSAPoint(QComboBox *box)
for (int i = 0; i < nodes.size(); ++i)
{
const VPieceNode &node = nodes.at(i);
if (node.GetTypeTool() == Tool::NodePoint)
if (node.GetTypeTool() == Tool::NodePoint && not node.IsExcluded())
{
const QString name = GetNodeName(node);
box->addItem(name, node.GetId());

View File

@ -58,8 +58,13 @@ const QString VAbstractNode::AttrIdTool = QStringLiteral("idTool");
*/
VAbstractNode::VAbstractNode(VAbstractPattern *doc, VContainer *data, const quint32 &id, const quint32 &idNode,
const QString &drawName, const quint32 &idTool, QObject *parent)
: VAbstractTool(doc, data, id, parent), parentType(ParentType::Item), idNode(idNode), idTool(idTool),
currentColor(Qt::black), m_drawName(drawName)
: VAbstractTool(doc, data, id, parent),
parentType(ParentType::Item),
idNode(idNode),
idTool(idTool),
currentColor(Qt::black),
m_drawName(drawName),
m_exluded(false)
{
_referens = 0;
}
@ -140,6 +145,18 @@ void VAbstractNode::GroupVisibility(quint32 object, bool visible)
Q_UNUSED(visible)
}
//---------------------------------------------------------------------------------------------------------------------
bool VAbstractNode::IsExluded() const
{
return m_exluded;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractNode::SetExluded(bool exluded)
{
m_exluded = exluded;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractNode::ToolCreation(const Source &typeCreation)
{

View File

@ -61,11 +61,12 @@ public:
virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE;
bool IsExluded() const;
void SetExluded(bool exluded);
protected:
ParentType parentType;
virtual void ToolCreation(const Source &typeCreation) Q_DECL_OVERRIDE;
protected:
/** @brief idNodenode id. */
quint32 idNode;
@ -77,11 +78,16 @@ protected:
QString m_drawName;
bool m_exluded;
void AddToModeling(const QDomElement &domElement);
virtual void ToolCreation(const Source &typeCreation) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE {}
virtual void ShowNode()=0;
virtual void HideNode()=0;
private:
Q_DISABLE_COPY(VAbstractNode)
};
#endif // VABSTRACTNODE_H

View File

@ -321,7 +321,7 @@ void VNodePoint::RefreshLine()
//---------------------------------------------------------------------------------------------------------------------
void VNodePoint::ShowNode()
{
if (parentType != ParentType::Scene)
if (parentType != ParentType::Scene && not m_exluded)
{
show();
}

View File

@ -624,6 +624,16 @@ QDomElement VAbstractTool::AddSANode(VAbstractPattern *doc, const QString &tagNa
}
}
const bool excluded = node.IsExcluded();
if (excluded)
{
doc->SetAttribute(nod, VAbstractPattern::AttrNodeExcluded, node.IsExcluded());
}
else
{ // For backward compatebility.
nod.removeAttribute(VAbstractPattern::AttrNodeExcluded);
}
switch (type)
{
case (Tool::NodeArc):
@ -669,36 +679,51 @@ QVector<VPieceNode> VAbstractTool::PrepareNodes(const VPiecePath &path, VMainGra
QVector<VPieceNode> nodes;
for (int i = 0; i< path.CountNodes(); ++i)
{
quint32 id = 0;
VPieceNode nodeD = path.at(i);
switch (nodeD.GetTypeTool())
const quint32 id = PrepareNode(nodeD, scene, doc, data);
if (id > NULL_ID)
{
nodeD.SetId(id);
nodes.append(nodeD);
}
}
return nodes;
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VAbstractTool::PrepareNode(const VPieceNode &node, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data)
{
SCASSERT(scene != nullptr)
SCASSERT(doc != nullptr)
SCASSERT(data != nullptr)
quint32 id = NULL_ID;
switch (node.GetTypeTool())
{
case (Tool::NodePoint):
id = CreateNode<VPointF>(data, nodeD.GetId());
VNodePoint::Create(doc, data, scene, id, nodeD.GetId(), Document::FullParse, Source::FromGui);
id = CreateNode<VPointF>(data, node.GetId());
VNodePoint::Create(doc, data, scene, id, node.GetId(), Document::FullParse, Source::FromGui);
break;
case (Tool::NodeArc):
id = CreateNode<VArc>(data, nodeD.GetId());
VNodeArc::Create(doc, data, id, nodeD.GetId(), Document::FullParse, Source::FromGui);
id = CreateNode<VArc>(data, node.GetId());
VNodeArc::Create(doc, data, id, node.GetId(), Document::FullParse, Source::FromGui);
break;
case (Tool::NodeElArc):
id = CreateNode<VEllipticalArc>(data, nodeD.GetId());
VNodeEllipticalArc::Create(doc, data, id, nodeD.GetId(), Document::FullParse, Source::FromGui);
id = CreateNode<VEllipticalArc>(data, node.GetId());
VNodeEllipticalArc::Create(doc, data, id, node.GetId(), Document::FullParse, Source::FromGui);
break;
case (Tool::NodeSpline):
id = CreateNodeSpline(data, nodeD.GetId());
VNodeSpline::Create(doc, data, id, nodeD.GetId(), Document::FullParse, Source::FromGui);
id = CreateNodeSpline(data, node.GetId());
VNodeSpline::Create(doc, data, id, node.GetId(), Document::FullParse, Source::FromGui);
break;
case (Tool::NodeSplinePath):
id = CreateNodeSplinePath(data, nodeD.GetId());
VNodeSplinePath::Create(doc, data, id, nodeD.GetId(), Document::FullParse, Source::FromGui);
id = CreateNodeSplinePath(data, node.GetId());
VNodeSplinePath::Create(doc, data, id, node.GetId(), Document::FullParse, Source::FromGui);
break;
default:
qDebug()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
break;
}
nodeD.SetId(id);
nodes.append(nodeD);
}
return nodes;
return id;
}

View File

@ -47,6 +47,7 @@
#include "vdatatool.h"
class VGraphicsSimpleTextItem;
class VAbstractNode;
/**
* @brief The VAbstractTool abstract class for all tools.
@ -150,6 +151,8 @@ protected:
static QVector<VPieceNode> PrepareNodes(const VPiecePath &path, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static quint32 PrepareNode(const VPieceNode &node, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
private:
Q_DISABLE_COPY(VAbstractTool)
};

View File

@ -166,6 +166,50 @@ void VToolSeamAllowance::Remove(bool ask)
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolSeamAllowance::InsertNode(VPieceNode node, quint32 pieceId, VMainGraphicsScene *scene,
VContainer *data, VAbstractPattern *doc)
{
SCASSERT(scene != nullptr)
SCASSERT(data != nullptr)
SCASSERT(doc != nullptr)
if (pieceId > NULL_ID)
{
VPiece oldDet;
try
{
oldDet = data->GetPiece(pieceId);
}
catch (const VExceptionBadId &)
{
return;
}
VPiece newDet = oldDet;
const quint32 id = PrepareNode(node, scene, doc, data);
if (id == NULL_ID)
{
return;
}
node.SetId(id);
newDet.GetPath().Append(node);
// Seam allowance tool already initializated and can't init the node
VToolSeamAllowance *saTool = qobject_cast<VToolSeamAllowance*>(doc->getTool(pieceId));
SCASSERT(saTool != nullptr);
InitNode(node, scene, data, doc, saTool);
SavePieceOptions *saveCommand = new SavePieceOptions(oldDet, newDet, doc, pieceId);
qApp->getUndoStack()->push(saveCommand);// First push then make a connect
data->UpdatePiece(pieceId, newDet);// Update piece because first save will not call lite update
connect(saveCommand, &SavePieceOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolSeamAllowance::AddAttributes(VAbstractPattern *doc, QDomElement &domElement, quint32 id, const VPiece &piece)
{
@ -409,6 +453,7 @@ void VToolSeamAllowance::GroupVisibility(quint32 object, bool visible)
//---------------------------------------------------------------------------------------------------------------------
void VToolSeamAllowance::FullUpdateFromFile()
{
UpdateExcludeState();
RefreshGeometry();
}
@ -1163,6 +1208,24 @@ VToolSeamAllowance::VToolSeamAllowance(VAbstractPattern *doc, VContainer *data,
UpdateGrainline();
}
//---------------------------------------------------------------------------------------------------------------------
void VToolSeamAllowance::UpdateExcludeState()
{
const VPiece detail = VAbstractTool::data.GetPiece(id);
for (int i = 0; i< detail.GetPath().CountNodes(); ++i)
{
const VPieceNode &node = detail.GetPath().at(i);
if (node.GetTypeTool() == Tool::NodePoint)
{
VNodePoint *tool = qobject_cast<VNodePoint*>(doc->getTool(node.GetId()));
SCASSERT(tool != nullptr);
tool->SetExluded(node.IsExcluded());
tool->setVisible(not node.IsExcluded());//Hide excluded point
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolSeamAllowance::RefreshGeometry()
{
@ -1394,26 +1457,46 @@ void VToolSeamAllowance::InitNodes(const VPiece &detail, VMainGraphicsScene *sce
{
for (int i = 0; i< detail.GetPath().CountNodes(); ++i)
{
switch (detail.GetPath().at(i).GetTypeTool())
InitNode(detail.GetPath().at(i), scene, &(VAbstractTool::data), doc, this);
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolSeamAllowance::InitNode(const VPieceNode &node, VMainGraphicsScene *scene, VContainer *data,
VAbstractPattern *doc, VToolSeamAllowance *parent)
{
SCASSERT(scene != nullptr)
SCASSERT(data != nullptr)
SCASSERT(doc != nullptr)
SCASSERT(parent != nullptr)
switch (node.GetTypeTool())
{
case (Tool::NodePoint):
{
VNodePoint *tool = InitTool<VNodePoint>(scene, detail.GetPath().at(i).GetId());
connect(tool, &VNodePoint::ShowContextMenu, this, &VToolSeamAllowance::contextMenuEvent);
VNodePoint *tool = qobject_cast<VNodePoint*>(doc->getTool(node.GetId()));
SCASSERT(tool != nullptr);
connect(tool, &VNodePoint::ShowContextMenu, parent, &VToolSeamAllowance::contextMenuEvent);
connect(tool, &VNodePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
tool->setParentItem(parent);
tool->SetParentType(ParentType::Item);
tool->SetExluded(node.IsExcluded());
tool->setVisible(not node.IsExcluded());//Hide excluded point
doc->IncrementReferens(node.GetId());
break;
}
case (Tool::NodeArc):
case (Tool::NodeElArc):
case (Tool::NodeSpline):
case (Tool::NodeSplinePath):
doc->IncrementReferens(VAbstractTool::data.GetGObject(detail.GetPath().at(i).GetId())->getIdTool());
doc->IncrementReferens(data->GetGObject(node.GetId())->getIdTool());
break;
default:
qDebug()<<"Get wrong tool type. Ignore.";
break;
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolSeamAllowance::InitCSAPaths(const VPiece &detail)
@ -1500,21 +1583,3 @@ void VToolSeamAllowance::ToolCreation(const Source &typeCreation)
RefreshDataInFile();
}
}
//---------------------------------------------------------------------------------------------------------------------
template <typename Tool>
/**
* @brief InitTool initial node item on scene
* @param scene pointer to scene.
* @param toolId if of tool object.
*/
Tool *VToolSeamAllowance::InitTool(VMainGraphicsScene *scene, quint32 toolId)
{
Tool *tool = qobject_cast<Tool*>(doc->getTool(toolId));
SCASSERT(tool != nullptr);
connect(tool, &Tool::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
tool->setParentItem(this);
tool->SetParentType(ParentType::Item);
doc->IncrementReferens(toolId);
return tool;
}

View File

@ -74,6 +74,9 @@ public:
void Remove(bool ask);
static void InsertNode(VPieceNode node, quint32 pieceId, VMainGraphicsScene *scene, VContainer *data,
VAbstractPattern *doc);
static void AddAttributes(VAbstractPattern *doc, QDomElement &domElement, quint32 id, const VPiece &piece);
static void AddCSARecord(VAbstractPattern *doc, QDomElement &domElement, const CustomSARecord &record);
static void AddCSARecords(VAbstractPattern *doc, QDomElement &domElement, const QVector<CustomSARecord> &records);
@ -150,6 +153,7 @@ private:
VToolSeamAllowance(VAbstractPattern *doc, VContainer *data, const quint32 &id, const Source &typeCreation,
VMainGraphicsScene *scene, const QString &m_drawName, QGraphicsItem * parent = nullptr);
void UpdateExcludeState();
void RefreshGeometry();
void SaveDialogChange();
VPieceItem::MoveTypes FindLabelGeometry(const VPatternLabelData &labelData, qreal &rotationAngle, qreal &labelWidth,
@ -158,12 +162,11 @@ private:
QPointF &pos);
void InitNodes(const VPiece &detail, VMainGraphicsScene *scene);
static void InitNode(const VPieceNode &node, VMainGraphicsScene *scene, VContainer *data, VAbstractPattern *doc,
VToolSeamAllowance *parent);
void InitCSAPaths(const VPiece &detail);
void InitInternalPaths(const VPiece &detail);
void InitPins(const VPiece &detail);
template <typename Tool>
Tool* InitTool(VMainGraphicsScene *scene, quint32 toolId);
};
#endif // VTOOLSEAMALLOWANCE_H

View File

@ -624,7 +624,11 @@ void AddNodeToNewPath(const VToolUnionDetailsInitData &initData, VPiecePath &new
qDebug()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
break;
}
newPath.Append(VPieceNode(id, node.GetTypeTool(), node.GetReverse()));
VPieceNode newNode(id, node.GetTypeTool(), node.GetReverse());
newNode.SetExcluded(node.IsExcluded());
newPath.Append(newNode);
}
//---------------------------------------------------------------------------------------------------------------------