From c0f36dffbe3efa3020f4343d62830fbad7713cc2 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 5 Apr 2017 13:22:33 +0300 Subject: [PATCH] Resolved issue #652. Show passmarks for builtin seam allowance. --HG-- branch : develop --- .../dialogs/configpages/patternpage.cpp | 27 +- .../dialogs/configpages/patternpage.h | 1 + .../dialogs/dialogpatternproperties.ui | 2 +- src/app/valentina/mainwindow.cpp | 1 + src/app/valentina/xml/vpattern.cpp | 2 + src/libs/ifc/schema.qrc | 1 + src/libs/ifc/schema/pattern/v0.4.7.xsd | 902 ++++++++++++++++++ src/libs/ifc/xml/vpatternconverter.cpp | 22 +- src/libs/ifc/xml/vpatternconverter.h | 5 +- src/libs/vlayout/vabstractpiece.cpp | 12 + src/libs/vlayout/vabstractpiece.h | 3 + src/libs/vlayout/vabstractpiece_p.h | 3 + src/libs/vlayout/vlayoutpiece.cpp | 47 +- src/libs/vlayout/vlayoutpiece.h | 3 +- src/libs/vmisc/def.cpp | 18 +- src/libs/vmisc/def.h | 4 +- src/libs/vmisc/vcommonsettings.cpp | 13 + src/libs/vmisc/vcommonsettings.h | 4 + src/libs/vpatterndb/vpiece.cpp | 187 +++- src/libs/vpatterndb/vpiece.h | 6 + src/libs/vpatterndb/vpiecenode.cpp | 12 + src/libs/vpatterndb/vpiecenode.h | 3 + src/libs/vpatterndb/vpiecenode_p.h | 6 + .../tools/piece/dialogseamallowance.cpp | 21 + .../dialogs/tools/piece/tabs/tabpassmarks.ui | 28 +- .../dialogs/tools/piece/tabs/tabpaths.ui | 15 +- src/libs/vtools/tools/vtoolseamallowance.cpp | 36 +- src/libs/vtools/tools/vtoolseamallowance.h | 1 + 28 files changed, 1319 insertions(+), 66 deletions(-) create mode 100644 src/libs/ifc/schema/pattern/v0.4.7.xsd diff --git a/src/app/valentina/dialogs/configpages/patternpage.cpp b/src/app/valentina/dialogs/configpages/patternpage.cpp index f7ab051a5..c9bae976a 100644 --- a/src/app/valentina/dialogs/configpages/patternpage.cpp +++ b/src/app/valentina/dialogs/configpages/patternpage.cpp @@ -31,6 +31,8 @@ #include "../../core/vapplication.h" #include "../vmisc/vsettings.h" #include "../vwidgets/vmaingraphicsview.h" +#include "../ifc/xml/vabstractpattern.h" + #include #include #include @@ -56,7 +58,8 @@ PatternPage::PatternPage(QWidget *parent): userMaterialsGroup(nullptr), userMaterialClearButton(nullptr), workpieceGroup(nullptr), - forbidFlippingCheck(nullptr) + forbidFlippingCheck(nullptr), + doublePassmarkCheck(nullptr) { QGroupBox *userGroup = UserGroup(); QGroupBox *graphOutputGroup = GraphOutputGroup(); @@ -91,6 +94,12 @@ void PatternPage::Apply() settings->SetUndoCount(undoCount->value()); settings->SetForbidWorkpieceFlipping(forbidFlippingCheck->isChecked()); + + if (settings->IsDoublePassmark() != doublePassmarkCheck->isChecked()) + { + settings->SetDoublePassmark(doublePassmarkCheck->isChecked()); + qApp->getCurrentDocument()->LiteParseTree(Document::LiteParse); + } } //--------------------------------------------------------------------------------------------------------------------- @@ -198,8 +207,13 @@ QGroupBox *PatternPage::UserWorkpieceGroup() forbidFlippingCheck->setToolTip(tr("By default forbid flipping for all new created workpieces")); forbidFlippingCheck->setChecked(qApp->ValentinaSettings()->GetForbidWorkpieceFlipping()); + doublePassmarkCheck = new QCheckBox(tr("Show second passmark on seam line")); + doublePassmarkCheck->setToolTip(tr("Show a passmark both in the seam allowance and on the seam line.")); + doublePassmarkCheck->setChecked(qApp->ValentinaSettings()->IsDoublePassmark()); + QVBoxLayout *editLayout = new QVBoxLayout; editLayout->addWidget(forbidFlippingCheck); + editLayout->addWidget(doublePassmarkCheck); workpieceGroup->setLayout(editLayout); return workpieceGroup; @@ -210,8 +224,19 @@ void PatternPage::RetranslateUi() { userGroup->setTitle(tr("User")); userNameLabel->setText(tr("User name:")); + graphOutputGroup->setTitle(tr("Graphical output")); graphOutputCheck->setText(tr("Use antialiasing")); + undoGroup->setTitle(tr("Undo")); countStepsLabel->setText(tr("Count steps (0 - no limit):")); + + userMaterialsGroup->setTitle(tr("User defined materials")); + userMaterialClearButton->setText(tr("Delete all")); + + workpieceGroup->setTitle(tr("Workpiece")); + forbidFlippingCheck->setText(tr("Forbid flipping")); + forbidFlippingCheck->setToolTip(tr("By default forbid flipping for all new created workpieces")); + doublePassmarkCheck->setText(tr("Show second passmark on seam line")); + doublePassmarkCheck->setToolTip(tr("Show a passmark both in the seam allowance and on the seam line.")); } diff --git a/src/app/valentina/dialogs/configpages/patternpage.h b/src/app/valentina/dialogs/configpages/patternpage.h index 39de06c09..43e2fd793 100644 --- a/src/app/valentina/dialogs/configpages/patternpage.h +++ b/src/app/valentina/dialogs/configpages/patternpage.h @@ -63,6 +63,7 @@ private: QPushButton* userMaterialClearButton; QGroupBox *workpieceGroup; QCheckBox *forbidFlippingCheck; + QCheckBox *doublePassmarkCheck; QGroupBox *UserGroup() Q_REQUIRED_RESULT; QGroupBox *GraphOutputGroup() Q_REQUIRED_RESULT; diff --git a/src/app/valentina/dialogs/dialogpatternproperties.ui b/src/app/valentina/dialogs/dialogpatternproperties.ui index 6af2721d1..155897387 100644 --- a/src/app/valentina/dialogs/dialogpatternproperties.ui +++ b/src/app/valentina/dialogs/dialogpatternproperties.ui @@ -21,7 +21,7 @@ - 1 + 3 diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index d5202f5d9..4465fae99 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -4253,6 +4253,7 @@ void MainWindow::Preferences() connect(dlg.data(), &ConfigDialog::UpdateProperties, this, &MainWindow::WindowsLocale); // Must be first connect(dlg.data(), &ConfigDialog::UpdateProperties, toolOptions, &VToolOptionsPropertyBrowser::RefreshOptions); connect(dlg.data(), &ConfigDialog::UpdateProperties, this, &MainWindow::ToolBarStyles); + if (guard->exec() == QDialog::Accepted) { InitAutoSave(); diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 173989ec9..bee9761f6 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -703,6 +703,8 @@ void VPattern::ParseDetailElement(QDomElement &domElement, const Document &parse detail.SetMx(qApp->toPixel(GetParametrDouble(domElement, AttrMx, "0.0"))); detail.SetMy(qApp->toPixel(GetParametrDouble(domElement, AttrMy, "0.0"))); detail.SetSeamAllowance(GetParametrBool(domElement, VToolSeamAllowance::AttrSeamAllowance, falseStr)); + detail.SetSeamAllowanceBuiltIn(GetParametrBool(domElement, VToolSeamAllowance::AttrSeamAllowanceBuiltIn, + falseStr)); detail.SetForbidFlipping(GetParametrBool(domElement, VToolSeamAllowance::AttrForbidFlipping, QString().setNum(qApp->ValentinaSettings()->GetForbidWorkpieceFlipping()))); detail.SetInLayout(GetParametrBool(domElement, AttrInLayout, trueStr)); diff --git a/src/libs/ifc/schema.qrc b/src/libs/ifc/schema.qrc index d7e74799b..7dfbc9caf 100644 --- a/src/libs/ifc/schema.qrc +++ b/src/libs/ifc/schema.qrc @@ -30,6 +30,7 @@ schema/pattern/v0.4.4.xsd schema/pattern/v0.4.5.xsd schema/pattern/v0.4.6.xsd + schema/pattern/v0.4.7.xsd schema/standard_measurements/v0.3.0.xsd schema/standard_measurements/v0.4.0.xsd schema/standard_measurements/v0.4.1.xsd diff --git a/src/libs/ifc/schema/pattern/v0.4.7.xsd b/src/libs/ifc/schema/pattern/v0.4.7.xsd new file mode 100644 index 000000000..35c0d07e0 --- /dev/null +++ b/src/libs/ifc/schema/pattern/v0.4.7.xsd @@ -0,0 +1,902 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp index 45d6df477..2e95e6e16 100644 --- a/src/libs/ifc/xml/vpatternconverter.cpp +++ b/src/libs/ifc/xml/vpatternconverter.cpp @@ -58,8 +58,8 @@ class QDomElement; */ const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0"); -const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.4.6"); -const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.4.6.xsd"); +const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.4.7"); +const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.4.7.xsd"); //VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!! //VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!! @@ -207,6 +207,8 @@ QString VPatternConverter::XSDSchema(int ver) const case (0x000405): return QStringLiteral("://schema/pattern/v0.4.5.xsd"); case (0x000406): + return QStringLiteral("://schema/pattern/v0.4.6.xsd"); + case (0x000407): return CurrentSchema; default: InvalidVersion(ver); @@ -337,6 +339,10 @@ void VPatternConverter::ApplyPatches() ValidateXML(XSDSchema(0x000406), m_convertedFileName); V_FALLTHROUGH case (0x000406): + ToV0_4_7(); + ValidateXML(XSDSchema(0x000407), m_convertedFileName); + V_FALLTHROUGH + case (0x000407): break; default: InvalidVersion(m_ver); @@ -355,7 +361,7 @@ void VPatternConverter::DowngradeToCurrentMaxVersion() bool VPatternConverter::IsReadOnly() const { // Check if attribute readOnly was not changed in file format - Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 4, 6), + Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 4, 7), "Check attribute readOnly."); // Possibly in future attribute readOnly will change position etc. @@ -704,6 +710,16 @@ void VPatternConverter::ToV0_4_6() Save(); } +//--------------------------------------------------------------------------------------------------------------------- +void VPatternConverter::ToV0_4_7() +{ + // TODO. Delete if minimal supported version is 0.4.7 + Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 4, 7), + "Time to refactor the code."); + SetVersion(QStringLiteral("0.4.7")); + Save(); +} + //--------------------------------------------------------------------------------------------------------------------- void VPatternConverter::TagUnitToV0_2_0() { diff --git a/src/libs/ifc/xml/vpatternconverter.h b/src/libs/ifc/xml/vpatternconverter.h index bef07bc2b..dafb623c6 100644 --- a/src/libs/ifc/xml/vpatternconverter.h +++ b/src/libs/ifc/xml/vpatternconverter.h @@ -55,10 +55,10 @@ public: // GCC 4.6 doesn't allow constexpr and const together #if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) <= 406 static Q_DECL_CONSTEXPR int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0); - static Q_DECL_CONSTEXPR int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 6); + static Q_DECL_CONSTEXPR int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 7); #else static Q_DECL_CONSTEXPR const int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0); - static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 6); + static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 7); #endif protected: @@ -107,6 +107,7 @@ private: void ToV0_4_4(); void ToV0_4_5(); void ToV0_4_6(); + void ToV0_4_7(); void TagUnitToV0_2_0(); void TagIncrementToV0_2_0(); diff --git a/src/libs/vlayout/vabstractpiece.cpp b/src/libs/vlayout/vabstractpiece.cpp index 3189e35bb..70db3c3a5 100644 --- a/src/libs/vlayout/vabstractpiece.cpp +++ b/src/libs/vlayout/vabstractpiece.cpp @@ -99,6 +99,18 @@ void VAbstractPiece::SetSeamAllowance(bool value) d->m_seamAllowance = value; } +//--------------------------------------------------------------------------------------------------------------------- +bool VAbstractPiece::IsSeamAllowanceBuiltIn() const +{ + return d->m_seamAllowanceBuiltIn; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VAbstractPiece::SetSeamAllowanceBuiltIn(bool value) +{ + d->m_seamAllowanceBuiltIn = value; +} + //--------------------------------------------------------------------------------------------------------------------- qreal VAbstractPiece::GetSAWidth() const { diff --git a/src/libs/vlayout/vabstractpiece.h b/src/libs/vlayout/vabstractpiece.h index acd030497..15c8a058d 100644 --- a/src/libs/vlayout/vabstractpiece.h +++ b/src/libs/vlayout/vabstractpiece.h @@ -152,6 +152,9 @@ public: bool IsSeamAllowance() const; void SetSeamAllowance(bool value); + bool IsSeamAllowanceBuiltIn() const; + void SetSeamAllowanceBuiltIn(bool value); + qreal GetSAWidth() const; void SetSAWidth(qreal value); diff --git a/src/libs/vlayout/vabstractpiece_p.h b/src/libs/vlayout/vabstractpiece_p.h index 96440d352..933fef8cf 100644 --- a/src/libs/vlayout/vabstractpiece_p.h +++ b/src/libs/vlayout/vabstractpiece_p.h @@ -46,6 +46,7 @@ public: : m_name(tr("Detail")), m_forbidFlipping(false), m_seamAllowance(false), + m_seamAllowanceBuiltIn(false), m_width(0) {} @@ -54,6 +55,7 @@ public: m_name(piece.m_name), m_forbidFlipping(piece.m_forbidFlipping), m_seamAllowance(piece.m_seamAllowance), + m_seamAllowanceBuiltIn(piece.m_seamAllowanceBuiltIn), m_width(piece.m_width) {} @@ -63,6 +65,7 @@ public: /** @brief forbidFlipping forbid piece be mirrored in a layout. */ bool m_forbidFlipping; bool m_seamAllowance; + bool m_seamAllowanceBuiltIn; qreal m_width; private: diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index cd7c99bc9..f7224b82a 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -383,7 +383,8 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, const VContainer *pattern { VLayoutPiece det; det.SetCountourPoints(piece.MainPathPoints(pattern)); - det.SetSeamAllowancePoints(piece.SeamAllowancePoints(pattern), piece.IsSeamAllowance()); + det.SetSeamAllowancePoints(piece.SeamAllowancePoints(pattern), piece.IsSeamAllowance(), + piece.IsSeamAllowanceBuiltIn()); det.SetInternalPaths(ConvertInternalPaths(piece, pattern)); det.SetPassmarks(piece.PassmarksLines(pattern)); @@ -441,17 +442,18 @@ QVector VLayoutPiece::GetSeamAllowancePoints() const } //--------------------------------------------------------------------------------------------------------------------- -void VLayoutPiece::SetSeamAllowancePoints(const QVector &points, bool seamAllowance) +void VLayoutPiece::SetSeamAllowancePoints(const QVector &points, bool seamAllowance, bool seamAllowanceBuiltIn) { if (seamAllowance) { SetSeamAllowance(seamAllowance); + SetSeamAllowanceBuiltIn(seamAllowanceBuiltIn); d->seamAllowance = points; if (not d->seamAllowance.isEmpty()) { d->seamAllowance = RemoveDublicates(RoundPoints(d->seamAllowance), false); } - else + else if (not IsSeamAllowanceBuiltIn()) { qWarning()<<"Seam allowance is empty."; SetSeamAllowance(false); @@ -706,7 +708,7 @@ int VLayoutPiece::LayoutEdgeByPoint(const QPointF &p1) const QRectF VLayoutPiece::DetailBoundingRect() const { QVector points; - if (IsSeamAllowance()) + if (IsSeamAllowance() && not IsSeamAllowanceBuiltIn()) { points = GetSeamAllowancePoints(); } @@ -739,7 +741,7 @@ bool VLayoutPiece::isNull() const { if (d->contour.isEmpty() == false && d->layoutWidth > 0) { - if (IsSeamAllowance() && d->seamAllowance.isEmpty() == false) + if (IsSeamAllowance() && not IsSeamAllowanceBuiltIn() && d->seamAllowance.isEmpty() == false) { return false; } @@ -773,7 +775,7 @@ void VLayoutPiece::SetLayoutAllowancePoints() { if (d->layoutWidth > 0) { - if (IsSeamAllowance()) + if (IsSeamAllowance() && not IsSeamAllowanceBuiltIn()) { d->layoutAllowance = Equidistant(PrepareAllowance(GetSeamAllowancePoints()), d->layoutWidth); if (d->layoutAllowance.isEmpty() == false) @@ -868,24 +870,27 @@ QPainterPath VLayoutPiece::ContourPath() const path.lineTo(points.at(0)); // seam allowance - if (IsSeamAllowance() == true) + if (IsSeamAllowance()) { - // Draw seam allowance - points = GetSeamAllowancePoints(); - - if (points.last().toPoint() != points.first().toPoint()) + if (not IsSeamAllowanceBuiltIn()) { - points.append(points.at(0));// Should be always closed - } + // Draw seam allowance + points = GetSeamAllowancePoints(); - QPainterPath ekv; - ekv.moveTo(points.at(0)); - for (qint32 i = 1; i < points.count(); ++i) - { - ekv.lineTo(points.at(i)); - } + if (points.last().toPoint() != points.first().toPoint()) + { + points.append(points.at(0));// Should be always closed + } - path.addPath(ekv); + QPainterPath ekv; + ekv.moveTo(points.at(0)); + for (qint32 i = 1; i < points.count(); ++i) + { + ekv.lineTo(points.at(i)); + } + + path.addPath(ekv); + } // Draw passmarks const QVector passmarks = GetPassmarks(); @@ -973,7 +978,7 @@ void VLayoutPiece::CreateGrainlineItem(QGraphicsItem *parent) const //--------------------------------------------------------------------------------------------------------------------- QVector VLayoutPiece::DetailPath() const { - if (IsSeamAllowance()) + if (IsSeamAllowance() && not IsSeamAllowanceBuiltIn()) { return d->seamAllowance; } diff --git a/src/libs/vlayout/vlayoutpiece.h b/src/libs/vlayout/vlayoutpiece.h index cab060636..994e10554 100644 --- a/src/libs/vlayout/vlayoutpiece.h +++ b/src/libs/vlayout/vlayoutpiece.h @@ -68,7 +68,8 @@ public: void SetCountourPoints(const QVector &points); QVector GetSeamAllowancePoints() const; - void SetSeamAllowancePoints(const QVector &points, bool seamAllowance = true); + void SetSeamAllowancePoints(const QVector &points, bool seamAllowance = true, + bool seamAllowanceBuiltIn = false); QVector GetLayoutAllowancePoints() const; void SetLayoutAllowancePoints(); diff --git a/src/libs/vmisc/def.cpp b/src/libs/vmisc/def.cpp index a567583b7..5b2341ce7 100644 --- a/src/libs/vmisc/def.cpp +++ b/src/libs/vmisc/def.cpp @@ -2026,6 +2026,8 @@ void InitHighDpiScaling(int argc, char *argv[]) const QString strOne = QStringLiteral("one"); const QString strTwo = QStringLiteral("two"); const QString strThree = QStringLiteral("three"); +const QString strTMark = QStringLiteral("tMark"); +const QString strVMark = QStringLiteral("vMark"); //--------------------------------------------------------------------------------------------------------------------- QString PassmarkLineTypeToString(PassmarkLineType type) @@ -2038,6 +2040,10 @@ QString PassmarkLineTypeToString(PassmarkLineType type) return strTwo; case PassmarkLineType::ThreeLines: return strThree; + case PassmarkLineType::TMark: + return strTMark; + case PassmarkLineType::VMark: + return strVMark; default: break; } @@ -2048,16 +2054,20 @@ QString PassmarkLineTypeToString(PassmarkLineType type) //--------------------------------------------------------------------------------------------------------------------- PassmarkLineType StringToPassmarkLineType(const QString &value) { - const QStringList values = QStringList() << strOne << strTwo << strThree; + const QStringList values = QStringList() << strOne << strTwo << strThree << strTMark << strVMark; switch(values.indexOf(value)) { - case 0: + case 0: // strOne return PassmarkLineType::OneLine; - case 1: + case 1: // strTwo return PassmarkLineType::TwoLines; - case 2: + case 2: // strThree return PassmarkLineType::ThreeLines; + case 3: // strTMark + return PassmarkLineType::TMark; + case 4: // strVMark + return PassmarkLineType::VMark; default: break; } diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index 4dfdbad8f..2161a88fc 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -93,7 +93,9 @@ enum class PassmarkLineType : unsigned char { OneLine = 0, // Default TwoLines, - ThreeLines + ThreeLines, + TMark, + VMark }; QString PassmarkLineTypeToString(PassmarkLineType type); diff --git a/src/libs/vmisc/vcommonsettings.cpp b/src/libs/vmisc/vcommonsettings.cpp index bb53317e0..d6eb74274 100644 --- a/src/libs/vmisc/vcommonsettings.cpp +++ b/src/libs/vmisc/vcommonsettings.cpp @@ -60,6 +60,7 @@ const QString VCommonSettings::SettingConfigurationToolBarStyle = QString const QString VCommonSettings::SettingPatternUser = QStringLiteral("pattern/user"); const QString VCommonSettings::SettingPatternUndo = QStringLiteral("pattern/undo"); const QString VCommonSettings::SettingPatternForbidFlipping = QStringLiteral("pattern/forbidFlipping"); +const QString VCommonSettings::SettingDoublePassmark = QStringLiteral("pattern/doublePassmark"); const QString VCommonSettings::SettingGeneralRecentFileList = QStringLiteral("recentFileList"); const QString VCommonSettings::SettingGeneralRestoreFileList = QStringLiteral("restoreFileList"); @@ -587,3 +588,15 @@ void VCommonSettings::SetForbidWorkpieceFlipping(bool value) { setValue(SettingPatternForbidFlipping, value); } + +//--------------------------------------------------------------------------------------------------------------------- +bool VCommonSettings::IsDoublePassmark() const +{ + return value(SettingDoublePassmark, false).toBool(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VCommonSettings::SetDoublePassmark(bool value) +{ + setValue(SettingDoublePassmark, value); +} diff --git a/src/libs/vmisc/vcommonsettings.h b/src/libs/vmisc/vcommonsettings.h index 5a274a36b..987c43963 100644 --- a/src/libs/vmisc/vcommonsettings.h +++ b/src/libs/vmisc/vcommonsettings.h @@ -130,6 +130,9 @@ public: bool GetForbidWorkpieceFlipping() const; void SetForbidWorkpieceFlipping(bool value); + bool IsDoublePassmark() const; + void SetDoublePassmark(bool value); + #if !defined(Q_OS_WIN) static const QString unixStandardSharePath; #endif @@ -154,6 +157,7 @@ private: static const QString SettingPatternUser; static const QString SettingPatternUndo; static const QString SettingPatternForbidFlipping; + static const QString SettingDoublePassmark; static const QString SettingGeneralRecentFileList; static const QString SettingGeneralRestoreFileList; diff --git a/src/libs/vpatterndb/vpiece.cpp b/src/libs/vpatterndb/vpiece.cpp index b245428e6..e43c59ed9 100644 --- a/src/libs/vpatterndb/vpiece.cpp +++ b/src/libs/vpatterndb/vpiece.cpp @@ -31,11 +31,15 @@ #include "../vgeometry/vpointf.h" #include "../vgeometry/vabstractcurve.h" #include "vcontainer.h" +#include "../vmisc/vabstractapplication.h" #include #include #include +const qreal passmarkFactor = 0.5; +const qreal maxPassmarkLength = (10/*mm*/ / 25.4) * PrintDPI; + namespace { QVector PieceMissingNodes(const QVector &d1Nodes, const QVector &d2Nodes) @@ -152,6 +156,93 @@ QVector CreateThreePassmarkLines(const QLineF &line) return lines; } +//--------------------------------------------------------------------------------------------------------------------- +QVector CreateTMarkPassmark(const QLineF &line) +{ + QPointF p1; + { + QLineF tmpLine = QLineF(line.p2(), line.p1()); + tmpLine.setAngle(tmpLine.angle() - 90); + tmpLine.setLength(line.length() * 0.75 / 2); + p1 = tmpLine.p2(); + } + + QPointF p2; + { + QLineF tmpLine = QLineF(line.p2(), line.p1()); + tmpLine.setAngle(tmpLine.angle() + 90); + tmpLine.setLength(line.length() * 0.75 / 2); + p2 = tmpLine.p2(); + } + + QVector lines; + lines.append(line); + lines.append(QLineF(p1, p2)); + return lines; +} + +//--------------------------------------------------------------------------------------------------------------------- +QVector CreateVMarkPassmark(const QLineF &line) +{ + QLineF l1 = line; + l1.setAngle(l1.angle() - 35); + + QLineF l2 = line; + l2.setAngle(l2.angle() + 35); + + QVector lines; + lines.append(l1); + lines.append(l2); + return lines; +} + +//--------------------------------------------------------------------------------------------------------------------- +QVector CreatePassmarkLines(PassmarkLineType lineType, PassmarkAngleType angleType, const QLineF &line) +{ + QVector passmarksLines; + + if (angleType == PassmarkAngleType::Straightforward) + { + switch (lineType) + { + case PassmarkLineType::TwoLines: + passmarksLines += CreateTwoPassmarkLines(line); + break; + case PassmarkLineType::ThreeLines: + passmarksLines += CreateThreePassmarkLines(line); + break; + case PassmarkLineType::TMark: + passmarksLines += CreateTMarkPassmark(line); + break; + case PassmarkLineType::VMark: + passmarksLines += CreateVMarkPassmark(line); + break; + case PassmarkLineType::OneLine: + default: + passmarksLines.append(line); + break; + } + } + else + { + switch (lineType) + { + case PassmarkLineType::TMark: + passmarksLines += CreateTMarkPassmark(line); + break; + case PassmarkLineType::OneLine: + case PassmarkLineType::TwoLines: + case PassmarkLineType::ThreeLines: + case PassmarkLineType::VMark: + default: + passmarksLines.append(line); + break; + } + } + + return passmarksLines; +} + //--------------------------------------------------------------------------------------------------------------------- bool IsPassmarksPossible(const QVector &path) { @@ -237,7 +328,7 @@ QVector VPiece::SeamAllowancePoints(const VContainer *data) const SCASSERT(data != nullptr); - if (not IsSeamAllowance()) + if (not IsSeamAllowance() || IsSeamAllowanceBuiltIn()) { return QVector(); } @@ -392,7 +483,7 @@ QPainterPath VPiece::SeamAllowancePath(const VContainer *data) const QPainterPath ekv; // seam allowence - if (IsSeamAllowance()) + if (IsSeamAllowance() && not IsSeamAllowanceBuiltIn()) { if (not pointsEkv.isEmpty()) { @@ -669,6 +760,12 @@ QVector VPiece::GetUnitedPath(const VContainer *data) const SCASSERT(data != nullptr) QVector united = d->m_path.GetNodes(); + + if (IsSeamAllowance() && IsSeamAllowanceBuiltIn()) + { + return united; + } + const QVector records = FilterRecords(GetValidRecords()); for (int i = 0; i < records.size(); ++i) @@ -690,12 +787,26 @@ QVector VPiece::GetUnitedPath(const VContainer *data) const if (records.at(i).reverse) { customNodes = VGObject::GetReversePoints(customNodes); + } + for (int j = 0; j < customNodes.size(); ++j) + { // Additionally reverse all curves - for (int j = 0; j < customNodes.size(); ++j) - { // don't make a check because node point will ignore the change + if (records.at(i).reverse) + { + // don't make a check because node point will ignore the change customNodes[j].SetReverse(not customNodes.at(j).GetReverse()); } + + // If seam allowance is built in main path user will not see a passmark provided by piece path + if (IsSeamAllowanceBuiltIn()) + { + customNodes[j].SetPassmark(false); + } + else + { + customNodes[j].SetMainPathNode(false); + } } united = midBefore + customNodes + midAfter; @@ -929,6 +1040,11 @@ bool VPiece::IsPassmarkVisible(const QVector &path, int passmarkInde return false; } + if (IsSeamAllowance() && IsSeamAllowanceBuiltIn()) + { + return true; + } + const QVector records = FilterRecords(GetValidRecords()); if (records.isEmpty()) { @@ -979,6 +1095,27 @@ QVector VPiece::CreatePassmark(const QVector &path, int prev return QVector(); // Something wrong } + if (not IsSeamAllowanceBuiltIn()) + { + QVector lines; + lines += SAPassmark(path, previousSAPoint, passmarkSAPoint, nextSAPoint, data, passmarkIndex); + if (qApp->Settings()->IsDoublePassmark() && path.at(passmarkIndex).IsMainPathNode()) + { + lines += BuiltInSAPassmark(path, previousSAPoint, passmarkSAPoint, nextSAPoint, data, passmarkIndex); + } + return lines; + } + else + { + return BuiltInSAPassmark(path, previousSAPoint, passmarkSAPoint, nextSAPoint, data, passmarkIndex); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +QVector VPiece::SAPassmark(const QVector &path, const VSAPoint &previousSAPoint, + const VSAPoint &passmarkSAPoint, const VSAPoint &nextSAPoint, const VContainer *data, + int passmarkIndex) const +{ QPointF seamPassmarkSAPoint; if (not GetSeamPassmarkSAPoint(previousSAPoint, passmarkSAPoint, nextSAPoint, data, seamPassmarkSAPoint)) { @@ -991,24 +1128,14 @@ QVector VPiece::CreatePassmark(const QVector &path, int prev QVector passmarksLines; - const qreal passmarkLength = VAbstractPiece::MaxLocalSA(passmarkSAPoint, width) * 0.5; + qreal passmarkLength = VAbstractPiece::MaxLocalSA(passmarkSAPoint, width) * passmarkFactor; + passmarkLength = qMin(passmarkLength, maxPassmarkLength); const VPieceNode &node = path.at(passmarkIndex); if (node.GetPassmarkAngleType() == PassmarkAngleType::Straightforward) { QLineF line = QLineF(seamPassmarkSAPoint, passmarkSAPoint); line.setLength(passmarkLength); - if (node.GetPassmarkLineType() == PassmarkLineType::TwoLines) - { - passmarksLines += CreateTwoPassmarkLines(line); - } - else if (node.GetPassmarkLineType() == PassmarkLineType::ThreeLines) - { - passmarksLines += CreateThreePassmarkLines(line); - } - else - { - passmarksLines.append(line); - } + passmarksLines += CreatePassmarkLines(node.GetPassmarkLineType(), node.GetPassmarkAngleType(), line); } else { @@ -1017,12 +1144,36 @@ QVector VPiece::CreatePassmark(const QVector &path, int prev edge1.setAngle(edge1.angle() + edge1.angleTo(edge2)/2.); edge1.setLength(passmarkLength); - passmarksLines.append(edge1); + + passmarksLines += CreatePassmarkLines(node.GetPassmarkLineType(), node.GetPassmarkAngleType(), edge1); } return passmarksLines; } +//--------------------------------------------------------------------------------------------------------------------- +QVector VPiece::BuiltInSAPassmark(const QVector &path, const VSAPoint &previousSAPoint, + const VSAPoint &passmarkSAPoint, const VSAPoint &nextSAPoint, + const VContainer *data, int passmarkIndex) const +{ + QVector passmarksLines; + + const qreal width = ToPixel(GetSAWidth(), *data->GetPatternUnit()); + qreal passmarkLength = VAbstractPiece::MaxLocalSA(passmarkSAPoint, width) * passmarkFactor; + passmarkLength = qMin(passmarkLength, maxPassmarkLength); + + QLineF edge1 = QLineF(passmarkSAPoint, previousSAPoint); + QLineF edge2 = QLineF(passmarkSAPoint, nextSAPoint); + + edge1.setAngle(edge1.angle() + edge1.angleTo(edge2)/2.); + edge1.setLength(passmarkLength); + + const VPieceNode &node = path.at(passmarkIndex); + passmarksLines += CreatePassmarkLines(node.GetPassmarkLineType(), node.GetPassmarkAngleType(), edge1); + + return passmarksLines; +} + //--------------------------------------------------------------------------------------------------------------------- int VPiece::IsCSAStart(const QVector &records, quint32 id) { diff --git a/src/libs/vpatterndb/vpiece.h b/src/libs/vpatterndb/vpiece.h index b8ae28025..a5ff23d03 100644 --- a/src/libs/vpatterndb/vpiece.h +++ b/src/libs/vpatterndb/vpiece.h @@ -132,6 +132,12 @@ private: QVector CreatePassmark(const QVector &path, int previousIndex, int passmarkIndex, int nextIndex, const VContainer *data) const; + QVector SAPassmark(const QVector &path, const VSAPoint &previousSAPoint, + const VSAPoint &passmarkSAPoint, const VSAPoint &nextSAPoint, const VContainer *data, + int passmarkIndex) const; + QVector BuiltInSAPassmark(const QVector &path, const VSAPoint &previousSAPoint, + const VSAPoint &passmarkSAPoint, const VSAPoint &nextSAPoint, + const VContainer *data, int passmarkIndex) const; static int IsCSAStart(const QVector &records, quint32 id); }; diff --git a/src/libs/vpatterndb/vpiecenode.cpp b/src/libs/vpatterndb/vpiecenode.cpp index 3a669297d..4a93b286d 100644 --- a/src/libs/vpatterndb/vpiecenode.cpp +++ b/src/libs/vpatterndb/vpiecenode.cpp @@ -265,6 +265,18 @@ void VPieceNode::SetPassmark(bool passmark) } } +//--------------------------------------------------------------------------------------------------------------------- +bool VPieceNode::IsMainPathNode() const +{ + return d->m_isMainPathNode; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VPieceNode::SetMainPathNode(bool value) +{ + d->m_isMainPathNode = value; +} + //--------------------------------------------------------------------------------------------------------------------- PassmarkLineType VPieceNode::GetPassmarkLineType() const { diff --git a/src/libs/vpatterndb/vpiecenode.h b/src/libs/vpatterndb/vpiecenode.h index c4215586f..6266d8f27 100644 --- a/src/libs/vpatterndb/vpiecenode.h +++ b/src/libs/vpatterndb/vpiecenode.h @@ -80,6 +80,9 @@ public: bool IsPassmark() const; void SetPassmark(bool passmark); + bool IsMainPathNode() const; + void SetMainPathNode(bool value); + PassmarkLineType GetPassmarkLineType() const; void SetPassmarkLineType(PassmarkLineType lineType); diff --git a/src/libs/vpatterndb/vpiecenode_p.h b/src/libs/vpatterndb/vpiecenode_p.h index 65d3e70ef..a8f4e0ce9 100644 --- a/src/libs/vpatterndb/vpiecenode_p.h +++ b/src/libs/vpatterndb/vpiecenode_p.h @@ -46,6 +46,7 @@ public: m_reverse(false), m_excluded(false), m_isPassmark(false), + m_isMainPathNode(true), m_formulaWidthBefore(currentSeamAllowance), m_formulaWidthAfter(currentSeamAllowance), m_angleType(PieceNodeAngle::ByLength), @@ -59,6 +60,7 @@ public: m_reverse(reverse), m_excluded(false), m_isPassmark(false), + m_isMainPathNode(true), m_formulaWidthBefore(currentSeamAllowance), m_formulaWidthAfter(currentSeamAllowance), m_angleType(PieceNodeAngle::ByLength), @@ -78,6 +80,7 @@ public: m_reverse(node.m_reverse), m_excluded(node.m_excluded), m_isPassmark(node.m_isPassmark), + m_isMainPathNode(node.m_isMainPathNode), m_formulaWidthBefore(node.m_formulaWidthBefore), m_formulaWidthAfter(node.m_formulaWidthAfter), m_angleType(node.m_angleType), @@ -106,6 +109,9 @@ public: /** @brief m_isPassmark has sense only for points. If true to seam allowance should be added a passmark. */ bool m_isPassmark; + /** @brief m_isMainPathNode need fin know if allowed for this passmakr to be double. */ + bool m_isMainPathNode; + QString m_formulaWidthBefore; QString m_formulaWidthAfter; diff --git a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp index 5875d5069..1d778d831 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp @@ -235,6 +235,7 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece) uiTabPaths->checkBoxForbidFlipping->setChecked(piece.IsForbidFlipping()); uiTabPaths->checkBoxSeams->setChecked(piece.IsSeamAllowance()); + uiTabPaths->checkBoxBuiltIn->setChecked(piece.IsSeamAllowanceBuiltIn()); uiTabLabels->lineEditName->setText(piece.GetName()); const QString width = qApp->TrVars()->FormulaToUser(piece.GetFormulaSAWidth(), qApp->Settings()->GetOsSeparator()); @@ -762,6 +763,7 @@ void DialogSeamAllowance::ListChanged() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::EnableSeamAllowance(bool enable) { + uiTabPaths->checkBoxBuiltIn->setEnabled(enable); uiTabPaths->groupBoxAutomatic->setEnabled(enable); uiTabPaths->groupBoxCustom->setEnabled(enable); @@ -846,6 +848,8 @@ void DialogSeamAllowance::PassmarkChanged(int index) uiTabPassmarks->radioButtonOneLine->setDisabled(true); uiTabPassmarks->radioButtonTwoLines->setDisabled(true); uiTabPassmarks->radioButtonThreeLines->setDisabled(true); + uiTabPassmarks->radioButtonTMark->setDisabled(true); + uiTabPassmarks->radioButtonVMark->setDisabled(true); uiTabPassmarks->radioButtonStraightforward->setDisabled(true); uiTabPassmarks->radioButtonBisector->setDisabled(true); @@ -865,6 +869,8 @@ void DialogSeamAllowance::PassmarkChanged(int index) uiTabPassmarks->radioButtonOneLine->setEnabled(true); uiTabPassmarks->radioButtonTwoLines->setEnabled(true); uiTabPassmarks->radioButtonThreeLines->setEnabled(true); + uiTabPassmarks->radioButtonTMark->setEnabled(true); + uiTabPassmarks->radioButtonVMark->setEnabled(true); switch(node.GetPassmarkLineType()) { @@ -877,6 +883,12 @@ void DialogSeamAllowance::PassmarkChanged(int index) case PassmarkLineType::ThreeLines: uiTabPassmarks->radioButtonThreeLines->setChecked(true); break; + case PassmarkLineType::TMark: + uiTabPassmarks->radioButtonTMark->setChecked(true); + break; + case PassmarkLineType::VMark: + uiTabPassmarks->radioButtonVMark->setChecked(true); + break; default: break; } @@ -1171,6 +1183,14 @@ void DialogSeamAllowance::PassmarkLineTypeChanged(int id) { lineType = PassmarkLineType::ThreeLines; } + else if (id == uiTabPassmarks->buttonGroupLineType->id(uiTabPassmarks->radioButtonTMark)) + { + lineType = PassmarkLineType::TMark; + } + else if (id == uiTabPassmarks->buttonGroupLineType->id(uiTabPassmarks->radioButtonVMark)) + { + lineType = PassmarkLineType::VMark; + } rowNode.SetPassmarkLineType(lineType); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); @@ -2036,6 +2056,7 @@ VPiece DialogSeamAllowance::CreatePiece() const piece.SetPins(GetListInternals(uiTabPins->listWidgetPins)); piece.SetForbidFlipping(uiTabPaths->checkBoxForbidFlipping->isChecked()); piece.SetSeamAllowance(uiTabPaths->checkBoxSeams->isChecked()); + piece.SetSeamAllowanceBuiltIn(uiTabPaths->checkBoxBuiltIn->isChecked()); piece.SetName(uiTabLabels->lineEditName->text()); piece.SetMx(m_mx); piece.SetMy(m_my); diff --git a/src/libs/vtools/dialogs/tools/piece/tabs/tabpassmarks.ui b/src/libs/vtools/dialogs/tools/piece/tabs/tabpassmarks.ui index ee1f01f9b..edc651b7a 100644 --- a/src/libs/vtools/dialogs/tools/piece/tabs/tabpassmarks.ui +++ b/src/libs/vtools/dialogs/tools/piece/tabs/tabpassmarks.ui @@ -79,6 +79,32 @@ + + + + false + + + T mark + + + buttonGroupLineType + + + + + + + false + + + V mark + + + buttonGroupLineType + + + @@ -135,7 +161,7 @@ - + diff --git a/src/libs/vtools/dialogs/tools/piece/tabs/tabpaths.ui b/src/libs/vtools/dialogs/tools/piece/tabs/tabpaths.ui index d35b64c97..363f98f72 100644 --- a/src/libs/vtools/dialogs/tools/piece/tabs/tabpaths.ui +++ b/src/libs/vtools/dialogs/tools/piece/tabs/tabpaths.ui @@ -7,7 +7,7 @@ 0 0 401 - 572 + 600 @@ -105,6 +105,19 @@ + + + + false + + + The seam allowance is part of main path + + + Built in + + + diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index 5e6324ce1..d726a7409 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -70,17 +70,18 @@ const QString VToolSeamAllowance::TagRecord = QStringLiteral("record"); const QString VToolSeamAllowance::TagIPaths = QStringLiteral("iPaths"); const QString VToolSeamAllowance::TagPins = QStringLiteral("pins"); -const QString VToolSeamAllowance::AttrVersion = QStringLiteral("version"); -const QString VToolSeamAllowance::AttrForbidFlipping = QStringLiteral("forbidFlipping"); -const QString VToolSeamAllowance::AttrSeamAllowance = QStringLiteral("seamAllowance"); -const QString VToolSeamAllowance::AttrHeight = QStringLiteral("height"); -const QString VToolSeamAllowance::AttrUnited = QStringLiteral("united"); -const QString VToolSeamAllowance::AttrFont = QStringLiteral("fontSize"); -const QString VToolSeamAllowance::AttrTopLeftPin = QStringLiteral("topLeftPin"); -const QString VToolSeamAllowance::AttrBottomRightPin = QStringLiteral("bottomRightPin"); -const QString VToolSeamAllowance::AttrCenterPin = QStringLiteral("centerPin"); -const QString VToolSeamAllowance::AttrTopPin = QStringLiteral("topPin"); -const QString VToolSeamAllowance::AttrBottomPin = QStringLiteral("bottomPin"); +const QString VToolSeamAllowance::AttrVersion = QStringLiteral("version"); +const QString VToolSeamAllowance::AttrForbidFlipping = QStringLiteral("forbidFlipping"); +const QString VToolSeamAllowance::AttrSeamAllowance = QStringLiteral("seamAllowance"); +const QString VToolSeamAllowance::AttrSeamAllowanceBuiltIn = QStringLiteral("seamAllowanceBuiltIn"); +const QString VToolSeamAllowance::AttrHeight = QStringLiteral("height"); +const QString VToolSeamAllowance::AttrUnited = QStringLiteral("united"); +const QString VToolSeamAllowance::AttrFont = QStringLiteral("fontSize"); +const QString VToolSeamAllowance::AttrTopLeftPin = QStringLiteral("topLeftPin"); +const QString VToolSeamAllowance::AttrBottomRightPin = QStringLiteral("bottomRightPin"); +const QString VToolSeamAllowance::AttrCenterPin = QStringLiteral("centerPin"); +const QString VToolSeamAllowance::AttrTopPin = QStringLiteral("topPin"); +const QString VToolSeamAllowance::AttrBottomPin = QStringLiteral("bottomPin"); //--------------------------------------------------------------------------------------------------------------------- VToolSeamAllowance::~VToolSeamAllowance() @@ -223,6 +224,17 @@ void VToolSeamAllowance::AddAttributes(VAbstractPattern *doc, QDomElement &domEl doc->SetAttribute(domElement, AttrInLayout, piece.IsInLayout()); doc->SetAttribute(domElement, AttrForbidFlipping, piece.IsForbidFlipping()); doc->SetAttribute(domElement, AttrSeamAllowance, piece.IsSeamAllowance()); + + const bool saBuiltIn = piece.IsSeamAllowanceBuiltIn(); + if (saBuiltIn) + { + doc->SetAttribute(domElement, AttrSeamAllowanceBuiltIn, saBuiltIn); + } + else + { // For backward compatebility. + domElement.removeAttribute(AttrSeamAllowanceBuiltIn); + } + doc->SetAttribute(domElement, VAbstractPattern::AttrWidth, piece.GetFormulaSAWidth()); doc->SetAttribute(domElement, AttrUnited, piece.IsUnited()); } @@ -1242,7 +1254,7 @@ void VToolSeamAllowance::RefreshGeometry() this->setPos(detail.GetMx(), detail.GetMy()); - if (detail.IsSeamAllowance()) + if (detail.IsSeamAllowance() && not detail.IsSeamAllowanceBuiltIn()) { path.addPath(detail.SeamAllowancePath(this->getData())); path.setFillRule(Qt::OddEvenFill); diff --git a/src/libs/vtools/tools/vtoolseamallowance.h b/src/libs/vtools/tools/vtoolseamallowance.h index 469c3a19e..1566dae63 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.h +++ b/src/libs/vtools/tools/vtoolseamallowance.h @@ -63,6 +63,7 @@ public: static const QString AttrVersion; static const QString AttrForbidFlipping; static const QString AttrSeamAllowance; + static const QString AttrSeamAllowanceBuiltIn; static const QString AttrHeight; static const QString AttrUnited; static const QString AttrFont;