New piece option Follow grainline.

This commit is contained in:
Roman Telezhynskyi 2023-10-10 14:14:23 +03:00
parent 11b5efc514
commit 2118e0766d
25 changed files with 1978 additions and 91 deletions

View file

@ -43,6 +43,7 @@
- Redesign standard path system.
- New option: Translate formula.
- Fix filling piece label data.
- New piece option Follow grainline.
# Valentina 0.7.52 September 12, 2022
- Fix crash when default locale is ru.

View file

@ -26,16 +26,16 @@
**
*************************************************************************/
#include "vpundomovepieceonsheet.h"
#include "../vmisc/def.h"
#include "../layout/vpsheet.h"
#include "../layout/vplayout.h"
#include "../layout/vppiece.h"
#include "../layout/vpsheet.h"
#include "../vmisc/def.h"
//---------------------------------------------------------------------------------------------------------------------
VPUndoMovePieceOnSheet::VPUndoMovePieceOnSheet(const VPSheetPtr &sheet, const VPPiecePtr &piece, QUndoCommand *parent)
: VPUndoCommand(false, parent),
m_sheet(sheet),
m_piece(piece)
: VPUndoCommand(false, parent),
m_sheet(sheet),
m_piece(piece)
{
SCASSERT(not piece.isNull())
@ -116,7 +116,7 @@ void VPUndoMovePieceOnSheet::redo()
piece->SetSelected(false);
}
if (m_followGrainline)
if (m_followGrainline || piece->IsFollowGrainline())
{
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wnoexcept")

View file

@ -26,8 +26,8 @@
**
*************************************************************************/
#include "vpundopiecerotate.h"
#include "../layout/vppiece.h"
#include "../layout/vplayout.h"
#include "../layout/vppiece.h"
namespace
{
@ -37,16 +37,16 @@ auto RoundAngle(qreal angle) -> qreal
l.setAngle(angle);
return l.angle();
}
}
} // namespace
//---------------------------------------------------------------------------------------------------------------------
VPUndoPieceRotate::VPUndoPieceRotate(const VPPiecePtr &piece, const VPTransformationOrigon &origin, qreal angle,
qreal angleSum, bool allowMerge, QUndoCommand *parent)
: VPUndoCommand(allowMerge, parent),
m_piece(piece),
m_origin(origin),
m_angle(angle),
m_angleSum(angleSum)
: VPUndoCommand(allowMerge, parent),
m_piece(piece),
m_origin(origin),
m_angle(angle),
m_angleSum(angleSum)
{
SCASSERT(not piece.isNull())
@ -107,7 +107,7 @@ void VPUndoPieceRotate::redo()
if (m_firstCall)
{
if (m_followGrainline && piece->IsGrainlineEnabled())
if ((m_followGrainline || piece->IsFollowGrainline()) && piece->IsGrainlineEnabled())
{
piece->Rotate(m_origin.origin, m_angleSum);
}
@ -121,7 +121,7 @@ void VPUndoPieceRotate::redo()
piece->Rotate(m_origin.origin, m_angle);
}
if (m_followGrainline)
if (m_followGrainline || piece->IsFollowGrainline())
{
piece->RotateToGrainline(m_origin);
}
@ -149,8 +149,8 @@ auto VPUndoPieceRotate::mergeWith(const QUndoCommand *command) -> bool
VPPiecePtr piece = Piece();
if (not moveCommand->AllowMerge() || (moveCommand->Piece().isNull() || piece.isNull()) ||
moveCommand->Piece() != piece || moveCommand->Origin() != m_origin ||
moveCommand->FollowGrainline() != m_followGrainline)
moveCommand->Piece() != piece || moveCommand->Origin() != m_origin ||
moveCommand->FollowGrainline() != m_followGrainline)
{
return false;
}
@ -170,14 +170,14 @@ auto VPUndoPieceRotate::id() const -> int
//---------------------------------------------------------------------------------------------------------------------
VPUndoPiecesRotate::VPUndoPiecesRotate(const QList<VPPiecePtr> &pieces, const VPTransformationOrigon &origin,
qreal angle, qreal angleSum, bool allowMerge, QUndoCommand *parent)
: VPUndoCommand(allowMerge, parent),
m_origin(origin),
m_angle(angle),
m_angleSum(angleSum)
: VPUndoCommand(allowMerge, parent),
m_origin(origin),
m_angle(angle),
m_angleSum(angleSum)
{
setText(QObject::tr("rotate pieces"));
for (const auto& piece : pieces)
for (const auto &piece : pieces)
{
if (not piece.isNull())
{
@ -213,7 +213,7 @@ void VPUndoPiecesRotate::undo()
layout->SetFocusedSheet(sheet);
}
for (const auto& piece : qAsConst(m_pieces))
for (const auto &piece : qAsConst(m_pieces))
{
VPPiecePtr p = piece.toStrongRef();
if (not p.isNull())
@ -247,14 +247,14 @@ void VPUndoPiecesRotate::redo()
layout->SetFocusedSheet(sheet);
}
for (const auto& piece : qAsConst(m_pieces))
for (const auto &piece : qAsConst(m_pieces))
{
VPPiecePtr p = piece.toStrongRef();
if (not p.isNull())
{
if (m_firstCall)
{
if (m_followGrainline && p->IsGrainlineEnabled())
if ((m_followGrainline || p->IsFollowGrainline()) && p->IsGrainlineEnabled())
{
p->Rotate(m_origin.origin, m_angleSum);
}
@ -268,7 +268,7 @@ void VPUndoPiecesRotate::redo()
p->Rotate(m_origin.origin, m_angle);
}
if (m_followGrainline)
if (m_followGrainline || p->IsFollowGrainline())
{
p->RotateToGrainline(m_origin);
}
@ -297,7 +297,7 @@ auto VPUndoPiecesRotate::mergeWith(const QUndoCommand *command) -> bool
SCASSERT(moveCommand != nullptr)
if (not moveCommand->AllowMerge() || moveCommand->PieceIds() != PieceIds() || moveCommand->Origin() != m_origin ||
moveCommand->FollowGrainline() != m_followGrainline)
moveCommand->FollowGrainline() != m_followGrainline)
{
return false;
}
@ -317,7 +317,7 @@ auto VPUndoPiecesRotate::id() const -> int
auto VPUndoPiecesRotate::PieceIds() const -> QSet<QString>
{
QSet<QString> ids;
for (const auto& piece : m_pieces)
for (const auto &piece : m_pieces)
{
VPPiecePtr p = piece.toStrongRef();
if (not p.isNull())
@ -332,7 +332,7 @@ auto VPUndoPiecesRotate::PieceIds() const -> QSet<QString>
//---------------------------------------------------------------------------------------------------------------------
auto VPUndoPiecesRotate::Layout() const -> VPLayoutPtr
{
for (const auto& piece : m_pieces)
for (const auto &piece : m_pieces)
{
VPPiecePtr p = piece.toStrongRef();
if (not p.isNull())
@ -347,7 +347,7 @@ auto VPUndoPiecesRotate::Layout() const -> VPLayoutPtr
//---------------------------------------------------------------------------------------------------------------------
auto VPUndoPiecesRotate::Sheet() const -> VPSheetPtr
{
for (const auto& piece : m_pieces)
for (const auto &piece : m_pieces)
{
VPPiecePtr p = piece.toStrongRef();
if (not p.isNull())

View file

@ -512,6 +512,7 @@ void VPLayoutFileReader::ReadPiece(const VPPiecePtr &piece)
piece->SetMirror(ReadAttributeBool(attribs, ML::AttrMirrored, falseStr));
piece->SetForbidFlipping(ReadAttributeBool(attribs, ML::AttrForbidFlipping, falseStr));
piece->SetForceFlipping(ReadAttributeBool(attribs, ML::AttrForceFlipping, falseStr));
piece->SetFollowGrainline(ReadAttributeBool(attribs, ML::AttrFollowGrainline, falseStr));
piece->SetSewLineOnDrawing(ReadAttributeBool(attribs, ML::AttrSewLineOnDrawing, falseStr));
piece->SetMatrix(StringToTransfrom(ReadAttributeEmptyString(attribs, ML::AttrTransform)));

View file

@ -265,6 +265,8 @@ void VPLayoutFileWriter::WritePiece(const VPPiecePtr &piece)
[](bool forbid) noexcept { return not forbid; });
SetAttributeOrRemoveIf<bool>(ML::AttrForceFlipping, piece->IsForceFlipping(),
[](bool force) noexcept { return not force; });
SetAttributeOrRemoveIf<bool>(ML::AttrFollowGrainline, piece->IsFollowGrainline(),
[](bool follow) noexcept { return not follow; });
SetAttributeOrRemoveIf<bool>(ML::AttrSewLineOnDrawing, piece->IsSewLineOnDrawing(),
[](bool value) noexcept { return not value; });
SetAttribute(ML::AttrTransform, TransformToString(piece->GetMatrix()));

View file

@ -964,6 +964,7 @@ void VPattern::ParseDetailElement(QDomElement &domElement, const Document &parse
initData.detail.SetForceFlipping(GetParametrBool(
domElement, AttrForceFlipping,
QString().setNum(VAbstractValApplication::VApp()->ValentinaSettings()->GetForceWorkpieceFlipping())));
initData.detail.SetFollowGrainline(GetParametrBool(domElement, AttrFollowGrainline, falseStr));
initData.detail.SetSewLineOnDrawing(GetParametrBool(
domElement, AttrSewLineOnDrawing,
QString().setNum(VAbstractValApplication::VApp()->ValentinaSettings()->GetSewLineOnDrawing())));

View file

@ -126,6 +126,7 @@ const QString AttrIdObject = QStringLiteral("idObject");
const QString AttrInLayout = QStringLiteral("inLayout");
const QString AttrForbidFlipping = QStringLiteral("forbidFlipping");
const QString AttrForceFlipping = QStringLiteral("forceFlipping");
const QString AttrFollowGrainline = QStringLiteral("followGrainline");
const QString AttrSewLineOnDrawing = QStringLiteral("sewLineOnDrawing");
const QString AttrRotationAngle = QStringLiteral("rotationAngle");
const QString AttrClosed = QStringLiteral("closed");

View file

@ -144,6 +144,7 @@ extern const QString AttrIdObject;
extern const QString AttrInLayout;
extern const QString AttrForbidFlipping;
extern const QString AttrForceFlipping;
extern const QString AttrFollowGrainline;
extern const QString AttrSewLineOnDrawing;
extern const QString AttrClosed;
extern const QString AttrShowLabel;

View file

@ -68,6 +68,7 @@
<file>schema/pattern/v0.9.0.xsd</file>
<file>schema/pattern/v0.9.1.xsd</file>
<file>schema/pattern/v0.9.2.xsd</file>
<file>schema/pattern/v0.9.3.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>
@ -97,5 +98,6 @@
<file>schema/layout/v0.1.3.xsd</file>
<file>schema/layout/v0.1.4.xsd</file>
<file>schema/layout/v0.1.5.xsd</file>
<file>schema/layout/v0.1.6.xsd</file>
</qresource>
</RCC>

View file

@ -0,0 +1,589 @@
<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:float" name="piecesGap"/>
</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: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: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:sequence>
<xs:attribute name="uid" type="uuid" use="required"/>
<xs:attribute type="xs:string" name="name"/>
<xs:attribute type="xs:boolean" name="mirrored"/>
<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: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: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: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:sequence>
<xs:attribute name="uid" type="uuid" use="required"/>
<xs:attribute type="xs:string" name="name"/>
<xs:attribute type="xs:boolean" name="mirrored"/>
<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: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:schema>

File diff suppressed because it is too large Load diff

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.5");
const QString VLayoutConverter::CurrentSchema = QStringLiteral("://schema/layout/v0.1.5.xsd");
const QString VLayoutConverter::LayoutMaxVerStr = QStringLiteral("0.1.6");
const QString VLayoutConverter::CurrentSchema = QStringLiteral("://schema/layout/v0.1.6.xsd");
// VLayoutConverter::LayoutMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
// VLayoutConverter::LayoutMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
@ -147,7 +147,8 @@ auto VLayoutConverter::XSDSchemas() -> QHash<unsigned int, QString>
std::make_pair(FormatVersion(0, 1, 2), QStringLiteral("://schema/layout/v0.1.2.xsd")),
std::make_pair(FormatVersion(0, 1, 3), QStringLiteral("://schema/layout/v0.1.3.xsd")),
std::make_pair(FormatVersion(0, 1, 4), QStringLiteral("://schema/layout/v0.1.4.xsd")),
std::make_pair(FormatVersion(0, 1, 5), CurrentSchema),
std::make_pair(FormatVersion(0, 1, 5), QStringLiteral("://schema/layout/v0.1.5.xsd")),
std::make_pair(FormatVersion(0, 1, 6), CurrentSchema),
};
return schemas;
@ -182,9 +183,12 @@ void VLayoutConverter::ApplyPatches()
case (FormatVersion(0, 1, 3)):
case (FormatVersion(0, 1, 4)):
ToV0_1_5();
ValidateXML(CurrentSchema);
Q_FALLTHROUGH();
case (FormatVersion(0, 1, 5)):
ToV0_1_6();
ValidateXML(CurrentSchema);
Q_FALLTHROUGH();
case (FormatVersion(0, 1, 6)):
break;
default:
InvalidVersion(m_ver);
@ -394,3 +398,13 @@ void VLayoutConverter::ToV0_1_5()
SetVersion(QStringLiteral("0.1.5"));
Save();
}
//---------------------------------------------------------------------------------------------------------------------
void VLayoutConverter::ToV0_1_6()
{
// TODO. Delete if minimal supported version is 0.1.6
Q_STATIC_ASSERT_X(VLayoutConverter::LayoutMinVer < FormatVersion(0, 1, 6), "Time to refactor the code.");
SetVersion(QStringLiteral("0.1.6"));
Save();
}

View file

@ -28,8 +28,8 @@
#ifndef VLAYOUTCONVERTER_H
#define VLAYOUTCONVERTER_H
#include "vabstractconverter.h"
#include "../vmisc/projectversion.h"
#include "vabstractconverter.h"
class QDomElement;
class QString;
@ -37,18 +37,19 @@ class QString;
class VLayoutConverter : public VAbstractConverter
{
Q_OBJECT // NOLINT
public:
explicit VLayoutConverter(const QString &fileName);
~VLayoutConverter() override =default;
~VLayoutConverter() override = default;
auto GetFormatVersionStr() const -> QString override;
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, 5);
static Q_DECL_CONSTEXPR const unsigned LayoutMaxVer = FormatVersion(0, 1, 6);
static auto XSDSchemas() -> QHash <unsigned, QString>;
static auto XSDSchemas() -> QHash<unsigned, QString>;
protected:
void SetVersion(const QString &version) override;
@ -64,7 +65,7 @@ protected:
auto IsReadOnly() const -> bool override;
auto Schemas() const -> QHash <unsigned, QString> override;
auto Schemas() const -> QHash<unsigned, QString> override;
void ConvertPiecesToV0_1_3();
void ConvertPathToV0_1_3(QDomElement &node);
@ -73,6 +74,7 @@ protected:
void ToV0_1_3();
void ToV0_1_5();
void ToV0_1_6();
private:
Q_DISABLE_COPY_MOVE(VLayoutConverter) // NOLINT

View file

@ -63,8 +63,8 @@ class QDomElement;
*/
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.4"); // NOLINT
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.9.2"); // NOLINT
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.9.2.xsd"); // NOLINT
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.9.3"); // NOLINT
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.9.3.xsd"); // NOLINT
// VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
// VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
@ -264,7 +264,8 @@ auto VPatternConverter::XSDSchemas() -> QHash<unsigned int, QString>
std::make_pair(FormatVersion(0, 8, 13), QStringLiteral("://schema/pattern/v0.8.13.xsd")),
std::make_pair(FormatVersion(0, 9, 0), QStringLiteral("://schema/pattern/v0.9.0.xsd")),
std::make_pair(FormatVersion(0, 9, 1), QStringLiteral("://schema/pattern/v0.9.1.xsd")),
std::make_pair(FormatVersion(0, 9, 2), CurrentSchema)};
std::make_pair(FormatVersion(0, 9, 2), QStringLiteral("://schema/pattern/v0.9.2.xsd")),
std::make_pair(FormatVersion(0, 9, 3), CurrentSchema)};
return schemas;
}
@ -382,9 +383,12 @@ void VPatternConverter::ApplyPatches()
Q_FALLTHROUGH();
case (FormatVersion(0, 9, 1)):
ToV0_9_2();
ValidateXML(CurrentSchema);
Q_FALLTHROUGH();
case (FormatVersion(0, 9, 2)):
ToV0_9_3();
ValidateXML(CurrentSchema);
Q_FALLTHROUGH();
case (FormatVersion(0, 9, 3)):
break;
default:
InvalidVersion(m_ver);
@ -402,7 +406,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, 2), "Check attribute readOnly.");
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == FormatVersion(0, 9, 3), "Check attribute readOnly.");
// Possibly in future attribute readOnly will change position etc.
// For now position is the same for all supported format versions.
@ -577,6 +581,16 @@ void VPatternConverter::ToV0_9_2()
Save();
}
//---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::ToV0_9_3()
{
// TODO. Delete if minimal supported version is 0.9.3
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 9, 3), "Time to refactor the code.");
SetVersion(QStringLiteral("0.9.3"));
Save();
}
//---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::TagUnitToV0_2_0()
{

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, 2);
static Q_DECL_CONSTEXPR const unsigned PatternMaxVer = FormatVersion(0, 9, 3);
static auto XSDSchemas() -> QHash<unsigned, QString>;
@ -91,6 +91,7 @@ private:
void ToV0_9_0();
void ToV0_9_1();
void ToV0_9_2();
void ToV0_9_3();
void TagUnitToV0_2_0();
void TagIncrementToV0_2_0();

