Added VGrainlineGeometry class to hold grainline parameters and methods to save, load and edit it

--HG--
branch : feature
This commit is contained in:
BojanKverh 2016-09-06 23:50:46 +02:00
parent 7e70c3a8f5
commit 287f8fc41e
20 changed files with 961 additions and 17 deletions

View File

@ -51,6 +51,7 @@
#include "../vpatterndb/calculator.h"
#include "../vpatterndb/vpatternpiecedata.h"
#include "../vpatterndb/vpatterninfogeometry.h"
#include "../vpatterndb/vgrainlinegeometry.h"
#include <QMessageBox>
#include <QUndoStack>
@ -716,6 +717,25 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
qreal dRot = GetParametrDouble(element, VToolDetail::AttrRotation, "0");
detail.GetPatternInfo().SetRotation(dRot);
}
else if (element.tagName() == TagGrainline)
{
detail.GetGrainlineGeometry().SetVisible(GetParametrBool(element, AttrVisible, falseStr));
QPointF ptPos;
ptPos.setX(GetParametrDouble(element, AttrMx, "0"));
ptPos.setY(GetParametrDouble(element, AttrMy, "0"));
detail.GetGrainlineGeometry().SetPos(ptPos);
qreal dLength = GetParametrDouble(element, AttrLength, "0");
detail.GetGrainlineGeometry().SetLength(dLength);
if (detail.GetGrainlineGeometry().IsVisible() == true)
{
qreal dRot = GetParametrDouble(element, VToolDetail::AttrRotation, "0");
detail.GetGrainlineGeometry().SetRotation(dRot);
}
else
{
detail.GetGrainlineGeometry().SetRotation(0);
}
}
}
}
VToolDetail::Create(id, detail, sceneDetail, this, data, parse, Source::FromFile);

View File

@ -27,5 +27,6 @@
<file>schema/individual_measurements/v0.3.1.xsd</file>
<file>schema/individual_measurements/v0.3.2.xsd</file>
<file>schema/individual_measurements/v0.3.3.xsd</file>
<file>schema/pattern/v0.3.5.xsd</file>
</qresource>
</RCC>

View File

