diff --git a/src/libs/vgeometry/vabstractcurve.cpp b/src/libs/vgeometry/vabstractcurve.cpp index bf224393c..15e6d466d 100644 --- a/src/libs/vgeometry/vabstractcurve.cpp +++ b/src/libs/vgeometry/vabstractcurve.cpp @@ -126,15 +126,25 @@ QVector VAbstractCurve::GetSegmentPoints(const QVector &points } //--------------------------------------------------------------------------------------------------------------------- -QVector VAbstractCurve::GetSegmentPoints(const QPointF &begin, const QPointF &end, bool reverse) const +QVector VAbstractCurve::GetSegmentPoints(const QPointF &begin, const QPointF &end, bool reverse, + const QString &piece) const { QString error; QVector segment = GetSegmentPoints(GetPoints(), begin, end, reverse, error); if (not error.isEmpty()) { - const QString errorMsg = QObject::tr("Error calculating segment for curve '%1'. %2") - .arg(name(), error); + QString errorMsg; + if (piece.isEmpty()) + { + errorMsg = QObject::tr("Error calculating segment for curve '%1'. %2") + .arg(name(), error); + } + else + { + errorMsg = QObject::tr("Error in path '%1'. Calculating segment for curve '%2' has failed. %3") + .arg(piece, name(), error); + } qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) : qWarning() << VAbstractApplication::patternMessageSignature + errorMsg; } diff --git a/src/libs/vgeometry/vabstractcurve.h b/src/libs/vgeometry/vabstractcurve.h index 2b38cd1fa..f72d8e60f 100644 --- a/src/libs/vgeometry/vabstractcurve.h +++ b/src/libs/vgeometry/vabstractcurve.h @@ -64,7 +64,8 @@ public: virtual QVector GetPoints() const =0; static QVector GetSegmentPoints(const QVector &points, const QPointF &begin, const QPointF &end, bool reverse, QString &error); - QVector GetSegmentPoints(const QPointF &begin, const QPointF &end, bool reverse) const; + QVector GetSegmentPoints(const QPointF &begin, const QPointF &end, bool reverse, + const QString &piece = QString()) const; virtual QPainterPath GetPath() const; virtual qreal GetLength() const =0; diff --git a/src/libs/vpatterndb/vpiece.cpp b/src/libs/vpatterndb/vpiece.cpp index 1e8fccdad..44ee8202a 100644 --- a/src/libs/vpatterndb/vpiece.cpp +++ b/src/libs/vpatterndb/vpiece.cpp @@ -174,7 +174,10 @@ QVector VPiece::MainPathPoints(const VContainer *data) const { // DumpPiece(*this, data); // Uncomment for dumping test data - QVector points = GetPath().PathPoints(data); + VPiecePath mainPath = GetPath(); + mainPath.SetName(tr("Main path of piece %1").arg(GetName())); + + QVector points = mainPath.PathPoints(data); points = CheckLoops(CorrectEquidistantPoints(points));//A path can contains loops // DumpVector(points); // Uncomment for dumping test data @@ -184,7 +187,7 @@ QVector VPiece::MainPathPoints(const VContainer *data) const //--------------------------------------------------------------------------------------------------------------------- QVector VPiece::UniteMainPathPoints(const VContainer *data) const { - QVector points = VPiecePath::NodesToPoints(data, GetUnitedPath(data)); + QVector points = VPiecePath::NodesToPoints(data, GetUnitedPath(data), GetName()); points = CheckLoops(CorrectEquidistantPoints(points));//A path can contains loops return points; } @@ -731,7 +734,7 @@ QVector VPiece::SeamAllowancePointsWithRotation(const VContainer *data, const QSharedPointer curve = data->GeometricObject(node.GetId()); pointsEkv += VPiecePath::CurveSeamAllowanceSegment(data, unitedPath, curve, i, node.GetReverse(), - width); + width, GetName()); } } break; @@ -899,7 +902,7 @@ QVector VPiece::GetNodeSAPoints(const QVector &path, int i const QSharedPointer curve = data->GeometricObject(node.GetId()); const qreal width = ToPixel(GetSAWidth(), *data->GetPatternUnit()); - points += VPiecePath::CurveSeamAllowanceSegment(data, path, curve, index, node.GetReverse(), width); + points += VPiecePath::CurveSeamAllowanceSegment(data, path, curve, index, node.GetReverse(), width, GetName()); } return points; } diff --git a/src/libs/vpatterndb/vpiecepath.cpp b/src/libs/vpatterndb/vpiecepath.cpp index dbaced0b3..9ba8fa888 100644 --- a/src/libs/vpatterndb/vpiecepath.cpp +++ b/src/libs/vpatterndb/vpiecepath.cpp @@ -366,7 +366,7 @@ bool VPiecePath::IsLastToCuttingCountour() const //--------------------------------------------------------------------------------------------------------------------- QVector VPiecePath::PathPoints(const VContainer *data, const QVector &cuttingPath) const { - QVector points = NodesToPoints(data, d->m_nodes); + QVector points = NodesToPoints(data, d->m_nodes, GetName()); if (GetType() == PiecePathType::InternalPath && not cuttingPath.isEmpty() && points.size() > 1) { @@ -464,7 +464,7 @@ QVector > VPiecePath::PathCurvePoints(const VContainer *data) c const QPointF begin = StartSegment(data, i, at(i).GetReverse()); const QPointF end = EndSegment(data, i, at(i).GetReverse()); - curves.append(curve->GetSegmentPoints(begin, end, at(i).GetReverse())); + curves.append(curve->GetSegmentPoints(begin, end, at(i).GetReverse(), GetName())); break; } case (Tool::NodePoint): @@ -498,7 +498,7 @@ QVector VPiecePath::SeamAllowancePoints(const VContainer *data, qreal case (Tool::NodeSplinePath): { const QSharedPointer curve = data->GeometricObject(node.GetId()); - pointsEkv += CurveSeamAllowanceSegment(data, d->m_nodes, curve, i, node.GetReverse(), width); + pointsEkv += CurveSeamAllowanceSegment(data, d->m_nodes, curve, i, node.GetReverse(), width, GetName()); } break; default: @@ -882,7 +882,7 @@ QPointF VPiecePath::NodePreviousPoint(const VContainer *data, int i) const const VSAPoint begin = StartSegment(data, d->m_nodes, index, node.GetReverse()); const VSAPoint end = EndSegment(data, d->m_nodes, index, node.GetReverse()); - const QVector points = curve->GetSegmentPoints(begin, end, node.GetReverse()); + const QVector points = curve->GetSegmentPoints(begin, end, node.GetReverse(), GetName()); if (points.size() > 1) { return points.at(points.size()-2); @@ -934,7 +934,7 @@ QPointF VPiecePath::NodeNextPoint(const VContainer *data, int i) const const VSAPoint begin = StartSegment(data, d->m_nodes, index, node.GetReverse()); const VSAPoint end = EndSegment(data, d->m_nodes, index, node.GetReverse()); - const QVector points = curve->GetSegmentPoints(begin, end, node.GetReverse()); + const QVector points = curve->GetSegmentPoints(begin, end, node.GetReverse(), GetName()); if (points.size() > 1) { return points.at(1); @@ -1084,14 +1084,14 @@ VSAPoint VPiecePath::PreparePointEkv(const VPieceNode &node, const VContainer *d //--------------------------------------------------------------------------------------------------------------------- QVector VPiecePath::CurveSeamAllowanceSegment(const VContainer *data, const QVector &nodes, const QSharedPointer &curve, int i, - bool reverse, qreal width) + bool reverse, qreal width, const QString &piece) { QVector pointsEkv; const VSAPoint begin = StartSegment(data, nodes, i, reverse); const VSAPoint end = EndSegment(data, nodes, i, reverse); - const QVector points = curve->GetSegmentPoints(begin, end, reverse); + const QVector points = curve->GetSegmentPoints(begin, end, reverse, piece); if (points.isEmpty()) { return pointsEkv; @@ -1193,7 +1193,8 @@ QString VPiecePath::NodeName(const QVector &nodes, int nodeIndex, co } //--------------------------------------------------------------------------------------------------------------------- -QVector VPiecePath::NodesToPoints(const VContainer *data, const QVector &nodes) +QVector VPiecePath::NodesToPoints(const VContainer *data, const QVector &nodes, + const QString &piece) { QVector points; for (int i = 0; i < nodes.size(); ++i) @@ -1223,7 +1224,7 @@ QVector VPiecePath::NodesToPoints(const VContainer *data, const QVector const QPointF begin = StartSegment(data, nodes, i, node.GetReverse()); const QPointF end = EndSegment(data, nodes, i, node.GetReverse()); - points << curve->GetSegmentPoints(begin, end, node.GetReverse()); + points << curve->GetSegmentPoints(begin, end, node.GetReverse(), piece); } break; default: diff --git a/src/libs/vpatterndb/vpiecepath.h b/src/libs/vpatterndb/vpiecepath.h index 4998d1672..ffaef1573 100644 --- a/src/libs/vpatterndb/vpiecepath.h +++ b/src/libs/vpatterndb/vpiecepath.h @@ -133,11 +133,13 @@ public: static QVector CurveSeamAllowanceSegment(const VContainer *data, const QVector &nodes, const QSharedPointer &curve, - int i, bool reverse, qreal width); + int i, bool reverse, qreal width, + const QString &piece = QString()); static QString NodeName(const QVector &nodes, int nodeIndex, const VContainer *data); - static QVector NodesToPoints(const VContainer *data, const QVector &nodes); + static QVector NodesToPoints(const VContainer *data, const QVector &nodes, + const QString &piece = QString()); private: QSharedDataPointer d;