From c044b334d7fb47c397db3cacd26d77d56ddb40cf Mon Sep 17 00:00:00 2001 From: dismine Date: Sat, 17 Jan 2015 22:51:17 +0200 Subject: [PATCH] Fix for method UniteWithContour. --HG-- branch : feature --- src/libs/vlayout/vlayoutpaper.cpp | 41 +++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/src/libs/vlayout/vlayoutpaper.cpp b/src/libs/vlayout/vlayoutpaper.cpp index a40b35df7..8e8c255a0 100644 --- a/src/libs/vlayout/vlayoutpaper.cpp +++ b/src/libs/vlayout/vlayoutpaper.cpp @@ -639,11 +639,20 @@ QVector VLayoutPaper::UniteWithContour(const VLayoutDetail &detail, int return QVector(); } - for(int i=0; i < d->globalContour.count(); ++i) + int i2 = 0; + if (globalI == d->globalContour.count()) { - newContour.append(d->globalContour.at(i)); - ++i; - if (i==globalI) + i2 = 0; + } + else + { + i2 = globalI; + } + + int i=0; + while(i < d->globalContour.count()) + { + if (i == i2) { int processedEdges = 0; const int nD = detail.EdgesCount(); @@ -654,15 +663,31 @@ QVector VLayoutPaper::UniteWithContour(const VLayoutDetail &detail, int { j=1; } - const QVector points = CutEdge(detail.Edge(j)); - for (int i = 0; i < points.size()-1; ++i) + if (j != detJ) { - newContour.append(points.at(i)); + const QVector points = CutEdge(detail.Edge(j)); + for (int i = 0; i < points.size()-1; ++i) + { + newContour.append(points.at(i)); + } } ++processedEdges; ++j; - }while (processedEdges <= nD); + }while (processedEdges < nD); } + + if (newContour.isEmpty() == false) + { + if (newContour.last() != d->globalContour.at(i)) + { + newContour.append(d->globalContour.at(i)); + } + } + else + { + newContour.append(d->globalContour.at(i)); + } + ++i; } } return newContour;