Use method VAbstractCurve::PathLength to get length.
--HG-- branch : feature
This commit is contained in:
parent
dd8067e47f
commit
ebd58376d9
|
@ -321,6 +321,11 @@ QPainterPath VAbstractCurve::ShowDirection(const QVector<QPointF> &points) const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal VAbstractCurve::PathLength(const QVector<QPointF> &path)
|
qreal VAbstractCurve::PathLength(const QVector<QPointF> &path)
|
||||||
{
|
{
|
||||||
|
if (path.size() < 2)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
QPainterPath splinePath;
|
QPainterPath splinePath;
|
||||||
splinePath.moveTo(path.at(0));
|
splinePath.moveTo(path.at(0));
|
||||||
for (qint32 i = 1; i < path.count(); ++i)
|
for (qint32 i = 1; i < path.count(); ++i)
|
||||||
|
|
|
@ -79,13 +79,14 @@ public:
|
||||||
QString GetColor() const;
|
QString GetColor() const;
|
||||||
void SetColor(const QString &color);
|
void SetColor(const QString &color);
|
||||||
|
|
||||||
|
static qreal PathLength(const QVector<QPointF> &path);
|
||||||
|
|
||||||
static QVector<QPointF> CurveIntersectLine(const QVector<QPointF> &points, const QLineF &line);
|
static QVector<QPointF> CurveIntersectLine(const QVector<QPointF> &points, const QLineF &line);
|
||||||
|
|
||||||
virtual QString NameForHistory(const QString &toolName) const=0;
|
virtual QString NameForHistory(const QString &toolName) const=0;
|
||||||
protected:
|
protected:
|
||||||
QPainterPath ShowDirection(const QVector<QPointF> &points) const;
|
QPainterPath ShowDirection(const QVector<QPointF> &points) const;
|
||||||
virtual void CreateName() =0;
|
virtual void CreateName() =0;
|
||||||
static qreal PathLength(const QVector<QPointF> &path);
|
|
||||||
private:
|
private:
|
||||||
QSharedDataPointer<VAbstractCurveData> d;
|
QSharedDataPointer<VAbstractCurveData> d;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user