Use method VAbstractCurve::PathLength to get length.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2016-11-11 20:15:44 +02:00
parent dd8067e47f
commit ebd58376d9
2 changed files with 7 additions and 1 deletions

View File

@ -321,6 +321,11 @@ QPainterPath VAbstractCurve::ShowDirection(const QVector<QPointF> &points) const
//---------------------------------------------------------------------------------------------------------------------
qreal VAbstractCurve::PathLength(const QVector<QPointF> &path)
{
if (path.size() < 2)
{
return 0;
}
QPainterPath splinePath;
splinePath.moveTo(path.at(0));
for (qint32 i = 1; i < path.count(); ++i)

View File

@ -79,13 +79,14 @@ public:
QString GetColor() const;
void SetColor(const QString &color);
static qreal PathLength(const QVector<QPointF> &path);
static QVector<QPointF> CurveIntersectLine(const QVector<QPointF> &points, const QLineF &line);
virtual QString NameForHistory(const QString &toolName) const=0;
protected:
QPainterPath ShowDirection(const QVector<QPointF> &points) const;
virtual void CreateName() =0;
static qreal PathLength(const QVector<QPointF> &path);
private:
QSharedDataPointer<VAbstractCurveData> d;