Read and write local seam allowance width (before and after).

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2016-11-12 13:18:16 +02:00
parent 6706f3b39d
commit d0b0f55d19
4 changed files with 26 additions and 6 deletions

View file

@ -748,7 +748,9 @@ void VPattern::ParseDetailNodes(const QDomElement &domElement, VPiece &detail) c
if (not element.isNull() && element.tagName() == VToolSeamAllowance::TagNode)
{
const quint32 id = GetParametrUInt(element, AttrIdObject, NULL_ID_STR);
const bool reverse = GetParametrUInt(element, VToolDetail::AttrReverse, "0");
const bool reverse = GetParametrUInt(element, VToolSeamAllowance::AttrNodeReverse, "0");
const qreal saBefore = GetParametrDouble(element, VToolSeamAllowance::AttrSABefore, "-1");
const qreal saAfter = GetParametrDouble(element, VToolSeamAllowance::AttrSAAfter, "-1");
const QString t = GetParametrString(element, AttrType, VToolSeamAllowance::NodePoint);
Tool tool;
@ -771,7 +773,10 @@ void VPattern::ParseDetailNodes(const QDomElement &domElement, VPiece &detail) c
VException e(tr("Wrong tag name '%1'.").arg(t));
throw e;
}
detail.Append(VPieceNode(id, tool, reverse));
VPieceNode node(id, tool, reverse);
node.SetSABefore(saBefore);
node.SetSAAfter(saAfter);
detail.Append(node);
}
}
}

View file

@ -399,9 +399,11 @@
<xs:sequence>
<xs:element name="node" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="type" type="xs:string" use="required"></xs:attribute>
<xs:attribute name="idObject" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="reverse" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="before" type="xs:double"></xs:attribute>
<xs:attribute name="after" type="xs:double"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>

View file

@ -64,6 +64,8 @@ const QString VToolSeamAllowance::AttrNodeReverse = QStringLiteral("reverse")
const QString VToolSeamAllowance::AttrForbidFlipping = QStringLiteral("forbidFlipping");
const QString VToolSeamAllowance::AttrSeamAllowance = QStringLiteral("seamAllowance");
const QString VToolSeamAllowance::AttrWidth = QStringLiteral("width");
const QString VToolSeamAllowance::AttrSABefore = QStringLiteral("before");
const QString VToolSeamAllowance::AttrSAAfter = QStringLiteral("after");
const QString VToolSeamAllowance::NodeArc = QStringLiteral("NodeArc");
const QString VToolSeamAllowance::NodePoint = QStringLiteral("NodePoint");
@ -204,12 +206,21 @@ void VToolSeamAllowance::AddNode(VAbstractPattern *doc, QDomElement &domElement,
doc->SetAttribute(nod, AttrIdObject, node.GetId());
if (node.GetTypeTool() != Tool::NodePoint)
const Tool type = node.GetTypeTool();
if (type != Tool::NodePoint)
{
doc->SetAttribute(nod, AttrNodeReverse, static_cast<quint8>(node.GetReverse()));
}
else
{
const qreal w1 = node.GetSABefore();
w1 < 0 ? domElement.removeAttribute(AttrSABefore) : doc->SetAttribute(nod, AttrSABefore, w1);
switch (node.GetTypeTool())
const qreal w2 = node.GetSAAfter();
w2 < 0 ? domElement.removeAttribute(AttrSAAfter) : doc->SetAttribute(nod, AttrSAAfter, w2);
}
switch (type)
{
case (Tool::NodeArc):
doc->SetAttribute(nod, AttrType, NodeArc);

View file

@ -62,6 +62,8 @@ public:
static const QString AttrForbidFlipping;
static const QString AttrSeamAllowance;
static const QString AttrWidth;
static const QString AttrSABefore;
static const QString AttrSAAfter;
static const QString NodeArc;
static const QString NodePoint;