View file

@ -992,6 +992,18 @@ void VAbstractPiece::SetForceFlipping(bool value)
}
}
//---------------------------------------------------------------------------------------------------------------------
auto VAbstractPiece::IsFollowGrainline() const -> bool
{
return d->m_followGrainline;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractPiece::SetFollowGrainline(bool value)
{
d->m_followGrainline = value;
}
//---------------------------------------------------------------------------------------------------------------------
auto VAbstractPiece::IsSeamAllowance() const -> bool
{

View file

@ -74,6 +74,9 @@ public:
auto IsForceFlipping() const -> bool;
void SetForceFlipping(bool value);
auto IsFollowGrainline() const -> bool;
void SetFollowGrainline(bool value);
auto IsSeamAllowance() const -> bool;
void SetSeamAllowance(bool value);

View file

@ -58,9 +58,10 @@ public:
friend auto operator>>(QDataStream &dataStream, VAbstractPieceData &piece) -> QDataStream &;
QString m_name{tr("Detail")}; // NOLINT (misc-non-private-member-variables-in-classes)
/** @brief forbidFlipping forbid piece be mirrored in a layout. */
/** @brief forbidFlipping forbid piece to be mirrored in a layout. */
bool m_forbidFlipping{false}; // NOLINT (misc-non-private-member-variables-in-classes)
bool m_forceFlipping{false}; // NOLINT (misc-non-private-member-variables-in-classes)
bool m_followGrainline{false}; // NOLINT (misc-non-private-member-variables-in-classes)
bool m_seamAllowance{false}; // NOLINT (misc-non-private-member-variables-in-classes)
bool m_seamAllowanceBuiltIn{false}; // NOLINT (misc-non-private-member-variables-in-classes)
bool m_hideMainPath{false}; // NOLINT (misc-non-private-member-variables-in-classes)
@ -75,7 +76,7 @@ private:
Q_DISABLE_ASSIGN_MOVE(VAbstractPieceData) // NOLINT
static constexpr quint32 streamHeader = 0x05CDD73A; // CRC-32Q string "VAbstractPieceData"
static constexpr quint16 classVersion = 4;
static constexpr quint16 classVersion = 5;
};
QT_WARNING_POP
@ -112,6 +113,9 @@ inline auto operator<<(QDataStream &dataStream, const VAbstractPieceData &piece)
// Added in classVersion = 4
dataStream << piece.m_onDrawing;
// Added in classVersion = 5
dataStream << piece.m_followGrainline;
return dataStream;
}
@ -167,6 +171,11 @@ inline auto operator>>(QDataStream &dataStream, VAbstractPieceData &piece) -> QD
dataStream >> piece.m_onDrawing;
}
if (actualClassVersion >= 5)
{
dataStream >> piece.m_followGrainline;
}
return dataStream;
}

