From 948ae32dc598b400c72ed9fb975b97348a4a8f42 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 20 Aug 2016 17:34:49 +0300 Subject: [PATCH] Fixed regression with tool "Union details". One file in collection contain unpredicted case. For fixing returned old code. --HG-- branch : develop --- src/libs/vtools/tools/vtooluniondetails.cpp | 78 +++++++++++++-------- 1 file changed, 47 insertions(+), 31 deletions(-) diff --git a/src/libs/vtools/tools/vtooluniondetails.cpp b/src/libs/vtools/tools/vtooluniondetails.cpp index 2fb3b036d..87c3c6dbf 100644 --- a/src/libs/vtools/tools/vtooluniondetails.cpp +++ b/src/libs/vtools/tools/vtooluniondetails.cpp @@ -676,45 +676,61 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d QVector children = AllChildren(doc, id); if (not children.isEmpty()) { - qint32 i = 0; - do + // This check need for backward compatibility + // Remove check and "else" part if min version is 0.3.2 + Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 3, 2), + "Time to refactor the code."); + if (children.size() == countNodeD1 + countNodeD2-1) { - // This check need for backward compatibility - // Remove it if min version is 0.3.2 - // Instead: - // UpdatePoints(data, d1.RemoveEdge(indexD1), i, children); - Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 3, 2), - "Time to refactor the code."); - if (children.size() != countNodeD2) + qint32 i = 0; + do { UpdatePoints(data, d1.RemoveEdge(indexD1), i, children); - } - ++i; - if (i > d1.indexOfNode(det1p1.getId()) && pointsD2 < countNodeD2-1) - { - VDetail d2REdge = d2.RemoveEdge(indexD2); - qint32 j = 0; - FindIndexJ(pointsD2, d2, indexD2, j); - do + ++i; + if (i > d1.indexOfNode(det1p1.getId()) && pointsD2 < countNodeD2-1) { - if (j >= countNodeD2) + VDetail d2REdge = d2.RemoveEdge(indexD2); + qint32 j = 0; + FindIndexJ(pointsD2, d2, indexD2, j); + do { - j=0; - } - UpdatePoints(data, d2REdge, j, children, dx, dy, det1p1.getId(), angle); - ++pointsD2; - ++j; - } while (pointsD2 < countNodeD2-1); - // This check need for backward compatibility - // Remove it if min version is 0.3.2 - Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 3, 2), - "Time to refactor the code."); - if (children.size() == countNodeD2) + if (j >= countNodeD2) + { + j=0; + } + UpdatePoints(data, d2REdge, j, children, dx, dy, det1p1.getId(), angle); + ++pointsD2; + ++j; + } while (pointsD2 < countNodeD2-1); + } + } while (i d1.indexOfNode(det1p1.getId())) { + const int childrenCount = children.size(); + VDetail d2REdge = d2.RemoveEdge(indexD2); + qint32 j = 0; + FindIndexJ(pointsD2, d2, indexD2, j); + do + { + if (j >= countNodeD2) + { + j=0; + } + UpdatePoints(data, d2REdge, j, children, dx, dy, det1p1.getId(), angle); + ++pointsD2; + ++j; + } while (pointsD2 < childrenCount); break; } - } - } while (i