@ -0,0 +1,581 @@
<?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>
<xs:element name="unit" type="units"></xs:element>
<xs:element name="image" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="extension" type="imageExtension"></xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="author" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="notes" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<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>
<xs:attribute name="h92" type="xs:boolean"></xs:attribute>
<xs:attribute name="h98" type="xs:boolean"></xs:attribute>
<xs:attribute name="h104" type="xs:boolean"></xs:attribute>
<xs:attribute name="h110" type="xs:boolean"></xs:attribute>
<xs:attribute name="h116" type="xs:boolean"></xs:attribute>
<xs:attribute name="h122" type="xs:boolean"></xs:attribute>
<xs:attribute name="h128" type="xs:boolean"></xs:attribute>
<xs:attribute name="h134" type="xs:boolean"></xs:attribute>
<xs:attribute name="h140" type="xs:boolean"></xs:attribute>
<xs:attribute name="h146" type="xs:boolean"></xs:attribute>
<xs:attribute name="h152" type="xs:boolean"></xs:attribute>
<xs:attribute name="h158" type="xs:boolean"></xs:attribute>
<xs:attribute name="h164" type="xs:boolean"></xs:attribute>
<xs:attribute name="h170" type="xs:boolean"></xs:attribute>
<xs:attribute name="h176" type="xs:boolean"></xs:attribute>
<xs:attribute name="h182" type="xs:boolean"></xs:attribute>
<xs:attribute name="h188" type="xs:boolean"></xs:attribute>
<xs:attribute name="h194" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="sizes">
<xs:complexType>
<xs:attribute name="all" type="xs:boolean" use="required"></xs:attribute>
<xs:attribute name="s22" type="xs:boolean"></xs:attribute>
<xs:attribute name="s24" type="xs:boolean"></xs:attribute>
<xs:attribute name="s26" type="xs:boolean"></xs:attribute>
<xs:attribute name="s28" type="xs:boolean"></xs:attribute>
<xs:attribute name="s30" type="xs:boolean"></xs:attribute>
<xs:attribute name="s32" type="xs:boolean"></xs:attribute>
<xs:attribute name="s34" type="xs:boolean"></xs:attribute>
<xs:attribute name="s36" type="xs:boolean"></xs:attribute>
<xs:attribute name="s38" type="xs:boolean"></xs:attribute>
<xs:attribute name="s40" type="xs:boolean"></xs:attribute>
<xs:attribute name="s42" type="xs:boolean"></xs:attribute>
<xs:attribute name="s44" type="xs:boolean"></xs:attribute>
<xs:attribute name="s46" type="xs:boolean"></xs:attribute>
<xs:attribute name="s48" type="xs:boolean"></xs:attribute>
<xs:attribute name="s50" type="xs:boolean"></xs:attribute>
<xs:attribute name="s52" type="xs:boolean"></xs:attribute>
<xs:attribute name="s54" type="xs:boolean"></xs:attribute>
<xs:attribute name="s56" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="custom" type="xs:boolean"></xs:attribute>
<xs:attribute name="defHeight" type="baseHeight"></xs:attribute>
<xs:attribute name="defSize" type="baseSize"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="patternName" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="patternNumber" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="company" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="customer" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="size" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="showDate" type="xs:boolean" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="showMeasurements" type="xs:boolean" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="measurements" type="xs:string"></xs:element>
<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>
<xs:attribute name="name" type="shortName" use="required"></xs:attribute>
<xs:attribute name="formula" type="xs:string" use="required"></xs:attribute>
</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>
<xs:attribute name="x" type="xs:double"></xs:attribute>
<xs:attribute name="y" type="xs:double"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="name" type="shortName"></xs:attribute>
<xs:attribute name="firstPoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="secondPoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="thirdPoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="basePoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="pShoulder" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p1Line" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p2Line" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="length" type="xs:string"></xs:attribute>
<xs:attribute name="angle" type="xs:string"></xs:attribute>
<xs:attribute name="typeLine" type="xs:string"></xs:attribute>
<xs:attribute name="splinePath" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="spline" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p1Line1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p1Line2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p2Line1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p2Line2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="center" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="radius" type="xs:string"></xs:attribute>
<xs:attribute name="axisP1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="axisP2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="arc" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="curve" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="curve1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="curve2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="lineColor" type="colors"></xs:attribute>
<xs:attribute name="color" type="colors"></xs:attribute>
<xs:attribute name="firstArc" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="secondArc" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="crossPoint" type="crossType"></xs:attribute>
<xs:attribute name="vCrossPoint" type="crossType"></xs:attribute>
<xs:attribute name="hCrossPoint" type="crossType"></xs:attribute>
<xs:attribute name="c1Center" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="c2Center" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="c1Radius" type="xs:string"></xs:attribute>
<xs:attribute name="c2Radius" type="xs:string"></xs:attribute>
<xs:attribute name="cRadius" type="xs:string"></xs:attribute>
<xs:attribute name="tangent" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="cCenter" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="name1" type="shortName"></xs:attribute>
<xs:attribute name="mx1" type="xs:double"></xs:attribute>
<xs:attribute name="my1" type="xs:double"></xs:attribute>
<xs:attribute name="name2" type="shortName"></xs:attribute>
<xs:attribute name="mx2" type="xs:double"></xs:attribute>
<xs:attribute name="my2" type="xs:double"></xs:attribute>
<xs:attribute name="point1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="point2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="dartP1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="dartP2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="dartP3" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="baseLineP1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="baseLineP2" type="xs:unsignedInt"></xs:attribute>
</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>
<xs:attribute name="firstPoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="secondPoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="typeLine" type="xs:string"></xs:attribute>
<xs:attribute name="lineColor" type="colors"></xs:attribute>
</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:attribute>
</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>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="center" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="angle" type="xs:string"></xs:attribute>
<xs:attribute name="suffix" type="xs:string"></xs:attribute>
<xs:attribute name="type" type="xs:string" use="required"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="arc" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="angle1" type="xs:string"></xs:attribute>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="angle2" type="xs:string"></xs:attribute>
<xs:attribute name="radius" type="xs:string"></xs:attribute>
<xs:attribute name="center" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="color" type="colors"></xs:attribute>
<xs:attribute name="length" type="xs:string"></xs:attribute>
</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>
<xs:attribute name="pSpline" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="angle" type="xs:string"></xs:attribute>
<xs:attribute name="angle1" type="xs:string"></xs:attribute>
<xs:attribute name="angle2" type="xs:string"></xs:attribute>
<xs:attribute name="length1" type="xs:string"></xs:attribute>
<xs:attribute name="length2" type="xs:string"></xs:attribute>
<xs:attribute name="kAsm1" type="xs:string"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="kCurve" type="xs:double"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="kAsm1" type="xs:double"></xs:attribute>
<xs:attribute name="kAsm2" type="xs:double"></xs:attribute>
<xs:attribute name="angle1" type="xs:string"></xs:attribute>
<xs:attribute name="angle2" type="xs:string"></xs:attribute>
<xs:attribute name="length1" type="xs:string"></xs:attribute>
<xs:attribute name="length2" type="xs:string"></xs:attribute>
<xs:attribute name="point1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="point2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="point3" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="point4" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="color" type="colors"></xs:attribute>
<xs:attribute name="duplicate" type="xs:unsignedInt"></xs:attribute>
</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>
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="typeObject" type="xs:string"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="idTool" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="inUse" type="xs:boolean"></xs:attribute>
</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>
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="typeObject" type="xs:string"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="idTool" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="inUse" type="xs:boolean"></xs:attribute>
</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>
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="typeObject" type="xs:string"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="idTool" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="inUse" type="xs:boolean"></xs:attribute>
</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="node" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="nodeType" type="xs:string"></xs:attribute>
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="reverse" type="xs:unsignedInt"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="children" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="child" type="xs:unsignedInt" minOccurs="1" maxOccurs="unbounded"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="indexD1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="indexD2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="inUse" type="xs:boolean"></xs:attribute>
</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>
<xs:attribute name="visible" type="xs:boolean"></xs:attribute>
<xs:attribute name="fontSize" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="width" type="xs:double"></xs:attribute>
<xs:attribute name="height" type="xs:double"></xs:attribute>
<xs:attribute name="rotation" type="xs:double"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="patternInfo" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="visible" type="xs:boolean"></xs:attribute>
<xs:attribute name="fontSize" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="width" type="xs:double"></xs:attribute>
<xs:attribute name="height" type="xs:double"></xs:attribute>
<xs:attribute name="rotation" type="xs:double"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="grainline" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="visible" type="xs:boolean"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="length" type="xs:double"></xs:attribute>
<xs:attribute name="rotation" type="xs:double"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="node" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="nodeType" type="xs:string"></xs:attribute>
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="reverse" type="xs:unsignedInt"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="supplement" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="width" type="xs:double"></xs:attribute>
<xs:attribute name="name" type="xs:string"></xs:attribute>
<xs:attribute name="closed" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="forbidFlipping" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="inLayout" type="xs:boolean"></xs:attribute>
</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>
<xs:attribute name="tool" type="xs:unsignedInt"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="name" type="xs:string"></xs:attribute>
<xs:attribute name="visible" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name" type="xs:string"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="readOnly" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="^([^0-9*/^+\-=\s()?%:;!.,`'\&quot;]){1,1}([^*/^+\-=\s()?%:;!.,`'\&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:restriction>
</xs:simpleType>
<xs:simpleType name="baseHeight">
<xs:restriction base="xs:unsignedInt">
<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="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: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="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: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="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:schema>

View File

@ -88,6 +88,7 @@ const QString VAbstractPattern::TagCompanyName = QStringLiteral("company");
const QString VAbstractPattern::TagSize = QStringLiteral("size");
const QString VAbstractPattern::TagShowDate = QStringLiteral("showDate");
const QString VAbstractPattern::TagShowMeasurements = QStringLiteral("showMeasurements");
const QString VAbstractPattern::TagGrainline = QStringLiteral("grainline");
const QString VAbstractPattern::AttrName = QStringLiteral("name");
const QString VAbstractPattern::AttrVisible = QStringLiteral("visible");

View File

@ -192,6 +192,7 @@ public:
static const QString TagSize;
static const QString TagShowDate;
static const QString TagShowMeasurements;
static const QString TagGrainline;
static const QString AttrName;
static const QString AttrVisible;

View File

@ -58,8 +58,8 @@ class QDomElement;
*/
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.3.4");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.3.4.xsd");
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.3.5");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.3.5.xsd");
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
@ -167,6 +167,8 @@ QString VPatternConverter::XSDSchema(int ver) const
case (0x000303):
return QStringLiteral("://schema/pattern/v0.3.3.xsd");
case (0x000304):
return QStringLiteral("://schema/pattern/v0.3.4.xsd");
case (0x000305):
return CurrentSchema;
default:
InvalidVersion(ver);
@ -250,6 +252,9 @@ void VPatternConverter::ApplyPatches()
ValidateXML(XSDSchema(0x000304), fileName);
V_FALLTHROUGH
case (0x000304):
ToV0_3_5();
ValidateXML(XSDSchema(0x000305), fileName);
case (0x000305):
break;
default:
break;
@ -410,6 +415,13 @@ void VPatternConverter::ToV0_3_4()
Save();
}
//---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::ToV0_3_5()
{
SetVersion(QStringLiteral("0.3.5"));
Save();
}
//---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::TagUnitToV0_2_0()
{

View File

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

View File

@ -47,6 +47,7 @@
#include "vdetail_p.h"
#include "vnodedetail.h"
#include "vpatternpiecedata.h"
#include "vgrainlinegeometry.h"
class QPointF;
@ -580,6 +581,28 @@ const VPatternInfoGeometry& VDetail::GetPatternInfo() const
return d->m_piPatternInfo;
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VDetail::GetGrainlineGeometry full access to the grainline geometry object
* @return reference to grainline geometry object
*/
VGrainlineGeometry& VDetail::GetGrainlineGeometry()
{
return d->m_glGrainline;
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VDetail::GetGrainlineGeometry returns the read-only reference to the grainline geometry object
* @return reference to grainline geometry object
*/
const VGrainlineGeometry& VDetail::GetGrainlineGeometry() const
{
return d->m_glGrainline;
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief indexOfNode return index in list node using id object.

View File

@ -47,6 +47,7 @@ class VDetailData;
class VNodeDetail;
class VPatternInfoGeometry;
class VPatternPieceData;
class VGrainlineGeometry;
/**
* @brief The VDetail class for path of object (points, arcs, splines).
@ -101,6 +102,8 @@ public:
const VPatternPieceData& GetPatternPieceData() const;
VPatternInfoGeometry& GetPatternInfo();
const VPatternInfoGeometry& GetPatternInfo() const;
VGrainlineGeometry& GetGrainlineGeometry();
const VGrainlineGeometry& GetGrainlineGeometry() const;
private:
QSharedDataPointer<VDetailData> d;

View File

@ -33,6 +33,7 @@
#include "vnodedetail.h"
#include "vpatternpiecedata.h"
#include "vpatterninfogeometry.h"
#include "vgrainlinegeometry.h"
#include "../ifc/ifcdef.h"
#include "../vmisc/diagnostic.h"
@ -52,7 +53,8 @@ public:
VDetailData(const VDetailData &detail)
:QSharedData(detail), _id(NULL_ID), nodes(detail.nodes), mx(detail.mx), my(detail.my),
m_ppData(detail.m_ppData), m_piPatternInfo(detail.m_piPatternInfo), inLayout(detail.inLayout)
m_ppData(detail.m_ppData), m_piPatternInfo(detail.m_piPatternInfo),
m_glGrainline(detail.m_glGrainline), inLayout(detail.inLayout)
{}
~VDetailData() {}
@ -73,6 +75,10 @@ public:
VPatternPieceData m_ppData;
/** @brief Pattern info coordinates */
VPatternInfoGeometry m_piPatternInfo;
/**
* @brief m_glGrainline grainline geometry object
*/
VGrainlineGeometry m_glGrainline;
bool inLayout;

View File

@ -0,0 +1,101 @@
/************************************************************************
**
** @file vgrainlinegeometry.cpp
** @author Bojan Kverh
** @date September 06, 2016
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#include <QPointF>
#include "vgrainlinegeometry.h"
//---------------------------------------------------------------------------------------------------------------------
VGrainlineGeometry::VGrainlineGeometry()
:m_ptPos(0, 0), m_dLength(0), m_dRotation(0), m_bVisible(true)
{}
//---------------------------------------------------------------------------------------------------------------------
VGrainlineGeometry::~VGrainlineGeometry()
{}
//---------------------------------------------------------------------------------------------------------------------
QPointF VGrainlineGeometry::GetPos() const
{
return m_ptPos;
}
//---------------------------------------------------------------------------------------------------------------------
void VGrainlineGeometry::SetPos(const QPointF &ptPos)
{
m_ptPos = ptPos;
}
//---------------------------------------------------------------------------------------------------------------------
qreal VGrainlineGeometry::GetLength() const
{
return m_dLength;
}
//---------------------------------------------------------------------------------------------------------------------
void VGrainlineGeometry::SetLength(qreal dLen)
{
m_dLength = dLen;
}
//---------------------------------------------------------------------------------------------------------------------
qreal VGrainlineGeometry::GetRotation() const
{
return m_dRotation;
}
//---------------------------------------------------------------------------------------------------------------------
void VGrainlineGeometry::SetRotation(qreal dRot)
{
m_dRotation = dRot;
}
//---------------------------------------------------------------------------------------------------------------------
bool VGrainlineGeometry::IsVisible() const
{
return m_bVisible;
}
//---------------------------------------------------------------------------------------------------------------------
void VGrainlineGeometry::SetVisible(bool bVisible)
{
m_bVisible = bVisible;
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -0,0 +1,76 @@
/************************************************************************
**
** @file vgrainlinegeometry.h
** @author Bojan Kverh
** @date September 06, 2016
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef VGRAINLINEGEOMETRY_H
#define VGRAINLINEGEOMETRY_H
#include <QtGlobal>
class QPointF;
/**
* @brief The VGrainlineGeometry class holds information about a grainline like
* position, size, rotation and visibility
*/
class VGrainlineGeometry
{
public:
VGrainlineGeometry();
~VGrainlineGeometry();
// methods, which set and return values of different parameters
QPointF GetPos() const;
void SetPos(const QPointF& ptPos);
qreal GetLength() const;
void SetLength(qreal dLen);
qreal GetRotation() const;
void SetRotation(qreal dRot);
bool IsVisible() const;
void SetVisible(bool bVisible);
private:
/**
* @brief m_ptPos position of grainline's center
*/
QPointF m_ptPos;
/**
* @brief m_dLength total length of grainline
*/
qreal m_dLength;
/**
* @brief m_dRotation rotation of grainline in [degrees]
*/
qreal m_dRotation;
/**
* @brief m_bVisible visibility flag
*/
bool m_bVisible;
};
#endif // VGRAINLINEGEOMETRY_H

View File

@ -19,7 +19,8 @@ SOURCES += \
$$PWD/variables/vvariable.cpp \
$$PWD/vformula.cpp \
$$PWD/vpatternpiecedata.cpp \
$$PWD/vpatterninfogeometry.cpp
$$PWD/vpatterninfogeometry.cpp \
$$PWD/vgrainlinegeometry.cpp
win32-msvc*:SOURCES += $$PWD/stable.cpp
@ -53,4 +54,5 @@ HEADERS += \
$$PWD/variables/vvariable_p.h \
$$PWD/vformula.h \
$$PWD/vpatternpiecedata.h \
$$PWD/vpatterninfogeometry.h
$$PWD/vpatterninfogeometry.h \
$$PWD/vgrainlinegeometry.h

View File

@ -67,3 +67,5 @@ CONFIG(release, debug|release){
}
include (../libs.pri)
HEADERS +=

View File

@ -76,7 +76,7 @@ class QWidget;
*/
DialogDetail::DialogDetail(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(), detail(VDetail()), supplement(true), closed(true), flagWidth(true),
m_bAddMode(true), m_qslMaterials(), m_qslPlacements(), m_conMCP(), m_oldData(), m_oldGeom()
m_bAddMode(true), m_qslMaterials(), m_qslPlacements(), m_conMCP(), m_oldData(), m_oldGeom(), m_oldGrainline()
{
ui.setupUi(this);
@ -150,7 +150,9 @@ DialogDetail::DialogDetail(const VContainer *data, const quint32 &toolId, QWidge
connect(ui.pushButtonRemove, &QPushButton::clicked, this, &DialogDetail::Remove);
connect(ui.listWidgetMCP, &QListWidget::itemClicked, this, &DialogDetail::SetEditMode);
connect(ui.comboBoxMaterial, &QComboBox::currentTextChanged, this, &DialogDetail::MaterialChanged);
connect(ui.checkBoxGrainline, &QCheckBox::toggled, this, &DialogDetail::EnableGrainlineRotation);
SetAddMode();
EnableGrainlineRotation();
ui.tabWidget->setCurrentIndex(0);
}
@ -463,6 +465,12 @@ VDetail DialogDetail::CreateDetail() const
detail.GetPatternInfo() = m_oldGeom;
detail.GetPatternInfo().SetVisible(ui.checkBoxPattern->isChecked());
detail.GetGrainlineGeometry() = m_oldGrainline;
detail.GetGrainlineGeometry().SetVisible(ui.checkBoxGrainline->isChecked());
if (ui.checkBoxGrainline->isChecked() == true)
{
detail.GetGrainlineGeometry().SetRotation(ui.spinBoxGrainlineRotation->value());
}
return detail;
}
@ -532,10 +540,16 @@ void DialogDetail::setDetail(const VDetail &value)
}
UpdateList();
ui.checkBoxGrainline->setChecked(detail.GetGrainlineGeometry().IsVisible());
ui.spinBoxGrainlineRotation->setValue(detail.GetGrainlineGeometry().GetRotation());
m_oldData = detail.GetPatternPieceData();
m_oldGeom = detail.GetPatternInfo();
m_oldGrainline = detail.GetGrainlineGeometry();
ValidObjects(DetailIsValid());
EnableGrainlineRotation();
}
//---------------------------------------------------------------------------------------------------------------------
@ -847,3 +861,9 @@ void DialogDetail::SetEditMode()
m_bAddMode = false;
}
//---------------------------------------------------------------------------------------------------------------------
void DialogDetail::EnableGrainlineRotation()
{
ui.spinBoxGrainlineRotation->setEnabled(ui.checkBoxGrainline->isChecked());
}

View File

@ -40,6 +40,7 @@
#include "../vpatterndb/vdetail.h"
#include "../vpatterndb/vpatterninfogeometry.h"
#include "../vpatterndb/vpatternpiecedata.h"
#include "../vpatterndb/vgrainlinegeometry.h"
#include "dialogtool.h"
#include "ui_dialogdetail.h"
@ -107,6 +108,7 @@ private:
MCPContainer m_conMCP;
VPatternPieceData m_oldData;
VPatternInfoGeometry m_oldGeom;
VGrainlineGeometry m_oldGrainline;
bool DetailIsValid() const;
@ -126,6 +128,7 @@ private:
private slots:
void SetAddMode();
void SetEditMode();
void EnableGrainlineRotation();
};
//---------------------------------------------------------------------------------------------------------------------

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>581</width>
<height>468</height>
<height>478</height>
</rect>
</property>
<property name="windowTitle">
@ -24,7 +24,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
@ -318,7 +318,8 @@
</property>
<property name="icon">
<iconset theme="go-down">
<normaloff>.</normaloff>.</iconset>
<normaloff/>
</iconset>
</property>
</widget>
</item>
@ -332,7 +333,8 @@
</property>
<property name="icon">
<iconset theme="go-up">
<normaloff>.</normaloff>.</iconset>
<normaloff/>
</iconset>
</property>
</widget>
</item>
@ -526,6 +528,50 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
<property name="cursor">
<cursorShape>SizeVerCursor</cursorShape>
</property>
<attribute name="title">
<string>Grainline</string>
</attribute>
<widget class="QWidget" name="formLayoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>291</width>
<height>62</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="1" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Rotation:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinBoxGrainlineRotation">
<property name="suffix">
<string>°</string>
</property>
<property name="maximum">
<number>359</number>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxGrainline">
<property name="text">
<string>Grainline visible</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</widget>
</item>
<item>
@ -539,11 +585,8 @@
</widget>
</item>
</layout>
<zorder>buttonBox</zorder>
<zorder>tabWidget</zorder>
</widget>
<tabstops>
<tabstop>lineEditLetter</tabstop>
<tabstop>lineEditName</tabstop>
<tabstop>comboBoxMaterial</tabstop>
<tabstop>spinBoxCutNumber</tabstop>
@ -551,8 +594,6 @@
<tabstop>pushButtonAdd</tabstop>
<tabstop>pushButtonCancel</tabstop>
<tabstop>pushButtonRemove</tabstop>
<tabstop>listWidgetMCP</tabstop>
<tabstop>buttonBox</tabstop>
<tabstop>toolButtonUp</tabstop>
<tabstop>listWidget</tabstop>
<tabstop>checkBoxClosed</tabstop>
@ -563,6 +604,13 @@
<tabstop>checkBoxSeams</tabstop>
<tabstop>doubleSpinBoxSeams</tabstop>
<tabstop>toolButtonDown</tabstop>
<tabstop>tabWidget</tabstop>
<tabstop>checkBoxForbidFlipping</tabstop>
<tabstop>checkBoxDetail</tabstop>
<tabstop>checkBoxPattern</tabstop>
<tabstop>lineEditLetter</tabstop>
<tabstop>checkBoxGrainline</tabstop>
<tabstop>spinBoxGrainlineRotation</tabstop>
</tabstops>
<resources>
<include location="../../../vmisc/share/resources/icon.qrc"/>