View file

@ -655,6 +655,7 @@ auto VLayoutPiece::Create(const VPiece &piece, vidtype id, const VContainer *pat
det.SetSAWidth(VAbstractValApplication::VApp()->toPixel(piece.GetSAWidth()));
det.SetForbidFlipping(piece.IsForbidFlipping());
det.SetForceFlipping(piece.IsForceFlipping());
det.SetFollowGrainline(piece.IsFollowGrainline());
det.SetSewLineOnDrawing(piece.IsSewLineOnDrawing());
det.SetId(id);

View file

@ -49,7 +49,6 @@
#include "../ifc/exception/vexception.h"
#include "../vlayout/vlayoutpoint.h"
#include "../vmisc/def.h"
#include "../vpatterndb/floatItemData/floatitemdef.h"
#include "vpiecegrainline.h"
namespace
@ -379,7 +378,7 @@ auto VPosition::CheckRotationEdges(VLayoutPiece &detail, int j, int dEdge, qreal
if (detail.IsForceFlipping())
{
detail.Mirror(not m_data.followGrainline ? globalEdge : QLineF(10, 10, 10, 100));
detail.Mirror(m_data.followGrainline || detail.IsFollowGrainline() ? QLineF(10, 10, 10, 100) : globalEdge);
}
RotateEdges(detail, globalEdge, dEdge, angle);
@ -548,7 +547,9 @@ void VPosition::FollowGrainline()
if (m_data.detail.IsForceFlipping())
{
VLayoutPiece workDetail = m_data.detail; // We need copy for temp change
workDetail.Mirror(not m_data.followGrainline ? m_data.gContour.GlobalEdge(m_data.j) : QLineF(10, 10, 10, 100));
workDetail.Mirror(m_data.followGrainline || workDetail.IsFollowGrainline()
? QLineF(10, 10, 10, 100)
: m_data.gContour.GlobalEdge(m_data.j));
detailGrainline = workDetail.GetMatrix().map(detailGrainline);
}
@ -603,41 +604,40 @@ void VPosition::FindBestPosition()
return;
}
if (not m_data.followGrainline || not m_data.detail.IsGrainlineEnabled())
if (m_data.detail.IsGrainlineEnabled() && (m_data.followGrainline || m_data.detail.IsFollowGrainline()))
{
// We should use copy of the detail.
VLayoutPiece workDetail = m_data.detail;
FollowGrainline();
return;
}
int dEdge = m_data.i; // For mirror detail edge will be different
if (CheckCombineEdges(workDetail, m_data.j, dEdge))
{
if (stop->load())
{
return;
}
#ifdef LAYOUT_DEBUG
#ifdef SHOW_CANDIDATE_BEST
DumpFrame(m_data.gContour, workDetail, m_data.mutex, m_data.details);
#endif
#endif
SaveCandidate(m_bestResult, workDetail, m_data.j, dEdge, BestFrom::Combine);
}
// We should use copy of the detail.
VLayoutPiece workDetail = m_data.detail;
int dEdge = m_data.i; // For mirror detail edge will be different
if (CheckCombineEdges(workDetail, m_data.j, dEdge))
{
if (stop->load())
{
return;
}
if (m_data.rotate)
{
Rotate(m_data.rotationNumber);
}
#ifdef LAYOUT_DEBUG
#ifdef SHOW_CANDIDATE_BEST
DumpFrame(m_data.gContour, workDetail, m_data.mutex, m_data.details);
#endif
#endif
SaveCandidate(m_bestResult, workDetail, m_data.j, dEdge, BestFrom::Combine);
}
else
if (stop->load())
{
FollowGrainline();
return;
}
if (m_data.rotate)
{
Rotate(m_data.rotationNumber);
}
}

