From 0d7c406df46aaad0f66c82af9906d4be37470c3a Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 18 Jul 2019 17:32:19 +0300 Subject: [PATCH] Fix calculating efficiency. Piece square must be based on seam allowance or main path instead of layout allowance. --HG-- branch : develop --- src/libs/vlayout/vlayoutpiece.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index c05a04a1d..c37e52dae 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -915,22 +915,29 @@ qint64 VLayoutPiece::Square() const //--------------------------------------------------------------------------------------------------------------------- void VLayoutPiece::SetLayoutAllowancePoints() { + d->m_square = 0; + if (d->layoutWidth > 0) { if (IsSeamAllowance() && not IsSeamAllowanceBuiltIn()) { - d->layoutAllowance = Equidistant(PrepareAllowance(GetMappedSeamAllowancePoints()), d->layoutWidth, GetName()); - if (d->layoutAllowance.isEmpty() == false) + d->layoutAllowance = Equidistant(PrepareAllowance(GetMappedSeamAllowancePoints()), d->layoutWidth, + GetName()); + if (not d->layoutAllowance.isEmpty()) { d->layoutAllowance.removeLast(); + + d->m_square = qFloor(qAbs(SumTrapezoids(GetSeamAllowancePoints())/2.0)); } } else { d->layoutAllowance = Equidistant(PrepareAllowance(GetMappedContourPoints()), d->layoutWidth, GetName()); - if (d->layoutAllowance.isEmpty() == false) + if (not d->layoutAllowance.isEmpty()) { d->layoutAllowance.removeLast(); + + d->m_square = qFloor(qAbs(SumTrapezoids(GetContourPoints())/2.0)); } } } @@ -938,13 +945,6 @@ void VLayoutPiece::SetLayoutAllowancePoints() { d->layoutAllowance.clear(); } - - if (d->layoutAllowance.isEmpty()) //-V807 - { - d->m_square = 0; - } - - d->m_square = qFloor(qAbs(SumTrapezoids(d->layoutAllowance)/2.0)); } //---------------------------------------------------------------------------------------------------------------------