New option Show mirror line.

Make showing a symmetry line optional. In some cases users don't need it.
This commit is contained in:
Roman Telezhynskyi 2024-04-05 19:54:48 +03:00
parent 812414f0ea
commit 5ea7817a02
25 changed files with 2060 additions and 74 deletions

View File

@ -176,6 +176,7 @@ void VPPiece::Update(const VPPiecePtr &piece)
SetFoldLineWidth(piece->GetFoldLineWidth());
SetForceFlipping(piece->IsForceFlipping());
SetForbidFlipping(piece->IsForbidFlipping());
SetShowMirrorLine(piece->IsShowMirrorLine());
if ((IsForceFlipping() && !IsVerticallyFlipped()) || (IsForbidFlipping() && IsVerticallyFlipped()))
{

View File

@ -954,7 +954,7 @@ void VPGraphicsPiece::PaintMirrorLine(QPainter *painter, const VPPiecePtr &piece
if (not piece->IsSeamAllowance() || piece->IsSeamAllowanceBuiltIn())
{
QLineF const seamMirrorLine = piece->GetMappedSeamMirrorLine();
if (!seamMirrorLine.isNull())
if (!seamMirrorLine.isNull() && piece->IsShowMirrorLine())
{
QPainterPath mirrorPath;
mirrorPath.moveTo(seamMirrorLine.p1());
@ -966,7 +966,7 @@ void VPGraphicsPiece::PaintMirrorLine(QPainter *painter, const VPPiecePtr &piece
else if (not piece->IsSeamAllowanceBuiltIn())
{
QLineF const seamAllowanceMirrorLine = piece->GetMappedSeamAllowanceMirrorLine();
if (!seamAllowanceMirrorLine.isNull())
if (!seamAllowanceMirrorLine.isNull() && piece->IsShowMirrorLine())
{
QPainterPath mirrorPath;
mirrorPath.moveTo(seamAllowanceMirrorLine.p1());

View File

@ -808,6 +808,25 @@ void VPMainWindow::InitPropertyTabCurrentPiece()
}
});
connect(ui->checkBoxShowMirrorLine, &QCheckBox::toggled, this,
[this](bool checked)
{
QList<VPPiecePtr> const selectedPieces = SelectedPieces();
if (selectedPieces.size() == 1)
{
const VPPiecePtr &selectedPiece = selectedPieces.constFirst();
if (not selectedPiece.isNull())
{
if (selectedPiece->IsShowMirrorLine() != checked)
{
selectedPiece->SetShowMirrorLine(checked);
LayoutWasSaved(false);
emit m_layout->PieceTransformationChanged(selectedPiece);
}
}
}
});
connect(ui->checkBoxCurrentPieceVerticallyFlipped, &QCheckBox::toggled, this,
[this](bool checked)
{
@ -1314,14 +1333,12 @@ void VPMainWindow::SetPropertyTabCurrentPieceData()
ui->groupBoxCurrentPieceInfo->setVisible(false);
ui->groupBoxPieceTransformation->setVisible(false);
ui->groupBoxCurrentPieceSeamline->setVisible(false);
ui->groupBoxCurrentPieceGeometry->setVisible(false);
}
else if (selectedPieces.count() == 1)
{
ui->groupBoxCurrentPieceInfo->setVisible(true);
ui->groupBoxPieceTransformation->setVisible(true);
ui->groupBoxCurrentPieceSeamline->setVisible(true);
ui->groupBoxCurrentPieceGeometry->setVisible(true);
const VPPiecePtr &selectedPiece = selectedPieces.constFirst();
@ -1338,6 +1355,9 @@ void VPMainWindow::SetPropertyTabCurrentPieceData()
QLineF const seamMirrorLine = selectedPiece->GetSeamMirrorLine();
SetCheckBoxValue(ui->checkBoxShowFullPiece, !seamMirrorLine.isNull() ? selectedPiece->IsShowFullPiece() : true);
ui->checkBoxShowFullPiece->setEnabled(!seamMirrorLine.isNull());
SetCheckBoxValue(ui->checkBoxShowMirrorLine,
!seamMirrorLine.isNull() ? selectedPiece->IsShowMirrorLine() : true);
ui->checkBoxShowMirrorLine->setEnabled(!seamMirrorLine.isNull());
const bool disableFlipping = selectedPiece->IsForbidFlipping() || selectedPiece->IsForceFlipping();
ui->checkBoxCurrentPieceVerticallyFlipped->setDisabled(disableFlipping);
@ -1357,7 +1377,6 @@ void VPMainWindow::SetPropertyTabCurrentPieceData()
// show the content "multiple pieces selected"
ui->groupBoxCurrentPieceInfo->setVisible(false);
ui->groupBoxPieceTransformation->setVisible(true);
ui->groupBoxCurrentPieceSeamline->setVisible(false);
ui->groupBoxCurrentPieceGeometry->setVisible(false);
if (not ui->checkBoxRelativeTranslation->isChecked())

View File

@ -280,7 +280,7 @@
<x>0</x>
<y>0</y>
<width>378</width>
<height>736</height>
<height>721</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_23">
@ -596,25 +596,6 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBoxCurrentPieceSeamline">
<property name="title">
<string>Seamline</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<widget class="QCheckBox" name="checkBoxCurrentPieceShowSeamline">
<property name="text">
<string>Show Seamline</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBoxCurrentPieceGeometry">
<property name="title">
@ -634,6 +615,26 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxCurrentPieceShowSeamline">
<property name="text">
<string>Show Seamline</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxShowMirrorLine">
<property name="text">
<string>Show mirror line</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxCurrentPieceVerticallyFlipped">
<property name="text">
@ -2415,7 +2416,6 @@
<tabstop>scrollAreaTiles</tabstop>
<tabstop>lineEditCurrentPieceName</tabstop>
<tabstop>plainTextEditCurrentPieceUUID</tabstop>
<tabstop>checkBoxCurrentPieceShowSeamline</tabstop>
<tabstop>checkBoxCurrentPieceVerticallyFlipped</tabstop>
<tabstop>doubleSpinBoxCurrentPieceAngle</tabstop>
<tabstop>doubleSpinBoxCurrentPieceBoxPositionX</tabstop>

View File

@ -962,6 +962,7 @@ void VPLayoutFileReader::ReadMirrorLines(const VPPiecePtr &piece)
ReadAttributeInt(attribs, ML::AttrAlignment, QString::number(static_cast<int>(Qt::AlignHCenter))));
piece->SetFoldLineLabel(ReadAttributeEmptyString(attribs, ML::AttrFoldLineLabel));
piece->SetFoldLineOutlineFont(FontFromString(ReadAttributeEmptyString(attribs, ML::AttrFont)));
piece->SetShowMirrorLine(ReadAttributeBool(attribs, ML::AttrVisible, trueStr));
if (QStringList const svgFontData = ReadAttributeEmptyString(attribs, ML::AttrSVGFont).split(','_L1);
!svgFontData.isEmpty())

View File

@ -406,6 +406,8 @@ void VPLayoutFileWriter::WritePiece(const VPPiecePtr &piece)
ML::AttrSVGFont,
QStringLiteral("%1,%2").arg(piece->GetFoldLineSVGFontFamily()).arg(piece->GetFoldLineSvgFontSize()),
[piece](const QString &) { return piece->GetFoldLineLabel().isEmpty(); });
SetAttributeOrRemoveIf<bool>(ML::AttrVisible, piece->IsShowMirrorLine(),
[](bool visible) noexcept { return visible; });
if (!seamMirrorLine.isNull())
{

View File

@ -152,6 +152,7 @@ struct VPieceFoldLineData
{
quint32 p1{NULL_ID};
quint32 p2{NULL_ID};
bool mirrorLineVisible{true};
QString heightFormula{};
QString widthFormula{};
QString centerFormula{};
@ -173,6 +174,8 @@ auto ParsePieceMirrorLine(const QDomElement &domElement) -> VPieceFoldLineData
data.p1 = VDomDocument::GetParametrUInt(domElement, VAbstractPattern::AttrMirrorLineP1, NULL_ID_STR);
data.p2 = VDomDocument::GetParametrUInt(domElement, VAbstractPattern::AttrMirrorLineP2, NULL_ID_STR);
data.mirrorLineVisible =
VDomDocument::GetParametrBool(domElement, VAbstractPattern::AttrMirrorLineVisible, trueStr);
data.heightFormula = VDomDocument::GetParametrEmptyString(domElement, VAbstractPattern::AttrFoldLineHeightFormula);
data.widthFormula = VDomDocument::GetParametrEmptyString(domElement, VAbstractPattern::AttrFoldLineWidthFormula);
data.centerFormula = VDomDocument::GetParametrEmptyString(domElement, VAbstractPattern::AttrFoldLineCenterFormula);
@ -1173,6 +1176,7 @@ void VPattern::ParseDetailInternals(const QDomElement &domElement, VPiece &detai
VPieceFoldLineData const data = futureMirrorLine.result();
detail.SetMirrorLineStartPoint(data.p1);
detail.SetMirrorLineEndPoint(data.p2);
detail.SetShowMirrorLine(data.mirrorLineVisible);
detail.SetManualFoldHeight(data.manualHeight);
detail.SetManualFoldWidth(data.manualWidth);
detail.SetManualFoldCenter(data.manualCenter);

View File

@ -70,6 +70,7 @@
<file>schema/pattern/v0.9.2.xsd</file>
<file>schema/pattern/v0.9.3.xsd</file>
<file>schema/pattern/v0.9.4.xsd</file>
<file>schema/pattern/v0.9.5.xsd</file>
<file>schema/multisize_measurements/v0.3.0.xsd</file>
<file>schema/multisize_measurements/v0.4.0.xsd</file>
<file>schema/multisize_measurements/v0.4.1.xsd</file>
@ -106,6 +107,7 @@
<file>schema/layout/v0.1.6.xsd</file>
<file>schema/layout/v0.1.7.xsd</file>
<file>schema/layout/v0.1.8.xsd</file>
<file>schema/layout/v0.1.9.xsd</file>
<file>schema/known_measurements/v1.0.0.xsd</file>
</qresource>
</RCC>

View File

@ -0,0 +1,648 @@
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="layout">
<xs:complexType>
<xs:sequence>
<xs:element name="properties">
<xs:complexType>
<xs:sequence>
<xs:element type="units" name="unit"/>
<xs:element type="xs:string" name="title"/>
<xs:element type="xs:string" name="description"/>
<xs:element name="control">
<xs:complexType>
<xs:attribute type="xs:boolean" name="warningSuperposition"/>
<xs:attribute type="xs:boolean" name="warningOutOfBound"/>
<xs:attribute type="xs:boolean" name="stickyEdges"/>
<xs:attribute type="xs:boolean" name="followGrainline"/>
<xs:attribute type="xs:boolean" name="boundaryTogetherWithNotches"/>
<xs:attribute type="xs:float" name="piecesGap"/>
<xs:attribute type="xs:boolean" name="cutOnFold"/>
</xs:complexType>
</xs:element>
<xs:element name="tiles">
<xs:complexType>
<xs:sequence>
<xs:element name="size">
<xs:complexType>
<xs:attribute type="xs:float" name="width" use="required"/>
<xs:attribute type="xs:float" name="length" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="margin">
<xs:complexType>
<xs:attribute type="xs:float" name="top"/>
<xs:attribute type="xs:float" name="right"/>
<xs:attribute type="xs:float" name="bottom"/>
<xs:attribute type="xs:float" name="left"/>
<xs:attribute type="xs:boolean" name="ignoreMargins"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:boolean" name="visible"/>
<xs:attribute type="xs:string" name="matchingMarks"/>
<xs:attribute type="xs:boolean" name="printScheme"/>
<xs:attribute type="xs:boolean" name="tileNumber"/>
</xs:complexType>
</xs:element>
<xs:element name="scale">
<xs:complexType>
<xs:attribute type="LayoutScale" name="xScale"/>
<xs:attribute type="LayoutScale" name="yScale"/>
</xs:complexType>
</xs:element>
<xs:element name="watermark">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:boolean" name="showPreview" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="unplacedPieces">
<xs:complexType>
<xs:sequence>
<xs:element name="piece" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="seamLine">
<xs:complexType>
<xs:sequence>
<xs:element name="point" minOccurs="3" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute type="xs:double" name="x" use="required"/>
<xs:attribute type="xs:double" name="y" use="required"/>
<xs:attribute type="xs:boolean" name="turnPoint" use="optional"/>
<xs:attribute type="xs:boolean" name="curvePoint" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="seamAllowance">
<xs:complexType>
<xs:sequence>
<xs:element name="point" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute type="xs:double" name="x" use="required"/>
<xs:attribute type="xs:double" name="y" use="required"/>
<xs:attribute type="xs:boolean" name="turnPoint" use="optional"/>
<xs:attribute type="xs:boolean" name="curvePoint" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:boolean" name="enabled" use="optional"/>
<xs:attribute type="xs:boolean" name="builtIn" use="optional"/>
</xs:complexType>
</xs:element>
<xs:element name="grainline">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="LinePathOrEmpty">
<xs:attribute type="xs:boolean" name="enabled" use="optional"/>
<xs:attribute type="ArrowDirection" name="arrowDirection" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="notches">
<xs:complexType>
<xs:sequence>
<xs:element name="notch" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute type="xs:boolean" name="builtIn" use="optional"/>
<xs:attribute type="NotchType" name="type" use="optional"/>
<xs:attribute type="LinePath" name="baseLine" use="optional"/>
<xs:attribute type="LinesPath" name="path" use="optional"/>
<xs:attribute type="xs:boolean" name="clockwiseOpening" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="internalPaths">
<xs:complexType>
<xs:sequence>
<xs:element name="internalPath" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="point" minOccurs="2" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute type="xs:double" name="x" use="required"/>
<xs:attribute type="xs:double" name="y" use="required"/>
<xs:attribute type="xs:boolean" name="turnPoint" use="optional"/>
<xs:attribute type="xs:boolean" name="curvePoint" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:boolean" name="cut" use="optional"/>
<xs:attribute type="CurvePenStyle" name="penStyle" use="optional"/>
<xs:attribute type="xs:boolean" name="notMirrored" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="markers">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element name="marker" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:attribute type="Transformation" name="transform" use="required"/>
<xs:attribute type="MarkerType" name="type" use="required"/>
<xs:attribute type="PointPath" name="center" use="required"/>
<xs:attribute type="RectPath" name="box" use="required"/>
<xs:attribute type="xs:boolean" name="notMirrored" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="labels">
<xs:complexType>
<xs:sequence>
<xs:element name="pieceLabel" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="lines">
<xs:complexType>
<xs:sequence>
<xs:element name="line" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:boolean" name="bold" 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="fontSize" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:string" name="font"/>
<xs:attribute type="xs:string" name="svgFont"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:string" name="shape" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="patternLabel" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="lines">
<xs:complexType>
<xs:sequence>
<xs:element name="line" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:boolean" name="bold" 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="fontSize" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:string" name="font"/>
<xs:attribute type="xs:string" name="svgFont"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:string" name="shape" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="mirrorLine" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element type="LinePathOrEmpty" name="seamLine"/>
<xs:element type="LinePathOrEmpty" name="seamAllowance"/>
</xs:sequence>
<xs:attribute name="type" type="foldLineType" use="optional"/>
<xs:attribute name="height" type="xs:double" use="optional"/>
<xs:attribute name="width" type="xs:double" use="optional"/>
<xs:attribute name="center" type="xs:double" use="optional"/>
<xs:attribute type="xs:boolean" name="bold" use="optional"/>
<xs:attribute type="xs:boolean" name="italic" use="optional"/>
<xs:attribute type="AlignmentType" name="alignment" use="optional"/>
<xs:attribute name="label" type="xs:string" use="optional"/>
<xs:attribute type="xs:string" name="font" use="optional"/>
<xs:attribute type="xs:string" name="svgFont" use="optional"/>
<xs:attribute type="xs:boolean" name="visible" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="uid" type="uuid" use="required"/>
<xs:attribute type="xs:string" name="name"/>
<xs:attribute type="xs:boolean" name="verticallyFlipped"/>
<xs:attribute type="xs:boolean" name="horizontallyFlipped"/>
<xs:attribute type="xs:boolean" name="forbidFlipping"/>
<xs:attribute type="xs:boolean" name="forceFlipping"/>
<xs:attribute type="xs:boolean" name="followGrainline"/>
<xs:attribute type="xs:boolean" name="sewLineOnDrawing"/>
<xs:attribute type="Transformation" name="transform"/>
<xs:attribute type="xs:string" name="gradationLabel"/>
<xs:attribute type="xs:unsignedInt" name="copyNumber"/>
<xs:attribute type="xs:boolean" name="showSeamline"/>
<xs:attribute type="xs:float" name="xScale"/>
<xs:attribute type="xs:float" name="yScale"/>
<xs:attribute type="xs:boolean" name="showFullPiece"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="sheets">
<xs:complexType>
<xs:sequence>
<xs:element name="sheet" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="name"/>
<xs:element name="size">
<xs:complexType>
<xs:attribute type="xs:float" name="width" use="required"/>
<xs:attribute type="xs:float" name="length" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="margin">
<xs:complexType>
<xs:attribute type="xs:float" name="top"/>
<xs:attribute type="xs:float" name="right"/>
<xs:attribute type="xs:float" name="bottom"/>
<xs:attribute type="xs:float" name="left"/>
<xs:attribute type="xs:boolean" name="ignoreMargins"/>
</xs:complexType>
</xs:element>
<xs:element name="pieces">
<xs:complexType>
<xs:sequence>
<xs:element name="piece" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="seamLine">
<xs:complexType>
<xs:sequence>
<xs:element name="point" minOccurs="3" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute type="xs:double" name="x" use="required"/>
<xs:attribute type="xs:double" name="y" use="required"/>
<xs:attribute type="xs:boolean" name="turnPoint" use="optional"/>
<xs:attribute type="xs:boolean" name="curvePoint" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="seamAllowance">
<xs:complexType>
<xs:sequence>
<xs:element name="point" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute type="xs:double" name="x" use="required"/>
<xs:attribute type="xs:double" name="y" use="required"/>
<xs:attribute type="xs:boolean" name="turnPoint" use="optional"/>
<xs:attribute type="xs:boolean" name="curvePoint" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:boolean" name="enabled" use="optional"/>
<xs:attribute type="xs:boolean" name="builtIn" use="optional"/>
</xs:complexType>
</xs:element>
<xs:element name="grainline">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="LinePathOrEmpty">
<xs:attribute type="xs:boolean" name="enabled" use="optional"/>
<xs:attribute type="ArrowDirection" name="arrowDirection" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="notches">
<xs:complexType>
<xs:sequence>
<xs:element name="notch" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute type="xs:boolean" name="builtIn" use="optional"/>
<xs:attribute type="NotchType" name="type" use="optional"/>
<xs:attribute type="LinePath" name="baseLine" use="optional"/>
<xs:attribute type="LinesPath" name="path" use="optional"/>
<xs:attribute type="xs:boolean" name="clockwiseOpening" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="internalPaths">
<xs:complexType>
<xs:sequence>
<xs:element name="internalPath" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="point" minOccurs="2" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute type="xs:double" name="x" use="required"/>
<xs:attribute type="xs:double" name="y" use="required"/>
<xs:attribute type="xs:boolean" name="turnPoint" use="optional"/>
<xs:attribute type="xs:boolean" name="curvePoint" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:boolean" name="cut" use="optional"/>
<xs:attribute type="CurvePenStyle" name="penStyle" use="optional"/>
<xs:attribute type="xs:boolean" name="notMirrored" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="markers">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element name="marker" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:attribute type="Transformation" name="transform" use="required"/>
<xs:attribute type="MarkerType" name="type" use="required"/>
<xs:attribute type="PointPath" name="center" use="required"/>
<xs:attribute type="RectPath" name="box" use="required"/>
<xs:attribute type="xs:boolean" name="notMirrored" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="labels">
<xs:complexType>
<xs:sequence>
<xs:element name="pieceLabel" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="lines">
<xs:complexType>
<xs:sequence>
<xs:element name="line" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:boolean" name="bold" use="optional"/>
<xs:attribute type="xs:boolean" name="italic" 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:element>
</xs:sequence>
<xs:attribute type="xs:string" name="font"/>
<xs:attribute type="xs:string" name="svgFont"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="PathNotEmpty" name="shape" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="patternLabel" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="lines">
<xs:complexType>
<xs:sequence>
<xs:element name="line" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:boolean" name="bold" use="optional"/>
<xs:attribute type="xs:boolean" name="italic" 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:element>
</xs:sequence>
<xs:attribute type="xs:string" name="font"/>
<xs:attribute type="xs:string" name="svgFont"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="PathNotEmpty" name="shape" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="mirrorLine" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element type="LinePathOrEmpty" name="seamLine"/>
<xs:element type="LinePathOrEmpty" name="seamAllowance"/>
</xs:sequence>
<xs:attribute name="type" type="foldLineType" use="optional"/>
<xs:attribute name="height" type="xs:double" use="optional"/>
<xs:attribute name="width" type="xs:double" use="optional"/>
<xs:attribute name="center" type="xs:double" use="optional"/>
<xs:attribute type="xs:boolean" name="bold" use="optional"/>
<xs:attribute type="xs:boolean" name="italic" use="optional"/>
<xs:attribute type="AlignmentType" name="alignment" use="optional"/>
<xs:attribute name="label" type="xs:string" use="optional"/>
<xs:attribute type="xs:string" name="font" use="optional"/>
<xs:attribute type="xs:string" name="svgFont" use="optional"/>
<xs:attribute type="xs:boolean" name="visible" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="uid" type="uuid" use="required"/>
<xs:attribute type="xs:string" name="name"/>
<xs:attribute type="xs:boolean" name="verticallyFlipped"/>
<xs:attribute type="xs:boolean" name="horizontallyFlipped"/>
<xs:attribute type="xs:boolean" name="forbidFlipping"/>
<xs:attribute type="xs:boolean" name="forceFlipping"/>
<xs:attribute type="xs:boolean" name="followGrainline"/>
<xs:attribute type="xs:boolean" name="sewLineOnDrawing"/>
<xs:attribute type="Transformation" name="transform"/>
<xs:attribute type="xs:string" name="gradationLabel"/>
<xs:attribute type="xs:unsignedInt" name="copyNumber"/>
<xs:attribute type="xs:boolean" name="showSeamline"/>
<xs:attribute type="xs:float" name="xScale"/>
<xs:attribute type="xs:float" name="yScale"/>
<xs:attribute type="xs:float" name="zValue"/>
<xs:attribute type="xs:boolean" name="showFullPiece"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="GrainlineType" name="grainlineType"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="formatVersion" name="version" use="required"/>
</xs:complexType>
</xs:element>
<!--Types-->
<xs:simpleType name="formatVersion">
<xs:restriction base="xs:string">
<xs:pattern value="[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}"/>
</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="uuid">
<xs:restriction base="xs:string">
<xs:pattern value="|\{[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}\}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ArrowDirection">
<xs:restriction base="xs:string">
<xs:enumeration value="oneWayUp"/>
<xs:enumeration value="oneWayDown"/>
<xs:enumeration value="twoWaysUpDown"/>
<xs:enumeration value="fourWays"/>
<xs:enumeration value="twoWaysUpLeft"/>
<xs:enumeration value="twoWaysUpRight"/>
<xs:enumeration value="twoWaysDownLeft"/>
<xs:enumeration value="twoWaysDownRight"/>
<xs:enumeration value="threeWaysUpDownLeft"/>
<xs:enumeration value="threeWaysUpDownRight"/>
<xs:enumeration value="threeWaysUpLeftRight"/>
<xs:enumeration value="threeWaysDownLeftRight"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="NotchType">
<xs:restriction base="xs:unsignedInt">
<!--OneLine-->
<xs:enumeration value="0"/>
<!--TwoLines-->
<xs:enumeration value="1"/>
<!--ThreeLines-->
<xs:enumeration value="2"/>
<!--TMark-->
<xs:enumeration value="3"/>
<!--VMark-->
<xs:enumeration value="4"/>
<!--VMark2-->
<xs:enumeration value="5"/>
<!--UMark-->
<xs:enumeration value="6"/>
<!--BoxMark-->
<xs:enumeration value="7"/>
<!--CheckMark-->
<xs:enumeration value="8"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="CurvePenStyle">
<xs:restriction base="xs:string">
<xs:enumeration value="hair"/>
<xs:enumeration value="dashLine"/>
<xs:enumeration value="dotLine"/>
<xs:enumeration value="dashDotLine"/>
<xs:enumeration value="dashDotDotLine"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="MarkerType">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="0"/><!--Segment-->
<xs:enumeration value="1"/><!--Rectangle-->
<xs:enumeration value="2"/><!--Cross-->
<xs:enumeration value="3"/><!--Tshaped-->
<xs:enumeration value="4"/><!--Doubletree-->
<xs:enumeration value="5"/><!--Corner-->
<xs:enumeration value="6"/><!--Triangle-->
<xs:enumeration value="7"/><!--Hshaped-->
<xs:enumeration value="8"/><!--Button-->
<xs:enumeration value="9"/><!--Circle-->
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="AlignmentType">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="0"/><!--default (no aligns)-->
<xs:enumeration value="1"/><!--aligns with the left edge-->
<xs:enumeration value="2"/><!--aligns with the right edge-->
<xs:enumeration value="4"/><!--Centers horizontally in the available space-->
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Transformation">
<xs:restriction base="xs:string">
<xs:pattern value="([-+]?\d+\.?\d*([eE][-+]?\d+)?;){8,}[-+]?\d+\.?\d*([eE][-+]?\d+)?"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="PathNotEmpty">
<xs:restriction base="xs:string">
<xs:pattern value="([-+]?\d+\.?\d*([eE][-+]?\d+)?,[-+]?\d+\.?\d*([eE][-+]?\d+)?\s){0,}[-+]?\d+\.?\d*([eE][-+]?\d+)?,[-+]?\d+\.?\d*([eE][-+]?\d+)?"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="PathOrEmpty">
<xs:restriction base="xs:string">
<xs:pattern value="|([-+]?\d+\.?\d*([eE][-+]?\d+)?,[-+]?\d+\.?\d*([eE][-+]?\d+)?\s){0,}[-+]?\d+\.?\d*([eE][-+]?\d+)?,[-+]?\d+\.?\d*([eE][-+]?\d+)?"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="LinePathOrEmpty">
<xs:restriction base="xs:string">
<xs:pattern value="|[-+]?\d+\.?\d*([eE][-+]?\d+)?,[-+]?\d+\.?\d*([eE][-+]?\d+)?;[-+]?\d+\.?\d*([eE][-+]?\d+)?,[-+]?\d+\.?\d*([eE][-+]?\d+)?"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="LinePath">
<xs:restriction base="xs:string">
<xs:pattern value="[-+]?\d+\.?\d*([eE][-+]?\d+)?,[-+]?\d+\.?\d*([eE][-+]?\d+)?;[-+]?\d+\.?\d*([eE][-+]?\d+)?,[-+]?\d+\.?\d*([eE][-+]?\d+)?"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="LinesPath">
<xs:restriction base="xs:string">
<xs:pattern value="([-+]?\d+\.?\d*([eE][-+]?\d+)?,[-+]?\d+\.?\d*([eE][-+]?\d+)?;[-+]?\d+\.?\d*([eE][-+]?\d+)?,[-+]?\d+\.?\d*([eE][-+]?\d+)?\*){0,}[-+]?\d+\.?\d*([eE][-+]?\d+)?,[-+]?\d+\.?\d*([eE][-+]?\d+)?;[-+]?\d+\.?\d*([eE][-+]?\d+)?,[-+]?\d+\.?\d*([eE][-+]?\d+)?"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="PointPath">
<xs:restriction base="xs:string">
<xs:pattern value="[-+]?\d+\.?\d*([eE][-+]?\d+)?,[-+]?\d+\.?\d*([eE][-+]?\d+)?"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="RectPath">
<xs:restriction base="xs:string">
<xs:pattern value="([-+]?\d+\.?\d*([eE][-+]?\d+)?;){3,}[-+]?\d+\.?\d*([eE][-+]?\d+)?"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="GrainlineType">
<xs:restriction base="xs:string">
<xs:enumeration value="horizontal"/>
<xs:enumeration value="vertical"/>
<xs:enumeration value="notFixed"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="LayoutScale">
<xs:restriction base="xs:float">
<xs:minInclusive value="0.01"/>
<xs:maxInclusive value="3"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="foldLineType">
<xs:restriction base="xs:string">
<xs:enumeration value="2ArrowsTextAbove"/><!--Same as default-->
<xs:enumeration value="2ArrowsTextUnder"/>
<xs:enumeration value="2Arrows"/>
<xs:enumeration value="text"/>
<xs:enumeration value="3dots"/>
<xs:enumeration value="3X"/>
<xs:enumeration value="none"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>

File diff suppressed because it is too large Load Diff

View File

@ -157,6 +157,7 @@ const QString VAbstractPattern::AttrDimensionB = QStringLiteral("dimensionB");
const QString VAbstractPattern::AttrDimensionC = QStringLiteral("dimensionC");
const QString VAbstractPattern::AttrMirrorLineP1 = QStringLiteral("p1");
const QString VAbstractPattern::AttrMirrorLineP2 = QStringLiteral("p2");
const QString VAbstractPattern::AttrMirrorLineVisible = QStringLiteral("visible");
const QString VAbstractPattern::AttrFoldLineHeightFormula = QStringLiteral("height");
const QString VAbstractPattern::AttrFoldLineWidthFormula = QStringLiteral("width");
const QString VAbstractPattern::AttrFoldLineCenterFormula = QStringLiteral("center");

View File

@ -391,6 +391,7 @@ public:
static const QString AttrDimensionC;
static const QString AttrMirrorLineP1;
static const QString AttrMirrorLineP2;
static const QString AttrMirrorLineVisible;
static const QString AttrFoldLineHeightFormula;
static const QString AttrFoldLineWidthFormula;
static const QString AttrFoldLineCenterFormula;

View File

@ -45,8 +45,8 @@ using namespace Qt::Literals::StringLiterals;
*/
const QString VLayoutConverter::LayoutMinVerStr = QStringLiteral("0.1.0");
const QString VLayoutConverter::LayoutMaxVerStr = QStringLiteral("0.1.8");
const QString VLayoutConverter::CurrentSchema = QStringLiteral("://schema/layout/v0.1.8.xsd");
const QString VLayoutConverter::LayoutMaxVerStr = QStringLiteral("0.1.9");
const QString VLayoutConverter::CurrentSchema = QStringLiteral("://schema/layout/v0.1.9.xsd");
// VLayoutConverter::LayoutMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
// VLayoutConverter::LayoutMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
@ -152,7 +152,8 @@ auto VLayoutConverter::XSDSchemas() -> QHash<unsigned int, QString>
std::make_pair(FormatVersion(0, 1, 5), QStringLiteral("://schema/layout/v0.1.5.xsd")),
std::make_pair(FormatVersion(0, 1, 6), QStringLiteral("://schema/layout/v0.1.6.xsd")),
std::make_pair(FormatVersion(0, 1, 7), QStringLiteral("://schema/layout/v0.1.7.xsd")),
std::make_pair(FormatVersion(0, 1, 8), CurrentSchema),
std::make_pair(FormatVersion(0, 1, 8), QStringLiteral("://schema/layout/v0.1.8.xsd")),
std::make_pair(FormatVersion(0, 1, 9), CurrentSchema),
};
return schemas;
@ -193,10 +194,11 @@ void VLayoutConverter::ApplyPatches()
ToV0_1_7();
Q_FALLTHROUGH();
case (FormatVersion(0, 1, 7)):
ToV0_1_8();
case (FormatVersion(0, 1, 8)):
ToV0_1_9();
ValidateXML(CurrentSchema);
Q_FALLTHROUGH();
case (FormatVersion(0, 1, 8)):
case (FormatVersion(0, 1, 9)):
break;
default:
InvalidVersion(m_ver);
@ -437,11 +439,11 @@ void VLayoutConverter::ToV0_1_7()
}
//---------------------------------------------------------------------------------------------------------------------
void VLayoutConverter::ToV0_1_8()
void VLayoutConverter::ToV0_1_9()
{
// TODO. Delete if minimal supported version is 0.1.8
Q_STATIC_ASSERT_X(VLayoutConverter::LayoutMinVer < FormatVersion(0, 1, 8), "Time to refactor the code.");
// TODO. Delete if minimal supported version is 0.1.9
Q_STATIC_ASSERT_X(VLayoutConverter::LayoutMinVer < FormatVersion(0, 1, 9), "Time to refactor the code.");
SetVersion(QStringLiteral("0.1.8"));
SetVersion(QStringLiteral("0.1.9"));
Save();
}

View File

@ -47,7 +47,7 @@ public:
static const QString LayoutMaxVerStr;
static const QString CurrentSchema;
static Q_DECL_CONSTEXPR const unsigned LayoutMinVer = FormatVersion(0, 1, 0);
static Q_DECL_CONSTEXPR const unsigned LayoutMaxVer = FormatVersion(0, 1, 8);
static Q_DECL_CONSTEXPR const unsigned LayoutMaxVer = FormatVersion(0, 1, 9);
static auto XSDSchemas() -> QHash<unsigned, QString>;
@ -77,7 +77,7 @@ protected:
void ToV0_1_3();
void ToV0_1_5();
void ToV0_1_7();
void ToV0_1_8();
void ToV0_1_9();
private:
Q_DISABLE_COPY_MOVE(VLayoutConverter) // NOLINT

View File

@ -62,8 +62,8 @@ class QDomElement;
*/
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.4"); // NOLINT
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.9.4"); // NOLINT
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.9.4.xsd"); // NOLINT
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.9.5"); // NOLINT
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.9.5.xsd"); // NOLINT
// VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
// VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
@ -265,7 +265,8 @@ auto VPatternConverter::XSDSchemas() -> QHash<unsigned int, QString>
std::make_pair(FormatVersion(0, 9, 1), QStringLiteral("://schema/pattern/v0.9.1.xsd")),
std::make_pair(FormatVersion(0, 9, 2), QStringLiteral("://schema/pattern/v0.9.2.xsd")),
std::make_pair(FormatVersion(0, 9, 3), QStringLiteral("://schema/pattern/v0.9.3.xsd")),
std::make_pair(FormatVersion(0, 9, 4), CurrentSchema)};
std::make_pair(FormatVersion(0, 9, 4), QStringLiteral("://schema/pattern/v0.9.4.xsd")),
std::make_pair(FormatVersion(0, 9, 5), CurrentSchema)};
return schemas;
}
@ -386,10 +387,11 @@ void VPatternConverter::ApplyPatches()
Q_FALLTHROUGH();
case (FormatVersion(0, 9, 2)):
case (FormatVersion(0, 9, 3)):
ToV0_9_4();
case (FormatVersion(0, 9, 4)):
ToV0_9_5();
ValidateXML(CurrentSchema);
Q_FALLTHROUGH();
case (FormatVersion(0, 9, 4)):
case (FormatVersion(0, 9, 5)):
break;
default:
InvalidVersion(m_ver);
@ -407,7 +409,7 @@ void VPatternConverter::DowngradeToCurrentMaxVersion()
auto VPatternConverter::IsReadOnly() const -> bool
{
// Check if attribute readOnly was not changed in file format
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == FormatVersion(0, 9, 4), "Check attribute readOnly.");
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == FormatVersion(0, 9, 5), "Check attribute readOnly.");
// Possibly in future attribute readOnly will change position etc.
// For now position is the same for all supported format versions.
@ -583,12 +585,12 @@ void VPatternConverter::ToV0_9_2()
}
//---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::ToV0_9_4()
void VPatternConverter::ToV0_9_5()
{
// TODO. Delete if minimal supported version is 0.9.4
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 9, 4), "Time to refactor the code.");
// TODO. Delete if minimal supported version is 0.9.5
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 9, 5), "Time to refactor the code.");
SetVersion(QStringLiteral("0.9.4"));
SetVersion(QStringLiteral("0.9.5"));
Save();
}
@ -1035,8 +1037,8 @@ auto VPatternConverter::FixIncrementInFormulaToV0_2_0(const QString &formula, co
// TODO. Delete if minimal supported version is 0.2.0
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0), "Time to refactor the code.");
auto *cal = new qmu::QmuTokenParser(formula, false, false); // Eval formula
QMap<vsizetype, QString> tokens = cal->GetTokens(); // Tokens (variables, measurements)
auto *cal = new qmu::QmuTokenParser(formula, false, false); // Eval formula
QMap<vsizetype, QString> tokens = cal->GetTokens(); // Tokens (variables, measurements)
delete cal;
QList<vsizetype> tKeys = tokens.keys(); // Take all tokens positions

