Resolved issue #157. New feature: Passmarks tool.

Merge with feature.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-03-30 13:33:00 +03:00
commit 66d4d1cd7b
52 changed files with 3698 additions and 227 deletions

View File

@ -56,6 +56,7 @@
- [#509] Improve feature: Support internal Paths in Detail tool.
- [#619] Non writable directory prevents opening.
- [#620] Detail path not correct. Previous curve also should cut segment.
- [#157] New feature: Passmarks tool.
# Version 0.4.6
- [#594] Broken export on Mac.

View File

@ -0,0 +1,86 @@
<?xml version='1.0' encoding='UTF-8'?>
<pattern>
<!--Pattern created with Valentina (http://www.valentina-project.org/).-->
<version>0.4.6</version>
<unit>cm</unit>
<author/>
<description/>
<notes/>
<measurements/>
<increments/>
<draw name="Pattern piece 1">
<calculation>
<point type="single" x="0.79375" y="1.05833" id="1" name="A" mx="0.132292" my="0.264583"/>
<point type="endLine" typeLine="hair" id="2" name="A1" basePoint="1" mx="0.132292" lineColor="black" my="0.264583" angle="0" length="35"/>
<point type="endLine" typeLine="hair" id="3" name="A2" basePoint="1" mx="0.132292" lineColor="black" my="0.264583" angle="270" length="30"/>
<point type="pointOfIntersection" id="4" name="A3" firstPoint="2" secondPoint="3" mx="0.132292" my="0.264583"/>
<line typeLine="hair" id="5" firstPoint="3" secondPoint="4" lineColor="black"/>
<line typeLine="hair" id="6" firstPoint="2" secondPoint="4" lineColor="black"/>
<point type="alongLine" typeLine="none" id="7" name="A4" firstPoint="3" secondPoint="2" mx="0.132292" lineColor="black" my="0.264583" length="5"/>
<point type="alongLine" typeLine="none" id="8" name="A5" firstPoint="2" secondPoint="3" mx="0.132292" lineColor="black" my="0.264583" length="5"/>
<point type="alongLine" typeLine="none" id="9" name="A6" firstPoint="1" secondPoint="4" mx="0.132292" lineColor="black" my="0.264583" length="5"/>
<point type="alongLine" typeLine="none" id="10" name="A7" firstPoint="4" secondPoint="1" mx="0.132292" lineColor="black" my="0.264583" length="5"/>
<point type="endLine" typeLine="hair" id="11" name="A8" basePoint="4" mx="0.132292" lineColor="black" my="0.264583" angle="45" length="5"/>
<spline type="simpleInteractive" point4="2" angle1="331.947" angle2="206.283" id="22" color="black" length1="10.6467" length2="3.72066" point1="1"/>
<point type="alongLine" typeLine="none" id="23" name="A9" firstPoint="9" secondPoint="10" mx="0.132292" lineColor="black" my="0.264583" length="CurrentLength/2"/>
<point type="alongLine" typeLine="none" id="26" name="A10" firstPoint="1" secondPoint="2" mx="0.132292" lineColor="black" my="0.264583" length="CurrentLength/2"/>
<spline type="pathInteractive" id="28" color="black">
<pathPoint angle1="99.6112" pSpline="1" angle2="279.611" length1="0" length2="12.1117"/>
<pathPoint angle1="182.155" pSpline="23" angle2="2.155" length1="3.681" length2="7.90283"/>
<pathPoint angle1="104.746" pSpline="4" angle2="284.746" length1="7.65108" length2="0"/>
</spline>
<point type="alongLine" typeLine="none" id="36" name="A11" firstPoint="3" secondPoint="4" mx="0.132292" lineColor="black" my="0.264583" length="CurrentLength/2"/>
<point type="endLine" typeLine="hair" id="37" name="A12" basePoint="3" mx="0.132292" lineColor="black" my="0.264583" angle="270" length="5"/>
<point type="endLine" typeLine="hair" id="38" name="A13" basePoint="4" mx="0.132292" lineColor="black" my="0.264583" angle="270" length="5"/>
<point type="endLine" typeLine="hair" id="39" name="A14" basePoint="36" mx="0.132292" lineColor="black" my="0.264583" angle="270" length="8"/>
<spline type="pathInteractive" id="40" color="black">
<pathPoint angle1="68.2546" pSpline="38" angle2="248.255" length1="0" length2="3.04533"/>
<pathPoint angle1="20.525" pSpline="39" angle2="200.525" length1="6.45371" length2="5.13433"/>
<pathPoint angle1="331.658" pSpline="37" angle2="151.658" length1="7.95538" length2="1.19499"/>
</spline>
</calculation>
<modeling>
<point type="modeling" inUse="true" id="29" idObject="3" mx="0.132292" my="0.264583"/>
<point type="modeling" inUse="true" id="30" idObject="1" mx="0.132292" my="0.264583"/>
<spline type="modelingPath" inUse="true" id="31" idObject="28"/>
<point type="modeling" inUse="true" id="32" idObject="23" mx="0.132292" my="0.264583"/>
<spline type="modelingPath" inUse="true" id="33" idObject="28"/>
<point type="modeling" inUse="true" id="34" idObject="4" mx="0.132292" my="0.264583"/>
<point type="modeling" inUse="true" id="41" idObject="36" mx="0.963072" my="-2.00913"/>
<point type="modeling" inUse="true" id="42" idObject="38" mx="0.132292" my="0.264583"/>
<spline type="modelingPath" inUse="true" id="43" idObject="40"/>
<point type="modeling" inUse="true" id="44" idObject="39" mx="0.132292" my="0.264583"/>
<spline type="modelingPath" inUse="true" id="45" idObject="40"/>
<point type="modeling" inUse="true" id="46" idObject="37" mx="0.132292" my="0.264583"/>
<path type="1" typeLine="hair" inUse="true" id="47" name="test path">
<nodes>
<node type="NodePoint" idObject="42"/>
<node type="NodeSplinePath" reverse="0" idObject="43"/>
<node type="NodePoint" passmarkAngle="straightforward" passmark="true" passmarkLine="one" idObject="44"/>
<node type="NodeSplinePath" reverse="0" idObject="45"/>
<node type="NodePoint" idObject="46"/>
</nodes>
</path>
</modeling>
<details>
<detail id="35" name="Detail" forbidFlipping="true" united="false" seamAllowance="true" mx="0.290976" inLayout="true" width="1" my="35.1303" version="2">
<data rotation="0" letter="" fontSize="0" visible="false" mx="0" width="1" my="0" height="1"/>
<patternInfo rotation="0" fontSize="0" visible="false" mx="0" width="1" my="0" height="1"/>
<grainline arrows="0" rotation="1" visible="false" mx="0" my="0" length="90"/>
<nodes>
<node type="NodePoint" idObject="34"/>
<node type="NodePoint" passmarkAngle="straightforward" passmark="true" passmarkLine="three" idObject="41"/>
<node type="NodePoint" idObject="29"/>
<node type="NodePoint" idObject="30"/>
<node type="NodeSplinePath" reverse="0" idObject="31"/>
<node type="NodePoint" passmarkAngle="straightforward" passmark="true" passmarkLine="three" idObject="32"/>
<node type="NodeSplinePath" reverse="0" idObject="33"/>
</nodes>
<csa>
<record path="47" reverse="false" includeAs="1" start="34" end="29"/>
</csa>
</detail>
</details>
<groups/>
</draw>
</pattern>

View File

@ -54,6 +54,7 @@ int main(int argc, char *argv[])
qt_qhash_seed.store(0); // Lock producing random attribute order in XML
// Need to internally move a node inside a piece main path
qRegisterMetaTypeStreamOperators<VPieceNode>("VPieceNode");
#ifndef Q_OS_MAC // supports natively

View File

@ -354,6 +354,7 @@ void MainWindow::InitScenes()
sceneDetails->setTransform(ui->view->transform());
connect(ui->view, &VMainGraphicsView::NewFactor, sceneDraw, &VMainGraphicsScene::SetFactor);
connect(ui->view, &VMainGraphicsView::MouseRelease, RECEIVER(this)[this](){EndVisualization(true);});
QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
policy.setHorizontalStretch(12);
ui->view->setSizePolicy(policy);
@ -588,7 +589,6 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons
connect(scene, &VMainGraphicsScene::SelectedObject, dialogTool.data(), &DialogTool::SelectedObject);
connect(dialogTool.data(), &DialogTool::DialogClosed, this, closeDialogSlot);
connect(dialogTool.data(), &DialogTool::ToolTip, this, &MainWindow::ShowToolTip);
connect(ui->view, &VMainGraphicsView::MouseRelease, [this](){EndVisualization(true);});
ui->view->itemClicked(nullptr);
}
else

View File

@ -29,6 +29,7 @@
<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/pattern/v0.4.6.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

@ -348,6 +348,7 @@
<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:double"/>
<xs:attribute name="after" type="xs:double"/>
<xs:attribute name="angle" type="nodeAngle"/>

View File

@ -0,0 +1,899 @@
<?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="excluded" type="xs:boolean"/>
<xs:attribute name="before" type="xs:double"/>
<xs:attribute name="after" type="xs:double"/>
<xs:attribute name="angle" type="nodeAngle"/>
<xs:attribute name="passmark" type="xs:boolean"/>
<xs:attribute name="passmarkLine" type="passmarkLineType"/>
<xs:attribute name="passmarkAngle" type="passmarkAngleType"/>
</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:attribute name="passmark" type="xs:boolean"/>
<xs:attribute name="passmarkLine" type="passmarkLineType"/>
<xs:attribute name="passmarkAngle" type="passmarkAngleType"/>
</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:attribute name="passmark" type="xs:boolean"/>
<xs:attribute name="passmarkLine" type="passmarkLineType"/>
<xs:attribute name="passmarkAngle" type="passmarkAngleType"/>
</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:simpleType name="passmarkLineType">
<xs:restriction base="xs:string">
<xs:enumeration value="one"/>
<xs:enumeration value="two"/>
<xs:enumeration value="three"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="passmarkAngleType">
<xs:restriction base="xs:string">
<xs:enumeration value="straightforward"/>
<xs:enumeration value="bisector"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>

View File

@ -108,6 +108,9 @@ 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::AttrNodePassmark = QStringLiteral("passmark");
const QString VAbstractPattern::AttrNodePassmarkLine = QStringLiteral("passmarkLine");
const QString VAbstractPattern::AttrNodePassmarkAngle = QStringLiteral("passmarkAngle");
const QString VAbstractPattern::AttrSABefore = QStringLiteral("before");
const QString VAbstractPattern::AttrSAAfter = QStringLiteral("after");
const QString VAbstractPattern::AttrStart = QStringLiteral("start");
@ -673,6 +676,14 @@ VPieceNode VAbstractPattern::ParseSANode(const QDomElement &domElement)
currentSeamAllowance);
const PieceNodeAngle angle = static_cast<PieceNodeAngle>(VDomDocument::GetParametrUInt(domElement, AttrAngle, "0"));
const bool passmark = VDomDocument::GetParametrBool(domElement, VAbstractPattern::AttrNodePassmark, falseStr);
const PassmarkLineType passmarkLine = StringToPassmarkLineType(VDomDocument::GetParametrString(domElement,
VAbstractPattern::AttrNodePassmarkLine,
strOne));
const PassmarkAngleType passmarkAngle = StringToPassmarkAngleType(VDomDocument::GetParametrString(domElement,
VAbstractPattern::AttrNodePassmarkAngle,
strStraightforward));
const QString t = VDomDocument::GetParametrString(domElement, AttrType, VAbstractPattern::NodePoint);
Tool tool;
@ -708,6 +719,9 @@ VPieceNode VAbstractPattern::ParseSANode(const QDomElement &domElement)
node.SetFormulaSAAfter(saAfter);
node.SetAngleType(angle);
node.SetExcluded(excluded);
node.SetPassmark(passmark);
node.SetPassmarkLineType(passmarkLine);
node.SetPassmarkAngleType(passmarkAngle);
return node;
}

View File

@ -218,6 +218,9 @@ public:
static const QString AttrArrows;
static const QString AttrNodeReverse;
static const QString AttrNodeExcluded;
static const QString AttrNodePassmark;
static const QString AttrNodePassmarkLine;
static const QString AttrNodePassmarkAngle;
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.5");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.4.5.xsd");
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.4.6");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.4.6.xsd");
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
@ -209,6 +209,8 @@ QString VPatternConverter::XSDSchema(int ver) const
case (0x000404):
return QStringLiteral("://schema/pattern/v0.4.4.xsd");
case (0x000405):
return QStringLiteral("://schema/pattern/v0.4.5.xsd");
case (0x000406):
return CurrentSchema;
default:
InvalidVersion(ver);
@ -335,6 +337,10 @@ void VPatternConverter::ApplyPatches()
ValidateXML(XSDSchema(0x000405), m_convertedFileName);
V_FALLTHROUGH
case (0x000405):
ToV0_4_6();
ValidateXML(XSDSchema(0x000406), m_convertedFileName);
V_FALLTHROUGH
case (0x000406):
break;
default:
InvalidVersion(m_ver);
@ -353,7 +359,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, 5),
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 4, 6),
"Check attribute readOnly.");
// Possibly in future attribute readOnly will change position etc.
@ -692,6 +698,16 @@ void VPatternConverter::ToV0_4_5()
Save();
}
//---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::ToV0_4_6()
{
// TODO. Delete if minimal supported version is 0.4.6
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 4, 6),
"Time to refactor the code.");
SetVersion(QStringLiteral("0.4.6"));
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, 5);
static Q_DECL_CONSTEXPR int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 6);
#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, 5);
static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 6);
#endif
protected:
@ -106,6 +106,7 @@ private:
void ToV0_4_3();
void ToV0_4_4();
void ToV0_4_5();
void ToV0_4_6();
void TagUnitToV0_2_0();
void TagIncrementToV0_2_0();

