diff --git a/src/libs/ifc/schema.qrc b/src/libs/ifc/schema.qrc
index 617a40a45..d7e74799b 100644
--- a/src/libs/ifc/schema.qrc
+++ b/src/libs/ifc/schema.qrc
@@ -29,6 +29,7 @@
schema/pattern/v0.4.3.xsd
schema/pattern/v0.4.4.xsd
schema/pattern/v0.4.5.xsd
+ schema/pattern/v0.4.6.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.6.xsd b/src/libs/ifc/schema/pattern/v0.4.6.xsd
new file mode 100644
index 000000000..6a43d3873
--- /dev/null
+++ b/src/libs/ifc/schema/pattern/v0.4.6.xsd
@@ -0,0 +1,899 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp
index 509634035..c6ecc35e9 100644
--- a/src/libs/ifc/xml/vabstractpattern.cpp
+++ b/src/libs/ifc/xml/vabstractpattern.cpp
@@ -95,27 +95,30 @@ const QString VAbstractPattern::TagPath = QStringLiteral("path");
const QString VAbstractPattern::TagNodes = QStringLiteral("nodes");
const QString VAbstractPattern::TagNode = QStringLiteral("node");
-const QString VAbstractPattern::AttrName = QStringLiteral("name");
-const QString VAbstractPattern::AttrVisible = QStringLiteral("visible");
-const QString VAbstractPattern::AttrObject = QStringLiteral("object");
-const QString VAbstractPattern::AttrTool = QStringLiteral("tool");
-const QString VAbstractPattern::AttrType = QStringLiteral("type");
-const QString VAbstractPattern::AttrLetter = QStringLiteral("letter");
-const QString VAbstractPattern::AttrMaterial = QStringLiteral("material");
-const QString VAbstractPattern::AttrUserDefined = QStringLiteral("userDef");
-const QString VAbstractPattern::AttrCutNumber = QStringLiteral("cutNumber");
-const QString VAbstractPattern::AttrPlacement = QStringLiteral("placement");
-const QString VAbstractPattern::AttrArrows = QStringLiteral("arrows");
-const QString VAbstractPattern::AttrNodeReverse = QStringLiteral("reverse");
-const QString VAbstractPattern::AttrNodeExcluded = QStringLiteral("excluded");
-const QString VAbstractPattern::AttrSABefore = QStringLiteral("before");
-const QString VAbstractPattern::AttrSAAfter = QStringLiteral("after");
-const QString VAbstractPattern::AttrStart = QStringLiteral("start");
-const QString VAbstractPattern::AttrPath = QStringLiteral("path");
-const QString VAbstractPattern::AttrEnd = QStringLiteral("end");
-const QString VAbstractPattern::AttrIncludeAs = QStringLiteral("includeAs");
-const QString VAbstractPattern::AttrWidth = QStringLiteral("width");
-const QString VAbstractPattern::AttrRotation = QStringLiteral("rotation");
+const QString VAbstractPattern::AttrName = QStringLiteral("name");
+const QString VAbstractPattern::AttrVisible = QStringLiteral("visible");
+const QString VAbstractPattern::AttrObject = QStringLiteral("object");
+const QString VAbstractPattern::AttrTool = QStringLiteral("tool");
+const QString VAbstractPattern::AttrType = QStringLiteral("type");
+const QString VAbstractPattern::AttrLetter = QStringLiteral("letter");
+const QString VAbstractPattern::AttrMaterial = QStringLiteral("material");
+const QString VAbstractPattern::AttrUserDefined = QStringLiteral("userDef");
+const QString VAbstractPattern::AttrCutNumber = QStringLiteral("cutNumber");
+const QString VAbstractPattern::AttrPlacement = QStringLiteral("placement");
+const QString VAbstractPattern::AttrArrows = QStringLiteral("arrows");
+const QString VAbstractPattern::AttrNodeReverse = QStringLiteral("reverse");
+const QString VAbstractPattern::AttrNodeExcluded = QStringLiteral("excluded");
+const QString VAbstractPattern::AttrNodePassmark = QStringLiteral("passmark");
+const QString VAbstractPattern::AttrNodePassmarkLine = QStringLiteral("passmarkLine");
+const QString VAbstractPattern::AttrNodePassmarkAngle = QStringLiteral("passmarkAngle");
+const QString VAbstractPattern::AttrSABefore = QStringLiteral("before");
+const QString VAbstractPattern::AttrSAAfter = QStringLiteral("after");
+const QString VAbstractPattern::AttrStart = QStringLiteral("start");
+const QString VAbstractPattern::AttrPath = QStringLiteral("path");
+const QString VAbstractPattern::AttrEnd = QStringLiteral("end");
+const QString VAbstractPattern::AttrIncludeAs = QStringLiteral("includeAs");
+const QString VAbstractPattern::AttrWidth = QStringLiteral("width");
+const QString VAbstractPattern::AttrRotation = QStringLiteral("rotation");
const QString VAbstractPattern::AttrAll = QStringLiteral("all");
@@ -673,6 +676,14 @@ VPieceNode VAbstractPattern::ParseSANode(const QDomElement &domElement)
currentSeamAllowance);
const PieceNodeAngle angle = static_cast(VDomDocument::GetParametrUInt(domElement, AttrAngle, "0"));
+ const bool passmark = VDomDocument::GetParametrBool(domElement, VAbstractPattern::AttrNodePassmark, falseStr);
+ const PassmarkLineType passmarkLine = StringToPassmarkLineType(VDomDocument::GetParametrString(domElement,
+ VAbstractPattern::AttrNodePassmarkLine,
+ strOne));
+ const PassmarkAngleType passmarkAngle = StringToPassmarkAngleType(VDomDocument::GetParametrString(domElement,
+ VAbstractPattern::AttrNodePassmarkAngle,
+ strStraightforward));
+
const QString t = VDomDocument::GetParametrString(domElement, AttrType, VAbstractPattern::NodePoint);
Tool tool;
@@ -708,6 +719,9 @@ VPieceNode VAbstractPattern::ParseSANode(const QDomElement &domElement)
node.SetFormulaSAAfter(saAfter);
node.SetAngleType(angle);
node.SetExcluded(excluded);
+ node.SetPassmark(passmark);
+ node.SetPassmarkLineType(passmarkLine);
+ node.SetPassmarkAngleType(passmarkAngle);
return node;
}
diff --git a/src/libs/ifc/xml/vabstractpattern.h b/src/libs/ifc/xml/vabstractpattern.h
index 0eb281daf..30f0bdd21 100644
--- a/src/libs/ifc/xml/vabstractpattern.h
+++ b/src/libs/ifc/xml/vabstractpattern.h
@@ -218,6 +218,9 @@ public:
static const QString AttrArrows;
static const QString AttrNodeReverse;
static const QString AttrNodeExcluded;
+ static const QString AttrNodePassmark;
+ static const QString AttrNodePassmarkLine;
+ static const QString AttrNodePassmarkAngle;
static const QString AttrSABefore;
static const QString AttrSAAfter;
static const QString AttrStart;
diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp
index 44b74b287..162d46935 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.5");
-const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.4.5.xsd");
+const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.4.6");
+const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.4.6.xsd");
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
@@ -209,6 +209,8 @@ QString VPatternConverter::XSDSchema(int ver) const
case (0x000404):
return QStringLiteral("://schema/pattern/v0.4.4.xsd");
case (0x000405):
+ return QStringLiteral("://schema/pattern/v0.4.5.xsd");
+ case (0x000406):
return CurrentSchema;
default:
InvalidVersion(ver);
@@ -335,6 +337,10 @@ void VPatternConverter::ApplyPatches()
ValidateXML(XSDSchema(0x000405), m_convertedFileName);
V_FALLTHROUGH
case (0x000405):
+ ToV0_4_6();
+ ValidateXML(XSDSchema(0x000406), m_convertedFileName);
+ V_FALLTHROUGH
+ case (0x000406):
break;
default:
InvalidVersion(m_ver);
@@ -353,7 +359,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, 5),
+ Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 4, 6),
"Check attribute readOnly.");
// Possibly in future attribute readOnly will change position etc.
@@ -692,6 +698,16 @@ void VPatternConverter::ToV0_4_5()
Save();
}
+//---------------------------------------------------------------------------------------------------------------------
+void VPatternConverter::ToV0_4_6()
+{
+ // TODO. Delete if minimal supported version is 0.4.6
+ Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 4, 6),
+ "Time to refactor the code.");
+ SetVersion(QStringLiteral("0.4.6"));
+ Save();
+}
+
//---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::TagUnitToV0_2_0()
{
diff --git a/src/libs/ifc/xml/vpatternconverter.h b/src/libs/ifc/xml/vpatternconverter.h
index 1eb0a7b0b..fe53ef5ee 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, 5);
+ static Q_DECL_CONSTEXPR int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 6);
#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, 5);
+ static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 6);
#endif
protected:
@@ -106,6 +106,7 @@ private:
void ToV0_4_3();
void ToV0_4_4();
void ToV0_4_5();
+ void ToV0_4_6();
void TagUnitToV0_2_0();
void TagIncrementToV0_2_0();
diff --git a/src/libs/vmisc/def.cpp b/src/libs/vmisc/def.cpp
index 37207d9b9..a567583b7 100644
--- a/src/libs/vmisc/def.cpp
+++ b/src/libs/vmisc/def.cpp
@@ -2022,3 +2022,80 @@ void InitHighDpiScaling(int argc, char *argv[])
#endif
}
}
+
+const QString strOne = QStringLiteral("one");
+const QString strTwo = QStringLiteral("two");
+const QString strThree = QStringLiteral("three");
+
+//---------------------------------------------------------------------------------------------------------------------
+QString PassmarkLineTypeToString(PassmarkLineType type)
+{
+ switch(type)
+ {
+ case PassmarkLineType::OneLine:
+ return strOne;
+ case PassmarkLineType::TwoLines:
+ return strTwo;
+ case PassmarkLineType::ThreeLines:
+ return strThree;
+ default:
+ break;
+ }
+
+ return strOne;
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+PassmarkLineType StringToPassmarkLineType(const QString &value)
+{
+ const QStringList values = QStringList() << strOne << strTwo << strThree;
+
+ switch(values.indexOf(value))
+ {
+ case 0:
+ return PassmarkLineType::OneLine;
+ case 1:
+ return PassmarkLineType::TwoLines;
+ case 2:
+ return PassmarkLineType::ThreeLines;
+ default:
+ break;
+ }
+ return PassmarkLineType::OneLine;
+}
+
+const QString strStraightforward = QStringLiteral("straightforward");
+const QString strBisector = QStringLiteral("bisector");
+
+//---------------------------------------------------------------------------------------------------------------------
+QString PassmarkAngleTypeToString(PassmarkAngleType type)
+{
+ switch(type)
+ {
+ case PassmarkAngleType::Straightforward:
+ return strStraightforward;
+ case PassmarkAngleType::Bisector:
+ return strBisector;
+ default:
+ break;
+ }
+
+ return strStraightforward;
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+PassmarkAngleType StringToPassmarkAngleType(const QString &value)
+{
+ const QStringList values = QStringList() << strStraightforward << strBisector;
+
+ switch(values.indexOf(value))
+ {
+ case 0:
+ return PassmarkAngleType::Straightforward;
+ case 1:
+ return PassmarkAngleType::Bisector;
+ default:
+ break;
+ }
+ return PassmarkAngleType::Straightforward;
+}
diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h
index e1523976b..4dfdbad8f 100644
--- a/src/libs/vmisc/def.h
+++ b/src/libs/vmisc/def.h
@@ -91,17 +91,23 @@ enum class PieceNodeAngle : unsigned char
enum class PassmarkLineType : unsigned char
{
- OneLine = 0,
+ OneLine = 0, // Default
TwoLines,
ThreeLines
};
+QString PassmarkLineTypeToString(PassmarkLineType type);
+PassmarkLineType StringToPassmarkLineType(const QString &value);
+
enum class PassmarkAngleType : unsigned char
{
- Straightforward = 0,
+ Straightforward = 0, // Default
Bisector
};
+QString PassmarkAngleTypeToString(PassmarkAngleType type);
+PassmarkAngleType StringToPassmarkAngleType(const QString &value);
+
enum class PiecePathIncludeType : unsigned char
{
AsMainPath = 0,
@@ -690,6 +696,13 @@ extern const QString degreeSymbol;
extern const QString trueStr;
extern const QString falseStr;
+extern const QString strOne;
+extern const QString strTwo;
+extern const QString strThree;
+
+extern const QString strStraightforward;
+extern const QString strBisector;
+
void SetOverrideCursor(const QString & pixmapPath, int hotX = -1, int hotY = -1);
void SetOverrideCursor(Qt::CursorShape shape);
void RestoreOverrideCursor(const QString & pixmapPath);
diff --git a/src/libs/vtools/tools/vabstracttool.cpp b/src/libs/vtools/tools/vabstracttool.cpp
index e4397de57..95af6c0bd 100644
--- a/src/libs/vtools/tools/vabstracttool.cpp
+++ b/src/libs/vtools/tools/vabstracttool.cpp
@@ -627,7 +627,7 @@ QDomElement VAbstractTool::AddSANode(VAbstractPattern *doc, const QString &tagNa
const bool excluded = node.IsExcluded();
if (excluded)
{
- doc->SetAttribute(nod, VAbstractPattern::AttrNodeExcluded, node.IsExcluded());
+ doc->SetAttribute(nod, VAbstractPattern::AttrNodeExcluded, excluded);
}
else
{ // For backward compatebility.
@@ -663,6 +663,30 @@ QDomElement VAbstractTool::AddSANode(VAbstractPattern *doc, const QString &tagNa
doc->SetAttribute(nod, AttrAngle, angleType);
}
+ if (type == Tool::NodePoint)
+ {
+ doc->SetAttribute(nod, VAbstractPattern::AttrNodePassmark, node.IsPassmark());
+ doc->SetAttribute(nod, VAbstractPattern::AttrNodePassmarkLine,
+ PassmarkLineTypeToString(node.GetPassmarkLineType()));
+ doc->SetAttribute(nod, VAbstractPattern::AttrNodePassmarkAngle,
+ PassmarkAngleTypeToString(node.GetPassmarkAngleType()));
+
+ if (not node.IsPassmark()
+ && node.GetPassmarkLineType() == PassmarkLineType::OneLine
+ && node.GetPassmarkAngleType() == PassmarkAngleType::Straightforward)
+ { // For backward compatebility.
+ nod.removeAttribute(VAbstractPattern::AttrNodePassmark);
+ nod.removeAttribute(VAbstractPattern::AttrNodePassmarkLine);
+ nod.removeAttribute(VAbstractPattern::AttrNodePassmarkAngle);
+ }
+ }
+ else
+ { // Wrong configuration.
+ nod.removeAttribute(VAbstractPattern::AttrNodePassmark);
+ nod.removeAttribute(VAbstractPattern::AttrNodePassmarkLine);
+ nod.removeAttribute(VAbstractPattern::AttrNodePassmarkAngle);
+ }
+
return nod;
}
diff --git a/src/libs/vtools/tools/vtooluniondetails.cpp b/src/libs/vtools/tools/vtooluniondetails.cpp
index ef040ae14..d9829a213 100644
--- a/src/libs/vtools/tools/vtooluniondetails.cpp
+++ b/src/libs/vtools/tools/vtooluniondetails.cpp
@@ -594,11 +594,11 @@ quint32 AddNodeSplinePath(const VPieceNode &node, const VToolUnionDetailsInitDat
/**
* @brief AddToNewDetail create united detail adding one node per time.
*/
-void AddNodeToNewPath(const VToolUnionDetailsInitData &initData, VPiecePath &newPath, const VPieceNode &node,
+void AddNodeToNewPath(const VToolUnionDetailsInitData &initData, VPiecePath &newPath, VPieceNode node,
quint32 idTool, QVector &children, const QString &drawName, qreal dx = 0, qreal dy = 0,
quint32 pRotate = NULL_ID, qreal angle = 0);
-void AddNodeToNewPath(const VToolUnionDetailsInitData &initData, VPiecePath &newPath, const VPieceNode &node,
+void AddNodeToNewPath(const VToolUnionDetailsInitData &initData, VPiecePath &newPath, VPieceNode node,
quint32 idTool, QVector &children, const QString &drawName, qreal dx, qreal dy,
quint32 pRotate, qreal angle)
{
@@ -625,10 +625,8 @@ void AddNodeToNewPath(const VToolUnionDetailsInitData &initData, VPiecePath &new
break;
}
- VPieceNode newNode(id, node.GetTypeTool(), node.GetReverse());
- newNode.SetExcluded(node.IsExcluded());
-
- newPath.Append(newNode);
+ node.SetId(id);
+ newPath.Append(node);
}
//---------------------------------------------------------------------------------------------------------------------