View File

@ -54,7 +54,7 @@ public:
static const QString PatternMaxVerStr;
static const QString CurrentSchema;
static Q_DECL_CONSTEXPR const unsigned PatternMinVer = FormatVersion(0, 1, 4);
static Q_DECL_CONSTEXPR const unsigned PatternMaxVer = FormatVersion(0, 9, 4);
static Q_DECL_CONSTEXPR const unsigned PatternMaxVer = FormatVersion(0, 9, 5);
static auto XSDSchemas() -> QHash<unsigned, QString>;
@ -91,7 +91,7 @@ private:
void ToV0_9_0();
void ToV0_9_1();
void ToV0_9_2();
void ToV0_9_4();
void ToV0_9_5();
void TagUnitToV0_2_0();
void TagIncrementToV0_2_0();

View File

@ -915,7 +915,7 @@ void VDxfEngine::ExportAAMADraw(const QSharedPointer<dx_ifaceBlock> &detailBlock
if (detail.IsShowFullPiece())
{
const QLineF mirrorLine = detail.GetMappedSeamAllowanceMirrorLine();
if (not mirrorLine.isNull())
if (not mirrorLine.isNull() && detail.IsShowMirrorLine())
{
if (DRW_Entity *e = AAMALine(mirrorLine, *layer8))
{
@ -1776,7 +1776,7 @@ void VDxfEngine::ExportASTMMirrorLine(const QSharedPointer<dx_ifaceBlock> &detai
if (DRW_Entity *e = AAMALine(mirrorLine, layer))
{
if (isShowFullPiece)
if (isShowFullPiece && detail.IsShowMirrorLine())
{
e->lineType = dx_iface::QtPenStyleToString(Qt::DashDotLine);
}

View File

@ -531,7 +531,8 @@ void VHPGLEngine::PlotPlaceLabels(QTextStream &out, const VLayoutPiece &detail)
for (auto &points : shape)
{
std::transform(points.begin(), points.end(), points.begin(),
[&matrix](const VLayoutPoint &point) { return VAbstractPiece::MapPoint(point, matrix); });
[&matrix](const VLayoutPoint &point)
{ return VAbstractPiece::MapPoint(point, matrix); });
}
PlotShape(shape);
@ -603,7 +604,7 @@ void VHPGLEngine::PlotMirrorLine(QTextStream &out, const VLayoutPiece &detail)
if (detail.IsShowFullPiece())
{
const QLineF mirrorLine = detail.GetMappedSeamAllowanceMirrorLine();
if (not mirrorLine.isNull())
if (not mirrorLine.isNull() && detail.IsShowMirrorLine())
{
PlotPath(out, CastToPoint(ConvertPath<QPointF>({mirrorLine.p1(), mirrorLine.p2()})), Qt::DashDotLine);
}

View File

@ -1598,6 +1598,18 @@ void VAbstractPiece::SetFoldLineLabelAlignment(int alignment)
d->m_foldLineLabelAlignment = alignment;
}
//---------------------------------------------------------------------------------------------------------------------
bool VAbstractPiece::IsShowMirrorLine() const
{
return d->m_showMirrorLine;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractPiece::SetShowMirrorLine(bool show)
{
d->m_showMirrorLine = show;
}
//---------------------------------------------------------------------------------------------------------------------
auto VAbstractPiece::GetUUID() const -> QUuid
{

View File

@ -135,6 +135,9 @@ public:
auto GetFoldLineLabelAlignment() const -> int;
void SetFoldLineLabelAlignment(int alignment);
auto IsShowMirrorLine() const -> bool;
void SetShowMirrorLine(bool show);
auto GetUUID() const -> QUuid;
void SetUUID(const QUuid &uuid);
void SetUUID(const QString &uuid);

View File

@ -73,6 +73,7 @@ public:
bool m_foldLineLabelFontBold{false}; // NOLINT (misc-non-private-member-variables-in-classes)
QString m_foldLineLabel{}; // NOLINT (misc-non-private-member-variables-in-classes)
int m_foldLineLabelAlignment{Qt::AlignHCenter}; // NOLINT (misc-non-private-member-variables-in-classes)
bool m_showMirrorLine{true}; // NOLINT (misc-non-private-member-variables-in-classes)
// NOLINTNEXTLINE(misc-non-private-member-variables-in-classes)
FoldLineType m_foldLineType{FoldLineType::TwoArrowsTextAbove};
@ -81,7 +82,7 @@ private:
Q_DISABLE_ASSIGN_MOVE(VAbstractPieceData) // NOLINT
static constexpr quint32 streamHeader = 0x05CDD73A; // CRC-32Q string "VAbstractPieceData"
static constexpr quint16 classVersion = 6;
static constexpr quint16 classVersion = 7;
};
QT_WARNING_POP
@ -124,6 +125,9 @@ inline auto operator<<(QDataStream &dataStream, const VAbstractPieceData &piece)
dataStream << piece.m_foldLineLabel;
dataStream << piece.m_foldLineLabelAlignment;
// Added in classVersion = 7
dataStream << piece.m_showMirrorLine;
return dataStream;
}
@ -197,6 +201,11 @@ inline auto operator>>(QDataStream &dataStream, VAbstractPieceData &piece) -> QD
dataStream >> piece.m_foldLineLabelAlignment;
}
if (actualClassVersion >= 7)
{
dataStream >> piece.m_showMirrorLine;
}
return dataStream;
}

View File

@ -669,6 +669,7 @@ auto VLayoutPiece::Create(const VPiece &piece, vidtype id, const VContainer *pat
det.SetShowFullPiece(piece.IsShowFullPiece());
det.SetSeamMirrorLine(piece.SeamMirrorLine(pattern));
det.SetSeamAllowanceMirrorLine(piece.SeamAllowanceMirrorLine(pattern));
det.SetShowMirrorLine(piece.IsShowMirrorLine());
det.SetId(id);
if (not futureSeamAllowanceValid.result())

View File

@ -763,6 +763,8 @@ void DialogSeamAllowance::InitFold(const VPiece &piece)
uiTabPaths->checkBoxShowFullPiece->setChecked(piece.IsShowFullPiece());
}
uiTabPaths->checkBoxShowMirrorLine->setChecked(piece.IsShowMirrorLine());
InitMirrorLine();
{
@ -3268,6 +3270,7 @@ auto DialogSeamAllowance::CreatePiece() const -> VPiece
piece.GetPieceLabelData().SetFontSize(uiTabLabels->comboBoxPieceLabelSize->currentData().toInt());
piece.SetMirrorLineStartPoint(GetMirrorLineStartPoint());
piece.SetMirrorLineEndPoint(GetMirrorLineEndPoint());
piece.SetShowMirrorLine(uiTabPaths->checkBoxShowMirrorLine->isChecked());
piece.SetShowFullPiece(
!piece.SeamAllowanceMirrorLine(data).isNull() ? uiTabPaths->checkBoxShowFullPiece->isChecked() : true);
piece.SetManualFoldHeight(uiTabFoldLine->groupBoxManualHeight->isChecked());

View File

@ -203,27 +203,41 @@
<property name="title">
<string>Mirror line</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="labelMLStartPoint">
<layout class="QVBoxLayout" name="verticalLayout_10">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="labelMLStartPoint">
<property name="text">
<string>Start point:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxMLStartPoint"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelMLEndPoint">
<property name="text">
<string>End point:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxMLEndPoint"/>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBoxShowMirrorLine">
<property name="text">
<string>Start point:</string>
<string>Show mirror line</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxMLStartPoint"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelMLEndPoint">
<property name="text">
<string>End point:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxMLEndPoint"/>
</item>
</layout>
</widget>
</item>

View File

@ -819,6 +819,8 @@ void VToolSeamAllowance::AddMirrorLine(VAbstractPattern *doc, QDomElement &domEl
[](const QString &label) noexcept { return label.isEmpty(); });
doc->SetAttributeOrRemoveIf<int>(domData, VDomDocument::AttrAlignment, piece.GetFoldLineLabelAlignment(),
[](int alignment) noexcept { return alignment == Qt::AlignHCenter; });
doc->SetAttributeOrRemoveIf<bool>(domData, VAbstractPattern::AttrMirrorLineVisible, piece.IsShowMirrorLine(),
[](bool visible) noexcept { return visible; });
domElement.appendChild(domData);
}
@ -1776,7 +1778,7 @@ void VToolSeamAllowance::RefreshGeometry(bool updateChildren)
[this, detail]()
{
QLineF const mirrorLine = detail.SeamAllowanceMirrorLine(getData());
if (detail.IsShowFullPiece() && !mirrorLine.isNull())
if (detail.IsShowFullPiece() && detail.IsShowMirrorLine() && !mirrorLine.isNull())
{
QPainterPath path;
path.moveTo(mirrorLine.p1());