diff --git a/src/app/tape/share/resources/diagrams.qrc b/src/app/tape/share/resources/diagrams.qrc index ee4476135..0f814d09f 100644 --- a/src/app/tape/share/resources/diagrams.qrc +++ b/src/app/tape/share/resources/diagrams.qrc @@ -76,6 +76,7 @@ diagrams/Np2.png diagrams/Np3.png diagrams/Np4.png + diagrams/Np5.png diagrams/Op1.png diagrams/Op2.png diagrams/Op3.png diff --git a/src/app/tape/share/resources/diagrams/Np5.png b/src/app/tape/share/resources/diagrams/Np5.png new file mode 100644 index 000000000..737e6bef5 Binary files /dev/null and b/src/app/tape/share/resources/diagrams/Np5.png differ diff --git a/src/app/tape/tape.pro b/src/app/tape/tape.pro index e1e8d5c2b..be72682c4 100644 --- a/src/app/tape/tape.pro +++ b/src/app/tape/tape.pro @@ -340,6 +340,7 @@ DIAGRAMS += \ $${PWD}/share/resources/diagrams/Np2.png \ $${PWD}/share/resources/diagrams/Np3.png \ $${PWD}/share/resources/diagrams/Np4.png \ + $${PWD}/share/resources/diagrams/Np5.png \ $${PWD}/share/resources/diagrams/Op1.png \ $${PWD}/share/resources/diagrams/Op2.png \ $${PWD}/share/resources/diagrams/Op3.png \ diff --git a/src/libs/ifc/schema.qrc b/src/libs/ifc/schema.qrc index de7259a73..6bec8b207 100644 --- a/src/libs/ifc/schema.qrc +++ b/src/libs/ifc/schema.qrc @@ -6,12 +6,15 @@ schema/pattern/v0.1.3.xsd schema/pattern/v0.1.4.xsd schema/pattern/v0.2.0.xsd + schema/pattern/v0.2.1.xsd schema/standard_measurements/v0.3.0.xsd schema/standard_measurements/v0.4.0.xsd schema/standard_measurements/v0.4.1.xsd + schema/standard_measurements/v0.4.2.xsd schema/individual_measurements/v0.2.0.xsd schema/individual_measurements/v0.3.0.xsd schema/individual_measurements/v0.3.1.xsd schema/individual_measurements/v0.3.2.xsd + schema/individual_measurements/v0.3.3.xsd diff --git a/src/libs/ifc/schema/individual_measurements/v0.3.3.xsd b/src/libs/ifc/schema/individual_measurements/v0.3.3.xsd new file mode 100644 index 000000000..a6a241e53 --- /dev/null +++ b/src/libs/ifc/schema/individual_measurements/v0.3.3.xsd @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ifc/schema/pattern/v0.2.1.xsd b/src/libs/ifc/schema/pattern/v0.2.1.xsd new file mode 100644 index 000000000..65456be2a --- /dev/null +++ b/src/libs/ifc/schema/pattern/v0.2.1.xsd @@ -0,0 +1,329 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ifc/schema/standard_measurements/v0.4.2.xsd b/src/libs/ifc/schema/standard_measurements/v0.4.2.xsd new file mode 100644 index 000000000..788adcbb1 --- /dev/null +++ b/src/libs/ifc/schema/standard_measurements/v0.4.2.xsd @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ifc/xml/vabstractmconverter.cpp b/src/libs/ifc/xml/vabstractmconverter.cpp index 2d8738e6e..268e4b2d4 100644 --- a/src/libs/ifc/xml/vabstractmconverter.cpp +++ b/src/libs/ifc/xml/vabstractmconverter.cpp @@ -128,7 +128,7 @@ QMultiMap VAbstractMConverter::OldNamesToNewNames_InV0_3_0() names.insert(QStringLiteral("body_armfold_circ"), QStringLiteral("shoulder_girth")); names.insert(QStringLiteral("body_torso_circ"), QStringLiteral("trunk_length")); names.insert(QStringLiteral("neck_front_to_waist_f"), QStringLiteral("front_waist_length")); - names.insert(QStringLiteral("neck_front_to_waist_flat"), QStringLiteral("center_front_waist_length")); + names.insert(QStringLiteral("neck_front_to_waist_flat_f"), QStringLiteral("center_front_waist_length")); names.insert(QStringLiteral("armpit_to_waist_side"), QStringLiteral("side_waist_length")); names.insert(QStringLiteral("neck_side_to_waist_b"), QStringLiteral("waist_to_neck_side")); @@ -235,3 +235,14 @@ QMultiMap VAbstractMConverter::OldNamesToNewNames_InV0_3_0() return names; } + +//--------------------------------------------------------------------------------------------------------------------- +QMap VAbstractMConverter::OldNamesToNewNames_InV0_3_3() +{ + // new name, old name + QMap names; + + names.insert(QStringLiteral("rise_length_side_sitting"), QStringLiteral("rise_length_side")); + + return names; +} diff --git a/src/libs/ifc/xml/vabstractmconverter.h b/src/libs/ifc/xml/vabstractmconverter.h index 3f73b6c46..24335f863 100644 --- a/src/libs/ifc/xml/vabstractmconverter.h +++ b/src/libs/ifc/xml/vabstractmconverter.h @@ -40,6 +40,7 @@ public: protected: void AddRootComment(); static QMultiMap OldNamesToNewNames_InV0_3_0(); + static QMap OldNamesToNewNames_InV0_3_3(); private: Q_DISABLE_COPY(VAbstractMConverter) diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp index babf25724..e75f854d0 100644 --- a/src/libs/ifc/xml/vpatternconverter.cpp +++ b/src/libs/ifc/xml/vpatternconverter.cpp @@ -43,8 +43,8 @@ */ const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0"); -const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.2.0"); -const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.2.0.xsd"); +const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.2.1"); +const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.2.1.xsd"); //--------------------------------------------------------------------------------------------------------------------- VPatternConverter::VPatternConverter(const QString &fileName) @@ -100,6 +100,8 @@ QString VPatternConverter::XSDSchema(int ver) const case (0x000104): return QStringLiteral("://schema/pattern/v0.1.4.xsd"); case (0x000200): + return QStringLiteral("://schema/pattern/v0.2.0.xsd"); + case (0x000201): return CurrentSchema; default: { @@ -152,6 +154,13 @@ void VPatternConverter::ApplyPatches() V_FALLTHROUGH } case (0x000200): + { + ToV0_2_1(); + const QString schema = XSDSchema(0x000201); + ValidateXML(schema, fileName); + V_FALLTHROUGH + } + case (0x000201): break; default: break; @@ -215,6 +224,14 @@ void VPatternConverter::ToV0_2_0() Save(); } +//--------------------------------------------------------------------------------------------------------------------- +void VPatternConverter::ToV0_2_1() +{ + SetVersion(QStringLiteral("0.2.1")); + ConvertMeasurementsToV0_2_1(); + Save(); +} + //--------------------------------------------------------------------------------------------------------------------- void VPatternConverter::TagUnitToV0_2_0() { @@ -665,6 +682,17 @@ void VPatternConverter::TagMeasurementsToV0_2_0() ms.appendChild(newNodeText); } +//--------------------------------------------------------------------------------------------------------------------- +void VPatternConverter::ConvertMeasurementsToV0_2_1() +{ + const QMap names = OldNamesToNewNames_InV0_2_1(); + + // Structure did not change. We can use the same code. + ConvertPointExpressionsToV0_2_0(names); + ConvertArcExpressionsToV0_2_0(names); + ConvertPathPointExpressionsToV0_2_0(names); +} + //--------------------------------------------------------------------------------------------------------------------- QString VPatternConverter::MUnitV0_1_4() const { @@ -826,7 +854,7 @@ QMap VPatternConverter::OldNamesToNewNames_InV0_2_0() names.insert(QStringLiteral("shoulder_girth"), QStringLiteral("body_armfold_circ")); names.insert(QStringLiteral("trunk_length"), QStringLiteral("body_torso_circ")); names.insert(QStringLiteral("front_waist_length"), QStringLiteral("neck_front_to_waist_f")); - names.insert(QStringLiteral("center_front_waist_length"), QStringLiteral("neck_front_to_waist_flat")); + names.insert(QStringLiteral("center_front_waist_length"), QStringLiteral("neck_front_to_waist_flat_f")); names.insert(QStringLiteral("side_waist_length"), QStringLiteral("armpit_to_waist_side")); names.insert(QStringLiteral("waist_to_neck_side"), QStringLiteral("neck_side_to_waist_b")); @@ -922,3 +950,14 @@ QMap VPatternConverter::OldNamesToNewNames_InV0_2_0() return names; } + +//--------------------------------------------------------------------------------------------------------------------- +QMap VPatternConverter::OldNamesToNewNames_InV0_2_1() +{ + // old name, new name + QMap names; + + names.insert(QStringLiteral("rise_length_side"), QStringLiteral("rise_length_side_sitting")); + + return names; +} diff --git a/src/libs/ifc/xml/vpatternconverter.h b/src/libs/ifc/xml/vpatternconverter.h index 5da3b07e1..b62ef6b5b 100644 --- a/src/libs/ifc/xml/vpatternconverter.h +++ b/src/libs/ifc/xml/vpatternconverter.h @@ -60,12 +60,15 @@ private: void ToV0_1_3(); void ToV0_1_4(); void ToV0_2_0(); + void ToV0_2_1(); void TagUnitToV0_2_0(); void TagIncrementToV0_2_0(); void ConvertMeasurementsToV0_2_0(); void TagMeasurementsToV0_2_0(); + void ConvertMeasurementsToV0_2_1(); + QSet FixIncrementsToV0_2_0(); QString FixIncrementInFormulaToV0_2_0(const QString &formula, const QSet &names); void FixPointExpressionsToV0_2_0(const QSet &names); @@ -83,6 +86,7 @@ private: QStringList ListPathPointExpressionsV0_1_4() const; static QMap OldNamesToNewNames_InV0_2_0(); + static QMap OldNamesToNewNames_InV0_2_1(); }; #endif // VPATTERNCONVERTER_H diff --git a/src/libs/ifc/xml/vvitconverter.cpp b/src/libs/ifc/xml/vvitconverter.cpp index bdd3eac36..b518967aa 100644 --- a/src/libs/ifc/xml/vvitconverter.cpp +++ b/src/libs/ifc/xml/vvitconverter.cpp @@ -40,8 +40,8 @@ */ const QString VVITConverter::MeasurementMinVerStr = QStringLiteral("0.2.0"); -const QString VVITConverter::MeasurementMaxVerStr = QStringLiteral("0.3.2"); -const QString VVITConverter::CurrentSchema = QStringLiteral("://schema/individual_measurements/v0.3.2.xsd"); +const QString VVITConverter::MeasurementMaxVerStr = QStringLiteral("0.3.3"); +const QString VVITConverter::CurrentSchema = QStringLiteral("://schema/individual_measurements/v0.3.3.xsd"); //--------------------------------------------------------------------------------------------------------------------- VVITConverter::VVITConverter(const QString &fileName) @@ -93,6 +93,8 @@ QString VVITConverter::XSDSchema(int ver) const case (0x000301): return QStringLiteral("://schema/individual_measurements/v0.3.1.xsd"); case (0x000302): + return QStringLiteral("://schema/individual_measurements/v0.3.2.xsd"); + case (0x000303): return CurrentSchema; default: { @@ -131,6 +133,13 @@ void VVITConverter::ApplyPatches() V_FALLTHROUGH } case (0x000302): + { + ToV0_3_3(); + const QString schema = XSDSchema(0x000303); + ValidateXML(schema, fileName); + V_FALLTHROUGH + } + case (0x000303): break; default: break; @@ -257,6 +266,34 @@ void VVITConverter::PM_SystemV0_3_2() parent.insertBefore(pm_system, personal); } +//--------------------------------------------------------------------------------------------------------------------- +void VVITConverter::ConvertMeasurementsToV0_3_3() +{ + const QMap names = OldNamesToNewNames_InV0_3_3(); + auto i = names.constBegin(); + while (i != names.constEnd()) + { + const QDomNodeList nodeList = this->elementsByTagName(QStringLiteral("m")); + if (nodeList.isEmpty()) + { + continue; + } + + for (int ii = 0; ii < nodeList.size(); ++ii) + { + const QString attrName = QStringLiteral("name"); + QDomElement element = nodeList.at(ii).toElement(); + const QString name = GetParametrString(element, attrName); + if (name == i.value()) + { + SetAttribute(element, attrName, i.key()); + } + } + + ++i; + } +} + //--------------------------------------------------------------------------------------------------------------------- void VVITConverter::ToV0_3_0() { @@ -282,3 +319,11 @@ void VVITConverter::ToV0_3_2() PM_SystemV0_3_2(); Save(); } + +//--------------------------------------------------------------------------------------------------------------------- +void VVITConverter::ToV0_3_3() +{ + SetVersion(QStringLiteral("0.3.3")); + ConvertMeasurementsToV0_3_3(); + Save(); +} diff --git a/src/libs/ifc/xml/vvitconverter.h b/src/libs/ifc/xml/vvitconverter.h index 10c808fee..b2a265d01 100644 --- a/src/libs/ifc/xml/vvitconverter.h +++ b/src/libs/ifc/xml/vvitconverter.h @@ -61,10 +61,12 @@ private: QDomElement AddMV0_3_0(const QString &name, qreal value); void GenderV0_3_1(); void PM_SystemV0_3_2(); + void ConvertMeasurementsToV0_3_3(); void ToV0_3_0(); void ToV0_3_1(); void ToV0_3_2(); + void ToV0_3_3(); }; #endif // VVITCONVERTER_H diff --git a/src/libs/ifc/xml/vvstconverter.cpp b/src/libs/ifc/xml/vvstconverter.cpp index ea6c2d4ba..0a928e054 100644 --- a/src/libs/ifc/xml/vvstconverter.cpp +++ b/src/libs/ifc/xml/vvstconverter.cpp @@ -40,8 +40,8 @@ */ const QString VVSTConverter::MeasurementMinVerStr = QStringLiteral("0.3.0"); -const QString VVSTConverter::MeasurementMaxVerStr = QStringLiteral("0.4.1"); -const QString VVSTConverter::CurrentSchema = QStringLiteral("://schema/standard_measurements/v0.4.1.xsd"); +const QString VVSTConverter::MeasurementMaxVerStr = QStringLiteral("0.4.2"); +const QString VVSTConverter::CurrentSchema = QStringLiteral("://schema/standard_measurements/v0.4.2.xsd"); //--------------------------------------------------------------------------------------------------------------------- VVSTConverter::VVSTConverter(const QString &fileName) @@ -91,6 +91,8 @@ QString VVSTConverter::XSDSchema(int ver) const case (0x000400): return QStringLiteral("://schema/standard_measurements/v0.4.0.xsd"); case (0x000401): + return QStringLiteral("://schema/standard_measurements/v0.4.1.xsd"); + case (0x000402): return CurrentSchema; default: { @@ -122,6 +124,13 @@ void VVSTConverter::ApplyPatches() V_FALLTHROUGH } case (0x000401): + { + ToV0_4_2(); + const QString schema = XSDSchema(0x000402); + ValidateXML(schema, fileName); + V_FALLTHROUGH + } + case (0x000402): break; default: break; @@ -263,6 +272,34 @@ void VVSTConverter::PM_SystemV0_4_1() parent.insertBefore(pm_system, personal); } +//--------------------------------------------------------------------------------------------------------------------- +void VVSTConverter::ConvertMeasurementsToV0_4_2() +{ + const QMap names = OldNamesToNewNames_InV0_3_3(); + auto i = names.constBegin(); + while (i != names.constEnd()) + { + const QDomNodeList nodeList = this->elementsByTagName(QStringLiteral("m")); + if (nodeList.isEmpty()) + { + continue; + } + + for (int ii = 0; ii < nodeList.size(); ++ii) + { + const QString attrName = QStringLiteral("name"); + QDomElement element = nodeList.at(ii).toElement(); + const QString name = GetParametrString(element, attrName); + if (name == i.value()) + { + SetAttribute(element, attrName, i.key()); + } + } + + ++i; + } +} + //--------------------------------------------------------------------------------------------------------------------- void VVSTConverter::ToV0_4_0() { @@ -281,3 +318,11 @@ void VVSTConverter::ToV0_4_1() PM_SystemV0_4_1(); Save(); } + +//--------------------------------------------------------------------------------------------------------------------- +void VVSTConverter::ToV0_4_2() +{ + SetVersion(QStringLiteral("0.4.2")); + ConvertMeasurementsToV0_4_2(); + Save(); +} diff --git a/src/libs/ifc/xml/vvstconverter.h b/src/libs/ifc/xml/vvstconverter.h index f124ff3fb..bdaa74d1b 100644 --- a/src/libs/ifc/xml/vvstconverter.h +++ b/src/libs/ifc/xml/vvstconverter.h @@ -60,9 +60,11 @@ private: void ConvertMeasurementsToV0_4_0(); QDomElement AddMV0_4_0(const QString &name, qreal value, qreal sizeIncrease, qreal heightIncrease); void PM_SystemV0_4_1(); + void ConvertMeasurementsToV0_4_2(); void ToV0_4_0(); void ToV0_4_1(); + void ToV0_4_2(); }; #endif // VMEASUREMENTCONVERTER_H diff --git a/src/libs/vmisc/def.cpp b/src/libs/vmisc/def.cpp index 47f06f728..b7886a359 100644 --- a/src/libs/vmisc/def.cpp +++ b/src/libs/vmisc/def.cpp @@ -264,6 +264,7 @@ const QString riseLengthSideSitting_M = QStringLiteral("rise_length_side_sitting const QString riseLengthDiag_M = QStringLiteral("rise_length_diag"); // N05 const QString riseLengthB_M = QStringLiteral("rise_length_b"); // N06 const QString riseLengthF_M = QStringLiteral("rise_length_f"); // N07 +const QString riseLengthSide_M = QStringLiteral("rise_length_side"); // N08 // O const QString neckBackToWaistFront_M = QStringLiteral("neck_back_to_waist_front"); // O01 const QString waistToWaistHalter_M = QStringLiteral("waist_to_waist_halter"); // O02 @@ -881,7 +882,8 @@ QStringList ListGroupN() << riseLengthSideSitting_M // N04 << riseLengthDiag_M // N05 << riseLengthB_M // N06 - << riseLengthF_M; // N07 + << riseLengthF_M // N07 + << riseLengthSide_M; // N08 return list; } @@ -1603,6 +1605,8 @@ QString MapDiagrams(const QString &number) V_FALLTHROUGH case 6: // N07 return QStringLiteral("Np4"); + case 7: // N08 + return QStringLiteral("Np5"); default: break; } diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index c757049d3..05247b423 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -420,6 +420,7 @@ extern const QString riseLengthSideSitting_M; // N04 extern const QString riseLengthDiag_M; // N05 extern const QString riseLengthB_M; // N06 extern const QString riseLengthF_M; // N07 +extern const QString riseLengthSide_M; // N08 // O extern const QString neckBackToWaistFront_M; // O01 extern const QString waistToWaistHalter_M; // O02 diff --git a/src/libs/vpatterndb/vtranslatemeasurements.cpp b/src/libs/vpatterndb/vtranslatemeasurements.cpp index 48f637e08..ecb8e0c1b 100644 --- a/src/libs/vpatterndb/vtranslatemeasurements.cpp +++ b/src/libs/vpatterndb/vtranslatemeasurements.cpp @@ -1852,6 +1852,13 @@ void VTranslateMeasurements::InitGroupN() "Full measurement description."); InitMeasurement(riseLengthF_M, m, g, d, "N07"); //================================================================================================================= + m = translate("VTranslateMeasurements", "rise_length_side", + "Name in a formula. Don't use math symbols and space in name!!!!"); + g = translate("VTranslateMeasurements", "Rise length, side", "Full measurement name."); + d = translate("VTranslateMeasurements", "Vertical distance from Waist side down to Crotch level. Use formula " + "(Height: Waist side - Leg: Crotch to floor).", "Full measurement description."); + InitMeasurement(riseLengthSide_M, m, g, d, "N08"); + //================================================================================================================= } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/test/ValentinaTest/tst_measurementregexp.cpp b/src/test/ValentinaTest/tst_measurementregexp.cpp index c000c23aa..5a5ad7ca9 100644 --- a/src/test/ValentinaTest/tst_measurementregexp.cpp +++ b/src/test/ValentinaTest/tst_measurementregexp.cpp @@ -334,6 +334,7 @@ void TST_MeasurementRegExp::TestCorrectOrderMeasurement_data() QTest::newRow("N05") << riseLengthDiag_M << "rise_length_diag"; QTest::newRow("N06") << riseLengthB_M << "rise_length_b"; QTest::newRow("N07") << riseLengthF_M << "rise_length_f"; + QTest::newRow("N08") << riseLengthSide_M << "rise_length_side"; QTest::newRow("O01") << neckBackToWaistFront_M << "neck_back_to_waist_front"; QTest::newRow("O02") << waistToWaistHalter_M << "waist_to_waist_halter"; QTest::newRow("O03") << waistNaturalCirc_M << "waist_natural_circ";