From 470ffcf7675ace78b33699dc8f737d2592c08601 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 17 Jun 2016 15:44:45 +0300 Subject: [PATCH] Fixed issue #515. Seam allowance wrong way. --HG-- branch : release --- ChangeLog.txt | 3 ++- src/libs/vlayout/vabstractdetail.cpp | 16 ++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 34d9786e8..77da4ea7e 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -6,7 +6,8 @@ - [#492] Valentina crashes when add an increment. - [#493] Error in seam allowance drawing. - [#468] Error - Tape 'Save As' should set 'Read Only' to false. -- [#501] Rename Window->Close Window to Window->Close pattern +- [#501] Rename Window->Close Window to Window->Close pattern. +- [#515] Seam allowance wrong way. # Version 0.4.4 April 12, 2016 - Updated measurement templates with all measurements. Added new template Aldrich/Women measurements. diff --git a/src/libs/vlayout/vabstractdetail.cpp b/src/libs/vlayout/vabstractdetail.cpp index c820722d1..0734f2f10 100644 --- a/src/libs/vlayout/vabstractdetail.cpp +++ b/src/libs/vlayout/vabstractdetail.cpp @@ -310,12 +310,6 @@ QVector VAbstractDetail::CheckLoops(const QVector &points) return points; } - bool closed = false; - if (points.first() == points.last()) - { - closed = true; - } - QVector ekvPoints; qint32 i, j; @@ -323,7 +317,7 @@ QVector VAbstractDetail::CheckLoops(const QVector &points) { /*Last three points no need check.*/ /*Triangle has not contain loops*/ - if (i >= count-3) + if (i > count-3) { ekvPoints.append(points.at(i)); continue; @@ -336,9 +330,11 @@ QVector VAbstractDetail::CheckLoops(const QVector &points) const QLineF line1(points.at(i), points.at(i+1)); // Because a path can contains several loops we will seek the last and only then remove the loop(s) // That's why we parse from the end - for (j = count-2; j >= i+2; --j) + for (j = count-1; j >= i+2; --j) { - const QLineF line2(points.at(j), points.at(j+1)); + QLineF line2; + j == count-1 ? line2 = QLineF(points.at(j), points.at(0)) : line2 = QLineF(points.at(j), points.at(j+1)); + const QLineF::IntersectType intersect = line1.intersect(line2, &crosPoint); if (intersect == QLineF::NoIntersection) { // According to the documentation QLineF::NoIntersection indicates that the lines do not intersect; @@ -372,7 +368,7 @@ QVector VAbstractDetail::CheckLoops(const QVector &points) } } } - else if (intersect == QLineF::BoundedIntersection && not (i == 0 && j+1 == count-1 && closed)) + else if (intersect == QLineF::BoundedIntersection && not (i == 0 && j == count-1)) { // Break, but not if intersects the first edge and the last edge in closed path if (line1.p1() != crosPoint && line1.p2() != crosPoint && line2.p1() != crosPoint && line2.p2() != crosPoint)