View file

@ -103,11 +103,6 @@ auto operator>>(QDataStream &dataStream, VRawLayoutData &data) -> QDataStream &
return dataStream;
}
//---------------------------------------------------------------------------------------------------------------------
VRawLayout::VRawLayout()
{
}
//---------------------------------------------------------------------------------------------------------------------
auto VRawLayout::WriteFile(QIODevice *ioDevice, const VRawLayoutData &data) -> bool
{
@ -119,7 +114,7 @@ auto VRawLayout::WriteFile(QIODevice *ioDevice, const VRawLayoutData &data) -> b
if (wasOpen || ioDevice->open(QIODevice::WriteOnly))
{
QDataStream dataStream(ioDevice);
dataStream.setVersion(QDataStream::Qt_5_4);
dataStream.setVersion(QDataStream::Qt_5_6);
// Don't use the << operator for QByteArray. See the note in ReadFile() below.
dataStream.writeRawData(fileHeaderByteArray.constData(), static_cast<int>(fileHeaderByteArray.size()));
@ -159,7 +154,7 @@ auto VRawLayout::ReadFile(QIODevice *ioDevice, VRawLayoutData &data) -> bool
});
QDataStream dataStream(ioDevice);
dataStream.setVersion(QDataStream::Qt_5_4);
dataStream.setVersion(QDataStream::Qt_5_6);
// Note: we could have used the QDataStream << and >> operators on QByteArray but since the first
// bytes of the stream will be the size of the array, we might end up attempting to allocate

