From 144c1b594591ba3d62513b126ca87a5f242b2f2b Mon Sep 17 00:00:00 2001 From: johanengelen Date: Mon, 30 Jun 2008 19:41:29 +0000 Subject: [PATCH] add SPCurve::get_segment_count --- src/display/curve.cpp | 16 ++++++++++++++++ src/display/curve.h | 1 + 2 files changed, 17 insertions(+) diff --git a/src/display/curve.cpp b/src/display/curve.cpp index af26fdda4..6c4baaa96 100644 --- a/src/display/curve.cpp +++ b/src/display/curve.cpp @@ -283,6 +283,22 @@ SPCurve::get_length() const return _end; } +/* + * Returns the number of segments of all paths summed + */ +guint +SPCurve::get_segment_count() const +{ + guint nr = 0; + for(Geom::PathVector::const_iterator it = _pathv.begin(); it != _pathv.end(); ++it) { + nr += (*it).size(); + + if (it->closed()) nr += 1; + } + return nr; +} + + /** * Increase _refcount of curve. * diff --git a/src/display/curve.h b/src/display/curve.h index e67c3897a..7dee3dbf1 100644 --- a/src/display/curve.h +++ b/src/display/curve.h @@ -45,6 +45,7 @@ public: Geom::PathVector const & get_pathvector() const; guint get_length() const; + guint get_segment_count() const; SPCurve * ref(); SPCurve * unref(); -- 2.30.2