View File

@ -435,6 +435,7 @@ void VToolDetail::AddToFile()
doc->SetAttribute(domElement, AttrWidth, detail.getWidth());
doc->SetAttribute(domElement, AttrForbidFlipping, static_cast<quint8>(detail.getForbidFlipping()));
// detail data
QDomElement domData = doc->createElement(VAbstractPattern::TagData);
const VPatternPieceData& data = detail.GetPatternPieceData();
doc->SetAttribute(domData, VAbstractPattern::AttrLetter, data.GetLetter());
@ -461,6 +462,7 @@ void VToolDetail::AddToFile()
}
domElement.appendChild(domData);
// pattern info
domData = doc->createElement(VAbstractPattern::TagPatternInfo);
const VPatternInfoGeometry& geom = detail.GetPatternInfo();
doc->SetAttribute(domData, VAbstractPattern::AttrVisible, geom.IsVisible() == true? trueStr : falseStr);
@ -471,6 +473,16 @@ void VToolDetail::AddToFile()
doc->SetAttribute(domData, AttrFont, geom.GetFontSize());
doc->SetAttribute(domData, AttrRotation, geom.GetRotation());
// grainline
domData = doc->createElement(VAbstractPattern::TagGrainline);
const VGrainlineGeometry& glGeom = detail.GetGrainlineGeometry();
doc->SetAttribute(domData, VAbstractPattern::AttrVisible, glGeom.IsVisible() == true? trueStr : falseStr);
doc->SetAttribute(domData, AttrMx, glGeom.GetPos().x());
doc->SetAttribute(domData, AttrMy, glGeom.GetPos().y());
doc->SetAttribute(domData, AttrLength, glGeom.GetLength());
doc->SetAttribute(domData, AttrRotation, glGeom.GetRotation());
// nodes
for (int i = 0; i < detail.CountNode(); ++i)
{
AddNode(doc, domElement, detail.at(i));
@ -497,6 +509,7 @@ void VToolDetail::RefreshDataInFile()
doc->SetAttribute(domElement, AttrWidth, QString().setNum(det.getWidth()));
doc->RemoveAllChildren(domElement);
// detail data
QDomElement domData = doc->createElement(VAbstractPattern::TagData);
const VPatternPieceData& data = det.GetPatternPieceData();
doc->SetAttribute(domData, VAbstractPattern::AttrLetter, data.GetLetter());
@ -527,6 +540,7 @@ void VToolDetail::RefreshDataInFile()
}
domElement.appendChild(domData);
// pattern info
domData = doc->createElement(VAbstractPattern::TagPatternInfo);
const VPatternInfoGeometry& geom = det.GetPatternInfo();
doc->SetAttribute(domData, VAbstractPattern::AttrVisible, geom.IsVisible() == true? trueStr : falseStr);
@ -537,6 +551,16 @@ void VToolDetail::RefreshDataInFile()
doc->SetAttribute(domData, AttrFont, geom.GetFontSize());
doc->SetAttribute(domData, AttrRotation, geom.GetRotation());
// grainline
domData = doc->createElement(VAbstractPattern::TagGrainline);
const VGrainlineGeometry& glGeom = det.GetGrainlineGeometry();
doc->SetAttribute(domData, VAbstractPattern::AttrVisible, glGeom.IsVisible() == true? trueStr : falseStr);
doc->SetAttribute(domData, AttrMx, glGeom.GetPos().x());
doc->SetAttribute(domData, AttrMy, glGeom.GetPos().y());
doc->SetAttribute(domData, AttrLength, glGeom.GetLength());
doc->SetAttribute(domData, AttrRotation, glGeom.GetRotation());
// nodes
for (int i = 0; i < det.CountNode(); ++i)
{
AddNode(doc, domElement, det.at(i));

View File

@ -38,6 +38,7 @@
#include "../vmisc/def.h"
#include "../vpatterndb/vpatterninfogeometry.h"
#include "../vpatterndb/vpatternpiecedata.h"
#include "../vpatterndb/vgrainlinegeometry.h"
#include "../tools/vtooldetail.h"
#include "vundocommand.h"
@ -69,6 +70,8 @@ void SaveDetailOptions::undo()
doc->RemoveAllChildren(domElement);
SavePatternPieceData(domElement, oldDet);
SavePatternInfo(domElement, oldDet);
SaveGrainline(domElement, oldDet);
for (int i = 0; i < oldDet.CountNode(); ++i)
{
VToolDetail::AddNode(doc, domElement, oldDet.at(i));
@ -95,6 +98,7 @@ void SaveDetailOptions::redo()
doc->RemoveAllChildren(domElement);
SavePatternPieceData(domElement, newDet);
SavePatternInfo(domElement, newDet);
SaveGrainline(domElement, newDet);
for (int i = 0; i < newDet.CountNode(); ++i)
{
@ -194,3 +198,17 @@ void SaveDetailOptions::SavePatternInfo(QDomElement &domElement, const VDetail &
domElement.appendChild(domData);
}
//---------------------------------------------------------------------------------------------------------------------
void SaveDetailOptions::SaveGrainline(QDomElement &domElement, const VDetail &det)
{
QDomElement domData = doc->createElement(VAbstractPattern::TagGrainline);
const VGrainlineGeometry& glGeom = det.GetGrainlineGeometry();
doc->SetAttribute(domData, VAbstractPattern::AttrVisible, glGeom.IsVisible() == true? trueStr : falseStr);
doc->SetAttribute(domData, AttrMx, glGeom.GetPos().x());
doc->SetAttribute(domData, AttrMy, glGeom.GetPos().y());
doc->SetAttribute(domData, AttrLength, glGeom.GetLength());
doc->SetAttribute(domData, VToolDetail::AttrRotation, glGeom.GetRotation());
domElement.appendChild(domData);
}

View File

@ -65,6 +65,7 @@ private:
void SaveDet(QDomElement &domElement, const VDetail &det);
void SavePatternPieceData(QDomElement &domElement, const VDetail &det);
void SavePatternInfo(QDomElement &domElement, const VDetail &det);
void SaveGrainline(QDomElement &domElement, const VDetail &det);
};
//---------------------------------------------------------------------------------------------------------------------