From 135cea212d7b2e7f6951ad1ec41b1b657ecc1224 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 27 Sep 2018 15:13:43 +0300 Subject: [PATCH] Generate seam allowance only one time to use it in creating notches. --HG-- branch : release --- src/libs/vpatterndb/vpiece.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/libs/vpatterndb/vpiece.cpp b/src/libs/vpatterndb/vpiece.cpp index eb75c3408..36eb04b13 100644 --- a/src/libs/vpatterndb/vpiece.cpp +++ b/src/libs/vpatterndb/vpiece.cpp @@ -439,6 +439,10 @@ QVector VPiece::PassmarksLines(const VContainer *data, const QVector passmarks; + QVector seamPoints; + seamAllowance.isEmpty() && not IsSeamAllowanceBuiltIn() ? seamPoints = SeamAllowancePoints(data) : + seamPoints = seamAllowance; + for (int i = 0; i< unitedPath.size(); ++i) { const VPieceNode &node = unitedPath.at(i); @@ -450,7 +454,7 @@ QVector VPiece::PassmarksLines(const VContainer *data, const QVector VPiece::SAPassmark(const QVector &path, VSAPoint &pr const VSAPoint &passmarkSAPoint, VSAPoint &nextSAPoint, const VContainer *data, int passmarkIndex, const QVector &seamAllowance) const { + if (seamAllowance.size() < 2) + { + return QVector(); // Something wrong + } + QPointF seamPassmarkSAPoint; if (not GetSeamPassmarkSAPoint(previousSAPoint, passmarkSAPoint, nextSAPoint, data, seamPassmarkSAPoint)) { @@ -1290,14 +1299,11 @@ QVector VPiece::SAPassmark(const QVector &path, VSAPoint &pr || node.GetPassmarkAngleType() == PassmarkAngleType::IntersectionOnlyLeft || node.GetPassmarkAngleType() == PassmarkAngleType::IntersectionOnlyRight) { - QVector seamPoints; - seamAllowance.isEmpty() ? seamPoints = SeamAllowancePoints(data) : seamPoints = seamAllowance; - if (node.GetPassmarkAngleType() == PassmarkAngleType::Intersection || node.GetPassmarkAngleType() == PassmarkAngleType::IntersectionOnlyRight) { // first passmark - PassmarkIntersection(QLineF(previousSAPoint, passmarkSAPoint), seamPoints, + PassmarkIntersection(QLineF(previousSAPoint, passmarkSAPoint), seamAllowance, passmarkSAPoint.GetSAAfter(width)); } @@ -1305,7 +1311,7 @@ QVector VPiece::SAPassmark(const QVector &path, VSAPoint &pr || node.GetPassmarkAngleType() == PassmarkAngleType::IntersectionOnlyLeft) { // second passmark - PassmarkIntersection(QLineF(nextSAPoint, passmarkSAPoint), seamPoints, + PassmarkIntersection(QLineF(nextSAPoint, passmarkSAPoint), seamAllowance, passmarkSAPoint.GetSABefore(width)); } } @@ -1313,16 +1319,13 @@ QVector VPiece::SAPassmark(const QVector &path, VSAPoint &pr || node.GetPassmarkAngleType() == PassmarkAngleType::Intersection2OnlyLeft || node.GetPassmarkAngleType() == PassmarkAngleType::Intersection2OnlyRight) { - QVector seamPoints; - seamAllowance.isEmpty() ? seamPoints = SeamAllowancePoints(data) : seamPoints = seamAllowance; - if (node.GetPassmarkAngleType() == PassmarkAngleType::Intersection2 || node.GetPassmarkAngleType() == PassmarkAngleType::Intersection2OnlyRight) { // first passmark QLineF line(passmarkSAPoint, nextSAPoint); line.setAngle(line.angle()+90); - PassmarkIntersection(line, seamPoints, passmarkSAPoint.GetSAAfter(width)); + PassmarkIntersection(line, seamAllowance, passmarkSAPoint.GetSAAfter(width)); } if (node.GetPassmarkAngleType() == PassmarkAngleType::Intersection2 @@ -1331,7 +1334,7 @@ QVector VPiece::SAPassmark(const QVector &path, VSAPoint &pr // second passmark QLineF line(passmarkSAPoint, previousSAPoint); line.setAngle(line.angle()-90); - PassmarkIntersection(line, seamPoints, passmarkSAPoint.GetSABefore(width)); + PassmarkIntersection(line, seamAllowance, passmarkSAPoint.GetSABefore(width)); } }