summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2008-06-30 19:41:29 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2008-06-30 19:41:29 +0000
commitacfd550034c5507503ef5f59315117b487baaa17 (patch)
tree370485dd5997cc90575b8c3fae97602663fd3f70 /src
parentTemporary "fix" for the recent pattern crash caused by invalid path data - pl... (diff)
downloadinkscape-acfd550034c5507503ef5f59315117b487baaa17.tar.gz
inkscape-acfd550034c5507503ef5f59315117b487baaa17.zip
add SPCurve::get_segment_count
(bzr r6100)
Diffstat (limited to 'src')
-rw-r--r--src/display/curve.cpp16
-rw-r--r--src/display/curve.h1
2 files changed, 17 insertions, 0 deletions
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();