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
This commit is contained in:
Roman Telezhynskyi 2019-06-08 15:32:25 +03:00
parent a97c90378d
commit d0cd313df0

View File

@ -244,8 +244,8 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
{ {
VLayoutPassmark layoutPassmark; VLayoutPassmark layoutPassmark;
VPiecePath path = piece.GetPath(); const QVector<VPieceNode> path = piece.GetUnitedPath(pattern);
const int nodeIndex = path.indexOfNode(pData.id); const int nodeIndex = VPiecePath::indexOfNode(path, pData.id);
if (nodeIndex != -1) if (nodeIndex != -1)
{ {
layoutPassmark.lines = passmark.BuiltInSAPassmark(piece, pattern); layoutPassmark.lines = passmark.BuiltInSAPassmark(piece, pattern);
@ -255,14 +255,21 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
layoutPassmarks.append(layoutPassmark); 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) auto PrepareSAPassmark = [pData, passmark, piece, &layoutPassmarks, pattern](PassmarkSide side)
{ {
VLayoutPassmark layoutPassmark; VLayoutPassmark layoutPassmark;
VPiecePath path = piece.GetPath(); const QVector<VPieceNode> path = piece.GetUnitedPath(pattern);
const int nodeIndex = path.indexOfNode(pData.id); const int nodeIndex = VPiecePath::indexOfNode(path, pData.id);
if (nodeIndex != -1) if (nodeIndex != -1)
{ {
QVector<QLineF> lines = QVector<QLineF> lines =
@ -282,6 +289,13 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
layoutPassmarks.append(layoutPassmark); 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()) if (not piece.IsSeamAllowanceBuiltIn())