Ver código fonte

pygrass: Check returned value from Vect_point_on_line function

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@65077 15284696-431f-4ddb-bdfa-cd5b030d7da7
Pietro Zambelli 10 anos atrás
pai
commit
8f2c255681
1 arquivos alterados com 6 adições e 5 exclusões
  1. 6 5
      lib/python/pygrass/vector/geometry.py

+ 6 - 5
lib/python/pygrass/vector/geometry.py

@@ -630,11 +630,12 @@ class Line(Geo):
             str_err = "The distance exceed the lenght of the line, that is: %f"
             raise ValueError(str_err % maxdist)
         pnt = Point(0, 0, -9999)
-        libvect.Vect_point_on_line(self.c_points, distance,
-                                   pnt.c_points.contents.x,
-                                   pnt.c_points.contents.y,
-                                   pnt.c_points.contents.z,
-                                   angle, slope)
+        if not libvect.Vect_point_on_line(self.c_points, distance,
+                                          pnt.c_points.contents.x,
+                                          pnt.c_points.contents.y,
+                                          pnt.c_points.contents.z,
+                                          angle, slope):
+            raise ValueError("Vect_point_on_line give an error.")
         pnt.is2D = self.is2D
         return pnt