diff --git a/src/libs/ifc/schema.qrc b/src/libs/ifc/schema.qrc
index 7dfbc9caf..e624374fa 100644
--- a/src/libs/ifc/schema.qrc
+++ b/src/libs/ifc/schema.qrc
@@ -31,6 +31,7 @@
schema/pattern/v0.4.5.xsd
schema/pattern/v0.4.6.xsd
schema/pattern/v0.4.7.xsd
+ schema/pattern/v0.4.8.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.8.xsd b/src/libs/ifc/schema/pattern/v0.4.8.xsd
new file mode 100644
index 000000000..43a85db80
--- /dev/null
+++ b/src/libs/ifc/schema/pattern/v0.4.8.xsd
@@ -0,0 +1,903 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp
index 2e95e6e16..a4a5ca2bf 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.7");
-const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.4.7.xsd");
+const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.4.8");
+const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.4.8.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 (0x000406):
return QStringLiteral("://schema/pattern/v0.4.6.xsd");
case (0x000407):
+ return QStringLiteral("://schema/pattern/v0.4.8.xsd");
+ case (0x000408):
return CurrentSchema;
default:
InvalidVersion(ver);
@@ -343,6 +345,10 @@ void VPatternConverter::ApplyPatches()
ValidateXML(XSDSchema(0x000407), m_convertedFileName);
V_FALLTHROUGH
case (0x000407):
+ ToV0_4_8();
+ ValidateXML(XSDSchema(0x000408), m_convertedFileName);
+ V_FALLTHROUGH
+ case (0x000408):
break;
default:
InvalidVersion(m_ver);
@@ -361,7 +367,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, 7),
+ Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 4, 8),
"Check attribute readOnly.");
// Possibly in future attribute readOnly will change position etc.
@@ -720,6 +726,16 @@ void VPatternConverter::ToV0_4_7()
Save();
}
+//---------------------------------------------------------------------------------------------------------------------
+void VPatternConverter::ToV0_4_8()
+{
+ // TODO. Delete if minimal supported version is 0.4.8
+ Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 4, 8),
+ "Time to refactor the code.");
+ SetVersion(QStringLiteral("0.4.8"));
+ Save();
+}
+
//---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::TagUnitToV0_2_0()
{
diff --git a/src/libs/ifc/xml/vpatternconverter.h b/src/libs/ifc/xml/vpatternconverter.h
index dafb623c6..37c727ecc 100644
--- a/src/libs/ifc/xml/vpatternconverter.h
+++ b/src/libs/ifc/xml/vpatternconverter.h
@@ -52,14 +52,8 @@ public:
static const QString PatternMaxVerStr;
static const QString CurrentSchema;
-// 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, 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, 7);
-#endif
+ static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 8);
protected:
virtual int MinVer() const Q_DECL_OVERRIDE;
@@ -108,6 +102,7 @@ private:
void ToV0_4_5();
void ToV0_4_6();
void ToV0_4_7();
+ void ToV0_4_8();
void TagUnitToV0_2_0();
void TagIncrementToV0_2_0();
diff --git a/src/libs/vgeometry/vgobject.cpp b/src/libs/vgeometry/vgobject.cpp
index a8146e252..162eab73d 100644
--- a/src/libs/vgeometry/vgobject.cpp
+++ b/src/libs/vgeometry/vgobject.cpp
@@ -419,7 +419,7 @@ QPointF VGObject::ClosestPoint(const QLineF &line, const QPointF &point)
}
else
{
- return QPointF();
+ return point;
}
}
diff --git a/src/libs/vlayout/vabstractpiece.cpp b/src/libs/vlayout/vabstractpiece.cpp
index c326c3cb5..06584008d 100644
--- a/src/libs/vlayout/vabstractpiece.cpp
+++ b/src/libs/vlayout/vabstractpiece.cpp
@@ -755,6 +755,51 @@ QLineF VAbstractPiece::ParallelLine(const VSAPoint &p1, const VSAPoint &p2, qrea
return paralel;
}
+//---------------------------------------------------------------------------------------------------------------------
+QVector VAbstractPiece::ParallelCurve(const QVector &points, qreal width)
+{
+ QVector curvePoints;
+
+ bool removeFirstAndLast = false;
+ const QVector p = CorrectEquidistantPoints(points, removeFirstAndLast);
+
+ if (p.size() < 2)
+ {
+ return QVector();
+ }
+ else if (p.size() < 3)
+ {
+ const QLineF line = ParallelLine(p.at(0), p.at(1), width);
+ curvePoints << line.p1();
+ curvePoints << line.p2();
+ }
+ else
+ {
+ for (qint32 i = 0; i < p.size(); ++i)
+ {
+ if ( i == 0)
+ {//first point
+ curvePoints << ParallelLine(p.at(i), p.at(i+1), width).p1();
+ continue;
+ }
+
+ if (i == p.size()-1)
+ {//last point
+ if (not curvePoints.isEmpty())
+ {
+ curvePoints << ParallelLine(p.at(i-1), p.at(i), width).p2();
+ }
+ continue;
+ }
+ //points in the middle of polyline
+ curvePoints << EkvPoint(p.at(i-1), p.at(i), p.at(i+1), p.at(i), width);
+ }
+ }
+
+ curvePoints = CheckLoops(CorrectEquidistantPoints(curvePoints, removeFirstAndLast));//Result path can contain loops
+ return curvePoints;
+}
+
//---------------------------------------------------------------------------------------------------------------------
QLineF VAbstractPiece::ParallelLine(const QPointF &p1, const QPointF &p2, qreal width)
{
@@ -970,3 +1015,23 @@ bool VAbstractPiece::IsEkvPointOnLine(const VSAPoint &iPoint, const VSAPoint &pr
}
return (VGObject::IsPointOnLineviaPDP(iPoint, prevPoint, nextPoint) && ekvPointOnLine);
}
+
+//---------------------------------------------------------------------------------------------------------------------
+qreal VSAPoint::GetSABefore(qreal width) const
+{
+ if (m_before < 0)
+ {
+ return width;
+ }
+ return m_before;
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+qreal VSAPoint::GetSAAfter(qreal width) const
+{
+ if (m_after < 0)
+ {
+ return width;
+ }
+ return m_after;
+}
diff --git a/src/libs/vlayout/vabstractpiece.h b/src/libs/vlayout/vabstractpiece.h
index b3d720352..b34ea01b1 100644
--- a/src/libs/vlayout/vabstractpiece.h
+++ b/src/libs/vlayout/vabstractpiece.h
@@ -56,9 +56,11 @@ public:
Q_DECL_CONSTEXPR explicit VSAPoint(const QPointF &p);
Q_DECL_CONSTEXPR qreal GetSABefore() const;
+ qreal GetSABefore(qreal width) const;
void SetSABefore(qreal value);
Q_DECL_CONSTEXPR qreal GetSAAfter() const;
+ qreal GetSAAfter(qreal width) const;
void SetSAAfter(qreal value);
Q_DECL_CONSTEXPR PieceNodeAngle GetAngleType() const;
@@ -171,6 +173,7 @@ public:
static QVector EkvPoint(const VSAPoint &p1Line1, const VSAPoint &p2Line1,
const VSAPoint &p1Line2, const VSAPoint &p2Line2, qreal width);
static QLineF ParallelLine(const VSAPoint &p1, const VSAPoint &p2, qreal width);
+ static QVector ParallelCurve(const QVector &points, qreal width);
template
static QVector CorrectEquidistantPoints(const QVector &points, bool removeFirstAndLast = true);
diff --git a/src/libs/vmisc/def.cpp b/src/libs/vmisc/def.cpp
index 9353d6f1d..ca4f04852 100644
--- a/src/libs/vmisc/def.cpp
+++ b/src/libs/vmisc/def.cpp
@@ -2070,6 +2070,7 @@ PassmarkLineType StringToPassmarkLineType(const QString &value)
const QString strStraightforward = QStringLiteral("straightforward");
const QString strBisector = QStringLiteral("bisector");
+const QString strIntersection = QStringLiteral("intersection");
//---------------------------------------------------------------------------------------------------------------------
QString PassmarkAngleTypeToString(PassmarkAngleType type)
@@ -2080,6 +2081,8 @@ QString PassmarkAngleTypeToString(PassmarkAngleType type)
return strStraightforward;
case PassmarkAngleType::Bisector:
return strBisector;
+ case PassmarkAngleType::Intersection:
+ return strIntersection;
default:
break;
}
@@ -2090,7 +2093,7 @@ QString PassmarkAngleTypeToString(PassmarkAngleType type)
//---------------------------------------------------------------------------------------------------------------------
PassmarkAngleType StringToPassmarkAngleType(const QString &value)
{
- const QStringList values = QStringList() << strStraightforward << strBisector;
+ const QStringList values = QStringList() << strStraightforward << strBisector << strIntersection;
switch(values.indexOf(value))
{
@@ -2098,6 +2101,8 @@ PassmarkAngleType StringToPassmarkAngleType(const QString &value)
return PassmarkAngleType::Straightforward;
case 1:
return PassmarkAngleType::Bisector;
+ case 2:
+ return PassmarkAngleType::Intersection;
default:
break;
}
diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h
index af1fb56d4..fce2848d7 100644
--- a/src/libs/vmisc/def.h
+++ b/src/libs/vmisc/def.h
@@ -104,7 +104,8 @@ PassmarkLineType StringToPassmarkLineType(const QString &value);
enum class PassmarkAngleType : unsigned char
{
Straightforward = 0, // Default
- Bisector
+ Bisector,
+ Intersection
};
QString PassmarkAngleTypeToString(PassmarkAngleType type);
@@ -698,6 +699,7 @@ extern const QString strThree;
extern const QString strStraightforward;
extern const QString strBisector;
+extern const QString strIntersection;
void SetOverrideCursor(const QString & pixmapPath, int hotX = -1, int hotY = -1);
void SetOverrideCursor(Qt::CursorShape shape);
diff --git a/src/libs/vpatterndb/vpiece.cpp b/src/libs/vpatterndb/vpiece.cpp
index 7259a9fff..d81f0427b 100644
--- a/src/libs/vpatterndb/vpiece.cpp
+++ b/src/libs/vpatterndb/vpiece.cpp
@@ -201,7 +201,7 @@ QVector CreatePassmarkLines(PassmarkLineType lineType, PassmarkAngleType
{
QVector passmarksLines;
- if (angleType == PassmarkAngleType::Straightforward)
+ if (angleType == PassmarkAngleType::Straightforward || angleType == PassmarkAngleType::Intersection)
{
switch (lineType)
{
@@ -936,26 +936,27 @@ bool VPiece::GetPassmarkSAPoint(const QVector &path, int index, cons
}
//---------------------------------------------------------------------------------------------------------------------
-bool VPiece::GetPassmarkPreviousSAPoint(const QVector &path, int index, const VSAPoint &passmarkSAPoint,
- const VContainer *data, VSAPoint &point) const
+int VPiece::GetPassmarkPreviousSAPoints(const QVector &path, int index, const VSAPoint &passmarkSAPoint,
+ const VContainer *data, QVector &points) const
{
SCASSERT(data != nullptr)
- const QVector points = GetNodeSAPoints(path, index, data);
+ const QVector saPoints = GetNodeSAPoints(path, index, data);
- if (points.isEmpty())
+ if (saPoints.isEmpty())
{
- return false; // Something wrong
+ return -1; // Something wrong
}
+ int saIndex = -1;
bool found = false;
- int nodeIndex = points.size()-1;
+ int nodeIndex = saPoints.size()-1;
do
{
- const VSAPoint previous = points.at(nodeIndex);
+ const VSAPoint previous = saPoints.at(nodeIndex);
if (passmarkSAPoint.toPoint() != previous.toPoint())
{
- point = previous;
+ saIndex = nodeIndex;
found = true;
}
--nodeIndex;
@@ -963,41 +964,44 @@ bool VPiece::GetPassmarkPreviousSAPoint(const QVector &path, int ind
if (not found)
{
- return false; // Something wrong
+ return -1; // Something wrong
}
- return true;
+ points = saPoints;
+ return saIndex;
}
//---------------------------------------------------------------------------------------------------------------------
-bool VPiece::GetPassmarkNextSAPoint(const QVector &path, int index, const VSAPoint &passmarkSAPoint,
- const VContainer *data, VSAPoint &point) const
+int VPiece::GetPassmarkNextSAPoints(const QVector &path, int index, const VSAPoint &passmarkSAPoint,
+ const VContainer *data, QVector &points) const
{
- const QVector points = GetNodeSAPoints(path, index, data);
+ const QVector saPoints = GetNodeSAPoints(path, index, data);
- if (points.isEmpty())
+ if (saPoints.isEmpty())
{
- return false; // Something wrong
+ return -1; // Something wrong
}
+ int saIndex = -1;
bool found = false;
int nodeIndex = 0;
do
{
- const VSAPoint next = points.at(nodeIndex);
+ const VSAPoint next = saPoints.at(nodeIndex);
if (passmarkSAPoint.toPoint() != next.toPoint())
{
- point = next;
+ saIndex = nodeIndex;
found = true;
}
++nodeIndex;
- } while (nodeIndex < points.size() && not found);
+ } while (nodeIndex < saPoints.size() && not found);
if (not found)
{
- return false; // Something wrong
+ return -1; // Something wrong
}
- return true;
+ points = saPoints;
+ return saIndex;
}
//---------------------------------------------------------------------------------------------------------------------
@@ -1095,14 +1099,17 @@ QVector VPiece::CreatePassmark(const QVector &path, int prev
return QVector(); // Something wrong
}
- VSAPoint previousSAPoint;
- if (not GetPassmarkPreviousSAPoint(path, previousIndex, passmarkSAPoint, data, previousSAPoint))
+ QVector previousSAPoints;
+ const int previousSAPointIndex = GetPassmarkPreviousSAPoints(path, previousIndex, passmarkSAPoint, data,
+ previousSAPoints);
+ if (previousSAPointIndex == -1)
{
return QVector(); // Something wrong
}
- VSAPoint nextSAPoint;
- if (not GetPassmarkNextSAPoint(path, nextIndex, passmarkSAPoint, data, nextSAPoint))
+ QVector nextSAPoints;
+ const int nextSAPointIndex = GetPassmarkNextSAPoints(path, nextIndex, passmarkSAPoint, data, nextSAPoints);
+ if (nextSAPointIndex == -1)
{
return QVector(); // Something wrong
}
@@ -1110,24 +1117,33 @@ QVector VPiece::CreatePassmark(const QVector &path, int prev
if (not IsSeamAllowanceBuiltIn())
{
QVector lines;
- lines += SAPassmark(path, previousSAPoint, passmarkSAPoint, nextSAPoint, data, passmarkIndex);
- if (qApp->Settings()->IsDoublePassmark() && path.at(passmarkIndex).IsMainPathNode())
+ lines += SAPassmark(path, previousSAPoints, previousSAPointIndex, passmarkSAPoint, nextSAPoints,
+ nextSAPointIndex, data, passmarkIndex);
+ if (qApp->Settings()->IsDoublePassmark()
+ && path.at(passmarkIndex).IsMainPathNode()
+ && path.at(passmarkIndex).GetPassmarkAngleType() != PassmarkAngleType::Intersection)
{
- lines += BuiltInSAPassmark(path, previousSAPoint, passmarkSAPoint, nextSAPoint, data, passmarkIndex);
+ lines += BuiltInSAPassmark(path, previousSAPoints.at(previousSAPointIndex), passmarkSAPoint,
+ nextSAPoints.at(nextSAPointIndex), data, passmarkIndex);
}
return lines;
}
else
{
- return BuiltInSAPassmark(path, previousSAPoint, passmarkSAPoint, nextSAPoint, data, passmarkIndex);
+ return BuiltInSAPassmark(path, previousSAPoints.at(previousSAPointIndex), passmarkSAPoint,
+ nextSAPoints.at(nextSAPointIndex), data, passmarkIndex);
}
}
//---------------------------------------------------------------------------------------------------------------------
-QVector VPiece::SAPassmark(const QVector &path, const VSAPoint &previousSAPoint,
- const VSAPoint &passmarkSAPoint, const VSAPoint &nextSAPoint, const VContainer *data,
- int passmarkIndex) const
+QVector VPiece::SAPassmark(const QVector &path, const QVector &previousSAPoints,
+ const int previousSAPointIndex, const VSAPoint &passmarkSAPoint,
+ const QVector &nextSAPoints, const int nextSAPointIndex,
+ const VContainer *data, int passmarkIndex) const
{
+ const VSAPoint &previousSAPoint = previousSAPoints.at(previousSAPointIndex);
+ const VSAPoint &nextSAPoint = nextSAPoints.at(nextSAPointIndex);
+
QPointF seamPassmarkSAPoint;
if (not GetSeamPassmarkSAPoint(previousSAPoint, passmarkSAPoint, nextSAPoint, data, seamPassmarkSAPoint))
{
@@ -1149,7 +1165,7 @@ QVector VPiece::SAPassmark(const QVector &path, const VSAPoi
line.setLength(passmarkLength);
passmarksLines += CreatePassmarkLines(node.GetPassmarkLineType(), node.GetPassmarkAngleType(), line);
}
- else
+ else if (node.GetPassmarkAngleType() == PassmarkAngleType::Bisector)
{
QLineF edge1 = QLineF(seamPassmarkSAPoint, bigLine1.p1());
QLineF edge2 = QLineF(seamPassmarkSAPoint, bigLine2.p2());
@@ -1159,6 +1175,86 @@ QVector VPiece::SAPassmark(const QVector &path, const VSAPoi
passmarksLines += CreatePassmarkLines(node.GetPassmarkLineType(), node.GetPassmarkAngleType(), edge1);
}
+ else if (node.GetPassmarkAngleType() == PassmarkAngleType::Intersection)
+ {
+ {
+ // first passmark
+ QPointF p;
+ QLineF line(previousSAPoint, passmarkSAPoint);
+
+ if (nextSAPoints.size() < 2)
+ {
+ const QLineF::IntersectType type = line.intersect(bigLine2, &p);
+ if (type == QLineF::NoIntersection)
+ {
+ p = passmarkSAPoint;
+ }
+ }
+ else
+ {
+ line.setLength(line.length() + passmarkSAPoint.GetSAAfter(width)*2);
+
+ QVector vector;
+ vector << previousSAPoints;
+ vector.append(passmarkSAPoint);
+ vector << nextSAPoints;
+
+ const QVector curvePoints = ParallelCurve(vector, width);
+ const QVector intersections = VAbstractCurve::CurveIntersectLine(curvePoints, line);
+
+ if (intersections.isEmpty())
+ {
+ return QVector(); // Something wrong
+ }
+
+ p = intersections.first();
+ }
+
+ line = QLineF(p, passmarkSAPoint);
+ line.setLength(qMin(passmarkSAPoint.GetSAAfter(width) * passmarkFactor, maxPassmarkLength));
+
+ passmarksLines += CreatePassmarkLines(node.GetPassmarkLineType(), node.GetPassmarkAngleType(), line);
+ }
+
+ {
+ // second passmark
+ QPointF p;
+ QLineF line(nextSAPoint, passmarkSAPoint);
+
+ if (previousSAPoints.size() < 2)
+ {
+ const QLineF::IntersectType type = line.intersect(bigLine1, &p);
+ if (type == QLineF::NoIntersection)
+ {
+ p = passmarkSAPoint;
+ }
+ }
+ else
+ {
+ line.setLength(line.length() + passmarkSAPoint.GetSABefore(width)*2);
+
+ QVector vector;
+ vector << previousSAPoints;
+ vector.append(passmarkSAPoint);
+ vector << nextSAPoints;
+
+ const QVector curvePoints = ParallelCurve(vector, width);
+ const QVector intersections = VAbstractCurve::CurveIntersectLine(curvePoints, line);
+
+ if (intersections.isEmpty())
+ {
+ return QVector(); // Something wrong
+ }
+
+ p = intersections.last();
+ }
+
+ line = QLineF(p, passmarkSAPoint);
+ line.setLength(qMin(passmarkSAPoint.GetSABefore(width) * passmarkFactor, maxPassmarkLength));
+
+ passmarksLines += CreatePassmarkLines(node.GetPassmarkLineType(), node.GetPassmarkAngleType(), line);
+ }
+ }
return passmarksLines;
}
diff --git a/src/libs/vpatterndb/vpiece.h b/src/libs/vpatterndb/vpiece.h
index 883704275..f6a5b9092 100644
--- a/src/libs/vpatterndb/vpiece.h
+++ b/src/libs/vpatterndb/vpiece.h
@@ -129,10 +129,10 @@ private:
QVector GetNodeSAPoints(const QVector &path, int index, const VContainer *data) const;
bool GetPassmarkSAPoint(const QVector &path, int index, const VContainer *data, VSAPoint &point) const;
- bool GetPassmarkPreviousSAPoint(const QVector &path, int index, const VSAPoint &passmarkSAPoint,
- const VContainer *data, VSAPoint &point) const;
- bool GetPassmarkNextSAPoint(const QVector &path, int index, const VSAPoint &passmarkSAPoint,
- const VContainer *data, VSAPoint &point) const;
+ int GetPassmarkPreviousSAPoints(const QVector &path, int index, const VSAPoint &passmarkSAPoint,
+ const VContainer *data, QVector &points) const;
+ int GetPassmarkNextSAPoints(const QVector &path, int index, const VSAPoint &passmarkSAPoint,
+ const VContainer *data, QVector &points) const;
bool GetSeamPassmarkSAPoint(const VSAPoint &previousSAPoint, const VSAPoint &passmarkSAPoint,
const VSAPoint &nextSAPoint, const VContainer *data, QPointF &point) const;
@@ -140,9 +140,10 @@ 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 SAPassmark(const QVector &path, const QVector &previousSAPoints,
+ const int previousSAPointIndex, const VSAPoint &passmarkSAPoint,
+ const QVector &nextSAPoints, const int nextSAPointIndex,
+ 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;
diff --git a/src/libs/vtools/dialogs/tools/dialogpiecepath.cpp b/src/libs/vtools/dialogs/tools/dialogpiecepath.cpp
index 9cb5ce3a5..a3188e0a7 100644
--- a/src/libs/vtools/dialogs/tools/dialogpiecepath.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogpiecepath.cpp
@@ -388,6 +388,7 @@ void DialogPiecePath::PassmarkChanged(int index)
ui->radioButtonStraightforward->setDisabled(true);
ui->radioButtonBisector->setDisabled(true);
+ ui->radioButtonIntersection->setDisabled(true);
ui->groupBoxMarkType->blockSignals(true);
ui->groupBoxAngleType->blockSignals(true);
@@ -431,6 +432,7 @@ void DialogPiecePath::PassmarkChanged(int index)
// Angle type
ui->radioButtonStraightforward->setEnabled(true);
ui->radioButtonBisector->setEnabled(true);
+ ui->radioButtonIntersection->setEnabled(true);
switch(node.GetPassmarkAngleType())
{
@@ -440,6 +442,9 @@ void DialogPiecePath::PassmarkChanged(int index)
case PassmarkAngleType::Bisector:
ui->radioButtonBisector->setChecked(true);
break;
+ case PassmarkAngleType::Intersection:
+ ui->radioButtonIntersection->setChecked(true);
+ break;
default:
break;
}
@@ -523,6 +528,10 @@ void DialogPiecePath::PassmarkAngleTypeChanged(int id)
{
angleType = PassmarkAngleType::Bisector;
}
+ else if (id == ui->buttonGroupAngleType->id(ui->radioButtonIntersection))
+ {
+ angleType = PassmarkAngleType::Intersection;
+ }
rowNode.SetPassmarkAngleType(angleType);
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
diff --git a/src/libs/vtools/dialogs/tools/dialogpiecepath.ui b/src/libs/vtools/dialogs/tools/dialogpiecepath.ui
index e08a7b3d6..553af560c 100644
--- a/src/libs/vtools/dialogs/tools/dialogpiecepath.ui
+++ b/src/libs/vtools/dialogs/tools/dialogpiecepath.ui
@@ -923,6 +923,22 @@
+ -
+
+
+ false
+
+
+ Select if need designate the corner point as a passmark
+
+
+ Intersection
+
+
+ buttonGroupAngleType
+
+
+
@@ -993,7 +1009,7 @@
-
+
diff --git a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp
index 3f84f4e59..5c78b7962 100644
--- a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp
+++ b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp
@@ -853,6 +853,7 @@ void DialogSeamAllowance::PassmarkChanged(int index)
uiTabPassmarks->radioButtonStraightforward->setDisabled(true);
uiTabPassmarks->radioButtonBisector->setDisabled(true);
+ uiTabPassmarks->radioButtonIntersection->setDisabled(true);
uiTabPassmarks->groupBoxMarkType->blockSignals(true);
uiTabPassmarks->groupBoxAngleType->blockSignals(true);
@@ -896,6 +897,7 @@ void DialogSeamAllowance::PassmarkChanged(int index)
// Angle type
uiTabPassmarks->radioButtonStraightforward->setEnabled(true);
uiTabPassmarks->radioButtonBisector->setEnabled(true);
+ uiTabPassmarks->radioButtonIntersection->setEnabled(true);
switch(node.GetPassmarkAngleType())
{
@@ -905,6 +907,9 @@ void DialogSeamAllowance::PassmarkChanged(int index)
case PassmarkAngleType::Bisector:
uiTabPassmarks->radioButtonBisector->setChecked(true);
break;
+ case PassmarkAngleType::Intersection:
+ uiTabPassmarks->radioButtonIntersection->setChecked(true);
+ break;
default:
break;
}
@@ -1221,6 +1226,10 @@ void DialogSeamAllowance::PassmarkAngleTypeChanged(int id)
{
angleType = PassmarkAngleType::Bisector;
}
+ else if (id == uiTabPassmarks->buttonGroupAngleType->id(uiTabPassmarks->radioButtonIntersection))
+ {
+ angleType = PassmarkAngleType::Intersection;
+ }
rowNode.SetPassmarkAngleType(angleType);
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 0aa14e7d2..fa36033bd 100644
--- a/src/libs/vtools/dialogs/tools/piece/tabs/tabpassmarks.ui
+++ b/src/libs/vtools/dialogs/tools/piece/tabs/tabpassmarks.ui
@@ -6,8 +6,8 @@
0
0
- 208
- 321
+ 222
+ 349
@@ -140,6 +140,22 @@
+ -
+
+
+ false
+
+
+ Select if need designate the corner point as a passmark
+
+
+ Intersection
+
+
+ buttonGroupAngleType
+
+
+