View File

@ -935,3 +935,29 @@ QVector<QPointF> VAbstractPiece::SubPath(const QVector<QPointF> &path, int start
return subPath;
}
//---------------------------------------------------------------------------------------------------------------------
bool VAbstractPiece::IsEkvPointOnLine(const QPointF &iPoint, const QPointF &prevPoint, const QPointF &nextPoint)
{
return (VGObject::IsPointOnLineviaPDP(iPoint, prevPoint, nextPoint)
&& prevPoint == nextPoint);// not zigzag
}
//---------------------------------------------------------------------------------------------------------------------
bool VAbstractPiece::IsEkvPointOnLine(const VSAPoint &iPoint, const VSAPoint &prevPoint, const VSAPoint &nextPoint)
{
// See bug #646
bool ekvPointOnLine = false;
if (VFuzzyComparePossibleNulls(prevPoint.GetSAAfter(), iPoint.GetSABefore())
&& VFuzzyComparePossibleNulls(iPoint.GetSAAfter(), nextPoint.GetSABefore()))
{
if (VFuzzyComparePossibleNulls(prevPoint.GetSAAfter(), nextPoint.GetSABefore()))
{
ekvPointOnLine = true;
}
}
return (VGObject::IsPointOnLineviaPDP(iPoint, prevPoint, nextPoint)
&& prevPoint == nextPoint// not zigzag
&& ekvPointOnLine);
}

View File

@ -158,6 +158,9 @@ public:
static QVector<QPointF> Equidistant(const QVector<VSAPoint> &points, qreal width);
static qreal SumTrapezoids(const QVector<QPointF> &points);
static QVector<QPointF> CheckLoops(const QVector<QPointF> &points);
static QVector<QPointF> EkvPoint(const VSAPoint &p1Line1, const VSAPoint &p2Line1,
const VSAPoint &p1Line2, const VSAPoint &p2Line2, qreal width);
static QLineF ParallelLine(const VSAPoint &p1, const VSAPoint &p2, qreal width);
template <class T>
static QVector<T> CorrectEquidistantPoints(const QVector<T> &points, bool removeFirstAndLast = true);
@ -165,6 +168,7 @@ public:
protected:
template <class T>
static QVector<T> RemoveDublicates(const QVector<T> &points, bool removeFirstAndLast = true);
static qreal MaxLocalSA(const VSAPoint &p, qreal width);
private:
QSharedDataPointer<VAbstractPieceData> d;
@ -175,9 +179,6 @@ private:
static bool Crossing(const QVector<QPointF> &sub1, const QVector<QPointF> &sub2);
static QVector<QPointF> SubPath(const QVector<QPointF> &path, int startIndex, int endIndex);
static Q_DECL_CONSTEXPR qreal PointPosition(const QPointF &p, const QLineF &line);
static qreal MaxLocalSA(const VSAPoint &p, qreal width);
static QVector<QPointF> EkvPoint(const VSAPoint &p1Line1, const VSAPoint &p2Line1,
const VSAPoint &p1Line2, const VSAPoint &p2Line2, qreal width);
static QVector<QPointF> AngleByLength(const QPointF &p2, const QPointF &sp1, const QPointF &sp2, const QPointF &sp3,
qreal width);
static QVector<QPointF> AngleByIntersection(const QPointF &p1, const QPointF &p2, const QPointF &p3,
@ -195,11 +196,13 @@ private:
static QVector<QPointF> AngleBySecondRightAngle(const QPointF &p2, const QPointF &p3,
const QPointF &sp1, const QPointF &sp2, const QPointF &sp3,
qreal width);
static QLineF ParallelLine(const VSAPoint &p1, const VSAPoint &p2, qreal width);
static QLineF ParallelLine(const QPointF &p1, const QPointF &p2, qreal width);
static QPointF SingleParallelPoint(const QPointF &p1, const QPointF &p2, qreal angle, qreal width);
static QLineF BisectorLine(const QPointF &p1, const QPointF &p2, const QPointF &p3);
static qreal AngleBetweenBisectors(const QLineF &b1, const QLineF &b2);
static bool IsEkvPointOnLine(const QPointF &iPoint, const QPointF &prevPoint, const QPointF &nextPoint);
static bool IsEkvPointOnLine(const VSAPoint &iPoint, const VSAPoint &prevPoint,
const VSAPoint &nextPoint);
};
Q_DECLARE_TYPEINFO(VAbstractPiece, Q_MOVABLE_TYPE);
@ -245,16 +248,16 @@ QVector<T> VAbstractPiece::CorrectEquidistantPoints(const QVector<T> &points, bo
next = 0;
}
const QPointF &iPoint = buf1.at(i);
const QPointF &prevPoint = buf1.at(prev);
const QPointF &nextPoint = buf1.at(next);
const T &iPoint = buf1.at(i);
const T &prevPoint = buf1.at(prev);
const T &nextPoint = buf1.at(next);
if ((not VGObject::IsPointOnLineviaPDP(iPoint, prevPoint, nextPoint) && prevPoint != nextPoint)// not zigzag
if (not IsEkvPointOnLine(iPoint, prevPoint, nextPoint)
// If RemoveDublicates does not remove these points it is a valid case.
// Case where last point equal first point
|| ((i == 0 || i == buf1.size() - 1) && (iPoint == prevPoint || iPoint == nextPoint)))
{
buf2.append(buf1.at(i));
buf2.append(iPoint);
prev = -1;
}
}

View File

