diff --git a/src/libs/vpatterndb/vpiece.cpp b/src/libs/vpatterndb/vpiece.cpp index 4fdbd7b9d..069c9571e 100644 --- a/src/libs/vpatterndb/vpiece.cpp +++ b/src/libs/vpatterndb/vpiece.cpp @@ -1085,7 +1085,7 @@ bool VPiece::GetPassmarkSAPoint(const QVector &path, int index, cons //--------------------------------------------------------------------------------------------------------------------- bool VPiece::GetPassmarkPreviousSAPoints(const QVector &path, int index, const VSAPoint &passmarkSAPoint, - const VContainer *data, VSAPoint &point) const + const VContainer *data, VSAPoint &point, int passmarkIndex) const { SCASSERT(data != nullptr) @@ -1093,6 +1093,9 @@ bool VPiece::GetPassmarkPreviousSAPoints(const QVector &path, int in if (points.isEmpty()) { + const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'.") + .arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName()); + qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : qWarning() << errorMsg; return false; // Something wrong } @@ -1111,6 +1114,7 @@ bool VPiece::GetPassmarkPreviousSAPoints(const QVector &path, int in if (not found) { + // No warning here because of valid case of passmark collapse return false; // Something wrong } return true; @@ -1118,7 +1122,7 @@ bool VPiece::GetPassmarkPreviousSAPoints(const QVector &path, int in //--------------------------------------------------------------------------------------------------------------------- int VPiece::GetPassmarkNextSAPoints(const QVector &path, int index, const VSAPoint &passmarkSAPoint, - const VContainer *data, VSAPoint &point) const + const VContainer *data, VSAPoint &point, int passmarkIndex) const { SCASSERT(data != nullptr) @@ -1126,6 +1130,9 @@ int VPiece::GetPassmarkNextSAPoints(const QVector &path, int index, if (points.isEmpty()) { + const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'.") + .arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName()); + qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : qWarning() << errorMsg; return false; // Something wrong } @@ -1145,6 +1152,7 @@ int VPiece::GetPassmarkNextSAPoints(const QVector &path, int index, if (not found) { + // No warning here because of valid case of passmark collapse return false; // Something wrong } return true; @@ -1258,15 +1266,14 @@ QVector VPiece::CreatePassmark(const QVector &path, int prev } VSAPoint previousSAPoint; - if (not GetPassmarkPreviousSAPoints(path, previousIndex, passmarkSAPoint, data, - previousSAPoint)) + if (not GetPassmarkPreviousSAPoints(path, previousIndex, passmarkSAPoint, data, previousSAPoint, passmarkIndex)) { // No check here because it will cover valid cases return QVector(); // Something wrong } VSAPoint nextSAPoint; - if (not GetPassmarkNextSAPoints(path, nextIndex, passmarkSAPoint, data, nextSAPoint)) + if (not GetPassmarkNextSAPoints(path, nextIndex, passmarkSAPoint, data, nextSAPoint, passmarkIndex)) { // No check here because it will cover valid cases return QVector(); // Something wrong diff --git a/src/libs/vpatterndb/vpiece.h b/src/libs/vpatterndb/vpiece.h index 4f1c65810..bc6e75254 100644 --- a/src/libs/vpatterndb/vpiece.h +++ b/src/libs/vpatterndb/vpiece.h @@ -142,9 +142,9 @@ private: bool GetPassmarkSAPoint(const QVector &path, int index, const VContainer *data, VSAPoint &point) const; bool GetPassmarkPreviousSAPoints(const QVector &path, int index, const VSAPoint &passmarkSAPoint, - const VContainer *data, VSAPoint &point) const; + const VContainer *data, VSAPoint &point, int passmarkIndex) const; int GetPassmarkNextSAPoints(const QVector &path, int index, const VSAPoint &passmarkSAPoint, - const VContainer *data, VSAPoint &point) const; + const VContainer *data, VSAPoint &point, int passmarkIndex) const; bool GetSeamPassmarkSAPoint(const VSAPoint &previousSAPoint, const VSAPoint &passmarkSAPoint, const VSAPoint &nextSAPoint, const VContainer *data, QPointF &point) const;