View file

@ -42,12 +42,12 @@ private:
static const quint16 classVersion;
};
class VRawLayout
{
Q_DECLARE_TR_FUNCTIONS(VRawLayout) // NOLINT
public:
VRawLayout();
VRawLayout() = default;
auto WriteFile(QIODevice *ioDevice, const VRawLayoutData &data) -> bool;
auto ReadFile(QIODevice *ioDevice, VRawLayoutData &data) -> bool;

View file

@ -355,6 +355,7 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
uiTabPaths->checkBoxForbidFlipping->setChecked(piece.IsForbidFlipping());
uiTabPaths->checkBoxForceFlipping->setChecked(piece.IsForceFlipping());
uiTabPaths->checkBoxFollowGrainline->setChecked(piece.IsFollowGrainline());
uiTabPaths->checkBoxOnDrawing->setChecked(piece.IsSewLineOnDrawing());
uiTabPaths->checkBoxSeams->setChecked(piece.IsSeamAllowance());
uiTabPaths->checkBoxBuiltIn->setChecked(piece.IsSeamAllowanceBuiltIn());
@ -2751,6 +2752,7 @@ auto DialogSeamAllowance::CreatePiece() const -> VPiece
piece.SetPlaceLabels(GetListInternals<quint32>(uiTabPlaceLabels->listWidgetPlaceLabels));
piece.SetForbidFlipping(uiTabPaths->checkBoxForbidFlipping->isChecked());
piece.SetForceFlipping(uiTabPaths->checkBoxForceFlipping->isChecked());
piece.SetFollowGrainline(uiTabPaths->checkBoxFollowGrainline->isChecked());
piece.SetSewLineOnDrawing(uiTabPaths->checkBoxOnDrawing->isChecked());
piece.SetSeamAllowance(uiTabPaths->checkBoxSeams->isChecked());
piece.SetSeamAllowanceBuiltIn(uiTabPaths->checkBoxBuiltIn->isChecked());

View file

@ -111,7 +111,7 @@
<string>Move on top</string>
</property>
<property name="text">
<string notr="true"></string>
<string notr="true"/>
</property>
<property name="icon">
<iconset theme="go-top">
@ -128,7 +128,7 @@
<string>Move up</string>
</property>
<property name="text">
<string notr="true"></string>
<string notr="true"/>
</property>
<property name="icon">
<iconset theme="go-up">
@ -145,7 +145,7 @@
<string>Move down</string>
</property>
<property name="text">
<string notr="true"></string>
<string notr="true"/>
</property>
<property name="icon">
<iconset theme="go-down">
@ -162,7 +162,7 @@
<string>Move on bottom</string>
</property>
<property name="text">
<string notr="true"></string>
<string notr="true"/>
</property>
<property name="icon">
<iconset theme="go-bottom">
@ -325,6 +325,16 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxFollowGrainline">
<property name="toolTip">
<string>Force piece to always follow grainline direction regardless of layout settings.</string>
</property>
<property name="text">
<string>Follow grainline</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
@ -457,7 +467,7 @@
<string>Formula wizard</string>
</property>
<property name="text">
<string notr="true"></string>
<string notr="true"/>
</property>
<property name="icon">
<iconset resource="../../../../../vmisc/share/resources/icon.qrc">
@ -696,7 +706,7 @@
<string>Formula wizard</string>
</property>
<property name="text">
<string notr="true"></string>
<string notr="true"/>
</property>
<property name="icon">
<iconset resource="../../../../../vmisc/share/resources/icon.qrc">
@ -886,7 +896,7 @@
<string>Formula wizard</string>
</property>
<property name="text">
<string notr="true"></string>
<string notr="true"/>
</property>
<property name="icon">
<iconset resource="../../../../../vmisc/share/resources/icon.qrc">

View file

@ -418,6 +418,7 @@ void VToolSeamAllowance::AddAttributes(VAbstractPattern *doc, QDomElement &domEl
[](bool inLayout) noexcept { return inLayout; });
doc->SetAttribute(domElement, AttrForbidFlipping, piece.IsForbidFlipping());
doc->SetAttribute(domElement, AttrForceFlipping, piece.IsForceFlipping());
doc->SetAttribute(domElement, AttrFollowGrainline, piece.IsFollowGrainline());
doc->SetAttribute(domElement, AttrSewLineOnDrawing, piece.IsSewLineOnDrawing());
doc->SetAttributeOrRemoveIf<bool>(domElement, AttrSeamAllowance, piece.IsSeamAllowance(),
[](bool seamAllowance) noexcept { return not seamAllowance; });