@ -299,14 +299,13 @@ QVector<QPointF> CorrectPosition(const QRectF &parentBoundingRect, QVector<QPoin
}
//---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> RoundPoints(const QVector<QPointF> &points)
QVector<QPointF> RoundPoints(QVector<QPointF> points)
{
QVector<QPointF> p;
for (int i=0; i < points.size(); ++i)
{
p.append(QPointF(qRound(points.at(i).x()), qRound(points.at(i).y())));
points[i] = QPointF(qRound(points.at(i).x()), qRound(points.at(i).y()));
}
return p;
return points;
}
//---------------------------------------------------------------------------------------------------------------------
@ -385,6 +384,7 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, const VContainer *pattern
det.SetCountourPoints(piece.MainPathPoints(pattern));
det.SetSeamAllowancePoints(piece.SeamAllowancePoints(pattern), piece.IsSeamAllowance());
det.SetInternalPaths(ConvertInternalPaths(piece, pattern));
det.SetPassmarks(piece.PassmarksLines(pattern));
det.SetName(piece.GetName());
@ -803,6 +803,21 @@ void VLayoutPiece::SetLayoutAllowancePoints()
}
}
//---------------------------------------------------------------------------------------------------------------------
QVector<QLineF> VLayoutPiece::GetPassmarks() const
{
return Map(d->passmarks);
}
//---------------------------------------------------------------------------------------------------------------------
void VLayoutPiece::SetPassmarks(const QVector<QLineF> &passmarks)
{
if (IsSeamAllowance())
{
d->passmarks = passmarks;
}
}
//---------------------------------------------------------------------------------------------------------------------
QVector<VLayoutPiecePath> VLayoutPiece::GetInternalPaths() const
{
@ -816,9 +831,10 @@ void VLayoutPiece::SetInternalPaths(const QVector<VLayoutPiecePath> &internalPat
}
//---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VLayoutPiece::Map(const QVector<QPointF> &points) const
template <class T>
QVector<T> VLayoutPiece::Map(const QVector<T> &points) const
{
QVector<QPointF> p;
QVector<T> p;
for (int i = 0; i < points.size(); ++i)
{
p.append(d->matrix.map(points.at(i)));
@ -826,7 +842,7 @@ QVector<QPointF> VLayoutPiece::Map(const QVector<QPointF> &points) const
if (d->mirror)
{
QList<QPointF> list = p.toList();
QList<T> list = p.toList();
for (int k=0, s=list.size(), max=(s/2); k<max; k++)
{
list.swap(k, s-(1+k));
@ -853,6 +869,7 @@ QPainterPath VLayoutPiece::ContourPath() const
// seam allowance
if (IsSeamAllowance() == true)
{
// Draw seam allowance
points = GetSeamAllowancePoints();
if (points.last().toPoint() != points.first().toPoint())
@ -868,6 +885,17 @@ QPainterPath VLayoutPiece::ContourPath() const
}
path.addPath(ekv);
// Draw passmarks
const QVector<QLineF> passmarks = GetPassmarks();
QPainterPath passmaksPath;
for (qint32 i = 0; i < passmarks.count(); ++i)
{
passmaksPath.moveTo(passmarks.at(i).p1());
passmaksPath.lineTo(passmarks.at(i).p2());
}
path.addPath(passmaksPath);
path.setFillRule(Qt::WindingFill);
}

View File

@ -73,6 +73,9 @@ public:
QVector<QPointF> GetLayoutAllowancePoints() const;
void SetLayoutAllowancePoints();
QVector<QLineF> GetPassmarks() const;
void SetPassmarks(const QVector<QLineF> &passmarks);
QVector<VLayoutPiecePath> GetInternalPaths() const;
void SetInternalPaths(const QVector<VLayoutPiecePath> &internalPaths);
@ -128,7 +131,8 @@ private:
void CreateInternalPathItem(int i, QGraphicsItem *parent) const;
void CreateGrainlineItem(QGraphicsItem *parent) const;
QVector<QPointF> Map(const QVector<QPointF> &points) const;
template <class T>
QVector<T> Map(const QVector<T> &points) const;
QLineF Edge(const QVector<QPointF> &path, int i) const;
int EdgeByPoint(const QVector<QPointF> &path, const QPointF &p1) const;

View File

@ -52,6 +52,7 @@ public:
: contour(),
seamAllowance(),
layoutAllowance(),
passmarks(),
m_internalPaths(),
matrix(),
layoutWidth(0),
@ -68,6 +69,7 @@ public:
contour(detail.contour),
seamAllowance(detail.seamAllowance),
layoutAllowance(detail.layoutAllowance),
passmarks(detail.passmarks),
m_internalPaths(detail.m_internalPaths),
matrix(detail.matrix),
layoutWidth(detail.layoutWidth),
@ -90,6 +92,9 @@ public:
/** @brief layoutAllowance list of layout allowance points. */
QVector<QPointF> layoutAllowance;
/** @brief passmarks list of passmakrs. */
QVector<QLineF> passmarks;
/** @brief m_internalPaths list of internal paths. */
QVector<VLayoutPiecePath> m_internalPaths;

View File

@ -2022,3 +2022,80 @@ void InitHighDpiScaling(int argc, char *argv[])
#endif
}
}
const QString strOne = QStringLiteral("one");
const QString strTwo = QStringLiteral("two");
const QString strThree = QStringLiteral("three");
//---------------------------------------------------------------------------------------------------------------------
QString PassmarkLineTypeToString(PassmarkLineType type)
{
switch(type)
{
case PassmarkLineType::OneLine:
return strOne;
case PassmarkLineType::TwoLines:
return strTwo;
case PassmarkLineType::ThreeLines:
return strThree;
default:
break;
}
return strOne;
}
//---------------------------------------------------------------------------------------------------------------------
PassmarkLineType StringToPassmarkLineType(const QString &value)
{
const QStringList values = QStringList() << strOne << strTwo << strThree;
switch(values.indexOf(value))
{
case 0:
return PassmarkLineType::OneLine;
case 1:
return PassmarkLineType::TwoLines;
case 2:
return PassmarkLineType::ThreeLines;
default:
break;
}
return PassmarkLineType::OneLine;
}
const QString strStraightforward = QStringLiteral("straightforward");
const QString strBisector = QStringLiteral("bisector");
//---------------------------------------------------------------------------------------------------------------------
QString PassmarkAngleTypeToString(PassmarkAngleType type)
{
switch(type)
{
case PassmarkAngleType::Straightforward:
return strStraightforward;
case PassmarkAngleType::Bisector:
return strBisector;
default:
break;
}
return strStraightforward;
}
//---------------------------------------------------------------------------------------------------------------------
PassmarkAngleType StringToPassmarkAngleType(const QString &value)
{
const QStringList values = QStringList() << strStraightforward << strBisector;
switch(values.indexOf(value))
{
case 0:
return PassmarkAngleType::Straightforward;
case 1:
return PassmarkAngleType::Bisector;
default:
break;
}
return PassmarkAngleType::Straightforward;
}

View File

@ -89,6 +89,25 @@ enum class PieceNodeAngle : unsigned char
BySecondEdgeRightAngle
};
enum class PassmarkLineType : unsigned char
{
OneLine = 0, // Default
TwoLines,
ThreeLines
};
QString PassmarkLineTypeToString(PassmarkLineType type);
PassmarkLineType StringToPassmarkLineType(const QString &value);
enum class PassmarkAngleType : unsigned char
{
Straightforward = 0, // Default
Bisector
};
QString PassmarkAngleTypeToString(PassmarkAngleType type);
PassmarkAngleType StringToPassmarkAngleType(const QString &value);
enum class PiecePathIncludeType : unsigned char
{
AsMainPath = 0,
@ -677,6 +696,13 @@ extern const QString degreeSymbol;
extern const QString trueStr;
extern const QString falseStr;
extern const QString strOne;
extern const QString strTwo;
extern const QString strThree;
extern const QString strStraightforward;
extern const QString strBisector;
void SetOverrideCursor(const QString & pixmapPath, int hotX = -1, int hotY = -1);
void SetOverrideCursor(Qt::CursorShape shape);
void RestoreOverrideCursor(const QString & pixmapPath);

View File

@ -74,5 +74,7 @@
<file>icon/32x32/paths@2x.png</file>
<file>icon/32x32/pins.png</file>
<file>icon/32x32/pins@2x.png</file>
<file>icon/32x32/passmark.png</file>
<file>icon/32x32/passmark@2x.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
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="Layer_1"
x="0px"
y="0px"
viewBox="0 0 348.1 348.1"
style="enable-background:new 0 0 348.1 348.1;"
xml:space="preserve"
sodipodi:docname="passmark.svg"
inkscape:export-filename="/home/dismine/CAD/Valentina_0.5.x/valentina/src/libs/vmisc/share/resources/icon/32x32/passmark.png"
inkscape:export-xdpi="8.8250504"
inkscape:export-ydpi="8.8250504"
inkscape:version="0.92.1 unknown"><metadata
id="metadata43"><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="defs41" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1500"
inkscape:window-height="941"
id="namedview39"
showgrid="false"
inkscape:zoom="0.95878884"
inkscape:cx="309.49411"
inkscape:cy="242.53486"
inkscape:window-x="160"
inkscape:window-y="34"
inkscape:window-maximized="0"
inkscape:current-layer="Layer_1" /><g
id="g8" /><g
id="g10" /><g
id="g12" /><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" /><path
style="fill:#40c0e7;fill-opacity:1;fill-rule:evenodd;stroke:#40c0e7;stroke-width:26.50922966;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 14.766461,125.24325 212.73792,337.58203"
id="path4499-6"
inkscape:connector-curvature="0" /><path
style="fill:#1e1b0f;fill-opacity:1;fill-rule:evenodd;stroke:#40c0e7;stroke-width:26.6836853;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 73.263343,70.634795 274.48873,282.53507"
id="path4499-6-7"
inkscape:connector-curvature="0" /><path
style="fill:#1e1b0f;fill-opacity:1;fill-rule:evenodd;stroke:#40c0e7;stroke-width:26.50922966;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 133.84547,11.64291 333.75508,222.15799"
id="path4499-6-5"
inkscape:connector-curvature="0" /></svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -66,6 +66,91 @@ QVector<quint32> PieceMissingNodes(const QVector<quint32> &d1Nodes, const QVecto
return r;
}
const qreal passmarkGap = (1.5/*mm*/ / 25.4) * PrintDPI;
//---------------------------------------------------------------------------------------------------------------------
QVector<QLineF> CreateTwoPassmarkLines(const QLineF &line)
{
QPointF l1p1;
{
QLineF line1 = line;
line1.setAngle(line1.angle() + 90);
line1.setLength(passmarkGap/2.);
l1p1 = line1.p2();
}
QPointF l2p1;
{
QLineF line2 = line;
line2.setAngle(line2.angle() - 90);
line2.setLength(passmarkGap/2.);
l2p1 = line2.p2();
}
QPointF l1p2;
{
QLineF line1 = QLineF(line.p2(), line.p1());
line1.setAngle(line1.angle() - 90);
line1.setLength(passmarkGap/2.);
l1p2 = line1.p2();
}
QPointF l2p2;
{
QLineF line2 = QLineF(line.p2(), line.p1());
line2.setAngle(line2.angle() + 90);
line2.setLength(passmarkGap/2.);
l2p2 = line2.p2();
}
QVector<QLineF> lines;
lines.append(QLineF(l1p1, l1p2));
lines.append(QLineF(l2p1, l2p2));
return lines;
}
//---------------------------------------------------------------------------------------------------------------------
QVector<QLineF> CreateThreePassmarkLines(const QLineF &line)
{
QPointF l1p1;
{
QLineF line1 = line;
line1.setAngle(line1.angle() + 90);
line1.setLength(passmarkGap);
l1p1 = line1.p2();
}
QPointF l2p1;
{
QLineF line2 = line;
line2.setAngle(line2.angle() - 90);
line2.setLength(passmarkGap);
l2p1 = line2.p2();
}
QPointF l1p2;
{
QLineF line1 = QLineF(line.p2(), line.p1());
line1.setAngle(line1.angle() - 90);
line1.setLength(passmarkGap);
l1p2 = line1.p2();
}
QPointF l2p2;
{
QLineF line2 = QLineF(line.p2(), line.p1());
line2.setAngle(line2.angle() + 90);
line2.setLength(passmarkGap);
l2p2 = line2.p2();
}
QVector<QLineF> lines;
lines.append(QLineF(l1p1, l1p2));
lines.append(line);
lines.append(QLineF(l2p1, l2p2));
return lines;
}
}
//---------------------------------------------------------------------------------------------------------------------
@ -137,15 +222,16 @@ QVector<QPointF> VPiece::SeamAllowancePoints(const VContainer *data) const
return QVector<QPointF>();
}
const QVector<CustomSARecord> records = GetValidRecords();
const QVector<CustomSARecord> records = FilterRecords(GetValidRecords());
int recordIndex = -1;
bool insertingCSA = false;
const qreal width = ToPixel(GetSAWidth(), *data->GetPatternUnit());
const QVector<VPieceNode> unitedPath = GetUnitedPath(data);
QVector<VSAPoint> pointsEkv;
for (int i = 0; i< d->m_path.CountNodes(); ++i)
for (int i = 0; i< unitedPath.size(); ++i)
{
const VPieceNode &node = d->m_path.at(i);
const VPieceNode &node = unitedPath.at(i);
if (node.IsExcluded())
{
continue;// skip excluded node
@ -160,22 +246,19 @@ QVector<QPointF> VPiece::SeamAllowancePoints(const VContainer *data) const
pointsEkv.append(VPiecePath::PreparePointEkv(node, data));
recordIndex = IsCSAStart(records, node.GetId());
if (recordIndex != -1)
if (recordIndex != -1 && records.at(recordIndex).includeType == PiecePathIncludeType::AsCustomSA)
{
insertingCSA = true;
const VPiecePath path = data->GetPiecePath(records.at(recordIndex).path);
QVector<VSAPoint> r = path.SeamAllowancePoints(data, width, records.at(recordIndex).reverse);
if (records.at(recordIndex).includeType == PiecePathIncludeType::AsCustomSA)
{
for (int j = 0; j < r.size(); ++j)
{
r[j].SetAngleType(PieceNodeAngle::ByLength);
r[j].SetSABefore(0);
r[j].SetSAAfter(0);
}
}
pointsEkv += r;
}
@ -201,8 +284,8 @@ QVector<QPointF> VPiece::SeamAllowancePoints(const VContainer *data) const
{
const QSharedPointer<VAbstractCurve> curve = data->GeometricObject<VAbstractCurve>(node.GetId());
pointsEkv += VPiecePath::CurveSeamAllowanceSegment(data, d->m_path.GetNodes(), curve, i,
node.GetReverse(), width);
pointsEkv += VPiecePath::CurveSeamAllowanceSegment(data, unitedPath, curve, i, node.GetReverse(),
width);
}
}
break;
@ -215,6 +298,53 @@ QVector<QPointF> VPiece::SeamAllowancePoints(const VContainer *data) const
return Equidistant(pointsEkv, width);
}
//---------------------------------------------------------------------------------------------------------------------
QVector<QLineF> VPiece::PassmarksLines(const VContainer *data) const
{
const QVector<VPieceNode> unitedPath = GetUnitedPath(data);
if (not IsSeamAllowance() || not IsPassmarksPossible(unitedPath))
{
return QVector<QLineF>();
}
QVector<QLineF> passmarks;
for (int i = 0; i< unitedPath.size(); ++i)
{
const VPieceNode &node = unitedPath.at(i);
if (node.IsExcluded() || not node.IsPassmark())
{
continue;// skip node
}
int passmarkIndex = i;
int previousIndex = 0;
if (passmarkIndex == 0)
{
previousIndex = VPiecePath::FindInLoopNotExcludedUp(unitedPath.size()-1, unitedPath);
}
else
{
previousIndex = VPiecePath::FindInLoopNotExcludedUp(passmarkIndex-1, unitedPath);
}
int nextIndex = 0;
if (passmarkIndex == unitedPath.size()-1)
{
nextIndex = VPiecePath::FindInLoopNotExcludedDown(0, unitedPath);
}
else
{
nextIndex = VPiecePath::FindInLoopNotExcludedDown(passmarkIndex+1, unitedPath);
}
passmarks += CreatePassmark(unitedPath, previousIndex, passmarkIndex, nextIndex, data);
}
return passmarks;
}
//---------------------------------------------------------------------------------------------------------------------
QPainterPath VPiece::MainPathPath(const VContainer *data) const
{
@ -259,6 +389,30 @@ QPainterPath VPiece::SeamAllowancePath(const VContainer *data) const
return ekv;
}
//---------------------------------------------------------------------------------------------------------------------
QPainterPath VPiece::PassmarksPath(const VContainer *data) const
{
const QVector<QLineF> passmarks = PassmarksLines(data);
QPainterPath path;
// seam allowence
if (IsSeamAllowance())
{
if (not passmarks.isEmpty())
{
for (qint32 i = 0; i < passmarks.count(); ++i)
{
path.moveTo(passmarks.at(i).p1());
path.lineTo(passmarks.at(i).p2());
}
path.setFillRule(Qt::WindingFill);
}
}
return path;
}
//---------------------------------------------------------------------------------------------------------------------
qreal VPiece::GetMx() const
{
@ -489,6 +643,47 @@ const VGrainlineData &VPiece::GetGrainlineGeometry() const
return d->m_glGrainline;
}
//---------------------------------------------------------------------------------------------------------------------
QVector<VPieceNode> VPiece::GetUnitedPath(const VContainer *data) const
{
SCASSERT(data != nullptr)
QVector<VPieceNode> united = d->m_path.GetNodes();
const QVector<CustomSARecord> records = FilterRecords(GetValidRecords());
for (int i = 0; i < records.size(); ++i)
{
if (records.at(i).includeType == PiecePathIncludeType::AsMainPath)
{
const int indexStartPoint = VPiecePath::indexOfNode(united, records.at(i).startPoint);
const int indexEndPoint = VPiecePath::indexOfNode(united, records.at(i).endPoint);
if (indexStartPoint == -1 || indexEndPoint == -1)
{
continue;
}
const QVector<VPieceNode> midBefore = united.mid(0, indexStartPoint+1);
const QVector<VPieceNode> midAfter = united.mid(indexEndPoint);
QVector<VPieceNode> customNodes = data->GetPiecePath(records.at(i).path).GetNodes();
if (records.at(i).reverse)
{
customNodes = VGObject::GetReversePoints(customNodes);
// Additionally reverse all curves
for (int j = 0; j < customNodes.size(); ++j)
{ // don't make a check because node point will ignore the change
customNodes[j].SetReverse(not customNodes.at(j).GetReverse());
}
}
united = midBefore + customNodes + midAfter;
}
}
return united;
}
//---------------------------------------------------------------------------------------------------------------------
QVector<CustomSARecord> VPiece::GetValidRecords() const
{
@ -505,7 +700,8 @@ QVector<CustomSARecord> VPiece::GetValidRecords() const
&& indexStartPoint != -1
&& not d->m_path.at(indexStartPoint).IsExcluded()
&& indexEndPoint != -1
&& not d->m_path.at(indexEndPoint).IsExcluded())
&& not d->m_path.at(indexEndPoint).IsExcluded()
&& indexStartPoint < indexEndPoint)
{
records.append(record);
}
@ -513,6 +709,319 @@ QVector<CustomSARecord> VPiece::GetValidRecords() const
return records;
}
//---------------------------------------------------------------------------------------------------------------------
QVector<CustomSARecord> VPiece::FilterRecords(QVector<CustomSARecord> records) const
{
if (records.size() < 2)
{
return records;
}
bool foundFilter = false;// Need in case "filter" will stay empty.
CustomSARecord filter;
int startIndex = d->m_path.CountNodes()-1;
for (int i = 0; i < records.size(); ++i)
{
const int indexStartPoint = d->m_path.indexOfNode(records.at(i).startPoint);
if (indexStartPoint < startIndex)
{
startIndex = i;
filter = records.at(i);
foundFilter = true;
}
}
if (not foundFilter)
{
return records; // return as is
}
records.remove(startIndex);
QVector<CustomSARecord> secondRound;
for (int i = 0; i < records.size(); ++i)
{
const int indexStartPoint = d->m_path.indexOfNode(records.at(i).startPoint);
const int indexEndPoint = d->m_path.indexOfNode(filter.endPoint);
if (indexStartPoint > indexEndPoint)
{
secondRound.append(records.at(i));
}
}
QVector<CustomSARecord> filtered;
filtered.append(filter);
filtered += FilterRecords(secondRound);
return filtered;
}
//---------------------------------------------------------------------------------------------------------------------
QVector<VSAPoint> VPiece::GetNodeSAPoints(const QVector<VPieceNode> &path, int index, const VContainer *data) const
{
SCASSERT(data != nullptr)
if (index < 0 || index >= path.size())
{
return QVector<VSAPoint>();
}
const VPieceNode &node = path.at(index);
QVector<VSAPoint> points;
if (node.GetTypeTool() == Tool::NodePoint)
{
points.append(VPiecePath::PreparePointEkv(node, data));
}
else
{
const QSharedPointer<VAbstractCurve> curve = data->GeometricObject<VAbstractCurve>(node.GetId());
const qreal width = ToPixel(GetSAWidth(), *data->GetPatternUnit());
points += VPiecePath::CurveSeamAllowanceSegment(data, path, curve, index, node.GetReverse(), width);
}
return points;
}
//---------------------------------------------------------------------------------------------------------------------
bool VPiece::GetPassmarkSAPoint(const QVector<VPieceNode> &path, int index, const VContainer *data,
VSAPoint &point) const
{
SCASSERT(data != nullptr)
const QVector<VSAPoint> points = GetNodeSAPoints(path, index, data);
if (points.isEmpty() || points.size() > 1)
{
return false;
}
point = points.first();
return true;
}
//---------------------------------------------------------------------------------------------------------------------
bool VPiece::GetPassmarkPreviousSAPoint(const QVector<VPieceNode> &path, int index, const VSAPoint &passmarkSAPoint,
const VContainer *data, VSAPoint &point) const
{
SCASSERT(data != nullptr)
const QVector<VSAPoint> points = GetNodeSAPoints(path, index, data);
if (points.isEmpty())
{
return false; // Something wrong
}
bool found = false;
int nodeIndex = points.size()-1;
do
{
const VSAPoint previous = points.at(nodeIndex);
if (passmarkSAPoint.toPoint() != previous.toPoint())
{
point = previous;
found = true;
}
--nodeIndex;
} while (nodeIndex >= 0 && not found);
if (not found)
{
return false; // Something wrong
}
return true;
}
//---------------------------------------------------------------------------------------------------------------------
bool VPiece::GetPassmarkNextSAPoint(const QVector<VPieceNode> &path, int index, const VSAPoint &passmarkSAPoint,
const VContainer *data, VSAPoint &point) const
{
const QVector<VSAPoint> points = GetNodeSAPoints(path, index, data);
if (points.isEmpty())
{
return false; // Something wrong
}
bool found = false;
int nodeIndex = 0;
do
{
const VSAPoint next = points.at(nodeIndex);
if (passmarkSAPoint.toPoint() != next.toPoint())
{
point = next;
found = true;
}
++nodeIndex;
} while (nodeIndex < points.size() && not found);
if (not found)
{
return false; // Something wrong
}
return true;
}
//---------------------------------------------------------------------------------------------------------------------
bool VPiece::GetSeamPassmarkSAPoint(const VSAPoint &previousSAPoint, const VSAPoint &passmarkSAPoint,
const VSAPoint &nextSAPoint, const VContainer *data, QPointF &point) const
{
SCASSERT(data != nullptr)
const qreal width = ToPixel(GetSAWidth(), *data->GetPatternUnit());
const QVector<QPointF> ekvPoints = EkvPoint(previousSAPoint, passmarkSAPoint, nextSAPoint, passmarkSAPoint, width);
if (ekvPoints.isEmpty())
{ // Just in case
return false; // Something wrong
}
if (ekvPoints.size() == 1 || ekvPoints.size() > 2)
{
point = ekvPoints.first();
}
else if (ekvPoints.size() == 2)
{
QLineF line = QLineF(ekvPoints.at(0), ekvPoints.at(1));
line.setLength(line.length()/2.);
point = line.p2();
}
return true;
}
//---------------------------------------------------------------------------------------------------------------------
bool VPiece::IsPassmarksPossible(const QVector<VPieceNode> &path) const
{
int countPointNodes = 0;
int countOthers = 0;
for (int i = 0; i< path.size(); ++i)
{
const VPieceNode &node = path.at(i);
if (node.IsExcluded())
{
continue;// skip node
}
node.GetTypeTool() == Tool::NodePoint ? ++countPointNodes : ++countOthers;
}
return countPointNodes >= 3 || (countPointNodes >= 1 && countOthers >= 1);
}
//---------------------------------------------------------------------------------------------------------------------
bool VPiece::IsPassmarkVisible(const QVector<VPieceNode> &path, int passmarkIndex) const
{
if (passmarkIndex < 0 || passmarkIndex >= path.size())
{
return false;
}
const VPieceNode &node = path.at(passmarkIndex);
if (node.GetTypeTool() != Tool::NodePoint || not node.IsPassmark() || node.IsExcluded())
{
return false;
}
const QVector<CustomSARecord> records = FilterRecords(GetValidRecords());
if (records.isEmpty())
{
return true;
}
for (int i = 0; i < records.size(); ++i)
{
if (records.at(i).includeType == PiecePathIncludeType::AsCustomSA)
{
const int indexStartPoint = VPiecePath::indexOfNode(path, records.at(i).startPoint);
const int indexEndPoint = VPiecePath::indexOfNode(path, records.at(i).endPoint);
if (passmarkIndex > indexStartPoint && passmarkIndex < indexEndPoint)
{
return false;
}
}
}
return true;
}
//---------------------------------------------------------------------------------------------------------------------
QVector<QLineF> VPiece::CreatePassmark(const QVector<VPieceNode> &path, int previousIndex, int passmarkIndex,
int nextIndex, const VContainer *data) const
{
SCASSERT(data != nullptr);
if (not IsPassmarkVisible(path, passmarkIndex))
{
return QVector<QLineF>();
}
VSAPoint passmarkSAPoint;
if (not GetPassmarkSAPoint(path, passmarkIndex, data, passmarkSAPoint))
{
return QVector<QLineF>(); // Something wrong
}
VSAPoint previousSAPoint;
if (not GetPassmarkPreviousSAPoint(path, previousIndex, passmarkSAPoint, data, previousSAPoint))
{
return QVector<QLineF>(); // Something wrong
}
VSAPoint nextSAPoint;
if (not GetPassmarkNextSAPoint(path, nextIndex, passmarkSAPoint, data, nextSAPoint))
{
return QVector<QLineF>(); // Something wrong
}
QPointF seamPassmarkSAPoint;
if (not GetSeamPassmarkSAPoint(previousSAPoint, passmarkSAPoint, nextSAPoint, data, seamPassmarkSAPoint))
{
return QVector<QLineF>(); // Something wrong
}
const qreal width = ToPixel(GetSAWidth(), *data->GetPatternUnit());
const QLineF bigLine1 = ParallelLine(previousSAPoint, passmarkSAPoint, width );
const QLineF bigLine2 = ParallelLine(passmarkSAPoint, nextSAPoint, width );
QVector<QLineF> passmarksLines;
const qreal passmarkLength = VAbstractPiece::MaxLocalSA(passmarkSAPoint, width) * 0.25;
const VPieceNode &node = path.at(passmarkIndex);
if (node.GetPassmarkAngleType() == PassmarkAngleType::Straightforward)
{
QLineF line = QLineF(seamPassmarkSAPoint, passmarkSAPoint);
line.setLength(passmarkLength);
if (node.GetPassmarkLineType() == PassmarkLineType::TwoLines)
{
passmarksLines += CreateTwoPassmarkLines(line);
}
else if (node.GetPassmarkLineType() == PassmarkLineType::ThreeLines)
{
passmarksLines += CreateThreePassmarkLines(line);
}
else
{
passmarksLines.append(line);
}
}
else
{
QLineF edge1 = QLineF(seamPassmarkSAPoint, bigLine1.p1());
QLineF edge2 = QLineF(seamPassmarkSAPoint, bigLine2.p2());
edge1.setAngle(edge1.angle() + edge1.angleTo(edge2)/2.);
edge1.setLength(passmarkLength);
passmarksLines.append(edge1);
}
return passmarksLines;
}
//---------------------------------------------------------------------------------------------------------------------
int VPiece::IsCSAStart(const QVector<CustomSARecord> &records, quint32 id)
{

View File

@ -61,9 +61,11 @@ public:
QVector<QPointF> MainPathPoints(const VContainer *data) const;
QVector<VPointF> MainPathNodePoints(const VContainer *data, bool showExcluded = false) const;
QVector<QPointF> SeamAllowancePoints(const VContainer *data) const;
QVector<QLineF> PassmarksLines(const VContainer *data) const;
QPainterPath MainPathPath(const VContainer *data) const;
QPainterPath SeamAllowancePath(const VContainer *data) const;
QPainterPath PassmarksPath(const VContainer *data) const;
qreal GetMx() const;
void SetMx(qreal value);
@ -111,7 +113,26 @@ public:
private:
QSharedDataPointer<VPieceData> d;
QVector<VPieceNode> GetUnitedPath(const VContainer *data) const;
QVector<CustomSARecord> GetValidRecords() const;
QVector<CustomSARecord> FilterRecords(QVector<CustomSARecord> records) const;
QVector<VSAPoint> GetNodeSAPoints(const QVector<VPieceNode> &path, int index, const VContainer *data) const;
bool GetPassmarkSAPoint(const QVector<VPieceNode> &path, int index, const VContainer *data, VSAPoint &point) const;
bool GetPassmarkPreviousSAPoint(const QVector<VPieceNode> &path, int index, const VSAPoint &passmarkSAPoint,
const VContainer *data, VSAPoint &point) const;
bool GetPassmarkNextSAPoint(const QVector<VPieceNode> &path, int index, const VSAPoint &passmarkSAPoint,
const VContainer *data, VSAPoint &point) const;
bool GetSeamPassmarkSAPoint(const VSAPoint &previousSAPoint, const VSAPoint &passmarkSAPoint,
const VSAPoint &nextSAPoint, const VContainer *data, QPointF &point) const;
bool IsPassmarksPossible(const QVector<VPieceNode> &path) const;
bool IsPassmarkVisible(const QVector<VPieceNode> &path, int passmarkIndex) const;
QVector<QLineF> CreatePassmark(const QVector<VPieceNode> &path, int previousIndex, int passmarkIndex, int nextIndex,
const VContainer *data) const;
static int IsCSAStart(const QVector<CustomSARecord> &records, quint32 id);
};

