Read/write info about pin points.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2017-02-23 16:49:20 +02:00
parent 8721a4a5d8
commit 5f4760f06f
4 changed files with 88 additions and 0 deletions

View file

@ -828,6 +828,12 @@ void VPattern::ParsePieceDataTag(const QDomElement &domElement, VPiece &detail)
qreal dRot = GetParametrDouble(domElement, AttrRotation, "0");
detail.GetPatternPieceData().SetRotation(dRot);
const quint32 topLeftPin = GetParametrUInt(domElement, VToolSeamAllowance::AttrTopLeftPin, NULL_ID_STR);
detail.GetPatternPieceData().SetTopLeftPin(topLeftPin);
const quint32 bottomRightPin = GetParametrUInt(domElement, VToolSeamAllowance::AttrBottomRightPin, NULL_ID_STR);
detail.GetPatternPieceData().SetBottomRightPin(bottomRightPin);
QDomNodeList nodeListMCP = domElement.childNodes();
for (int iMCP = 0; iMCP < nodeListMCP.count(); ++iMCP)
{
@ -860,6 +866,12 @@ void VPattern::ParsePiecePatternInfo(const QDomElement &domElement, VPiece &deta
detail.GetPatternInfo().SetFontSize(iFS);
qreal dRot = GetParametrDouble(domElement, AttrRotation, "0");
detail.GetPatternInfo().SetRotation(dRot);
const quint32 topLeftPin = GetParametrUInt(domElement, VToolSeamAllowance::AttrTopLeftPin, NULL_ID_STR);
detail.GetPatternInfo().SetTopLeftPin(topLeftPin);
const quint32 bottomRightPin = GetParametrUInt(domElement, VToolSeamAllowance::AttrBottomRightPin, NULL_ID_STR);
detail.GetPatternInfo().SetBottomRightPin(bottomRightPin);
}
//---------------------------------------------------------------------------------------------------------------------
@ -876,6 +888,12 @@ void VPattern::ParsePieceGrainline(const QDomElement &domElement, VPiece &detail
detail.GetGrainlineGeometry().SetRotation(qsRot);
ArrowType eAT = static_cast<ArrowType>(GetParametrUInt(domElement, AttrArrows, "0"));
detail.GetGrainlineGeometry().SetArrowType(eAT);
const quint32 topPin = GetParametrUInt(domElement, VToolSeamAllowance::AttrTopPin, NULL_ID_STR);
detail.GetGrainlineGeometry().SetTopPin(topPin);
const quint32 bottomPin = GetParametrUInt(domElement, VToolSeamAllowance::AttrBottomPin, NULL_ID_STR);
detail.GetGrainlineGeometry().SetBottomPin(bottomPin);
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -494,6 +494,8 @@
<xs:attribute name="width" type="xs:double"/>
<xs:attribute name="height" type="xs:double"/>
<xs:attribute name="rotation" type="xs:double"/>
<xs:attribute name="topLeftPin" type="xs:unsignedInt"/>
<xs:attribute name="bottomRightPin" type="xs:unsignedInt"/>
</xs:complexType>
</xs:element>
<xs:element name="patternInfo" minOccurs="0" maxOccurs="1">
@ -505,6 +507,8 @@
<xs:attribute name="width" type="xs:double"/>
<xs:attribute name="height" type="xs:double"/>
<xs:attribute name="rotation" type="xs:double"/>
<xs:attribute name="topLeftPin" type="xs:unsignedInt"/>
<xs:attribute name="bottomRightPin" type="xs:unsignedInt"/>
</xs:complexType>
</xs:element>
<xs:element name="grainline" minOccurs="0" maxOccurs="1">
@ -515,6 +519,8 @@
<xs:attribute name="length" type="xs:string"/>
<xs:attribute name="rotation" type="xs:string"/>
<xs:attribute name="arrows" type="arrowType"/>
<xs:attribute name="topPin" type="xs:unsignedInt"/>
<xs:attribute name="bottomPin" type="xs:unsignedInt"/>
</xs:complexType>
</xs:element>
<xs:element name="nodes" minOccurs="1" maxOccurs="1">

View file

@ -75,6 +75,10 @@ const QString VToolSeamAllowance::AttrSeamAllowance = QStringLiteral("seamAllow
const QString VToolSeamAllowance::AttrHeight = QStringLiteral("height");
const QString VToolSeamAllowance::AttrUnited = QStringLiteral("united");
const QString VToolSeamAllowance::AttrFont = QStringLiteral("fontSize");
const QString VToolSeamAllowance::AttrTopLeftPin = QStringLiteral("topLeftPin");
const QString VToolSeamAllowance::AttrBottomRightPin = QStringLiteral("bottomRightPin");
const QString VToolSeamAllowance::AttrTopPin = QStringLiteral("topPin");
const QString VToolSeamAllowance::AttrBottomPin = QStringLiteral("bottomPin");
//---------------------------------------------------------------------------------------------------------------------
VToolSeamAllowance::~VToolSeamAllowance()
@ -252,6 +256,24 @@ void VToolSeamAllowance::AddPatternPieceData(VAbstractPattern *doc, QDomElement
doc->SetAttribute(domData, AttrFont, data.GetFontSize());
doc->SetAttribute(domData, VAbstractPattern::AttrRotation, data.GetRotation());
if (data.TopLeftPin() > NULL_ID)
{
doc->SetAttribute(domData, AttrTopLeftPin, data.TopLeftPin());
}
else
{
domData.removeAttribute(AttrTopLeftPin);
}
if (data.BottomRightPin() > NULL_ID)
{
doc->SetAttribute(domData, AttrBottomRightPin, data.BottomRightPin());
}
else
{
domData.removeAttribute(AttrBottomRightPin);
}
for (int i = 0; i < data.GetMCPCount(); ++i)
{
const MaterialCutPlacement mcp = data.GetMCP(i);
@ -280,6 +302,25 @@ void VToolSeamAllowance::AddPatternInfo(VAbstractPattern *doc, QDomElement &domE
doc->SetAttribute(domData, AttrHeight, geom.GetLabelHeight());
doc->SetAttribute(domData, AttrFont, geom.GetFontSize());
doc->SetAttribute(domData, VAbstractPattern::AttrRotation, geom.GetRotation());
if (geom.TopLeftPin() > NULL_ID)
{
doc->SetAttribute(domData, AttrTopLeftPin, geom.TopLeftPin());
}
else
{
domData.removeAttribute(AttrTopLeftPin);
}
if (geom.BottomRightPin() > NULL_ID)
{
doc->SetAttribute(domData, AttrBottomRightPin, geom.BottomRightPin());
}
else
{
domData.removeAttribute(AttrBottomRightPin);
}
domElement.appendChild(domData);
}
@ -295,6 +336,25 @@ void VToolSeamAllowance::AddGrainline(VAbstractPattern *doc, QDomElement &domEle
doc->SetAttribute(domData, AttrLength, glGeom.GetLength());
doc->SetAttribute(domData, VAbstractPattern::AttrRotation, glGeom.GetRotation());
doc->SetAttribute(domData, VAbstractPattern::AttrArrows, int(glGeom.GetArrowType()));
if (glGeom.TopPin() > NULL_ID)
{
doc->SetAttribute(domData, AttrTopPin, glGeom.TopPin());
}
else
{
domData.removeAttribute(AttrTopPin);
}
if (glGeom.BottomPin() > NULL_ID)
{
doc->SetAttribute(domData, AttrBottomPin, glGeom.BottomPin());
}
else
{
domData.removeAttribute(AttrBottomPin);
}
domElement.appendChild(domData);
}

View file

@ -66,6 +66,10 @@ public:
static const QString AttrHeight;
static const QString AttrUnited;
static const QString AttrFont;
static const QString AttrTopLeftPin;
static const QString AttrBottomRightPin;
static const QString AttrTopPin;
static const QString AttrBottomPin;
void Remove(bool ask);