From d0cd313df0b0a58907d242cf8d695d141219639f Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 8 Jun 2019 15:32:25 +0300 Subject: [PATCH] Fix export passmarks for layout. Because we did not search in united path we could not draw them and silently skipped. Now user also will see a warning. --HG-- branch : develop --- src/libs/vlayout/vlayoutpiece.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index a0cf4dbc4..4d6dc84a7 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -244,8 +244,8 @@ QVector ConvertPassmarks(const VPiece &piece, const VContainer { VLayoutPassmark layoutPassmark; - VPiecePath path = piece.GetPath(); - const int nodeIndex = path.indexOfNode(pData.id); + const QVector path = piece.GetUnitedPath(pattern); + const int nodeIndex = VPiecePath::indexOfNode(path, pData.id); if (nodeIndex != -1) { layoutPassmark.lines = passmark.BuiltInSAPassmark(piece, pattern); @@ -255,14 +255,21 @@ QVector ConvertPassmarks(const VPiece &piece, const VContainer layoutPassmarks.append(layoutPassmark); } + else + { + const QString errorMsg = + QObject::tr("Passmark '%1' is not part of piece '%2'.") + .arg(pData.nodeName, piece.GetName()); + qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg; + } }; auto PrepareSAPassmark = [pData, passmark, piece, &layoutPassmarks, pattern](PassmarkSide side) { VLayoutPassmark layoutPassmark; - VPiecePath path = piece.GetPath(); - const int nodeIndex = path.indexOfNode(pData.id); + const QVector path = piece.GetUnitedPath(pattern); + const int nodeIndex = VPiecePath::indexOfNode(path, pData.id); if (nodeIndex != -1) { QVector lines = @@ -282,6 +289,13 @@ QVector ConvertPassmarks(const VPiece &piece, const VContainer layoutPassmarks.append(layoutPassmark); } + else + { + const QString errorMsg = + QObject::tr("Passmark '%1' is not part of piece '%2'.") + .arg(pData.nodeName, piece.GetName()); + qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg; + } }; if (not piece.IsSeamAllowanceBuiltIn())