From: johanengelen Date: Mon, 30 Jun 2008 19:41:29 +0000 (+0000) Subject: add SPCurve::get_segment_count X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=144c1b594591ba3d62513b126ca87a5f242b2f2b;p=inkscape.git add SPCurve::get_segment_count --- 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();