View File

@ -97,6 +97,21 @@ VPieceNode &VPieceNode::operator=(const VPieceNode &node)
VPieceNode::~VPieceNode()
{}
// Friend functions
//---------------------------------------------------------------------------------------------------------------------
QDataStream &operator<<(QDataStream &out, const VPieceNode &p)
{
out << p.d;
return out;
}
//---------------------------------------------------------------------------------------------------------------------
QDataStream &operator>>(QDataStream &in, VPieceNode &p)
{
in >> *p.d;
return in;
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VPieceNode::GetId() const
{
@ -139,12 +154,22 @@ void VPieceNode::SetReverse(bool reverse)
//---------------------------------------------------------------------------------------------------------------------
qreal VPieceNode::GetSABefore(const VContainer *data) const
{
if (d->m_formulaWidthBefore == currentSeamAllowance)
{
return -1;
}
return EvalFormula(data, d->m_formulaWidthBefore);
}
//---------------------------------------------------------------------------------------------------------------------
qreal VPieceNode::GetSABefore(const VContainer *data, Unit unit) const
{
if (d->m_formulaWidthBefore == currentSeamAllowance)
{
return -1;
}
qreal value = EvalFormula(data, d->m_formulaWidthBefore);
if (value >= 0)
{
@ -171,12 +196,22 @@ void VPieceNode::SetFormulaSABefore(const QString &formula)
//---------------------------------------------------------------------------------------------------------------------
qreal VPieceNode::GetSAAfter(const VContainer *data) const
{
if (d->m_formulaWidthAfter == currentSeamAllowance)
{
return -1;
}
return EvalFormula(data, d->m_formulaWidthAfter);
}
//---------------------------------------------------------------------------------------------------------------------
qreal VPieceNode::GetSAAfter(const VContainer *data, Unit unit) const
{
if (d->m_formulaWidthAfter == currentSeamAllowance)
{
return -1;
}
qreal value = EvalFormula(data, d->m_formulaWidthAfter);
if (value >= 0)
{
@ -215,25 +250,43 @@ void VPieceNode::SetAngleType(PieceNodeAngle type)
}
}
// Friend functions
//---------------------------------------------------------------------------------------------------------------------
QDataStream& operator<<(QDataStream& out, const VPieceNode& p)
bool VPieceNode::IsPassmark() const
{
out << p.d->m_id << static_cast<int>(p.d->m_typeTool) << p.d->m_reverse;
return out;
return d->m_isPassmark;
}
//---------------------------------------------------------------------------------------------------------------------
QDataStream& operator>>(QDataStream& in, VPieceNode& p)
void VPieceNode::SetPassmark(bool passmark)
{
in >> p.d->m_id;
if (GetTypeTool() == Tool::NodePoint)
{
d->m_isPassmark = passmark;
}
}
int type = 0;
in >> type;
p.d->m_typeTool = static_cast<Tool>(type);
//---------------------------------------------------------------------------------------------------------------------
PassmarkLineType VPieceNode::GetPassmarkLineType() const
{
return d->m_passmarkLineType;
}
in >> p.d->m_reverse;
return in;
//---------------------------------------------------------------------------------------------------------------------
void VPieceNode::SetPassmarkLineType(PassmarkLineType lineType)
{
d->m_passmarkLineType = lineType;
}
//---------------------------------------------------------------------------------------------------------------------
PassmarkAngleType VPieceNode::GetPassmarkAngleType() const
{
return d->m_passmarkAngleType;
}
//---------------------------------------------------------------------------------------------------------------------
void VPieceNode::SetPassmarkAngleType(PassmarkAngleType angleType)
{
d->m_passmarkAngleType = angleType;
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -76,6 +76,15 @@ public:
PieceNodeAngle GetAngleType() const;
void SetAngleType(PieceNodeAngle type);
bool IsPassmark() const;
void SetPassmark(bool passmark);
PassmarkLineType GetPassmarkLineType() const;
void SetPassmarkLineType(PassmarkLineType lineType);
PassmarkAngleType GetPassmarkAngleType() const;
void SetPassmarkAngleType(PassmarkAngleType angleType);
private:
QSharedDataPointer<VPieceNodeData> d;
};

View File

@ -44,11 +44,12 @@ public:
m_typeTool(Tool::NodePoint),
m_reverse(false),
m_excluded(false),
m_saBefore(-1),
m_saAfter(-1),
m_isPassmark(false),
m_formulaWidthBefore(currentSeamAllowance),
m_formulaWidthAfter(currentSeamAllowance),
m_angleType(PieceNodeAngle::ByLength)
m_angleType(PieceNodeAngle::ByLength),
m_passmarkLineType(PassmarkLineType::OneLine),
m_passmarkAngleType(PassmarkAngleType::Straightforward)
{}
VPieceNodeData(quint32 id, Tool typeTool, bool reverse)
@ -56,11 +57,12 @@ public:
m_typeTool(typeTool),
m_reverse(reverse),
m_excluded(false),
m_saBefore(-1),
m_saAfter(-1),
m_isPassmark(false),
m_formulaWidthBefore(currentSeamAllowance),
m_formulaWidthAfter(currentSeamAllowance),
m_angleType(PieceNodeAngle::ByLength)
m_angleType(PieceNodeAngle::ByLength),
m_passmarkLineType(PassmarkLineType::OneLine),
m_passmarkAngleType(PassmarkAngleType::Straightforward)
{
if (m_typeTool == Tool::NodePoint)
{
@ -74,15 +76,19 @@ public:
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_isPassmark(node.m_isPassmark),
m_formulaWidthBefore(node.m_formulaWidthBefore),
m_formulaWidthAfter(node.m_formulaWidthAfter),
m_angleType(node.m_angleType)
m_angleType(node.m_angleType),
m_passmarkLineType(node.m_passmarkLineType),
m_passmarkAngleType(node.m_passmarkAngleType)
{}
~VPieceNodeData();
friend QDataStream& operator<<(QDataStream& out, const VPieceNodeData& p);
friend QDataStream& operator>>(QDataStream& in, VPieceNodeData& p);
/** @brief id object id. */
quint32 m_id;
@ -96,14 +102,17 @@ public:
* affect on main path. Also include to exist path items automatically setted excluded. */
bool m_excluded;
qreal m_saBefore;
qreal m_saAfter;
/** @brief m_isPassmark has sense only for points. If true to seam allowance should be added a passmark. */
bool m_isPassmark;
QString m_formulaWidthBefore;
QString m_formulaWidthAfter;
PieceNodeAngle m_angleType;
PassmarkLineType m_passmarkLineType;
PassmarkAngleType m_passmarkAngleType;
private:
VPieceNodeData &operator=(const VPieceNodeData &) Q_DECL_EQ_DELETE;
};
@ -111,6 +120,50 @@ private:
VPieceNodeData::~VPieceNodeData()
{}
// Friend functions
//---------------------------------------------------------------------------------------------------------------------
QDataStream &operator<<(QDataStream &out, const VPieceNodeData &p)
{
out << p.m_id
<< static_cast<int>(p.m_typeTool)
<< p.m_reverse
<< p.m_excluded
<< p.m_isPassmark
<< p.m_formulaWidthBefore
<< p.m_formulaWidthAfter
<< static_cast<int>(p.m_angleType)
<< static_cast<int>(p.m_passmarkLineType)
<< static_cast<int>(p.m_passmarkAngleType);
return out;
}
//---------------------------------------------------------------------------------------------------------------------
QDataStream &operator>>(QDataStream &in, VPieceNodeData &p)
{
int typeTool = 0;
int angleType = 0;
int passmarkLineType = 0;
int passmarkAngleType = 0;
in >> p.m_id
>> typeTool
>> p.m_reverse
>> p.m_excluded
>> p.m_isPassmark
>> p.m_formulaWidthBefore
>> p.m_formulaWidthAfter
>> angleType
>> passmarkLineType
>> passmarkAngleType;
p.m_typeTool = static_cast<Tool>(typeTool);
p.m_angleType = static_cast<PieceNodeAngle>(angleType);
p.m_passmarkLineType = static_cast<PassmarkLineType>(passmarkLineType);
p.m_passmarkAngleType = static_cast<PassmarkAngleType>(passmarkAngleType);
return in;
}
QT_WARNING_POP
#endif // VPIECENODE_P_H

View File

@ -387,10 +387,13 @@ VSAPoint VPiecePath::StartSegment(const VContainer *data, const QVector<VPieceNo
if (nodes.size() > 1)
{
int index = 0;
i == 0 ? index = nodes.size()-1 : index = i-1;
i == 0 ? index = FindInLoopNotExcludedUp(nodes.size()-1, nodes) : index = FindInLoopNotExcludedUp(i-1, nodes);
if (index != -1 && index != i)
{
begin = CurveStartPoint(begin, data, nodes.at(index), points);
}
}
return begin;
}
@ -416,10 +419,13 @@ VSAPoint VPiecePath::EndSegment(const VContainer *data, const QVector<VPieceNode
if (nodes.size() > 2)
{
int index = 0;
i == nodes.size() - 1 ? index = 0 : index = i+1;
i == nodes.size()-1 ? index=FindInLoopNotExcludedDown(0, nodes) : index=FindInLoopNotExcludedDown(i+1, nodes);
if (index != -1 && index != i)
{
end = CurveEndPoint(end, data, nodes.at(index), points);
}
}
return end;
}
@ -460,15 +466,7 @@ QVector<quint32> VPiecePath::MissingNodes(const VPiecePath &path) const
//---------------------------------------------------------------------------------------------------------------------
int VPiecePath::indexOfNode(quint32 id) const
{
for (int i = 0; i < d->m_nodes.size(); ++i)
{
if (d->m_nodes.at(i).GetId() == id)
{
return i;
}
}
qDebug()<<"Can't find node.";
return -1;
return indexOfNode(d->m_nodes, id);
}
//---------------------------------------------------------------------------------------------------------------------
@ -762,9 +760,81 @@ QPointF VPiecePath::NodeNextPoint(const VContainer *data, int i) const
return point;
}
//---------------------------------------------------------------------------------------------------------------------
int VPiecePath::indexOfNode(const QVector<VPieceNode> &nodes, quint32 id)
{
for (int i = 0; i < nodes.size(); ++i)
{
if (nodes.at(i).GetId() == id)
{
return i;
}
}
qDebug()<<"Can't find node.";
return -1;
}
//---------------------------------------------------------------------------------------------------------------------
int VPiecePath::FindInLoopNotExcludedUp(int candidate, const QVector<VPieceNode> &nodes)
{
if (candidate < 0 || candidate >= nodes.size())
{
return -1;
}
int checked = 0;
int i = candidate;
do
{
if (not nodes.at(i).IsExcluded())
{
break;
}
++checked;
--i;
if (i < 0)
{
i = nodes.size() - 1;
}
} while (checked < nodes.size());
return i;
}
//---------------------------------------------------------------------------------------------------------------------
int VPiecePath::FindInLoopNotExcludedDown(int candidate, const QVector<VPieceNode> &nodes)
{
if (candidate < 0 || candidate >= nodes.size())
{
return -1;
}
int checked = 0;
int i = candidate;
do
{
if (not nodes.at(i).IsExcluded())
{
break;
}
++checked;
++i;
if (i >= nodes.size())
{
i = 0;
}
} while (checked < nodes.size());
return i;
}
//---------------------------------------------------------------------------------------------------------------------
VSAPoint VPiecePath::PreparePointEkv(const VPieceNode &node, const VContainer *data)
{
SCASSERT(data !=nullptr)
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(node.GetId());
VSAPoint p(point->toQPointF());

View File

@ -94,6 +94,11 @@ public:
QPointF NodePreviousPoint(const VContainer *data, int i) const;
QPointF NodeNextPoint(const VContainer *data, int i) const;
static int indexOfNode(const QVector<VPieceNode> &nodes, quint32 id);
static int FindInLoopNotExcludedUp(int candidate, const QVector<VPieceNode> &nodes);
static int FindInLoopNotExcludedDown(int candidate, const QVector<VPieceNode> &nodes);
static VSAPoint StartSegment(const VContainer *data, const QVector<VPieceNode> &nodes, int i, bool reverse);
static VSAPoint EndSegment(const VContainer *data, const QVector<VPieceNode> &nodes, int i, bool reverse);

View File

@ -138,4 +138,5 @@ FORMS += \
$$PWD/tools/piece/tabs/tablabels.ui \
$$PWD/tools/piece/tabs/tabgrainline.ui \
$$PWD/tools/piece/tabs/tabpins.ui \
$$PWD/tools/dialoginsertnode.ui
$$PWD/tools/dialoginsertnode.ui \
$$PWD/tools/piece/tabs/tabpassmarks.ui

View File

@ -56,8 +56,11 @@
//---------------------------------------------------------------------------------------------------------------------
DialogCurveIntersectAxis::DialogCurveIntersectAxis(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogCurveIntersectAxis), formulaAngle(QString()),
formulaBaseHeightAngle(0)
: DialogTool(data, toolId, parent),
ui(new Ui::DialogCurveIntersectAxis),
formulaAngle(),
formulaBaseHeightAngle(0),
m_firstRelease(false)
{
ui->setupUi(this);
@ -191,6 +194,14 @@ void DialogCurveIntersectAxis::ShowDialog(bool click)
{
if (click)
{
// The check need to ignore first release of mouse button.
// User can select point by clicking on a label.
if (not m_firstRelease)
{
m_firstRelease = true;
return;
}
/*We will ignore click if poinet is in point circle*/
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
SCASSERT(scene != nullptr)

View File

@ -88,6 +88,8 @@ private:
QString formulaAngle;
int formulaBaseHeightAngle;
bool m_firstRelease;
};
#endif // DIALOGCURVEINTERSECTAXIS_H

View File

@ -62,8 +62,13 @@
* @param parent parent widget
*/
DialogEndLine::DialogEndLine(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogEndLine),
formulaLength(QString()), formulaAngle(QString()), formulaBaseHeight(0), formulaBaseHeightAngle(0)
: DialogTool(data, toolId, parent),
ui(new Ui::DialogEndLine),
formulaLength(),
formulaAngle(),
formulaBaseHeight(0),
formulaBaseHeightAngle(0),
m_firstRelease(false)
{
ui->setupUi(this);
@ -298,6 +303,14 @@ void DialogEndLine::ShowDialog(bool click)
{
if (click)
{
// The check need to ignore first release of mouse button.
// User can select point by clicking on a label.
if (not m_firstRelease)
{
m_firstRelease = true;
return;
}
/*We will ignore click if pointer is in point circle*/
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
SCASSERT(scene != nullptr)

View File

@ -110,6 +110,8 @@ private:
/** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight;
int formulaBaseHeightAngle;
bool m_firstRelease;
};
#endif // DIALOGENDLINE_H

View File

@ -60,8 +60,11 @@
//---------------------------------------------------------------------------------------------------------------------
DialogLineIntersectAxis::DialogLineIntersectAxis(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogLineIntersectAxis), formulaAngle(QString()),
formulaBaseHeightAngle(0)
: DialogTool(data, toolId, parent),
ui(new Ui::DialogLineIntersectAxis),
formulaAngle(),
formulaBaseHeightAngle(0),
m_firstRelease(false)
{
ui->setupUi(this);
@ -220,6 +223,14 @@ void DialogLineIntersectAxis::ShowDialog(bool click)
{
if (click)
{
// The check need to ignore first release of mouse button.
// User can select point by clicking on a label.
if (not m_firstRelease)
{
m_firstRelease = true;
return;
}
/*We will ignore click if poinet is in point circle*/
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
SCASSERT(scene != nullptr)

View File

@ -92,6 +92,8 @@ private:
QString formulaAngle;
int formulaBaseHeightAngle;
bool m_firstRelease;
};
#endif // DIALOGLINEINTERSECTAXIS_H

View File

@ -55,6 +55,7 @@ DialogPiecePath::DialogPiecePath(const VContainer *data, quint32 toolId, QWidget
InitPathTab();
InitSeamAllowanceTab();
InitPassmarksTab();
flagName = true;//We have default name of piece.
flagError = PathIsValid();
@ -62,7 +63,8 @@ DialogPiecePath::DialogPiecePath(const VContainer *data, quint32 toolId, QWidget
vis = new VisToolPiecePath(data);
ui->tabWidget->removeTab(1);
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabSeamAllowance));
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabPassmarks));
}
//---------------------------------------------------------------------------------------------------------------------
@ -224,6 +226,7 @@ void DialogPiecePath::ShowContextMenu(const QPoint &pos)
SCASSERT(rowItem != nullptr);
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
QAction *actionPassmark = nullptr;
QAction *actionReverse = nullptr;
if (rowNode.GetTypeTool() != Tool::NodePoint)
{
@ -231,6 +234,12 @@ void DialogPiecePath::ShowContextMenu(const QPoint &pos)
actionReverse->setCheckable(true);
actionReverse->setChecked(rowNode.GetReverse());
}
else
{
actionPassmark = menu->addAction(tr("Passmark"));
actionPassmark->setCheckable(true);
actionPassmark->setChecked(rowNode.IsPassmark());
}
QAction *actionDelete = menu->addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
@ -238,16 +247,21 @@ void DialogPiecePath::ShowContextMenu(const QPoint &pos)
if (selectedAction == actionDelete)
{
delete ui->listWidget->item(row);
ValidObjects(PathIsValid());
}
else if (rowNode.GetTypeTool() != Tool::NodePoint && selectedAction == actionReverse)
{
rowNode.SetReverse(not rowNode.GetReverse());
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
rowItem->setText(GetNodeName(rowNode));
ValidObjects(PathIsValid());
rowItem->setText(GetNodeName(rowNode, true));
}
else if (selectedAction == actionPassmark)
{
rowNode.SetPassmark(not rowNode.IsPassmark());
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
rowItem->setText(GetNodeName(rowNode, true));
}
ValidObjects(PathIsValid());
ListChanged();
}
@ -357,6 +371,68 @@ void DialogPiecePath::NodeChanged(int index)
ui->comboBoxAngle->blockSignals(false);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPiecePath::PassmarkChanged(int index)
{
ui->radioButtonOneLine->setDisabled(true);
ui->radioButtonTwoLines->setDisabled(true);
ui->radioButtonThreeLines->setDisabled(true);
ui->radioButtonStraightforward->setDisabled(true);
ui->radioButtonBisector->setDisabled(true);
ui->groupBoxLineType->blockSignals(true);
ui->groupBoxAngleType->blockSignals(true);
if (index != -1)
{
const VPiecePath path = CreatePath();
const int nodeIndex = path.indexOfNode(CURRENT_DATA(ui->comboBoxPassmarks).toUInt());
if (nodeIndex != -1)
{
const VPieceNode &node = path.at(nodeIndex);
// Line type
ui->radioButtonOneLine->setEnabled(true);
ui->radioButtonTwoLines->setEnabled(true);
ui->radioButtonThreeLines->setEnabled(true);
switch(node.GetPassmarkLineType())
{
case PassmarkLineType::OneLine:
ui->radioButtonOneLine->setChecked(true);
break;
case PassmarkLineType::TwoLines:
ui->radioButtonTwoLines->setChecked(true);
break;
case PassmarkLineType::ThreeLines:
ui->radioButtonThreeLines->setChecked(true);
break;
default:
break;
}
// Angle type
ui->radioButtonStraightforward->setEnabled(true);
ui->radioButtonBisector->setEnabled(true);
switch(node.GetPassmarkAngleType())
{
case PassmarkAngleType::Straightforward:
ui->radioButtonStraightforward->setChecked(true);
break;
case PassmarkAngleType::Bisector:
ui->radioButtonBisector->setChecked(true);
break;
default:
break;
}
}
}
ui->groupBoxLineType->blockSignals(false);
ui->groupBoxAngleType->blockSignals(false);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPiecePath::ReturnDefBefore()
{
@ -369,6 +445,70 @@ void DialogPiecePath::ReturnDefAfter()
ui->plainTextEditFormulaWidthAfter->setPlainText(currentSeamAllowance);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPiecePath::PassmarkLineTypeChanged(int id)
{
const int i = ui->comboBoxPassmarks->currentIndex();
if (i != -1)
{
QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(ui->comboBoxPassmarks).toUInt());
if (rowItem)
{
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
PassmarkLineType lineType = PassmarkLineType::OneLine;
if (id == ui->buttonGroupLineType->id(ui->radioButtonOneLine))
{
lineType = PassmarkLineType::OneLine;
}
else if (id == ui->buttonGroupLineType->id(ui->radioButtonTwoLines))
{
lineType = PassmarkLineType::TwoLines;
}
else if (id == ui->buttonGroupLineType->id(ui->radioButtonThreeLines))
{
lineType = PassmarkLineType::ThreeLines;
}
rowNode.SetPassmarkLineType(lineType);
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
rowItem->setText(GetNodeName(rowNode, true));
ListChanged();
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPiecePath::PassmarkAngleTypeChanged(int id)
{
const int i = ui->comboBoxPassmarks->currentIndex();
if (i != -1)
{
QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(ui->comboBoxPassmarks).toUInt());
if (rowItem)
{
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
PassmarkAngleType angleType = PassmarkAngleType::Straightforward;
if (id == ui->buttonGroupAngleType->id(ui->radioButtonStraightforward))
{
angleType = PassmarkAngleType::Straightforward;
}
else if (id == ui->buttonGroupAngleType->id(ui->radioButtonBisector))
{
angleType = PassmarkAngleType::Bisector;
}
rowNode.SetPassmarkAngleType(angleType);
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
rowItem->setText(GetNodeName(rowNode, true));
ListChanged();
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPiecePath::EvalWidth()
{
@ -581,6 +721,19 @@ void DialogPiecePath::InitSeamAllowanceTab()
&DialogPiecePath::DeployWidthAfterFormulaTextEdit);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPiecePath::InitPassmarksTab()
{
InitPassmarksList();
connect(ui->comboBoxPassmarks, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &DialogPiecePath::PassmarkChanged);
connect(ui->buttonGroupLineType, static_cast<void(QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked),
this, &DialogPiecePath::PassmarkLineTypeChanged);
connect(ui->buttonGroupAngleType, static_cast<void(QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked),
this, &DialogPiecePath::PassmarkAngleTypeChanged);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPiecePath::InitPathTypes()
{
@ -624,6 +777,40 @@ void DialogPiecePath::InitNodesList()
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPiecePath::InitPassmarksList()
{
const quint32 id = CURRENT_DATA(ui->comboBoxPassmarks).toUInt();
ui->comboBoxPassmarks->blockSignals(true);
ui->comboBoxPassmarks->clear();
const QVector<VPieceNode> nodes = GetListInternals<VPieceNode>(ui->listWidget);
for (int i = 0; i < nodes.size(); ++i)
{
const VPieceNode node = nodes.at(i);
if (node.GetTypeTool() == Tool::NodePoint && node.IsPassmark())
{
const QString name = GetNodeName(node);
ui->comboBoxPassmarks->addItem(name, node.GetId());
}
}
ui->comboBoxPassmarks->blockSignals(false);
const int index = ui->comboBoxPassmarks->findData(id);
if (index != -1)
{
ui->comboBoxPassmarks->setCurrentIndex(index);
PassmarkChanged(index);// Need in case combox index was not changed
}
else
{
ui->comboBoxPassmarks->count() > 0 ? PassmarkChanged(0) : PassmarkChanged(-1);
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPiecePath::NodeAngleChanged(int index)
{
@ -783,6 +970,11 @@ void DialogPiecePath::UpdateNodeSAAfter(const QString &formula)
//---------------------------------------------------------------------------------------------------------------------
void DialogPiecePath::SetFormulaSAWidth(const QString &formula)
{
if (formula.isEmpty())
{
return;
}
const QString width = qApp->TrVars()->FormulaToUser(formula, qApp->Settings()->GetOsSeparator());
// increase height if needed.
if (width.length() > 80)
@ -795,6 +987,16 @@ void DialogPiecePath::SetFormulaSAWidth(const QString &formula)
SCASSERT(path != nullptr)
path->SetPath(CreatePath());
if (ui->tabWidget->indexOf(ui->tabSeamAllowance) == -1)
{
ui->tabWidget->addTab(ui->tabSeamAllowance, tr("Seam allowance"));
}
if (ui->tabWidget->indexOf(ui->tabPassmarks) == -1)
{
ui->tabWidget->addTab(ui->tabPassmarks, tr("Passmarks"));
}
MoveCursorToEnd(ui->plainTextEditFormulaWidth);
}
@ -889,6 +1091,12 @@ bool DialogPiecePath::PathIsValid() const
ui->helpLabel->setText(url);
return false;
}
else if (not EachPointLabelIsUnique(ui->listWidget))
{
url += tr("Each point in the path must be unique!");
ui->helpLabel->setText(url);
return false;
}
}
if (not m_showMode && ui->comboBoxPiece->count() <= 0)

View File

@ -70,8 +70,11 @@ private slots:
void ListChanged();
void NameChanged();
void NodeChanged(int index);
void PassmarkChanged(int index);
void ReturnDefBefore();
void ReturnDefAfter();
void PassmarkLineTypeChanged(int id);
void PassmarkAngleTypeChanged(int id);
void EvalWidth();
void EvalWidthBefore();
@ -105,9 +108,11 @@ private:
void InitPathTab();
void InitSeamAllowanceTab();
void InitPassmarksTab();
void InitPathTypes();
void InitListPieces();
void InitNodesList();
void InitPassmarksList();
void NodeAngleChanged(int index);
VPiecePath CreatePath() const;

View File

@ -792,6 +792,129 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tabPassmarks">
<attribute name="title">
<string>Passmarks</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<layout class="QFormLayout" name="formLayout_2">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Passmark:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxPassmarks"/>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBoxLineType">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string>Lines</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QRadioButton" name="radioButtonOneLine">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>One line</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroupLineType</string>
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonTwoLines">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Two lines</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroupLineType</string>
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonThreeLines">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Three lines</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroupLineType</string>
</attribute>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBoxAngleType">
<property name="title">
<string>Angle</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QRadioButton" name="radioButtonStraightforward">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Straightforward</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroupAngleType</string>
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonBisector">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Bisector</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroupAngleType</string>
</attribute>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>85</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
<item>
@ -843,4 +966,8 @@
</hints>
</connection>
</connections>
<buttongroups>
<buttongroup name="buttonGroupLineType"/>
<buttongroup name="buttonGroupAngleType"/>
</buttongroups>
</ui>

View File

@ -72,7 +72,8 @@ DialogRotation::DialogRotation(const VContainer *data, const quint32 &toolId, QW
formulaBaseHeightAngle(0),
objects(),
stage1(true),
m_suffix()
m_suffix(),
m_firstRelease(false)
{
ui->setupUi(this);
@ -200,6 +201,14 @@ void DialogRotation::ShowDialog(bool click)
}
else if (not stage1 && prepare && click)
{
// The check need to ignore first release of mouse button.
// User can select point by clicking on a label.
if (not m_firstRelease)
{
m_firstRelease = true;
return;
}
/*We will ignore click if pointer is in point circle*/
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
SCASSERT(scene != nullptr)

View File

@ -109,6 +109,8 @@ private:
QString m_suffix;
bool m_firstRelease;
void EvalAngle();
};

View File

@ -522,6 +522,27 @@ bool DialogTool::DoublePoints(QListWidget *listWidget)
return false;
}
//---------------------------------------------------------------------------------------------------------------------
bool DialogTool::EachPointLabelIsUnique(QListWidget *listWidget)
{
SCASSERT(listWidget != nullptr);
QSet<quint32> pointLabels;
int countPoints = 0;
for (int i=0; i < listWidget->count(); ++i)
{
const QListWidgetItem *rowItem = listWidget->item(i);
SCASSERT(rowItem != nullptr);
const VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
if (rowNode.GetTypeTool() == Tool::NodePoint)
{
++countPoints;
pointLabels.insert(rowNode.GetId());
}
}
return countPoints == pointLabels.size();
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogTool::DialogWarningIcon()
{
@ -545,7 +566,7 @@ QFont DialogTool::NodeFont(bool nodeExcluded)
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogTool::GetNodeName(const VPieceNode &node) const
QString DialogTool::GetNodeName(const VPieceNode &node, bool showPassmark) const
{
const QSharedPointer<VGObject> obj = data->GetGObject(node.GetId());
QString name = obj->name();
@ -560,6 +581,23 @@ QString DialogTool::GetNodeName(const VPieceNode &node) const
name = QLatin1String("- ") + name;
}
}
else if (showPassmark && node.IsPassmark())
{
switch(node.GetPassmarkLineType())
{
case PassmarkLineType::OneLine:
name += QLatin1String("^");
break;
case PassmarkLineType::TwoLines:
name += QLatin1String("^^");
break;
case PassmarkLineType::ThreeLines:
name += QLatin1String("^^^");
break;
default:
break;
}
}
return name;
}
@ -577,7 +615,7 @@ void DialogTool::NewNodeItem(QListWidget *listWidget, const VPieceNode &node)
case (Tool::NodeElArc):
case (Tool::NodeSpline):
case (Tool::NodeSplinePath):
name = GetNodeName(node);
name = GetNodeName(node, true);
break;
default:
qDebug()<<"Got wrong tools. Ignore.";

View File

@ -256,6 +256,9 @@ protected:
template <typename T>
void AddVisualization();
template <typename T>
QVector<T> GetListInternals(const QListWidget *list) const;
void ChangeColor(QWidget *widget, const QColor &color);
virtual void ShowVisualization() {}
/**
@ -270,10 +273,11 @@ protected:
static int FindNotExcludedNodeUp(QListWidget *listWidget, int candidate);
static bool FirstPointEqualLast(QListWidget *listWidget);
static bool DoublePoints(QListWidget *listWidget);
static bool EachPointLabelIsUnique(QListWidget *listWidget);
static QString DialogWarningIcon();
static QFont NodeFont(bool nodeExcluded);
QString GetNodeName(const VPieceNode &node) const;
QString GetNodeName(const VPieceNode &node, bool showPassmark = false) const;
void NewNodeItem(QListWidget *listWidget, const VPieceNode &node);
void InitNodeAngles(QComboBox *box);
@ -293,6 +297,20 @@ private:
};
//---------------------------------------------------------------------------------------------------------------------
template <typename T>
QVector<T> DialogTool::GetListInternals(const QListWidget *list) const
{
SCASSERT(list != nullptr)
QVector<T> internals;
for (qint32 i = 0; i < list->count(); ++i)
{
QListWidgetItem *item = list->item(i);
internals.append(qvariant_cast<T>(item->data(Qt::UserRole)));
}
return internals;
}
//---------------------------------------------------------------------------------------------------------------------
inline VAbstractTool *DialogTool::GetAssociatedTool()
{

View File

@ -32,6 +32,7 @@
#include "ui_tablabels.h"
#include "ui_tabgrainline.h"
#include "ui_tabpins.h"
#include "ui_tabpassmarks.h"
#include "../vwidgets/fancytabbar/fancytabbar.h"
#include "../vpatterndb/vpiecenode.h"
#include "../vpatterndb/vpiecepath.h"
@ -46,7 +47,7 @@
#include <QTimer>
#include <QtNumeric>
enum TabOrder {Paths=0, Labels=1, Grainline=2, Pins=3, Count=4};
enum TabOrder {Paths=0, Labels=1, Grainline=2, Pins=3, Passmarks=4, Count=5};
namespace
{
@ -80,10 +81,12 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &
uiTabLabels(new Ui::TabLabels),
uiTabGrainline(new Ui::TabGrainline),
uiTabPins(new Ui::TabPins),
uiTabPassmarks(new Ui::TabPassmarks),
m_tabPaths(new QWidget),
m_tabLabels(new QWidget),
m_tabGrainline(new QWidget),
m_tabPins(new QWidget),
m_tabPassmarks(new QWidget),
m_ftb(new FancyTabBar(FancyTabBar::Left, this)),
dialogIsInitialized(false),
applyAllowed(false),// By default disabled
@ -135,6 +138,7 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &
InitLabelsTab();
InitGrainlineTab();
InitPinsTab();
InitPassmarksTab();
flagName = true;//We have default name of piece.
ChangeColor(uiTabLabels->labelEditName, okColor);
@ -153,10 +157,12 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &
DialogSeamAllowance::~DialogSeamAllowance()
{
delete m_visPins;
delete m_tabPassmarks;
delete m_tabPins;
delete m_tabGrainline;
delete m_tabLabels;
delete m_tabPaths;
delete uiTabPassmarks;
delete uiTabPins;
delete uiTabGrainline;
delete uiTabLabels;
@ -176,6 +182,7 @@ void DialogSeamAllowance::EnableApply(bool enable)
m_ftb->SetTabEnabled(TabOrder::Labels, applyAllowed);
m_ftb->SetTabEnabled(TabOrder::Grainline, applyAllowed);
m_ftb->SetTabEnabled(TabOrder::Pins, applyAllowed);
m_ftb->SetTabEnabled(TabOrder::Passmarks, applyAllowed);
}
//---------------------------------------------------------------------------------------------------------------------
@ -579,6 +586,7 @@ void DialogSeamAllowance::ShowMainPathContextMenu(const QPoint &pos)
SCASSERT(rowItem != nullptr);
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
QAction *actionPassmark = nullptr;
QAction *actionReverse = nullptr;
if (rowNode.GetTypeTool() != Tool::NodePoint)
{
@ -586,6 +594,12 @@ void DialogSeamAllowance::ShowMainPathContextMenu(const QPoint &pos)
actionReverse->setCheckable(true);
actionReverse->setChecked(rowNode.GetReverse());
}
else
{
actionPassmark = menu->addAction(tr("Passmark"));
actionPassmark->setCheckable(true);
actionPassmark->setChecked(rowNode.IsPassmark());
}
QAction *actionExcluded = menu->addAction(tr("Excluded"));
actionExcluded->setCheckable(true);
@ -597,24 +611,28 @@ void DialogSeamAllowance::ShowMainPathContextMenu(const QPoint &pos)
if (selectedAction == actionDelete)
{
delete uiTabPaths->listWidgetMainPath->item(row);
ValidObjects(MainPathIsValid());
}
else if (rowNode.GetTypeTool() != Tool::NodePoint && selectedAction == actionReverse)
{
rowNode.SetReverse(not rowNode.GetReverse());
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
rowItem->setText(GetNodeName(rowNode));
ValidObjects(MainPathIsValid());
rowItem->setText(GetNodeName(rowNode, true));
}
else if (selectedAction == actionExcluded)
{
rowNode.SetExcluded(not rowNode.IsExcluded());
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
rowItem->setText(GetNodeName(rowNode));
rowItem->setText(GetNodeName(rowNode, true));
rowItem->setFont(NodeFont(rowNode.IsExcluded()));
ValidObjects(MainPathIsValid());
}
else if (selectedAction == actionPassmark)
{
rowNode.SetPassmark(not rowNode.IsPassmark());
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
rowItem->setText(GetNodeName(rowNode, true));
}
ValidObjects(MainPathIsValid());
ListChanged();
}
@ -736,6 +754,7 @@ void DialogSeamAllowance::ListChanged()
visPath->RefreshGeometry();
}
InitNodesList();
InitPassmarksList();
CustomSAChanged(uiTabPaths->listWidgetCustomSA->currentRow());
}
@ -820,6 +839,68 @@ void DialogSeamAllowance::NodeChanged(int index)
uiTabPaths->comboBoxAngle->blockSignals(false);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::PassmarkChanged(int index)
{
uiTabPassmarks->radioButtonOneLine->setDisabled(true);
uiTabPassmarks->radioButtonTwoLines->setDisabled(true);
uiTabPassmarks->radioButtonThreeLines->setDisabled(true);
uiTabPassmarks->radioButtonStraightforward->setDisabled(true);
uiTabPassmarks->radioButtonBisector->setDisabled(true);
uiTabPassmarks->groupBoxLineType->blockSignals(true);
uiTabPassmarks->groupBoxAngleType->blockSignals(true);
if (index != -1)
{
const VPiece piece = CreatePiece();
const int nodeIndex = piece.GetPath().indexOfNode(CURRENT_DATA(uiTabPassmarks->comboBoxPassmarks).toUInt());
if (nodeIndex != -1)
{
const VPieceNode &node = piece.GetPath().at(nodeIndex);
// Line type
uiTabPassmarks->radioButtonOneLine->setEnabled(true);
uiTabPassmarks->radioButtonTwoLines->setEnabled(true);
uiTabPassmarks->radioButtonThreeLines->setEnabled(true);
switch(node.GetPassmarkLineType())
{
case PassmarkLineType::OneLine:
uiTabPassmarks->radioButtonOneLine->setChecked(true);
break;
case PassmarkLineType::TwoLines:
uiTabPassmarks->radioButtonTwoLines->setChecked(true);
break;
case PassmarkLineType::ThreeLines:
uiTabPassmarks->radioButtonThreeLines->setChecked(true);
break;
default:
break;
}
// Angle type
uiTabPassmarks->radioButtonStraightforward->setEnabled(true);
uiTabPassmarks->radioButtonBisector->setEnabled(true);
switch(node.GetPassmarkAngleType())
{
case PassmarkAngleType::Straightforward:
uiTabPassmarks->radioButtonStraightforward->setChecked(true);
break;
case PassmarkAngleType::Bisector:
uiTabPassmarks->radioButtonBisector->setChecked(true);
break;
default:
break;
}
}
}
uiTabPassmarks->groupBoxLineType->blockSignals(false);
uiTabPassmarks->groupBoxAngleType->blockSignals(false);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::CSAStartPointChanged(int index)
{
@ -1010,6 +1091,7 @@ void DialogSeamAllowance::FancyTabChanged(int index)
m_tabLabels->hide();
m_tabGrainline->hide();
m_tabPins->hide();
m_tabPassmarks->hide();
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
@ -1027,6 +1109,9 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
case TabOrder::Pins:
m_tabPins->show();
break;
case TabOrder::Passmarks:
m_tabPassmarks->show();
break;
}
QT_WARNING_POP
@ -1061,6 +1146,70 @@ void DialogSeamAllowance::TabChanged(int index)
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::PassmarkLineTypeChanged(int id)
{
const int i = uiTabPassmarks->comboBoxPassmarks->currentIndex();
if (i != -1)
{
QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(uiTabPassmarks->comboBoxPassmarks).toUInt());
if (rowItem)
{
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
PassmarkLineType lineType = PassmarkLineType::OneLine;
if (id == uiTabPassmarks->buttonGroupLineType->id(uiTabPassmarks->radioButtonOneLine))
{
lineType = PassmarkLineType::OneLine;
}
else if (id == uiTabPassmarks->buttonGroupLineType->id(uiTabPassmarks->radioButtonTwoLines))
{
lineType = PassmarkLineType::TwoLines;
}
else if (id == uiTabPassmarks->buttonGroupLineType->id(uiTabPassmarks->radioButtonThreeLines))
{
lineType = PassmarkLineType::ThreeLines;
}
rowNode.SetPassmarkLineType(lineType);
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
rowItem->setText(GetNodeName(rowNode, true));
ListChanged();
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::PassmarkAngleTypeChanged(int id)
{
const int i = uiTabPassmarks->comboBoxPassmarks->currentIndex();
if (i != -1)
{
QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(uiTabPassmarks->comboBoxPassmarks).toUInt());
if (rowItem)
{
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
PassmarkAngleType angleType = PassmarkAngleType::Straightforward;
if (id == uiTabPassmarks->buttonGroupAngleType->id(uiTabPassmarks->radioButtonStraightforward))
{
angleType = PassmarkAngleType::Straightforward;
}
else if (id == uiTabPassmarks->buttonGroupAngleType->id(uiTabPassmarks->radioButtonBisector))
{
angleType = PassmarkAngleType::Bisector;
}
rowNode.SetPassmarkAngleType(angleType);
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
rowItem->setText(GetNodeName(rowNode, true));
ListChanged();
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::UpdateGrainlineValues()
{
@ -1880,10 +2029,10 @@ void DialogSeamAllowance::PatternPinPointChanged()
VPiece DialogSeamAllowance::CreatePiece() const
{
VPiece piece;
piece.GetPath().SetNodes(GetPieceInternals<VPieceNode>(uiTabPaths->listWidgetMainPath));
piece.SetCustomSARecords(GetPieceInternals<CustomSARecord>(uiTabPaths->listWidgetCustomSA));
piece.SetInternalPaths(GetPieceInternals<quint32>(uiTabPaths->listWidgetInternalPaths));
piece.SetPins(GetPieceInternals<quint32>(uiTabPins->listWidgetPins));
piece.GetPath().SetNodes(GetListInternals<VPieceNode>(uiTabPaths->listWidgetMainPath));
piece.SetCustomSARecords(GetListInternals<CustomSARecord>(uiTabPaths->listWidgetCustomSA));
piece.SetInternalPaths(GetListInternals<quint32>(uiTabPaths->listWidgetInternalPaths));
piece.SetPins(GetListInternals<quint32>(uiTabPins->listWidgetPins));
piece.SetForbidFlipping(uiTabPaths->checkBoxForbidFlipping->isChecked());
piece.SetSeamAllowance(uiTabPaths->checkBoxSeams->isChecked());
piece.SetName(uiTabLabels->lineEditName->text());
@ -2029,6 +2178,12 @@ bool DialogSeamAllowance::MainPathIsValid() const
uiTabPaths->helpLabel->setText(url);
valid = false;
}
else if (not EachPointLabelIsUnique(uiTabPaths->listWidgetMainPath))
{
url += tr("Each point in the path must be unique!");
uiTabPaths->helpLabel->setText(url);
valid = false;
}
}
if (valid)
@ -2077,7 +2232,7 @@ void DialogSeamAllowance::InitNodesList()
uiTabPaths->comboBoxNodes->blockSignals(true);
uiTabPaths->comboBoxNodes->clear();
const QVector<VPieceNode> nodes = GetPieceInternals<VPieceNode>(uiTabPaths->listWidgetMainPath);
const QVector<VPieceNode> nodes = GetListInternals<VPieceNode>(uiTabPaths->listWidgetMainPath);
for (int i = 0; i < nodes.size(); ++i)
{
@ -2103,6 +2258,40 @@ void DialogSeamAllowance::InitNodesList()
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::InitPassmarksList()
{
const quint32 id = CURRENT_DATA(uiTabPassmarks->comboBoxPassmarks).toUInt();
uiTabPassmarks->comboBoxPassmarks->blockSignals(true);
uiTabPassmarks->comboBoxPassmarks->clear();
const QVector<VPieceNode> nodes = GetListInternals<VPieceNode>(uiTabPaths->listWidgetMainPath);
for (int i = 0; i < nodes.size(); ++i)
{
const VPieceNode node = nodes.at(i);
if (node.GetTypeTool() == Tool::NodePoint && node.IsPassmark())
{
const QString name = GetNodeName(node);
uiTabPassmarks->comboBoxPassmarks->addItem(name, node.GetId());
}
}
uiTabPassmarks->comboBoxPassmarks->blockSignals(false);
const int index = uiTabPassmarks->comboBoxPassmarks->findData(id);
if (index != -1)
{
uiTabPassmarks->comboBoxPassmarks->setCurrentIndex(index);
PassmarkChanged(index);// Need in case combox index was not changed
}
else
{
uiTabPassmarks->comboBoxPassmarks->count() > 0 ? PassmarkChanged(0) : PassmarkChanged(-1);
}
}
//---------------------------------------------------------------------------------------------------------------------
QListWidgetItem *DialogSeamAllowance::GetItemById(quint32 id)
{
@ -2188,6 +2377,7 @@ void DialogSeamAllowance::InitFancyTabBar()
m_ftb->InsertTab(TabOrder::Labels, QIcon("://icon/32x32/labels.png"), tr("Labels"));
m_ftb->InsertTab(TabOrder::Grainline, QIcon("://icon/32x32/grainline.png"), tr("Grainline"));
m_ftb->InsertTab(TabOrder::Pins, QIcon("://icon/32x32/pins.png"), tr("Pins"));
m_ftb->InsertTab(TabOrder::Passmarks, QIcon("://icon/32x32/passmark.png"), tr("Passmarks"));
ui->horizontalLayout->addWidget(m_ftb, 0, Qt::AlignLeft);
@ -2209,6 +2399,10 @@ void DialogSeamAllowance::InitFancyTabBar()
uiTabPins->setupUi(m_tabPins);
ui->horizontalLayout->addWidget(m_tabPins, 1);
m_tabPassmarks->hide();
uiTabPassmarks->setupUi(m_tabPassmarks);
ui->horizontalLayout->addWidget(m_tabPassmarks, 1);
connect(m_ftb, &FancyTabBar::CurrentChanged, this, &DialogSeamAllowance::FancyTabChanged);
connect(uiTabLabels->tabWidget, &QTabWidget::currentChanged, this, &DialogSeamAllowance::TabChanged);
}
@ -2301,7 +2495,7 @@ void DialogSeamAllowance::InitCSAPoint(QComboBox *box)
box->clear();
box->addItem(tr("Empty"), NULL_ID);
const QVector<VPieceNode> nodes = GetPieceInternals<VPieceNode>(uiTabPaths->listWidgetMainPath);
const QVector<VPieceNode> nodes = GetListInternals<VPieceNode>(uiTabPaths->listWidgetMainPath);
for (int i = 0; i < nodes.size(); ++i)
{
@ -2328,7 +2522,7 @@ void DialogSeamAllowance::InitPinPoint(QComboBox *box)
box->clear();
box->addItem(QLatin1String("<") + tr("no pin") + QLatin1String(">"), NULL_ID);
const QVector<quint32> pins = GetPieceInternals<quint32>(uiTabPins->listWidgetPins);
const QVector<quint32> pins = GetListInternals<quint32>(uiTabPins->listWidgetPins);
for (int i = 0; i < pins.size(); ++i)
{
@ -2515,6 +2709,19 @@ void DialogSeamAllowance::InitPinsTab()
&DialogSeamAllowance::ShowPinsContextMenu);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::InitPassmarksTab()
{
InitPassmarksList();
connect(uiTabPassmarks->comboBoxPassmarks, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &DialogSeamAllowance::PassmarkChanged);
connect(uiTabPassmarks->buttonGroupLineType, static_cast<void(QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked),
this, &DialogSeamAllowance::PassmarkLineTypeChanged);
connect(uiTabPassmarks->buttonGroupAngleType, static_cast<void(QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked),
this, &DialogSeamAllowance::PassmarkAngleTypeChanged);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::InitAllPinComboboxes()
{
@ -2596,20 +2803,6 @@ void DialogSeamAllowance::ClearFields()
uiTabLabels->comboBoxPlacement->setCurrentIndex(0);
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T>
QVector<T> DialogSeamAllowance::GetPieceInternals(const QListWidget *list) const
{
SCASSERT(list != nullptr)
QVector<T> internals;
for (qint32 i = 0; i < list->count(); ++i)
{
QListWidgetItem *item = list->item(i);
internals.append(qvariant_cast<T>(item->data(Qt::UserRole)));
}
return internals;
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::SetGrainlineAngle(QString angleFormula)
{
@ -2777,7 +2970,7 @@ void DialogSeamAllowance::ShowPins()
m_visPins = new VisPiecePins(data);
}
m_visPins->SetPins(GetPieceInternals<quint32>(uiTabPins->listWidgetPins));
m_visPins->SetPins(GetListInternals<quint32>(uiTabPins->listWidgetPins));
if (not qApp->getCurrentScene()->items().contains(m_visPins))
{

View File

@ -42,6 +42,7 @@ namespace Ui
class TabLabels;
class TabGrainline;
class TabPins;
class TabPassmarks;
}
class VisPiecePins;
@ -90,6 +91,7 @@ private slots:
void ListChanged();
void EnableSeamAllowance(bool enable);
void NodeChanged(int index);
void PassmarkChanged(int index);
void CSAStartPointChanged(int index);
void CSAEndPointChanged(int index);
void CSAIncludeTypeChanged(int index);
@ -100,6 +102,8 @@ private slots:
void PathDialogClosed(int result);
void FancyTabChanged(int index);
void TabChanged(int index);
void PassmarkLineTypeChanged(int id);
void PassmarkAngleTypeChanged(int id);
void UpdateGrainlineValues();
void UpdateDetailLabelValues();
@ -158,11 +162,13 @@ private:
Ui::TabLabels *uiTabLabels;
Ui::TabGrainline *uiTabGrainline;
Ui::TabPins *uiTabPins;
Ui::TabPassmarks *uiTabPassmarks;
QWidget *m_tabPaths;
QWidget *m_tabLabels;
QWidget *m_tabGrainline;
QWidget *m_tabPins;
QWidget *m_tabPassmarks;
FancyTabBar* m_ftb;
@ -236,6 +242,7 @@ private:
void InitMainPathTab();
void InitSeamAllowanceTab();
void InitNodesList();
void InitPassmarksList();
void InitCSAPoint(QComboBox *box);
void InitPinPoint(QComboBox *box);
void InitSAIncludeType();
@ -244,13 +251,11 @@ private:
void InitLabelsTab();
void InitGrainlineTab();
void InitPinsTab();
void InitPassmarksTab();
void InitAllPinComboboxes();
void SetFormulaSAWidth(const QString &formula);
template <typename T>
QVector<T> GetPieceInternals(const QListWidget *list) const;
void SetGrainlineAngle(QString angleFormula);
void SetGrainlineLength(QString lengthFormula);

View File

@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TabPassmarks</class>
<widget class="QWidget" name="TabPassmarks">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>208</width>
<height>285</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Passmark:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxPassmarks"/>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBoxLineType">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string>Lines</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QRadioButton" name="radioButtonOneLine">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>One line</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroupLineType</string>
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonTwoLines">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Two lines</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroupLineType</string>
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonThreeLines">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Three lines</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroupLineType</string>
</attribute>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBoxAngleType">
<property name="title">
<string>Angle</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QRadioButton" name="radioButtonStraightforward">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Straightforward</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroupAngleType</string>
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonBisector">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Bisector</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroupAngleType</string>
</attribute>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
<buttongroups>
<buttongroup name="buttonGroupLineType"/>
<buttongroup name="buttonGroupAngleType"/>
</buttongroups>
</ui>

View File

@ -627,7 +627,7 @@ QDomElement VAbstractTool::AddSANode(VAbstractPattern *doc, const QString &tagNa
const bool excluded = node.IsExcluded();
if (excluded)
{
doc->SetAttribute(nod, VAbstractPattern::AttrNodeExcluded, node.IsExcluded());
doc->SetAttribute(nod, VAbstractPattern::AttrNodeExcluded, excluded);
}
else
{ // For backward compatebility.
@ -663,6 +663,30 @@ QDomElement VAbstractTool::AddSANode(VAbstractPattern *doc, const QString &tagNa
doc->SetAttribute(nod, AttrAngle, angleType);
}
if (type == Tool::NodePoint)
{
doc->SetAttribute(nod, VAbstractPattern::AttrNodePassmark, node.IsPassmark());
doc->SetAttribute(nod, VAbstractPattern::AttrNodePassmarkLine,
PassmarkLineTypeToString(node.GetPassmarkLineType()));
doc->SetAttribute(nod, VAbstractPattern::AttrNodePassmarkAngle,
PassmarkAngleTypeToString(node.GetPassmarkAngleType()));
if (not node.IsPassmark()
&& node.GetPassmarkLineType() == PassmarkLineType::OneLine
&& node.GetPassmarkAngleType() == PassmarkAngleType::Straightforward)
{ // For backward compatebility.
nod.removeAttribute(VAbstractPattern::AttrNodePassmark);
nod.removeAttribute(VAbstractPattern::AttrNodePassmarkLine);
nod.removeAttribute(VAbstractPattern::AttrNodePassmarkAngle);
}
}
else
{ // Wrong configuration.
nod.removeAttribute(VAbstractPattern::AttrNodePassmark);
nod.removeAttribute(VAbstractPattern::AttrNodePassmarkLine);
nod.removeAttribute(VAbstractPattern::AttrNodePassmarkAngle);
}
return nod;
}

View File

@ -1172,7 +1172,7 @@ VToolSeamAllowance::VToolSeamAllowance(VAbstractPattern *doc, VContainer *data,
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
RefreshGeometry();
m_seamAllowance->setBrush(QBrush(Qt::FDiagPattern));
m_seamAllowance->setBrush(QBrush(Qt::Dense7Pattern));
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
this->setFlag(QGraphicsItem::ItemIsFocusable, true);// For keyboard input focus
@ -1232,15 +1232,21 @@ void VToolSeamAllowance::RefreshGeometry()
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false);
const VPiece detail = VAbstractTool::data.GetPiece(id);
QPainterPath mainPath = detail.MainPathPath(this->getData());
QPainterPath path = detail.MainPathPath(this->getData());
{
QPainterPath mainPath = path;
mainPath.addPath(detail.PassmarksPath(this->getData()));
this->setPath(mainPath);
}
this->setPos(detail.GetMx(), detail.GetMy());
if (detail.IsSeamAllowance())
{
mainPath.addPath(detail.SeamAllowancePath(this->getData()));
mainPath.setFillRule(Qt::OddEvenFill);
m_seamAllowance->setPath(mainPath);
path.addPath(detail.SeamAllowancePath(this->getData()));
path.setFillRule(Qt::OddEvenFill);
m_seamAllowance->setPath(path);
}
else
{

View File

@ -594,11 +594,11 @@ quint32 AddNodeSplinePath(const VPieceNode &node, const VToolUnionDetailsInitDat
/**
* @brief AddToNewDetail create united detail adding one node per time.
*/
void AddNodeToNewPath(const VToolUnionDetailsInitData &initData, VPiecePath &newPath, const VPieceNode &node,
void AddNodeToNewPath(const VToolUnionDetailsInitData &initData, VPiecePath &newPath, VPieceNode node,
quint32 idTool, QVector<quint32> &children, const QString &drawName, qreal dx = 0, qreal dy = 0,
quint32 pRotate = NULL_ID, qreal angle = 0);
void AddNodeToNewPath(const VToolUnionDetailsInitData &initData, VPiecePath &newPath, const VPieceNode &node,
void AddNodeToNewPath(const VToolUnionDetailsInitData &initData, VPiecePath &newPath, VPieceNode node,
quint32 idTool, QVector<quint32> &children, const QString &drawName, qreal dx, qreal dy,
quint32 pRotate, qreal angle)
{
@ -625,10 +625,8 @@ void AddNodeToNewPath(const VToolUnionDetailsInitData &initData, VPiecePath &new
break;
}
VPieceNode newNode(id, node.GetTypeTool(), node.GetReverse());
newNode.SetExcluded(node.IsExcluded());
newPath.Append(newNode);
node.SetId(id);
newPath.Append(node);
}
//---------------------------------------------------------------------------------------------------------------------

File diff suppressed because it is too large Load Diff

View File

@ -90,6 +90,9 @@ private:
QVector<QPointF> InputPointsCase3a() const;
QVector<QPointF> InputPointsCase4a() const;
QVector<QPointF> InputPointsCase5a() const;
QVector<VSAPoint> InputPointsIssue646() const;
QVector<QPointF> OutputPointsIssue646() const;
};
#endif // TST_VABSTRACTPIECE_H

View File

@ -106,7 +106,7 @@ void TST_VPiece::ClearLoop()
const QVector<QPointF> pointsEkv = detail.SeamAllowancePoints(data);
QVector<QPointF> origPoints;
origPoints.append(QPointF(42.46405659601934, 415.2845470563871));
origPoints.append(QPointF(42.46405659601932, 415.2845470563871));
origPoints.append(QPointF(669.4711112822802, 560.1912138528764));
origPoints.append(QPointF(669.3860586912449, 594.8702688224456));
origPoints.append(QPointF(669.8537241707239, 619.8499975627876));
@ -120,8 +120,10 @@ void TST_VPiece::ClearLoop()
origPoints.append(QPointF(689.2446146317781, 744.0149891243127));
origPoints.append(QPointF(692.7177992446996, 752.7004886151328));
origPoints.append(QPointF(696.2448548679188, 760.4478278509594));
origPoints.append(QPointF(701.7756191283249, 771.1817664136103));
origPoints.append(QPointF(715.0901851898707, 793.875700151992));
origPoints.append(QPointF(701.8005387196029, 771.2301295961994));
origPoints.append(QPointF(709.4908502689113, 784.4621360005407));
origPoints.append(QPointF(713.2090350731621, 790.7616409320319));
origPoints.append(QPointF(715.0121915355467, 793.763727920337));
origPoints.append(QPointF(718.7808834775552, 799.1742815201673));
origPoints.append(QPointF(722.5723522600899, 803.7317522627161));
origPoints.append(QPointF(726.4900810611796, 807.6675956080389));
@ -135,10 +137,10 @@ void TST_VPiece::ClearLoop()
origPoints.append(QPointF(766.9761113390083, 824.236813134474));
origPoints.append(QPointF(773.6735265709667, 824.7970381873482));
origPoints.append(QPointF(780.6615727577812, 825.0343457026618));
origPoints.append(QPointF(792.1099959092389, 824.8480813766124));
origPoints.append(QPointF(792.109995909239, 824.8480813766124));
origPoints.append(QPointF(826.0032661558732, 877.1274330708662));
origPoints.append(QPointF(828.6858753986579, 1697.305833468011));
origPoints.append(QPointF(42.46405659601934, 415.2845470563871));
origPoints.append(QPointF(42.46405659601932, 415.2845470563871));
// Begin comparison
Comparison(pointsEkv, origPoints);