From e18d3281786065a41be52f41c1ca08b28f7dd57d Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sun, 21 Jul 2019 10:19:00 +0300 Subject: [PATCH] Do not use piece's path for nesting. Use only layout allowance path. --HG-- branch : develop --- src/libs/vlayout/vlayoutpiece.cpp | 12 ---------- src/libs/vlayout/vlayoutpiece.h | 3 --- src/libs/vlayout/vposition.cpp | 38 ++++--------------------------- 3 files changed, 4 insertions(+), 49 deletions(-) diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index 6a71bc1e9..edf8eef5b 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -856,24 +856,12 @@ int VLayoutPiece::LayoutEdgesCount() const return d->layoutAllowance.count(); } -//--------------------------------------------------------------------------------------------------------------------- -QLineF VLayoutPiece::DetailEdge(int i) const -{ - return Edge(DetailPath(), i); -} - //--------------------------------------------------------------------------------------------------------------------- QLineF VLayoutPiece::LayoutEdge(int i) const { return Edge(d->layoutAllowance, i); } -//--------------------------------------------------------------------------------------------------------------------- -int VLayoutPiece::DetailEdgeByPoint(const QPointF &p1) const -{ - return EdgeByPoint(DetailPath(), p1); -} - //--------------------------------------------------------------------------------------------------------------------- int VLayoutPiece::LayoutEdgeByPoint(const QPointF &p1) const { diff --git a/src/libs/vlayout/vlayoutpiece.h b/src/libs/vlayout/vlayoutpiece.h index f31fa2119..63047275e 100644 --- a/src/libs/vlayout/vlayoutpiece.h +++ b/src/libs/vlayout/vlayoutpiece.h @@ -133,10 +133,7 @@ public: int DetailEdgesCount() const; int LayoutEdgesCount() const; - QLineF DetailEdge(int i) const; QLineF LayoutEdge(int i) const; - - int DetailEdgeByPoint(const QPointF &p1) const; int LayoutEdgeByPoint(const QPointF &p1) const; QRectF DetailBoundingRect() const; diff --git a/src/libs/vlayout/vposition.cpp b/src/libs/vlayout/vposition.cpp index a3ecb1fb8..a75afa327 100644 --- a/src/libs/vlayout/vposition.cpp +++ b/src/libs/vlayout/vposition.cpp @@ -240,14 +240,7 @@ bool VPosition::CheckCombineEdges(VLayoutPiece &detail, int j, int &dEdge) if (flagMirror && not detail.IsForbidFlipping()) { - if (m_data.gContour.GetContour().isEmpty()) - { - dEdge = detail.DetailEdgeByPoint(globalEdge.p2()); - } - else - { - dEdge = detail.LayoutEdgeByPoint(globalEdge.p2()); - } + dEdge = detail.LayoutEdgeByPoint(globalEdge.p2()); if (dEdge <= 0) { @@ -367,15 +360,7 @@ bool VPosition::SheetContains(const QRectF &rect) const //--------------------------------------------------------------------------------------------------------------------- void VPosition::CombineEdges(VLayoutPiece &detail, const QLineF &globalEdge, int dEdge) { - QLineF detailEdge; - if (m_data.gContour.GetContour().isEmpty()) - { - detailEdge = detail.DetailEdge(dEdge); - } - else - { - detailEdge = detail.LayoutEdge(dEdge); - } + QLineF detailEdge = detail.LayoutEdge(dEdge); // Find distance between two edges for two begin vertex. const qreal dx = globalEdge.x2() - detailEdge.x2(); @@ -396,24 +381,9 @@ void VPosition::CombineEdges(VLayoutPiece &detail, const QLineF &globalEdge, int //--------------------------------------------------------------------------------------------------------------------- void VPosition::RotateEdges(VLayoutPiece &detail, const QLineF &globalEdge, int dEdge, qreal angle) const { - QLineF detailEdge; - if (m_data.gContour.GetContour().isEmpty()) - { - detailEdge = detail.DetailEdge(dEdge); - } - else - { - detailEdge = detail.LayoutEdge(dEdge); - } - - // Find distance between two edges for two begin vertex. - const qreal dx = globalEdge.x2() - detailEdge.x2(); - const qreal dy = globalEdge.y2() - detailEdge.y2(); - - detailEdge.translate(dx, dy); // Use values for translate detail edge. - + QLineF detailEdge = detail.LayoutEdge(dEdge); // Now we move detail to position near to global contour edge. - detail.Translate(dx, dy); + detail.Translate(globalEdge.x2() - detailEdge.x2(), globalEdge.y2() - detailEdge.y2()); detail.Rotate(globalEdge.p2(), angle); }