diff --git a/src/libs/ifc/schema.qrc b/src/libs/ifc/schema.qrc
index 33ca3fdf5..3e40a2a66 100644
--- a/src/libs/ifc/schema.qrc
+++ b/src/libs/ifc/schema.qrc
@@ -22,6 +22,7 @@
schema/pattern/v0.3.6.xsd
schema/pattern/v0.3.7.xsd
schema/pattern/v0.3.8.xsd
+ schema/pattern/v0.4.0.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.0.xsd b/src/libs/ifc/schema/pattern/v0.4.0.xsd
new file mode 100644
index 000000000..eb822a1c5
--- /dev/null
+++ b/src/libs/ifc/schema/pattern/v0.4.0.xsd
@@ -0,0 +1,634 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp
index deff9a092..cf12435a9 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.3.8");
-const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.3.8.xsd");
+const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.4.0");
+const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.4.0.xsd");
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
@@ -115,6 +115,20 @@ const QString strPointFromArcAndTangent = QStringLiteral("pointFromArcAndTang
const QString strPointOfIntersectionArcs = QStringLiteral("pointOfIntersectionArcs");
const QString strFirstArc = QStringLiteral("firstArc");
const QString strSecondArc = QStringLiteral("secondArc");
+const QString strDetail = QStringLiteral("detail");
+const QString strSupplement = QStringLiteral("supplement");
+const QString strClosed = QStringLiteral("closed");
+const QString strWidth = QStringLiteral("width");
+const QString strNode = QStringLiteral("node");
+const QString strNodes = QStringLiteral("nodes");
+const QString strData = QStringLiteral("data");
+const QString strPatternInfo = QStringLiteral("patternInfo");
+const QString strGrainline = QStringLiteral("grainline");
+const QString strReverse = QStringLiteral("reverse");
+const QString strMx = QStringLiteral("mx");
+const QString strMy = QStringLiteral("my");
+const QString strForbidFlipping = QStringLiteral("forbidFlipping");
+const QString strInLayout = QStringLiteral("inLayout");
//---------------------------------------------------------------------------------------------------------------------
VPatternConverter::VPatternConverter(const QString &fileName)
@@ -175,6 +189,8 @@ QString VPatternConverter::XSDSchema(int ver) const
case (0x000307):
return QStringLiteral("://schema/pattern/v0.3.7.xsd");
case (0x000308):
+ return QStringLiteral("://schema/pattern/v0.3.8.xsd");
+ case (0x000400):
return CurrentSchema;
default:
InvalidVersion(ver);
@@ -274,6 +290,10 @@ void VPatternConverter::ApplyPatches()
ValidateXML(XSDSchema(0x000308), fileName);
V_FALLTHROUGH
case (0x000308):
+ ToV0_4_0();
+ ValidateXML(XSDSchema(0x000400), fileName);
+ V_FALLTHROUGH
+ case (0x000400):
break;
default:
break;
@@ -462,6 +482,14 @@ void VPatternConverter::ToV0_3_8()
Save();
}
+//---------------------------------------------------------------------------------------------------------------------
+void VPatternConverter::ToV0_4_0()
+{
+ SetVersion(QStringLiteral("0.4.0"));
+ TagDetailToV0_4_0();
+ Save();
+}
+
//---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::TagUnitToV0_2_0()
{
@@ -1467,3 +1495,81 @@ void VPatternConverter::FixSubPaths(int i, quint32 id, quint32 baseCurve)
}
}
}
+
+//---------------------------------------------------------------------------------------------------------------------
+void VPatternConverter::TagDetailToV0_4_0()
+{
+ const QDomNodeList list = elementsByTagName(strDetail);
+ for (int i=0; i < list.size(); ++i)
+ {
+ QDomElement dom = list.at(i).toElement();
+
+ if (not dom.isNull())
+ {
+ dom.removeAttribute(strName);
+ dom.removeAttribute(strSupplement);
+ dom.removeAttribute(strClosed);
+ dom.removeAttribute(strWidth);
+ dom.removeAttribute(strMx);
+ dom.removeAttribute(strMy);
+ dom.removeAttribute(strForbidFlipping);
+ dom.removeAttribute(strInLayout);
+
+ dom.setAttribute(strVersion, "1");
+
+ const QStringList tags = QStringList() << strNode << strData << strPatternInfo << strGrainline;
+
+ QDomElement tagData;
+ QDomElement tagPatternInfo;
+ QDomElement tagGrainline;
+ QDomElement tagNodes = createElement(strNodes);
+
+ const QDomNodeList childList = dom.childNodes();
+ for (qint32 i = 0; i < childList.size(); ++i)
+ {
+ const QDomElement element = childList.at(i).toElement();
+ if (not element.isNull())
+ {
+ switch (tags.indexOf(element.tagName()))
+ {
+ case 0://strNode
+ {
+ QDomElement tagNode = createElement(strNode);
+
+ tagNode.setAttribute(strIdObject, element.attribute(strIdObject, NULL_ID_STR));
+
+ if (element.hasAttribute(strReverse))
+ {
+ tagNode.setAttribute(strReverse, element.attribute(strReverse, "0"));
+ }
+
+ tagNode.setAttribute(strType, element.attribute(strType, ""));
+
+ tagNodes.appendChild(tagNode);
+
+ break;
+ }
+ case 1://strData
+ tagData = element.cloneNode().toElement();
+ break;
+ case 2://strPatternInfo
+ tagPatternInfo = element.cloneNode().toElement();
+ break;
+ case 3://strGrainline
+ tagGrainline = element.cloneNode().toElement();
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ RemoveAllChildren(dom);
+
+ dom.appendChild(tagData);
+ dom.appendChild(tagPatternInfo);
+ dom.appendChild(tagGrainline);
+ dom.appendChild(tagNodes);
+ }
+ }
+}
diff --git a/src/libs/ifc/xml/vpatternconverter.h b/src/libs/ifc/xml/vpatternconverter.h
index 267bbbfd5..483d8782b 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, 3, 8);
+ static Q_DECL_CONSTEXPR int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 0);
#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, 3, 8);
+ static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 0);
#endif
protected:
@@ -97,6 +97,7 @@ private:
void ToV0_3_6();
void ToV0_3_7();
void ToV0_3_8();
+ void ToV0_4_0();
void TagUnitToV0_2_0();
void TagIncrementToV0_2_0();
@@ -132,6 +133,8 @@ private:
void FixCutPoint();
void FixSubPaths(int i, quint32 id, quint32 baseCurve);
+
+ void TagDetailToV0_4_0();
};
//---------------------------------------------------------------------------------------------------------------------