Fix reading piece labels.
This commit is contained in:
parent
d21546e397
commit
88508b102e
|
@ -672,16 +672,54 @@ void VPLayoutFileReader::ReadLabels(const VPPiecePtr &piece)
|
||||||
{
|
{
|
||||||
if (name() == ML::TagPieceLabel)
|
if (name() == ML::TagPieceLabel)
|
||||||
{
|
{
|
||||||
QXmlStreamAttributes attribs = attributes();
|
ReadPieceLabel(piece);
|
||||||
piece->SetPieceLabelRect(StringToPath(ReadAttributeEmptyString(attribs, ML::AttrShape)));
|
|
||||||
|
|
||||||
piece->SetPieceLabelData(ReadLabelLines());
|
|
||||||
}
|
}
|
||||||
else if (name() == ML::TagPatternLabel)
|
else if (name() == ML::TagPatternLabel)
|
||||||
{
|
{
|
||||||
|
ReadPatternLabel(piece);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qCDebug(MLReader, "Ignoring tag %s", qUtf8Printable(name().toString()));
|
||||||
|
skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPLayoutFileReader::ReadPieceLabel(const VPPiecePtr &piece)
|
||||||
|
{
|
||||||
|
AssertRootTag(ML::TagPieceLabel);
|
||||||
|
|
||||||
|
QXmlStreamAttributes attribs = attributes();
|
||||||
|
piece->SetPieceLabelRect(StringToPath(ReadAttributeEmptyString(attribs, ML::AttrShape)));
|
||||||
|
|
||||||
|
while (readNextStartElement())
|
||||||
|
{
|
||||||
|
if (name() == ML::TagLines)
|
||||||
|
{
|
||||||
|
piece->SetPieceLabelData(ReadLabelLines());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qCDebug(MLReader, "Ignoring tag %s", qUtf8Printable(name().toString()));
|
||||||
|
skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPLayoutFileReader::ReadPatternLabel(const VPPiecePtr &piece)
|
||||||
|
{
|
||||||
|
AssertRootTag(ML::TagPatternLabel);
|
||||||
|
|
||||||
QXmlStreamAttributes attribs = attributes();
|
QXmlStreamAttributes attribs = attributes();
|
||||||
piece->SetPatternLabelRect(StringToPath(ReadAttributeEmptyString(attribs, ML::AttrShape)));
|
piece->SetPatternLabelRect(StringToPath(ReadAttributeEmptyString(attribs, ML::AttrShape)));
|
||||||
|
|
||||||
|
while (readNextStartElement())
|
||||||
|
{
|
||||||
|
if (name() == ML::TagLines)
|
||||||
|
{
|
||||||
piece->SetPatternLabelData(ReadLabelLines());
|
piece->SetPatternLabelData(ReadLabelLines());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -695,7 +733,7 @@ void VPLayoutFileReader::ReadLabels(const VPPiecePtr &piece)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPLayoutFileReader::ReadLabelLines() -> VTextManager
|
auto VPLayoutFileReader::ReadLabelLines() -> VTextManager
|
||||||
{
|
{
|
||||||
AssertRootTag(ML::TagLabels);
|
AssertRootTag(ML::TagLines);
|
||||||
|
|
||||||
VTextManager text;
|
VTextManager text;
|
||||||
QVector<TextLine> lines;
|
QVector<TextLine> lines;
|
||||||
|
|
|
@ -70,6 +70,8 @@ private:
|
||||||
void ReadMarkers(const VPPiecePtr &piece);
|
void ReadMarkers(const VPPiecePtr &piece);
|
||||||
auto ReadMarker() -> VLayoutPlaceLabel;
|
auto ReadMarker() -> VLayoutPlaceLabel;
|
||||||
void ReadLabels(const VPPiecePtr &piece);
|
void ReadLabels(const VPPiecePtr &piece);
|
||||||
|
void ReadPieceLabel(const VPPiecePtr &piece);
|
||||||
|
void ReadPatternLabel(const VPPiecePtr &piece);
|
||||||
auto ReadLabelLines() -> VTextManager;
|
auto ReadLabelLines() -> VTextManager;
|
||||||
auto ReadLabelLine() -> TextLine;
|
auto ReadLabelLine() -> TextLine;
|
||||||
|
|
||||||
|
|
|
@ -128,13 +128,18 @@
|
||||||
<xs:sequence>
|
<xs:sequence>
|
||||||
<xs:element name="line" minOccurs="0" maxOccurs="unbounded">
|
<xs:element name="line" minOccurs="0" maxOccurs="unbounded">
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:attribute type="xs:string" name="font" use="required"/>
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
<xs:attribute type="xs:boolean" name="bold" use="optional"/>
|
<xs:attribute type="xs:boolean" name="bold" use="optional"/>
|
||||||
<xs:attribute type="xs:boolean" name="italic" use="optional"/>
|
<xs:attribute type="xs:boolean" name="italic" use="optional"/>
|
||||||
<xs:attribute type="xs:unsignedInt" name="alignment" use="optional"/>
|
<xs:attribute type="xs:unsignedInt" name="alignment" use="optional"/>
|
||||||
|
<xs:attribute type="xs:unsignedInt" name="fontSize" use="optional"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
|
<xs:attribute type="xs:string" name="font"/>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
|
@ -149,13 +154,18 @@
|
||||||
<xs:sequence>
|
<xs:sequence>
|
||||||
<xs:element name="line" minOccurs="0" maxOccurs="unbounded">
|
<xs:element name="line" minOccurs="0" maxOccurs="unbounded">
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:attribute type="xs:string" name="font" use="required"/>
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
<xs:attribute type="xs:boolean" name="bold" use="optional"/>
|
<xs:attribute type="xs:boolean" name="bold" use="optional"/>
|
||||||
<xs:attribute type="xs:boolean" name="italic" use="optional"/>
|
<xs:attribute type="xs:boolean" name="italic" use="optional"/>
|
||||||
<xs:attribute type="xs:unsignedInt" name="alignment" use="optional"/>
|
<xs:attribute type="xs:unsignedInt" name="alignment" use="optional"/>
|
||||||
|
<xs:attribute type="xs:unsignedInt" name="fontSize" use="optional"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
|
<xs:attribute type="xs:string" name="font"/>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
|
@ -285,13 +295,18 @@
|
||||||
<xs:sequence>
|
<xs:sequence>
|
||||||
<xs:element name="line" minOccurs="0" maxOccurs="unbounded">
|
<xs:element name="line" minOccurs="0" maxOccurs="unbounded">
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:attribute type="xs:string" name="font" use="required"/>
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
<xs:attribute type="xs:boolean" name="bold" use="optional"/>
|
<xs:attribute type="xs:boolean" name="bold" use="optional"/>
|
||||||
<xs:attribute type="xs:boolean" name="italic" use="optional"/>
|
<xs:attribute type="xs:boolean" name="italic" use="optional"/>
|
||||||
<xs:attribute type="AlignmentType" name="alignment" use="optional"/>
|
<xs:attribute type="AlignmentType" name="alignment" use="optional"/>
|
||||||
|
<xs:attribute type="xs:unsignedInt" name="fontSize" use="optional"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
|
<xs:attribute type="xs:string" name="font"/>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
|
@ -306,13 +321,18 @@
|
||||||
<xs:sequence>
|
<xs:sequence>
|
||||||
<xs:element name="line" minOccurs="0" maxOccurs="unbounded">
|
<xs:element name="line" minOccurs="0" maxOccurs="unbounded">
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:attribute type="xs:string" name="font" use="required"/>
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="xs:string">
|
||||||
<xs:attribute type="xs:boolean" name="bold" use="optional"/>
|
<xs:attribute type="xs:boolean" name="bold" use="optional"/>
|
||||||
<xs:attribute type="xs:boolean" name="italic" use="optional"/>
|
<xs:attribute type="xs:boolean" name="italic" use="optional"/>
|
||||||
<xs:attribute type="AlignmentType" name="alignment" use="optional"/>
|
<xs:attribute type="AlignmentType" name="alignment" use="optional"/>
|
||||||
|
<xs:attribute type="xs:unsignedInt" name="fontSize" use="optional"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
|
<xs:attribute type="xs:string" name="font"/>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user