Fix tool UnionDetails. Always left last poit of detail, save children ids,
save in correct section. --HG-- branch : develop
This commit is contained in:
parent
65bf17fcf9
commit
45454a8955
|
@ -2264,7 +2264,7 @@ void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &d
|
|||
const QVector<VDetail> vector = VToolUnionDetails::GetDetailFromFile(this, domElement);
|
||||
|
||||
VToolUnionDetails::Create(id, vector[0], vector[1], 0, 0, indexD1, indexD2, scene, this, data, parse,
|
||||
Source::FromFile);
|
||||
Source::FromFile);
|
||||
}
|
||||
catch (const VExceptionBadId &e)
|
||||
{
|
||||
|
|
|
@ -18,5 +18,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.2.4.xsd</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
423
src/libs/ifc/schema/pattern/v0.2.4.xsd
Normal file
423
src/libs/ifc/schema/pattern/v0.2.4.xsd
Normal file
|
@ -0,0 +1,423 @@
|
|||
<?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="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="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="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="xs:unsignedInt"></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="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="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:double"></xs:attribute>
|
||||
<xs:attribute name="angle2" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="point1" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="point4" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="color" type="colors"></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="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: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:complexType>
|
||||
</xs:element>
|
||||
<xs:simpleType name="shortName">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="^([^0-9*/^+\-=\s()?%:;!.,`'\"]){1,1}([^*/^+\-=\s()?%:;!.,`'\"]){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="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:schema>
|
|
@ -1311,3 +1311,23 @@ bool VAbstractPattern::IsModified() const
|
|||
{
|
||||
return modified;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QDomElement VAbstractPattern::GetDraw(const QString &name) const
|
||||
{
|
||||
const QDomNodeList draws = documentElement().elementsByTagName(TagDraw);
|
||||
for (int i=0; i < draws.size(); ++i)
|
||||
{
|
||||
QDomElement draw = draws.at(i).toElement();
|
||||
if (draw.isNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (draw.attribute(AttrName) == name)
|
||||
{
|
||||
return draw;
|
||||
}
|
||||
}
|
||||
return QDomElement();
|
||||
}
|
||||
|
|
|
@ -105,6 +105,8 @@ public:
|
|||
|
||||
bool IsModified() const;
|
||||
|
||||
QDomElement GetDraw(const QString &name) const;
|
||||
|
||||
static const QString TagPattern;
|
||||
static const QString TagCalculation;
|
||||
static const QString TagModeling;
|
||||
|
|
|
@ -43,8 +43,8 @@
|
|||
*/
|
||||
|
||||
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
|
||||
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.2.3");
|
||||
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.2.3.xsd");
|
||||
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.2.4");
|
||||
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.2.4.xsd");
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPatternConverter::VPatternConverter(const QString &fileName)
|
||||
|
@ -106,6 +106,8 @@ QString VPatternConverter::XSDSchema(int ver) const
|
|||
case (0x000202):
|
||||
return QStringLiteral("://schema/pattern/v0.2.2.xsd");
|
||||
case (0x000203):
|
||||
return QStringLiteral("://schema/pattern/v0.2.3.xsd");
|
||||
case (0x000204):
|
||||
return CurrentSchema;
|
||||
default:
|
||||
{
|
||||
|
@ -179,6 +181,13 @@ void VPatternConverter::ApplyPatches()
|
|||
V_FALLTHROUGH
|
||||
}
|
||||
case (0x000203):
|
||||
{
|
||||
ToV0_2_4();
|
||||
const QString schema = XSDSchema(0x000204);
|
||||
ValidateXML(schema, fileName);
|
||||
V_FALLTHROUGH
|
||||
}
|
||||
case (0x000204):
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -264,6 +273,14 @@ void VPatternConverter::ToV0_2_3()
|
|||
Save();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternConverter::ToV0_2_4()
|
||||
{
|
||||
FixToolUnionToV0_2_4();
|
||||
SetVersion(QStringLiteral("0.2.4"));
|
||||
Save();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternConverter::TagUnitToV0_2_0()
|
||||
{
|
||||
|
@ -807,6 +824,74 @@ QStringList VPatternConverter::ListPathPointExpressionsV0_1_4() const
|
|||
return expressions;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternConverter::FixToolUnionToV0_2_4()
|
||||
{
|
||||
QDomElement root = documentElement();
|
||||
const QDomNodeList modelings = root.elementsByTagName(QStringLiteral("modeling"));
|
||||
for (int i=0; i<modelings.size(); ++i)
|
||||
{
|
||||
ParseModelingToV0_2_4(modelings.at(i).toElement());
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternConverter::ParseModelingToV0_2_4(const QDomElement &modeling)
|
||||
{
|
||||
QDomElement node = modeling.firstChild().toElement();
|
||||
while (not node.isNull())
|
||||
{
|
||||
if (node.tagName() == QLatin1Literal("tools"))
|
||||
{
|
||||
const quint32 toolId = node.attribute(QStringLiteral("id")).toUInt();
|
||||
QVector<quint32> children;
|
||||
QDomElement childNode = node.nextSibling().toElement();
|
||||
const QString attrIdTool = QStringLiteral("idTool");
|
||||
while (not childNode.isNull())
|
||||
{
|
||||
if (childNode.hasAttribute(attrIdTool) && childNode.attribute(attrIdTool).toUInt() == toolId)
|
||||
{
|
||||
children.append(childNode.attribute(QStringLiteral("idObject")).toUInt());
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
childNode = childNode.nextSibling().toElement();
|
||||
}
|
||||
|
||||
if (not children.isEmpty())
|
||||
{
|
||||
SaveChildrenToolUnionToV0_2_4(toolId, children);
|
||||
}
|
||||
node = childNode;
|
||||
continue;
|
||||
}
|
||||
node = node.nextSibling().toElement();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternConverter::SaveChildrenToolUnionToV0_2_4(quint32 id, const QVector<quint32> &children)
|
||||
{
|
||||
QDomElement toolUnion = elementById(id);
|
||||
if (toolUnion.isNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QDomElement tagChildren = createElement(QString("children"));
|
||||
|
||||
for (int i=0; i<children.size(); ++i)
|
||||
{
|
||||
QDomElement tagChild = createElement(QString("child"));
|
||||
tagChild.appendChild(createTextNode(QString().setNum(children.at(i))));
|
||||
tagChildren.appendChild(tagChild);
|
||||
}
|
||||
|
||||
toolUnion.appendChild(tagChildren);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QMap<QString, QString> VPatternConverter::OldNamesToNewNames_InV0_2_0()
|
||||
{
|
||||
|
|
|
@ -63,6 +63,7 @@ private:
|
|||
void ToV0_2_1();
|
||||
void ToV0_2_2();
|
||||
void ToV0_2_3();
|
||||
void ToV0_2_4();
|
||||
|
||||
void TagUnitToV0_2_0();
|
||||
void TagIncrementToV0_2_0();
|
||||
|
@ -87,6 +88,10 @@ private:
|
|||
QDomElement TagIncrementsV0_1_4() const;
|
||||
QStringList ListPathPointExpressionsV0_1_4() const;
|
||||
|
||||
void FixToolUnionToV0_2_4();
|
||||
void ParseModelingToV0_2_4(const QDomElement &modeling);
|
||||
void SaveChildrenToolUnionToV0_2_4(quint32 id, const QVector<quint32> &children);
|
||||
|
||||
static QMap<QString, QString> OldNamesToNewNames_InV0_2_0();
|
||||
static QMap<QString, QString> OldNamesToNewNames_InV0_2_1();
|
||||
};
|
||||
|
|
|
@ -46,7 +46,8 @@ const QString VAbstractNode::AttrIdTool = QStringLiteral("idTool");
|
|||
*/
|
||||
VAbstractNode::VAbstractNode(VAbstractPattern *doc, VContainer *data, const quint32 &id, const quint32 &idNode,
|
||||
const quint32 &idTool, QObject *parent)
|
||||
: VAbstractTool(doc, data, id, parent), idNode(idNode), idTool(idTool), currentColor(Qt::black)
|
||||
: VAbstractTool(doc, data, id, parent), parentType(ParentType::Item), idNode(idNode), idTool(idTool),
|
||||
currentColor(Qt::black)
|
||||
{
|
||||
_referens = 0;
|
||||
}
|
||||
|
@ -95,6 +96,18 @@ void VAbstractNode::decrementReferens()
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
ParentType VAbstractNode::GetParentType() const
|
||||
{
|
||||
return parentType;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractNode::SetParentType(const ParentType &value)
|
||||
{
|
||||
parentType = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief AddToModeling add tag to modeling tag current pattern peace.
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
|
||||
#include <QColor>
|
||||
|
||||
enum class ParentType : bool {Scene, Item};
|
||||
|
||||
/**
|
||||
* @brief The VAbstractNode class parent class for all detail node.
|
||||
*/
|
||||
|
@ -48,6 +50,12 @@ public:
|
|||
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
|
||||
virtual void incrementReferens() Q_DECL_OVERRIDE;
|
||||
virtual void decrementReferens() Q_DECL_OVERRIDE;
|
||||
|
||||
ParentType GetParentType() const;
|
||||
void SetParentType(const ParentType &value);
|
||||
|
||||
protected:
|
||||
ParentType parentType;
|
||||
protected:
|
||||
/** @brief idNodenode id. */
|
||||
quint32 idNode;
|
||||
|
|
|
@ -76,10 +76,6 @@ void VNodeArc::Create(VAbstractPattern *doc, VContainer *data, VMainGraphicsScen
|
|||
{
|
||||
VNodeArc *arc = new VNodeArc(doc, data, id, idArc, typeCreation, idTool, parent);
|
||||
|
||||
// Try to prevent memory leak
|
||||
arc->hide();// If no one will use node, it will stay hidden
|
||||
scene->addItem(arc);// First adopted by scene
|
||||
|
||||
doc->AddTool(id, arc);
|
||||
if (idTool != NULL_ID)
|
||||
{
|
||||
|
@ -88,6 +84,13 @@ void VNodeArc::Create(VAbstractPattern *doc, VContainer *data, VMainGraphicsScen
|
|||
SCASSERT(tool != nullptr);
|
||||
arc->setParent(tool);// Adopted by a tool
|
||||
}
|
||||
else
|
||||
{
|
||||
// Try to prevent memory leak
|
||||
scene->addItem(arc);// First adopted by scene
|
||||
arc->hide();// If no one will use node, it will stay hidden
|
||||
arc->SetParentType(ParentType::Scene);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -186,7 +189,10 @@ void VNodeArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VNodeArc::ShowNode()
|
||||
{
|
||||
show();
|
||||
if (parentType != ParentType::Scene)
|
||||
{
|
||||
show();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -90,10 +90,6 @@ void VNodePoint::Create(VAbstractPattern *doc, VContainer *data, VMainGraphicsSc
|
|||
//Better check garbage before each saving file. Check only modeling tags.
|
||||
VNodePoint *point = new VNodePoint(doc, data, id, idPoint, typeCreation, idTool, parent);
|
||||
|
||||
// Try to prevent memory leak
|
||||
point->hide();// If no one will use node, it will stay hidden
|
||||
scene->addItem(point);// First adopted by scene
|
||||
|
||||
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VNodePoint::EnableToolMove);
|
||||
doc->AddTool(id, point);
|
||||
if (idTool != NULL_ID)
|
||||
|
@ -103,6 +99,13 @@ void VNodePoint::Create(VAbstractPattern *doc, VContainer *data, VMainGraphicsSc
|
|||
SCASSERT(tool != nullptr);
|
||||
point->setParent(tool);// Adopted by a tool
|
||||
}
|
||||
else
|
||||
{
|
||||
// Try to prevent memory leak
|
||||
scene->addItem(point);// First adopted by scene
|
||||
point->hide();// If no one will use node, it will stay hidden
|
||||
point->SetParentType(ParentType::Scene);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -274,7 +277,10 @@ void VNodePoint::RefreshLine()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VNodePoint::ShowNode()
|
||||
{
|
||||
show();
|
||||
if (parentType != ParentType::Scene)
|
||||
{
|
||||
show();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -79,10 +79,6 @@ VNodeSpline *VNodeSpline::Create(VAbstractPattern *doc, VContainer *data, VMainG
|
|||
{
|
||||
spl = new VNodeSpline(doc, data, id, idSpline, typeCreation, idTool, parent);
|
||||
|
||||
// Try to prevent memory leak
|
||||
spl->hide();// If no one will use node, it will stay hidden
|
||||
scene->addItem(spl);// First adopted by scene
|
||||
|
||||
doc->AddTool(id, spl);
|
||||
if (idTool != NULL_ID)
|
||||
{
|
||||
|
@ -91,6 +87,13 @@ VNodeSpline *VNodeSpline::Create(VAbstractPattern *doc, VContainer *data, VMainG
|
|||
SCASSERT(tool != nullptr);
|
||||
spl->setParent(tool);// Adopted by a tool
|
||||
}
|
||||
else
|
||||
{
|
||||
// Try to prevent memory leak
|
||||
scene->addItem(spl);// First adopted by scene
|
||||
spl->hide();// If no one will use node, it will stay hidden
|
||||
spl->SetParentType(ParentType::Scene);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -189,7 +192,10 @@ void VNodeSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VNodeSpline::ShowNode()
|
||||
{
|
||||
show();
|
||||
if (parentType != ParentType::Scene)
|
||||
{
|
||||
show();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -79,22 +79,20 @@ void VNodeSplinePath::Create(VAbstractPattern *doc, VContainer *data, VMainGraph
|
|||
{
|
||||
VNodeSplinePath *splPath = new VNodeSplinePath(doc, data, id, idSpline, typeCreation, idTool, parent);
|
||||
|
||||
// Try to prevent memory leak
|
||||
splPath->hide();// If no one will use node, it will stay hidden
|
||||
scene->addItem(splPath);// First adopted by scene
|
||||
|
||||
doc->AddTool(id, splPath);
|
||||
const QSharedPointer<VSplinePath> path = data->GeometricObject<VSplinePath>(id);
|
||||
const QVector<VSplinePoint> *points = path->GetPoint();
|
||||
for (qint32 i = 0; i<points->size(); ++i)
|
||||
if (idTool != NULL_ID)
|
||||
{
|
||||
if (idTool != NULL_ID)
|
||||
{
|
||||
//Some nodes we don't show on scene. Tool that create this nodes must free memory.
|
||||
VDataTool *tool = doc->getTool(idTool);
|
||||
SCASSERT(tool != nullptr);
|
||||
splPath->setParent(tool);// Adopted by a tool
|
||||
}
|
||||
//Some nodes we don't show on scene. Tool that create this nodes must free memory.
|
||||
VDataTool *tool = doc->getTool(idTool);
|
||||
SCASSERT(tool != nullptr);
|
||||
splPath->setParent(tool);// Adopted by a tool
|
||||
}
|
||||
else
|
||||
{
|
||||
// Try to prevent memory leak
|
||||
scene->addItem(splPath);// First adopted by scene
|
||||
splPath->hide();// If no one will use node, it will stay hidden
|
||||
splPath->SetParentType(ParentType::Scene);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -193,7 +191,10 @@ void VNodeSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VNodeSplinePath::ShowNode()
|
||||
{
|
||||
show();
|
||||
if (parentType != ParentType::Scene)
|
||||
{
|
||||
show();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -74,8 +74,8 @@ const QString VToolDetail::NodeSplinePath = QStringLiteral("NodeSplinePath");
|
|||
* @param parent parent object
|
||||
*/
|
||||
VToolDetail::VToolDetail(VAbstractPattern *doc, VContainer *data, const quint32 &id, const Source &typeCreation,
|
||||
VMainGraphicsScene *scene, QGraphicsItem *parent)
|
||||
:VAbstractTool(doc, data, id), QGraphicsPathItem(parent), dialog(nullptr), sceneDetails(scene)
|
||||
VMainGraphicsScene *scene, const QString &drawName, QGraphicsItem *parent)
|
||||
:VAbstractTool(doc, data, id), QGraphicsPathItem(parent), dialog(nullptr), sceneDetails(scene), drawName(drawName)
|
||||
{
|
||||
VDetail detail = data->GetDetail(id);
|
||||
for (int i = 0; i< detail.CountNode(); ++i)
|
||||
|
@ -208,7 +208,7 @@ void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstrac
|
|||
* @param typeCreation way we create this tool.
|
||||
*/
|
||||
void VToolDetail::Create(const quint32 &_id, const VDetail &newDetail, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
||||
VContainer *data, const Document &parse, const Source &typeCreation)
|
||||
VContainer *data, const Document &parse, const Source &typeCreation, const QString &drawName)
|
||||
{
|
||||
quint32 id = _id;
|
||||
if (typeCreation == Source::FromGui || typeCreation == Source::FromTool)
|
||||
|
@ -226,7 +226,7 @@ void VToolDetail::Create(const quint32 &_id, const VDetail &newDetail, VMainGrap
|
|||
VAbstractTool::AddRecord(id, Tool::Detail, doc);
|
||||
if (parse == Document::FullParse)
|
||||
{
|
||||
VToolDetail *detail = new VToolDetail(doc, data, id, typeCreation, scene);
|
||||
VToolDetail *detail = new VToolDetail(doc, data, id, typeCreation, scene, drawName);
|
||||
scene->addItem(detail);
|
||||
connect(detail, &VToolDetail::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
QHash<quint32, VDataTool*>* tools = doc->getTools();
|
||||
|
@ -305,7 +305,7 @@ void VToolDetail::AddToFile()
|
|||
AddNode(doc, domElement, detail.at(i));
|
||||
}
|
||||
|
||||
AddDet *addDet = new AddDet(domElement, doc, detail);
|
||||
AddDet *addDet = new AddDet(domElement, doc, detail, drawName);
|
||||
connect(addDet, &AddDet::NeedFullParsing, doc, &VAbstractPattern::NeedFullParsing);
|
||||
qApp->getUndoStack()->push(addDet);
|
||||
}
|
||||
|
@ -602,6 +602,7 @@ void VToolDetail::InitTool(VMainGraphicsScene *scene, const VNodeDetail &node)
|
|||
SCASSERT(tool != nullptr);
|
||||
connect(tool, &Tool::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
tool->setParentItem(this);
|
||||
tool->SetParentType(ParentType::Item);
|
||||
doc->IncrementReferens(node.getId());
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ class VToolDetail: public VAbstractTool, public QGraphicsPathItem
|
|||
Q_OBJECT
|
||||
public:
|
||||
VToolDetail(VAbstractPattern *doc, VContainer *data, const quint32 &id, const Source &typeCreation,
|
||||
VMainGraphicsScene *scene, QGraphicsItem * parent = nullptr);
|
||||
VMainGraphicsScene *scene, const QString &drawName, QGraphicsItem * parent = nullptr);
|
||||
~VToolDetail();
|
||||
|
||||
virtual void setDialog();
|
||||
|
@ -65,7 +65,7 @@ public:
|
|||
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data);
|
||||
static void Create(const quint32 &_id, const VDetail &newDetail, VMainGraphicsScene *scene,
|
||||
VAbstractPattern *doc, VContainer *data, const Document &parse,
|
||||
const Source &typeCreation);
|
||||
const Source &typeCreation, const QString &drawName = QString());
|
||||
static const QString TagName;
|
||||
static const QString TagNode;
|
||||
static const QString AttrSupplement;
|
||||
|
@ -109,6 +109,7 @@ private:
|
|||
|
||||
/** @brief sceneDetails pointer to the scene. */
|
||||
VMainGraphicsScene *sceneDetails;
|
||||
QString drawName;
|
||||
|
||||
void RefreshGeometry ();
|
||||
template <typename Tool>
|
||||
|
|
|
@ -33,12 +33,15 @@
|
|||
#include "../../vgeometry/varc.h"
|
||||
#include "../../vgeometry/vsplinepath.h"
|
||||
#include "../dialogs/tools/dialoguniondetails.h"
|
||||
#include "../undocommands/adduniondetails.h"
|
||||
|
||||
#include <QUndoStack>
|
||||
|
||||
const QString VToolUnionDetails::TagName = QStringLiteral("tools");
|
||||
const QString VToolUnionDetails::ToolType = QStringLiteral("unionDetails");
|
||||
const QString VToolUnionDetails::TagDetail = QStringLiteral("det");
|
||||
const QString VToolUnionDetails::TagNode = QStringLiteral("node");
|
||||
const QString VToolUnionDetails::TagChildren = QStringLiteral("children");
|
||||
const QString VToolUnionDetails::TagChild = QStringLiteral("child");
|
||||
const QString VToolUnionDetails::AttrIndexD1 = QStringLiteral("indexD1");
|
||||
const QString VToolUnionDetails::AttrIndexD2 = QStringLiteral("indexD2");
|
||||
const QString VToolUnionDetails::AttrIdObject = QStringLiteral("idObject");
|
||||
|
@ -46,6 +49,22 @@ const QString VToolUnionDetails::AttrNodeType = QStringLiteral("nodeType");
|
|||
const QString VToolUnionDetails::NodeTypeContour = QStringLiteral("Contour");
|
||||
const QString VToolUnionDetails::NodeTypeModeling = QStringLiteral("Modeling");
|
||||
|
||||
#if defined(Q_CC_CLANG)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||
#elif defined(Q_CC_INTEL)
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable: 1418 )
|
||||
#endif
|
||||
|
||||
Q_LOGGING_CATEGORY(vToolUnion, "v.toolUnion")
|
||||
|
||||
#if defined(Q_CC_CLANG)
|
||||
#pragma clang diagnostic pop
|
||||
#elif defined(Q_CC_INTEL)
|
||||
#pragma warning( pop )
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief VToolUnionDetails costructor.
|
||||
|
@ -61,8 +80,8 @@ const QString VToolUnionDetails::NodeTypeModeling = QStringLiteral("Modeling");
|
|||
*/
|
||||
VToolUnionDetails::VToolUnionDetails(VAbstractPattern *doc, VContainer *data, const quint32 &id, const VDetail &d1,
|
||||
const VDetail &d2, const quint32 &indexD1, const quint32 &indexD2,
|
||||
const Source &typeCreation, QObject *parent)
|
||||
:VAbstractTool(doc, data, id, parent), d1(d1), d2(d2), indexD1(indexD1), indexD2(indexD2)
|
||||
const Source &typeCreation, const QString &drawName, QObject *parent)
|
||||
:VAbstractTool(doc, data, id, parent), d1(d1), d2(d2), indexD1(indexD1), indexD2(indexD2), drawName(drawName)
|
||||
{
|
||||
_referens = 0;
|
||||
ToolCreation(typeCreation);
|
||||
|
@ -83,8 +102,9 @@ VToolUnionDetails::VToolUnionDetails(VAbstractPattern *doc, VContainer *data, co
|
|||
* @param pRotate point rotation.
|
||||
* @param angle angle rotation.
|
||||
*/
|
||||
void VToolUnionDetails::AddToNewDetail(QObject *tool, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data, VDetail &newDetail,
|
||||
const VDetail &det, const int &i, const quint32 &idTool, const qreal &dx,
|
||||
void VToolUnionDetails::AddToNewDetail(QObject *tool, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
||||
VContainer *data, VDetail &newDetail, const VDetail &det, const int &i,
|
||||
const quint32 &idTool, QVector<quint32> &children, const qreal &dx,
|
||||
const qreal &dy, const quint32 &pRotate, const qreal &angle)
|
||||
{
|
||||
quint32 id = 0, idObject = 0;
|
||||
|
@ -103,6 +123,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VMainGraphicsScene *scene,
|
|||
BiasRotatePoint(point, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(),
|
||||
angle);
|
||||
idObject = data->AddGObject(point);
|
||||
children.append(idObject);
|
||||
VPointF *point1 = new VPointF(*point);
|
||||
point1->setMode(Draw::Modeling);
|
||||
id = data->AddGObject(point1);
|
||||
|
@ -137,6 +158,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VMainGraphicsScene *scene,
|
|||
QString().setNum(l2.angle()));
|
||||
arc1->setMode(Draw::Modeling);
|
||||
idObject = data->AddGObject(arc1);
|
||||
children.append(idObject);
|
||||
|
||||
VArc *arc2 = new VArc(*arc1);
|
||||
arc2->setMode(Draw::Modeling);
|
||||
|
@ -172,6 +194,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VMainGraphicsScene *scene,
|
|||
VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline->GetKcurve(), 0,
|
||||
Draw::Modeling);
|
||||
idObject = data->AddGObject(spl);
|
||||
children.append(idObject);
|
||||
|
||||
VSpline *spl1 = new VSpline(*spl);
|
||||
spl1->setMode(Draw::Modeling);
|
||||
|
@ -227,6 +250,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VMainGraphicsScene *scene,
|
|||
delete p1;
|
||||
}
|
||||
idObject = data->AddGObject(path);
|
||||
children.append(idObject);
|
||||
|
||||
VSplinePath *path1 = new VSplinePath(*path);
|
||||
path1->setMode(Draw::Modeling);
|
||||
|
@ -250,14 +274,15 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VMainGraphicsScene *scene,
|
|||
* @param data container with variables.
|
||||
* @param det detail what we union.
|
||||
* @param i index node in detail.
|
||||
* @param idCount count updated or created objects.
|
||||
* @param children list ids of all children.
|
||||
* @param dx bias node x axis.
|
||||
* @param dy bias node y axis.
|
||||
* @param pRotate point rotation.
|
||||
* @param angle angle rotation.
|
||||
*/
|
||||
void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, const VDetail &det, const int &i,
|
||||
quint32 &idCount, const qreal &dx, const qreal &dy, const quint32 &pRotate,
|
||||
void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const int &i,
|
||||
QVector<quint32> &children, const qreal &dx, const qreal &dy,
|
||||
const quint32 &pRotate,
|
||||
const qreal &angle)
|
||||
{
|
||||
switch (det.at(i).getTypeTool())
|
||||
|
@ -269,10 +294,7 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data,
|
|||
VPointF *point = new VPointF(*data->GeometricObject<VPointF>(det.at(i).getId()));
|
||||
point->setMode(Draw::Modeling);
|
||||
BiasRotatePoint(point, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(), angle);
|
||||
++idCount;// For parent
|
||||
data->UpdateGObject(idDetail+idCount, point);
|
||||
|
||||
++idCount;// For child
|
||||
data->UpdateGObject(TakeNextId(children), point);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -297,10 +319,7 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data,
|
|||
VArc *arc1 = new VArc(*center, arc->GetRadius(), arc->GetFormulaRadius(), l1.angle(),
|
||||
QString().setNum(l1.angle()), l2.angle(), QString().setNum(l2.angle()));
|
||||
arc1->setMode(Draw::Modeling);
|
||||
++idCount;// For parent
|
||||
data->UpdateGObject(idDetail+idCount, arc1);
|
||||
|
||||
++idCount;// For child
|
||||
data->UpdateGObject(TakeNextId(children), arc1);
|
||||
delete center;
|
||||
}
|
||||
}
|
||||
|
@ -326,11 +345,7 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data,
|
|||
|
||||
VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline->GetKcurve(), 0,
|
||||
Draw::Modeling);
|
||||
|
||||
++idCount;// For parent
|
||||
data->UpdateGObject(idDetail+idCount, spl);
|
||||
|
||||
++idCount;// For child
|
||||
data->UpdateGObject(TakeNextId(children), spl);
|
||||
delete p1;
|
||||
delete p4;
|
||||
}
|
||||
|
@ -376,11 +391,7 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data,
|
|||
delete p1;
|
||||
delete p4;
|
||||
}
|
||||
|
||||
++idCount;//For parent
|
||||
data->UpdateGObject(idDetail+idCount, path);
|
||||
|
||||
++idCount;// For child
|
||||
data->UpdateGObject(TakeNextId(children), path);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -520,9 +531,12 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d
|
|||
{
|
||||
VToolUnionDetails *unionDetails = 0;
|
||||
quint32 id = _id;
|
||||
QString drawName;
|
||||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
id = data->getNextId();
|
||||
drawName = DrawName(doc, d1id, d2id);
|
||||
SCASSERT(not drawName.isEmpty());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -536,7 +550,7 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d
|
|||
if (parse == Document::FullParse)
|
||||
{
|
||||
//Scene doesn't show this tool, so doc will destroy this object.
|
||||
unionDetails = new VToolUnionDetails(doc, data, id, d1, d2, indexD1, indexD2, typeCreation, doc);
|
||||
unionDetails = new VToolUnionDetails(doc, data, id, d1, d2, indexD1, indexD2, typeCreation, drawName, doc);
|
||||
QHash<quint32, VDataTool*>* tools = doc->getTools();
|
||||
tools->insert(id, unionDetails);
|
||||
}
|
||||
|
@ -566,18 +580,6 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d
|
|||
const QLineF p4p3 = QLineF(point4.toQPointF(), point3.toQPointF());
|
||||
const QLineF p1p2 = QLineF(point1.toQPointF(), point2.toQPointF());
|
||||
|
||||
// How many points do we need to skip?
|
||||
// If lengths of edges not equal we should left the second point of the second detail.
|
||||
qint32 skip;
|
||||
if (qFuzzyCompare(p1p2.length(), p4p3.length()))
|
||||
{
|
||||
skip = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
skip = 1;
|
||||
}
|
||||
|
||||
const qreal angle = p4p3.angleTo(p1p2);
|
||||
qint32 pointsD2 = 0; //Keeps number points the second detail, what we have already added.
|
||||
|
||||
|
@ -588,11 +590,12 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d
|
|||
{
|
||||
qint32 i = 0;
|
||||
VDetail newDetail;
|
||||
QVector<quint32> children;
|
||||
do
|
||||
{
|
||||
AddToNewDetail(unionDetails, scene, doc, data, newDetail, d1.RemoveEdge(indexD1), i, id);
|
||||
AddToNewDetail(unionDetails, scene, doc, data, newDetail, d1.RemoveEdge(indexD1), i, id, children);
|
||||
++i;
|
||||
if (i > d1.indexOfNode(det1p1.getId()) && pointsD2 < countNodeD2-2)
|
||||
if (i > d1.indexOfNode(det1p1.getId()) && pointsD2 < countNodeD2-1)
|
||||
{
|
||||
qint32 j = 0;
|
||||
FindIndexJ(pointsD2, d2, indexD2, j);
|
||||
|
@ -602,17 +605,17 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d
|
|||
{
|
||||
j=0;
|
||||
}
|
||||
AddToNewDetail(unionDetails, scene, doc, data, newDetail, d2.RemoveEdge(indexD2), j, id, dx, dy,
|
||||
det1p1.getId(), angle);
|
||||
AddToNewDetail(unionDetails, scene, doc, data, newDetail, d2.RemoveEdge(indexD2), j, id, children,
|
||||
dx, dy, det1p1.getId(), angle);
|
||||
++pointsD2;
|
||||
++j;
|
||||
} while (pointsD2 < countNodeD2-skip);
|
||||
} while (pointsD2 < countNodeD2-1);
|
||||
}
|
||||
} while (i < countNodeD1);
|
||||
|
||||
newDetail.setName("Detail");
|
||||
newDetail.setWidth(d1.getWidth());
|
||||
VToolDetail::Create(0, newDetail, scene, doc, data, parse, Source::FromTool);
|
||||
VToolDetail::Create(0, newDetail, scene, doc, data, parse, Source::FromTool, drawName);
|
||||
QHash<quint32, VDataTool*>* tools = doc->getTools();
|
||||
SCASSERT(tools != nullptr);
|
||||
|
||||
|
@ -627,31 +630,40 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d
|
|||
SCASSERT(toolDet != nullptr);
|
||||
bool ask = false;
|
||||
toolDet->Remove(ask);
|
||||
|
||||
SCASSERT(not children.isEmpty())
|
||||
SaveChildren(doc, id, children);
|
||||
}
|
||||
else
|
||||
{
|
||||
quint32 idCount = 0;
|
||||
qint32 i = 0;
|
||||
do
|
||||
QVector<quint32> children = AllChildren(doc, id);
|
||||
if (not children.isEmpty())
|
||||
{
|
||||
UpdatePoints(id, data, d1.RemoveEdge(indexD1), i, idCount);
|
||||
++i;
|
||||
if (i > d1.indexOfNode(det1p1.getId()) && pointsD2 < countNodeD2-2)
|
||||
qint32 i = 0;
|
||||
do
|
||||
{
|
||||
qint32 j = 0;
|
||||
FindIndexJ(pointsD2, d2, indexD2, j);
|
||||
do
|
||||
//UpdatePoints(data, d1.RemoveEdge(indexD1), i, children);
|
||||
++i;
|
||||
if (i > d1.indexOfNode(det1p1.getId()))
|
||||
{
|
||||
if (j >= d2.RemoveEdge(indexD2).CountNode())
|
||||
const int childrenCount = children.size();
|
||||
VDetail d2REdge = d2.RemoveEdge(indexD2);
|
||||
qint32 j = 0;
|
||||
FindIndexJ(pointsD2, d2, indexD2, j);
|
||||
do
|
||||
{
|
||||
j=0;
|
||||
}
|
||||
UpdatePoints(id, data, d2.RemoveEdge(indexD2), j, idCount, dx, dy, det1p1.getId(), angle);
|
||||
++pointsD2;
|
||||
++j;
|
||||
} while (pointsD2 < countNodeD2-skip);
|
||||
}
|
||||
} while (i<countNodeD1);
|
||||
if (j >= countNodeD2)
|
||||
{
|
||||
j=0;
|
||||
}
|
||||
UpdatePoints(data, d2REdge, j, children, dx, dy, det1p1.getId(), angle);
|
||||
++pointsD2;
|
||||
++j;
|
||||
} while (pointsD2 < childrenCount);
|
||||
break;
|
||||
}
|
||||
} while (i<countNodeD1);
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -857,7 +869,146 @@ QDomNode VToolUnionDetails::UpdateDetail(const QDomNode &domNode, const VDetail
|
|||
*/
|
||||
void VToolUnionDetails::AddToModeling(const QDomElement &domElement)
|
||||
{
|
||||
AddUnionDetails *addUnion = new AddUnionDetails(domElement, doc);
|
||||
connect(addUnion, &AddUnionDetails::NeedFullParsing, doc, &VAbstractPattern::NeedFullParsing);
|
||||
qApp->getUndoStack()->push(addUnion);
|
||||
QDomElement modeling = doc->GetDraw(drawName).firstChildElement(VAbstractPattern::TagModeling);
|
||||
if (not modeling.isNull())
|
||||
{
|
||||
modeling.appendChild(domElement);
|
||||
}
|
||||
else
|
||||
{
|
||||
qCDebug(vToolUnion, "Can't find tag %s.", qUtf8Printable(VAbstractPattern::TagModeling));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolUnionDetails::SaveChildren(VAbstractPattern *doc, quint32 id, const QVector<quint32> &children)
|
||||
{
|
||||
QDomElement toolUnion = doc->elementById(id);
|
||||
if (toolUnion.isNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QDomElement tagChildren = doc->createElement(TagChildren);
|
||||
|
||||
for (int i=0; i<children.size(); ++i)
|
||||
{
|
||||
QDomElement tagChild = doc->createElement(TagChild);
|
||||
tagChild.appendChild(doc->createTextNode(QString().setNum(children.at(i))));
|
||||
tagChildren.appendChild(tagChild);
|
||||
}
|
||||
|
||||
toolUnion.appendChild(tagChildren);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<quint32> VToolUnionDetails::AllChildren(VAbstractPattern *doc, quint32 id)
|
||||
{
|
||||
const QDomElement toolUnion = doc->elementById(id);
|
||||
if (toolUnion.isNull())
|
||||
{
|
||||
return QVector<quint32>();
|
||||
}
|
||||
|
||||
const QDomElement tagChildren = toolUnion.firstChildElement(TagChildren);
|
||||
if (tagChildren.isNull())
|
||||
{
|
||||
return QVector<quint32>();
|
||||
}
|
||||
|
||||
QVector<quint32> childrenId;
|
||||
const QDomNodeList listChildren = tagChildren.elementsByTagName(TagChild);
|
||||
for (int i=0; i < listChildren.size(); ++i)
|
||||
{
|
||||
const QDomElement domElement = listChildren.at(i).toElement();
|
||||
if (not domElement.isNull())
|
||||
{
|
||||
childrenId.append(domElement.text().toUInt());
|
||||
}
|
||||
}
|
||||
return childrenId;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolUnionDetails::TakeNextId(QVector<quint32> &children)
|
||||
{
|
||||
quint32 idChild = NULL_ID;
|
||||
if (not children.isEmpty())
|
||||
{
|
||||
idChild = children.takeFirst();
|
||||
}
|
||||
else
|
||||
{
|
||||
idChild = NULL_ID;
|
||||
}
|
||||
return idChild;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VToolUnionDetails::DrawName(VAbstractPattern *doc, quint32 d1id, quint32 d2id)
|
||||
{
|
||||
const QDomElement detail1 = doc->elementById(d1id);
|
||||
if (detail1.isNull())
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
|
||||
const QDomElement detail2 = doc->elementById(d2id);
|
||||
if (detail2.isNull())
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
|
||||
const QDomElement draw1 = detail1.parentNode().parentNode().toElement();
|
||||
if (draw1.isNull() || not draw1.hasAttribute(VAbstractPattern::AttrName))
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
|
||||
const QDomElement draw2 = detail2.parentNode().parentNode().toElement();
|
||||
if (draw2.isNull() || not draw2.hasAttribute(VAbstractPattern::AttrName))
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
|
||||
const QString draw1Name = draw1.attribute(VAbstractPattern::AttrName);
|
||||
const QString draw2Name = draw2.attribute(VAbstractPattern::AttrName);
|
||||
|
||||
if (draw1Name == draw2Name)
|
||||
{
|
||||
return draw1Name;
|
||||
}
|
||||
|
||||
const QDomElement pattern = draw1.parentNode().toElement();
|
||||
if (pattern.isNull())
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
|
||||
int indexD1 = 0;
|
||||
int indexD2 = 0;
|
||||
const QDomNodeList listDraws = pattern.elementsByTagName(VAbstractPattern::TagDraw);
|
||||
for (int i=0; i < listDraws.size(); ++i)
|
||||
{
|
||||
const QDomElement draw = listDraws.at(i).toElement();
|
||||
if (draw == draw1)
|
||||
{
|
||||
indexD1 = i;
|
||||
}
|
||||
|
||||
if (draw == draw2)
|
||||
{
|
||||
indexD2 = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (indexD1 >= indexD2)
|
||||
{
|
||||
return draw1Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
return draw2Name;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ class VToolUnionDetails : public VAbstractTool
|
|||
public:
|
||||
VToolUnionDetails(VAbstractPattern *doc, VContainer *data, const quint32 &id, const VDetail &d1, const VDetail &d2,
|
||||
const quint32 &indexD1, const quint32 &indexD2, const Source &typeCreation,
|
||||
QObject *parent = nullptr);
|
||||
const QString &drawName, QObject *parent = nullptr);
|
||||
/**
|
||||
* @brief setDialog set dialog when user want change tool option.
|
||||
*/
|
||||
|
@ -63,18 +63,21 @@ public:
|
|||
static const QString ToolType;
|
||||
static const QString TagDetail;
|
||||
static const QString TagNode;
|
||||
static const QString TagChildren;
|
||||
static const QString TagChild;
|
||||
static const QString AttrIndexD1;
|
||||
static const QString AttrIndexD2;
|
||||
static const QString AttrIdObject;
|
||||
static const QString AttrNodeType;
|
||||
static const QString NodeTypeContour;
|
||||
static const QString NodeTypeModeling;
|
||||
static void AddToNewDetail(QObject *tool, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data, VDetail &newDetail,
|
||||
const VDetail &det, const int &i, const quint32 &idTool, const qreal &dx = 0,
|
||||
static void AddToNewDetail(QObject *tool, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
|
||||
VDetail &newDetail, const VDetail &det, const int &i, const quint32 &idTool,
|
||||
QVector<quint32> &children, const qreal &dx = 0,
|
||||
const qreal &dy = 0, const quint32 &pRotate = 0, const qreal &angle = 0);
|
||||
static void UpdatePoints(const quint32 &idDetail, VContainer *data, const VDetail &det, const int &i,
|
||||
quint32 &idCount, const qreal &dx = 0, const qreal &dy = 0, const quint32 &pRotate = 0,
|
||||
const qreal &angle = 0);
|
||||
static void UpdatePoints(VContainer *data, const VDetail &det, const int &i,
|
||||
QVector<quint32> &children, const qreal &dx = 0, const qreal &dy = 0,
|
||||
const quint32 &pRotate = 0, const qreal &angle = 0);
|
||||
static void BiasRotatePoint(VPointF *point, const qreal &dx, const qreal &dy, const QPointF &pRotate,
|
||||
const qreal &angle);
|
||||
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
||||
|
@ -104,10 +107,17 @@ private:
|
|||
/** @brief indexD2 index edge in second detail. */
|
||||
quint32 indexD2;
|
||||
|
||||
QString drawName;
|
||||
|
||||
void AddDetail(QDomElement &domElement, VDetail &d);
|
||||
void AddNode(QDomElement &domElement, const VNodeDetail &node);
|
||||
QDomNode UpdateDetail(const QDomNode &domNode, const VDetail &d);
|
||||
void AddToModeling(const QDomElement &domElement);
|
||||
|
||||
static void SaveChildren(VAbstractPattern *doc, quint32 id, const QVector<quint32> &children);
|
||||
static QVector<quint32> AllChildren(VAbstractPattern *doc, quint32 id);
|
||||
static quint32 TakeNextId(QVector<quint32> &children);
|
||||
static QString DrawName(VAbstractPattern *doc, quint32 d1id, quint32 d2id);
|
||||
};
|
||||
|
||||
#endif // VTOOLUNIONDETAILS_H
|
||||
|
|
|
@ -29,8 +29,9 @@
|
|||
#include "adddet.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
AddDet::AddDet(const QDomElement &xml, VAbstractPattern *doc, const VDetail &detail, QUndoCommand *parent)
|
||||
: VUndoCommand(xml, doc, parent), detail(detail)
|
||||
AddDet::AddDet(const QDomElement &xml, VAbstractPattern *doc, const VDetail &detail, const QString &drawName,
|
||||
QUndoCommand *parent)
|
||||
: VUndoCommand(xml, doc, parent), detail(detail), drawName(drawName)
|
||||
{
|
||||
setText(tr("add detail"));
|
||||
nodeId = doc->GetParametrId(xml);
|
||||
|
@ -46,13 +47,13 @@ void AddDet::undo()
|
|||
{
|
||||
qCDebug(vUndo, "Undo.");
|
||||
|
||||
QDomElement element;
|
||||
if (doc->GetActivNodeElement(VAbstractPattern::TagDetails, element))
|
||||
QDomElement details = GetDetailsSection();
|
||||
if (not details.isNull())
|
||||
{
|
||||
QDomElement domElement = doc->elementById(nodeId);
|
||||
if (domElement.isElement())
|
||||
{
|
||||
if (element.removeChild(domElement).isNull())
|
||||
if (details.removeChild(domElement).isNull())
|
||||
{
|
||||
qCDebug(vUndo, "Can't delete node");
|
||||
return;
|
||||
|
@ -87,10 +88,10 @@ void AddDet::redo()
|
|||
{
|
||||
qCDebug(vUndo, "Redo.");
|
||||
|
||||
QDomElement element;
|
||||
if (doc->GetActivNodeElement(VAbstractPattern::TagDetails, element))
|
||||
QDomElement details = GetDetailsSection();
|
||||
if (not details.isNull())
|
||||
{
|
||||
element.appendChild(xml);
|
||||
details.appendChild(xml);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -99,3 +100,18 @@ void AddDet::redo()
|
|||
}
|
||||
RedoFullParsing();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QDomElement AddDet::GetDetailsSection() const
|
||||
{
|
||||
QDomElement details;
|
||||
if (drawName.isEmpty())
|
||||
{
|
||||
doc->GetActivNodeElement(VAbstractPattern::TagDetails, details);
|
||||
}
|
||||
else
|
||||
{
|
||||
details = doc->GetDraw(drawName).firstChildElement(VAbstractPattern::TagDetails);
|
||||
}
|
||||
return details;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,8 @@ class AddDet : public VUndoCommand
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AddDet(const QDomElement &xml, VAbstractPattern *doc, const VDetail &detail, QUndoCommand *parent = 0);
|
||||
AddDet(const QDomElement &xml, VAbstractPattern *doc, const VDetail &detail, const QString &drawName = QString(),
|
||||
QUndoCommand *parent = 0);
|
||||
virtual ~AddDet() Q_DECL_OVERRIDE;
|
||||
// cppcheck-suppress unusedFunction
|
||||
virtual void undo() Q_DECL_OVERRIDE;
|
||||
|
@ -45,6 +46,9 @@ public:
|
|||
private:
|
||||
Q_DISABLE_COPY(AddDet)
|
||||
VDetail detail;
|
||||
QString drawName;
|
||||
|
||||
QDomElement GetDetailsSection() const;
|
||||
};
|
||||
|
||||
#endif // ADDDET_H
|
||||
|
|
|
@ -1,90 +0,0 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file adduniondetails.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 15 6, 2014
|
||||
**
|
||||
** @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 "adduniondetails.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
AddUnionDetails::AddUnionDetails(const QDomElement &xml, VAbstractPattern *doc, QUndoCommand *parent)
|
||||
: VUndoCommand(xml, doc, parent)
|
||||
{
|
||||
setText(tr("add union details"));
|
||||
nodeId = doc->GetParametrId(xml);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
AddUnionDetails::~AddUnionDetails()
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void AddUnionDetails::undo()
|
||||
{
|
||||
qCDebug(vUndo, "Undo.");
|
||||
|
||||
QDomElement modelingElement;
|
||||
if (doc->GetActivNodeElement(VAbstractPattern::TagModeling, modelingElement))
|
||||
{
|
||||
QDomElement domElement = doc->elementById(nodeId);
|
||||
if (domElement.isElement())
|
||||
{
|
||||
if (modelingElement.removeChild(domElement).isNull())
|
||||
{
|
||||
qCDebug(vUndo, "Can't delete node.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qCDebug(vUndo, "Can't get node by id = %u.", nodeId);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qCDebug(vUndo, "Can't find tag %s.", qUtf8Printable(VAbstractPattern::TagModeling));
|
||||
return;
|
||||
}
|
||||
emit NeedFullParsing();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void AddUnionDetails::redo()
|
||||
{
|
||||
qCDebug(vUndo, "Redo.");
|
||||
|
||||
QDomElement modelingElement;
|
||||
if (doc->GetActivNodeElement(VAbstractPattern::TagModeling, modelingElement))
|
||||
{
|
||||
modelingElement.appendChild(xml);
|
||||
}
|
||||
else
|
||||
{
|
||||
qCDebug(vUndo, "Can't find tag %s.", qUtf8Printable(VAbstractPattern::TagModeling));
|
||||
return;
|
||||
}
|
||||
RedoFullParsing();
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file adduniondetails.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 15 6, 2014
|
||||
**
|
||||
** @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 ADDUNIONDETAILS_H
|
||||
#define ADDUNIONDETAILS_H
|
||||
|
||||
#include "vundocommand.h"
|
||||
|
||||
class AddUnionDetails : public VUndoCommand
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AddUnionDetails(const QDomElement &xml, VAbstractPattern *doc, QUndoCommand *parent = 0);
|
||||
virtual ~AddUnionDetails() Q_DECL_OVERRIDE;
|
||||
virtual void undo() Q_DECL_OVERRIDE;
|
||||
virtual void redo() Q_DECL_OVERRIDE;
|
||||
private:
|
||||
Q_DISABLE_COPY(AddUnionDetails)
|
||||
};
|
||||
|
||||
#endif // ADDUNIONDETAILS_H
|
|
@ -14,7 +14,6 @@ HEADERS += \
|
|||
$$PWD/deletepatternpiece.h \
|
||||
$$PWD/adddetnode.h \
|
||||
$$PWD/adddet.h \
|
||||
$$PWD/adduniondetails.h \
|
||||
$$PWD/deletedetail.h \
|
||||
$$PWD/vundocommand.h \
|
||||
$$PWD/renamepp.h \
|
||||
|
@ -34,7 +33,6 @@ SOURCES += \
|
|||
$$PWD/deletepatternpiece.cpp \
|
||||
$$PWD/adddetnode.cpp \
|
||||
$$PWD/adddet.cpp \
|
||||
$$PWD/adduniondetails.cpp \
|
||||
$$PWD/deletedetail.cpp \
|
||||
$$PWD/vundocommand.cpp \
|
||||
$$PWD/renamepp.cpp \
|
||||
|
|
Loading…
Reference in New Issue
Block a user