Code

add SPCurve::get_segment_count
authorjohanengelen <johanengelen@users.sourceforge.net>
Mon, 30 Jun 2008 19:41:29 +0000 (19:41 +0000)
committerjohanengelen <johanengelen@users.sourceforge.net>
Mon, 30 Jun 2008 19:41:29 +0000 (19:41 +0000)
src/display/curve.cpp
src/display/curve.h

index af26fdda459fd7d4983c637ccdb62ce542bebb92..6c4baaa96560fc4a3ecf9c11d162a235394981b9 100644 (file)
@@ -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.
  *
index e67c3897ab302fc7936e3eb3b32d254f7c107ed8..7dee3dbf10316c62020759f67dcc47e52c6a13d7 100644 (file)
@@ -45,6 +45,7 @@ public:
     Geom::PathVector const & get_pathvector() const;
 
     guint get_length() const;
+    guint get_segment_count() const;
 
     SPCurve * ref();
     SPCurve * unref();