diff --git a/ChangeLog.txt b/ChangeLog.txt index f8987188c..8940bb288 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -9,6 +9,7 @@ - [#927] Freeze prefix language on pattern/project creation. - [#929] New variable type: Separator. - Speed optimization for switching "In layout" state. +- [#932] 2nd version V passmarks. # Version 0.6.2 (unreleased) - [#903] Bug in tool Cut Spline path. diff --git a/src/libs/ifc/schema.qrc b/src/libs/ifc/schema.qrc index b93cd30d2..3aab8e0cb 100644 --- a/src/libs/ifc/schema.qrc +++ b/src/libs/ifc/schema.qrc @@ -52,6 +52,7 @@ schema/pattern/v0.7.12.xsd schema/pattern/v0.7.13.xsd schema/pattern/v0.8.0.xsd + schema/pattern/v0.8.1.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.8.1.xsd b/src/libs/ifc/schema/pattern/v0.8.1.xsd new file mode 100644 index 000000000..84ffb389f --- /dev/null +++ b/src/libs/ifc/schema/pattern/v0.8.1.xsd @@ -0,0 +1,1110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp index d5b7bc9be..934791091 100644 --- a/src/libs/ifc/xml/vpatternconverter.cpp +++ b/src/libs/ifc/xml/vpatternconverter.cpp @@ -59,8 +59,8 @@ class QDomElement; */ const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.4"); -const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.8.0"); -const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.8.0.xsd"); +const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.8.1"); +const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.8.1.xsd"); //VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!! //VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!! @@ -230,7 +230,8 @@ QString VPatternConverter::XSDSchema(int ver) const std::make_pair(FORMAT_VERSION(0, 7, 11), QStringLiteral("://schema/pattern/v0.7.11.xsd")), std::make_pair(FORMAT_VERSION(0, 7, 12), QStringLiteral("://schema/pattern/v0.7.12.xsd")), std::make_pair(FORMAT_VERSION(0, 7, 13), QStringLiteral("://schema/pattern/v0.7.13.xsd")), - std::make_pair(FORMAT_VERSION(0, 8, 0), CurrentSchema) + std::make_pair(FORMAT_VERSION(0, 8, 0), QStringLiteral("://schema/pattern/v0.8.0.xsd")), + std::make_pair(FORMAT_VERSION(0, 8, 1), CurrentSchema) }; if (schemas.contains(ver)) @@ -451,6 +452,10 @@ void VPatternConverter::ApplyPatches() ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 0)), m_convertedFileName); V_FALLTHROUGH case (FORMAT_VERSION(0, 8, 0)): + ToV0_8_1(); + ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 1)), m_convertedFileName); + V_FALLTHROUGH + case (FORMAT_VERSION(0, 8, 1)): break; default: InvalidVersion(m_ver); @@ -468,7 +473,7 @@ void VPatternConverter::DowngradeToCurrentMaxVersion() bool VPatternConverter::IsReadOnly() const { // Check if attribute readOnly was not changed in file format - Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == FORMAT_VERSION(0, 8, 0), + Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == FORMAT_VERSION(0, 8, 1), "Check attribute readOnly."); // Possibly in future attribute readOnly will change position etc. @@ -1038,6 +1043,16 @@ void VPatternConverter::ToV0_8_0() Save(); } +//--------------------------------------------------------------------------------------------------------------------- +void VPatternConverter::ToV0_8_1() +{ + // TODO. Delete if minimal supported version is 0.8.1 + Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FORMAT_VERSION(0, 8, 1), + "Time to refactor the code."); + SetVersion(QStringLiteral("0.8.1")); + Save(); +} + //--------------------------------------------------------------------------------------------------------------------- void VPatternConverter::TagUnitToV0_2_0() { diff --git a/src/libs/ifc/xml/vpatternconverter.h b/src/libs/ifc/xml/vpatternconverter.h index 5efc09022..25f05cfda 100644 --- a/src/libs/ifc/xml/vpatternconverter.h +++ b/src/libs/ifc/xml/vpatternconverter.h @@ -53,7 +53,7 @@ public: static const QString PatternMaxVerStr; static const QString CurrentSchema; static Q_DECL_CONSTEXPR const int PatternMinVer = FORMAT_VERSION(0, 1, 4); - static Q_DECL_CONSTEXPR const int PatternMaxVer = FORMAT_VERSION(0, 8, 0); + static Q_DECL_CONSTEXPR const int PatternMaxVer = FORMAT_VERSION(0, 8, 1); protected: virtual int MinVer() const override; @@ -123,6 +123,7 @@ private: void ToV0_7_12(); void ToV0_7_13(); void ToV0_8_0(); + void ToV0_8_1(); void TagUnitToV0_2_0(); void TagIncrementToV0_2_0(); diff --git a/src/libs/vmisc/def.cpp b/src/libs/vmisc/def.cpp index 2709057f8..390ee46a8 100644 --- a/src/libs/vmisc/def.cpp +++ b/src/libs/vmisc/def.cpp @@ -495,6 +495,7 @@ const QString strThree = QStringLiteral("three"); Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTMark, (QLatin1String("tMark"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, strVMark, (QLatin1String("vMark"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, strVMark2, (QLatin1String("vMark2"))) //--------------------------------------------------------------------------------------------------------------------- QString PassmarkLineTypeToString(PassmarkLineType type) @@ -511,6 +512,8 @@ QString PassmarkLineTypeToString(PassmarkLineType type) return *strTMark; case PassmarkLineType::VMark: return *strVMark; + case PassmarkLineType::VMark2: + return *strVMark2; default: break; } @@ -521,7 +524,7 @@ QString PassmarkLineTypeToString(PassmarkLineType type) //--------------------------------------------------------------------------------------------------------------------- PassmarkLineType StringToPassmarkLineType(const QString &value) { - const QStringList values = QStringList() << strOne << strTwo << strThree << *strTMark << *strVMark; + const QStringList values{strOne, strTwo, strThree, *strTMark, *strVMark, *strVMark2}; switch(values.indexOf(value)) { @@ -535,6 +538,8 @@ PassmarkLineType StringToPassmarkLineType(const QString &value) return PassmarkLineType::TMark; case 4: // strVMark return PassmarkLineType::VMark; + case 5: // strVMark2 + return PassmarkLineType::VMark2; default: break; } diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index 8bf56379c..a3227f970 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -108,7 +108,8 @@ enum class PassmarkLineType : unsigned char TwoLines, ThreeLines, TMark, - VMark + VMark, + VMark2 }; QString PassmarkLineTypeToString(PassmarkLineType type); diff --git a/src/libs/vpatterndb/vpiece.cpp b/src/libs/vpatterndb/vpiece.cpp index 7db834bc5..bd5369667 100644 --- a/src/libs/vpatterndb/vpiece.cpp +++ b/src/libs/vpatterndb/vpiece.cpp @@ -196,7 +196,36 @@ QVector CreateVMarkPassmark(const QLineF &line) } //--------------------------------------------------------------------------------------------------------------------- -QVector CreatePassmarkLines(PassmarkLineType lineType, PassmarkAngleType angleType, const QLineF &line) +QVector CreateVMark2Passmark(const QLineF &line, const QVector &seamAllowance) +{ + QLineF l1 = QLineF(line.p2(), line.p1()); + l1.setAngle(l1.angle() + 35); + + QLineF l2 = QLineF(line.p2(), line.p1()); + l2.setAngle(l2.angle() - 35); + + auto FindIntersection = [seamAllowance](const QLineF &line) + { + QLineF testLine = line; + testLine.setLength(testLine.length()*10); + QVector intersections = VAbstractCurve::CurveIntersectLine(seamAllowance, testLine); + if (not intersections.isEmpty()) + { + return QLineF(line.p1(), intersections.last()); + } + + return line; + }; + + QVector lines; + lines.append(FindIntersection(l1)); + lines.append(FindIntersection(l2)); + return lines; +} + +//--------------------------------------------------------------------------------------------------------------------- +QVector CreatePassmarkLines(PassmarkLineType lineType, PassmarkAngleType angleType, const QLineF &line, + const QVector &seamAllowance) { QVector passmarksLines; @@ -222,6 +251,9 @@ QVector CreatePassmarkLines(PassmarkLineType lineType, PassmarkAngleType case PassmarkLineType::VMark: passmarksLines += CreateVMarkPassmark(line); break; + case PassmarkLineType::VMark2: + passmarksLines += CreateVMark2Passmark(line, seamAllowance); + break; case PassmarkLineType::OneLine: default: passmarksLines.append(line); @@ -239,6 +271,7 @@ QVector CreatePassmarkLines(PassmarkLineType lineType, PassmarkAngleType case PassmarkLineType::TwoLines: case PassmarkLineType::ThreeLines: case PassmarkLineType::VMark: + case PassmarkLineType::VMark2: default: passmarksLines.append(line); break; @@ -1309,6 +1342,8 @@ QVector VPiece::CreatePassmark(const QVector &path, int prev passmarkData.passmarkLineType = path.at(passmarkIndex).GetPassmarkLineType(); passmarkData.passmarkAngleType = path.at(passmarkIndex).GetPassmarkAngleType(); + const QVector mainPath = MainPathPoints(data); + if (not IsSeamAllowanceBuiltIn()) { // Because rollback cannot be calulated if passmark is not first point in main path we rotate it. @@ -1327,12 +1362,12 @@ QVector VPiece::CreatePassmark(const QVector &path, int prev && path.at(passmarkIndex).GetPassmarkAngleType() != PassmarkAngleType::Intersection2OnlyRight && path.at(passmarkIndex).IsShowSecondPassmark()) { - lines += BuiltInSAPassmark(passmarkData); + lines += BuiltInSAPassmark(passmarkData, mainPath); } return lines; } - return BuiltInSAPassmark(passmarkData); + return BuiltInSAPassmark(passmarkData, mainPath); } //--------------------------------------------------------------------------------------------------------------------- @@ -1381,7 +1416,7 @@ QVector VPiece::SAPassmark(const VPiecePassmarkData &passmarkData, const line.setLength(qMin(width * VSAPoint::passmarkFactor, VSAPoint::maxPassmarkLength)); passmarksLines += CreatePassmarkLines(passmarkData.passmarkLineType, passmarkData.passmarkAngleType, - line); + line, seamAllowance); } else { @@ -1404,7 +1439,8 @@ QVector VPiece::SAPassmark(const VPiecePassmarkData &passmarkData, const { QLineF line = QLineF(seamPassmarkSAPoint, passmarkData.passmarkSAPoint); line.setLength(passmarkData.passmarkSAPoint.PassmarkLength(passmarkData.saWidth)); - passmarksLines += CreatePassmarkLines(passmarkData.passmarkLineType, passmarkData.passmarkAngleType, line); + passmarksLines += CreatePassmarkLines(passmarkData.passmarkLineType, passmarkData.passmarkAngleType, line, + seamAllowance); } else if (passmarkData.passmarkAngleType == PassmarkAngleType::Bisector) { @@ -1457,7 +1493,7 @@ QVector VPiece::SAPassmark(const VPiecePassmarkData &passmarkData, const } //--------------------------------------------------------------------------------------------------------------------- -QVector VPiece::BuiltInSAPassmark(const VPiecePassmarkData &passmarkData) +QVector VPiece::BuiltInSAPassmark(const VPiecePassmarkData &passmarkData, const QVector &mainPath) { QVector passmarksLines; @@ -1467,7 +1503,8 @@ QVector VPiece::BuiltInSAPassmark(const VPiecePassmarkData &passmarkData edge1.setAngle(edge1.angle() + edge1.angleTo(edge2)/2.); edge1.setLength(passmarkData.passmarkSAPoint.PassmarkLength(passmarkData.saWidth)); - passmarksLines += CreatePassmarkLines(passmarkData.passmarkLineType, passmarkData.passmarkAngleType, edge1); + passmarksLines += CreatePassmarkLines(passmarkData.passmarkLineType, passmarkData.passmarkAngleType, edge1, + mainPath); return passmarksLines; } @@ -1524,5 +1561,5 @@ QVector VPiece::PassmarkBisector(PassmarkStatus seamPassmarkType, const edge1.setAngle(edge1.angle() + edge1.angleTo(edge2)/2.); edge1.setLength(passmarkData.passmarkSAPoint.PassmarkLength(passmarkData.saWidth)); - return CreatePassmarkLines(passmarkData.passmarkLineType, passmarkData.passmarkAngleType, edge1); + return CreatePassmarkLines(passmarkData.passmarkLineType, passmarkData.passmarkAngleType, edge1, seamAllowance); } diff --git a/src/libs/vpatterndb/vpiece.h b/src/libs/vpatterndb/vpiece.h index ed67d04d4..6d0dbc6b7 100644 --- a/src/libs/vpatterndb/vpiece.h +++ b/src/libs/vpatterndb/vpiece.h @@ -181,7 +181,7 @@ private: QVector CreatePassmark(const QVector &path, int previousIndex, int passmarkIndex, int nextIndex, const VContainer *data) const; - static QVector BuiltInSAPassmark(const VPiecePassmarkData &passmarkData); + static QVector BuiltInSAPassmark(const VPiecePassmarkData &passmarkData, const QVector &mainPath); static QVector PassmarkBisector(PassmarkStatus seamPassmarkType, const VPiecePassmarkData &passmarkData, const QPointF &seamPassmarkSAPoint, const QVector& seamAllowance); diff --git a/src/libs/vtools/dialogs/tools/dialogtool.cpp b/src/libs/vtools/dialogs/tools/dialogtool.cpp index fa5815554..05d2e3885 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.cpp +++ b/src/libs/vtools/dialogs/tools/dialogtool.cpp @@ -689,10 +689,13 @@ QString DialogTool::GetNodeName(const VPieceNode &node, bool showDetails) const name += QLatin1Literal("|||"); break; case PassmarkLineType::TMark: - name += QString("┴"); + name += QStringLiteral("┴"); break; case PassmarkLineType::VMark: - name += QLatin1Char('^'); + name += QStringLiteral("⊼"); + break; + case PassmarkLineType::VMark2: + name += QStringLiteral("⊽"); break; default: break; diff --git a/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp b/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp index 80646002c..81af79c6e 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp @@ -486,6 +486,7 @@ void DialogPiecePath::PassmarkChanged(int index) ui->radioButtonThreeLines->setDisabled(true); ui->radioButtonTMark->setDisabled(true); ui->radioButtonVMark->setDisabled(true); + ui->radioButtonVMark2->setDisabled(true); ui->radioButtonStraightforward->setDisabled(true); ui->radioButtonBisector->setDisabled(true); @@ -516,6 +517,7 @@ void DialogPiecePath::PassmarkChanged(int index) ui->radioButtonThreeLines->setEnabled(true); ui->radioButtonTMark->setEnabled(true); ui->radioButtonVMark->setEnabled(true); + ui->radioButtonVMark2->setEnabled(true); switch(node.GetPassmarkLineType()) { @@ -534,6 +536,9 @@ void DialogPiecePath::PassmarkChanged(int index) case PassmarkLineType::VMark: ui->radioButtonVMark->setChecked(true); break; + case PassmarkLineType::VMark2: + ui->radioButtonVMark2->setChecked(true); + break; default: break; } @@ -642,6 +647,10 @@ void DialogPiecePath::PassmarkLineTypeChanged(int id) { lineType = PassmarkLineType::VMark; } + else if (id == ui->buttonGroupMarkType->id(ui->radioButtonVMark2)) + { + lineType = PassmarkLineType::VMark2; + } rowNode.SetPassmarkLineType(lineType); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); diff --git a/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.ui b/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.ui index f6df54b5d..493c381f7 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.ui +++ b/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.ui @@ -992,6 +992,9 @@ false + + Acute angle that looks inside of piece + V mark @@ -1000,6 +1003,22 @@ + + + + false + + + Acute angle that looks outside of piece + + + V mark 2 + + + buttonGroupMarkType + + + @@ -1430,7 +1449,7 @@ - + diff --git a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp index 575eb416f..eb613d2a1 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp @@ -998,6 +998,7 @@ void DialogSeamAllowance::PassmarkChanged(int index) uiTabPassmarks->radioButtonThreeLines->setDisabled(true); uiTabPassmarks->radioButtonTMark->setDisabled(true); uiTabPassmarks->radioButtonVMark->setDisabled(true); + uiTabPassmarks->radioButtonVMark2->setDisabled(true); uiTabPassmarks->radioButtonStraightforward->setDisabled(true); uiTabPassmarks->radioButtonBisector->setDisabled(true); @@ -1028,6 +1029,7 @@ void DialogSeamAllowance::PassmarkChanged(int index) uiTabPassmarks->radioButtonThreeLines->setEnabled(true); uiTabPassmarks->radioButtonTMark->setEnabled(true); uiTabPassmarks->radioButtonVMark->setEnabled(true); + uiTabPassmarks->radioButtonVMark2->setEnabled(true); switch(node.GetPassmarkLineType()) { @@ -1046,6 +1048,9 @@ void DialogSeamAllowance::PassmarkChanged(int index) case PassmarkLineType::VMark: uiTabPassmarks->radioButtonVMark->setChecked(true); break; + case PassmarkLineType::VMark2: + uiTabPassmarks->radioButtonVMark2->setChecked(true); + break; default: break; } @@ -1442,6 +1447,10 @@ void DialogSeamAllowance::PassmarkLineTypeChanged(int id) { lineType = PassmarkLineType::VMark; } + else if (id == uiTabPassmarks->buttonGroupLineType->id(uiTabPassmarks->radioButtonVMark2)) + { + lineType = PassmarkLineType::VMark2; + } rowNode.SetPassmarkLineType(lineType); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); diff --git a/src/libs/vtools/dialogs/tools/piece/tabs/tabpassmarks.ui b/src/libs/vtools/dialogs/tools/piece/tabs/tabpassmarks.ui index e9d09f2ff..eba4bbbc3 100644 --- a/src/libs/vtools/dialogs/tools/piece/tabs/tabpassmarks.ui +++ b/src/libs/vtools/dialogs/tools/piece/tabs/tabpassmarks.ui @@ -7,7 +7,7 @@ 0 0 352 - 567 + 594 @@ -25,7 +25,7 @@ 0 0 332 - 547 + 574 @@ -112,6 +112,9 @@ false + + Acute angle that looks intside of piece + V mark @@ -120,6 +123,22 @@ + + + + false + + + Acute angle that looks outside of piece + + + V mark 2 + + + buttonGroupLineType + + + @@ -289,7 +308,7 @@ - +