[GRASS-SVN] r63447 - grass/trunk/lib/python/pygrass/vector

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Dec 9 00:08:08 PST 2014


Author: zarch
Date: 2014-12-09 00:08:08 -0800 (Tue, 09 Dec 2014)
New Revision: 63447

Modified:
   grass/trunk/lib/python/pygrass/vector/geometry.py
Log:
pygrass: add documentation to method segment

Modified: grass/trunk/lib/python/pygrass/vector/geometry.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/geometry.py	2014-12-08 18:17:38 UTC (rev 63446)
+++ grass/trunk/lib/python/pygrass/vector/geometry.py	2014-12-09 08:08:08 UTC (rev 63447)
@@ -919,8 +919,28 @@
         libvect.Vect_line_reverse(self.c_points)
 
     def segment(self, start, end):
-        # TODO improve documentation
         """Create line segment. using the ``Vect_line_segment`` C function.
+
+        :param start: distance from the begining of the line where
+                      the segment start
+        :type start: float
+        :param end: distance from the begining of the line where
+                    the segment end
+        :type end: float
+
+        ::
+            #            x (1, 1)
+            #            |
+            #            |-
+            #            |
+            #   x--------x (1, 0)
+            # (0, 0) ^
+
+            >>> line = Line([(0, 0), (1, 0), (1, 1)])
+            >>> line.segment(0.5, 1.5)         #doctest: +NORMALIZE_WHITESPACE
+            Line([Point(0.500000, 0.000000),
+                  Point(1.000000, 0.000000),
+                  Point(1.000000, 0.500000)])
         """
         line = Line()
         libvect.Vect_line_segment(self.c_points, start, end, line.c_points)



More information about the grass-commit mailing list