diff --git a/src/libs/vgeometry/vabstractcurve.cpp b/src/libs/vgeometry/vabstractcurve.cpp index d50762799..d1f89096d 100644 --- a/src/libs/vgeometry/vabstractcurve.cpp +++ b/src/libs/vgeometry/vabstractcurve.cpp @@ -321,6 +321,11 @@ QPainterPath VAbstractCurve::ShowDirection(const QVector &points) const //--------------------------------------------------------------------------------------------------------------------- qreal VAbstractCurve::PathLength(const QVector &path) { + if (path.size() < 2) + { + return 0; + } + QPainterPath splinePath; splinePath.moveTo(path.at(0)); for (qint32 i = 1; i < path.count(); ++i) diff --git a/src/libs/vgeometry/vabstractcurve.h b/src/libs/vgeometry/vabstractcurve.h index 13d16969c..3b58a8c2c 100644 --- a/src/libs/vgeometry/vabstractcurve.h +++ b/src/libs/vgeometry/vabstractcurve.h @@ -79,13 +79,14 @@ public: QString GetColor() const; void SetColor(const QString &color); + static qreal PathLength(const QVector &path); + static QVector CurveIntersectLine(const QVector &points, const QLineF &line); virtual QString NameForHistory(const QString &toolName) const=0; protected: QPainterPath ShowDirection(const QVector &points) const; virtual void CreateName() =0; - static qreal PathLength(const QVector &path); private: QSharedDataPointer d;