[GRASS-SVN] r55523 - grass/trunk/lib/vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Mar 26 06:49:57 PDT 2013


Author: martinl
Date: 2013-03-26 06:49:56 -0700 (Tue, 26 Mar 2013)
New Revision: 55523

Modified:
   grass/trunk/lib/vector/Vlib/level_two.c
Log:
vlib: Vect_get_line_areas() return -1 on error + doxygen update


Modified: grass/trunk/lib/vector/Vlib/level_two.c
===================================================================
--- grass/trunk/lib/vector/Vlib/level_two.c	2013-03-26 12:44:25 UTC (rev 55522)
+++ grass/trunk/lib/vector/Vlib/level_two.c	2013-03-26 13:49:56 UTC (rev 55523)
@@ -330,13 +330,16 @@
 }
 
 /*!
-   \brief Get area/isle ids on the left and right
+   \brief Get area id on the left and right side of the boundary
 
+   Negative area id indicates an isle.
+   
    \param Map pointer to Map_info struct
    \param line line id
-   \param[out] left,right area/isle id on the left and right
+   \param[out] left,right area id on the left and right side
 
-   \return 1
+   \return 1 on success
+   \return -1 on failure (topology not available, line is not a boundary)
  */
 int Vect_get_line_areas(const struct Map_info *Map, int line, int *left, int *right)
 {
@@ -344,19 +347,23 @@
 
     check_level(Map);
     
-    if (!Map->plus.Line[line]->topo)
-	G_fatal_error(_("Areas not available for line %d"), line);
+    if (!Map->plus.Line[line]->topo) {
+        G_warning(_("Areas not available for line %d"), line);
+        return -1;
+    }
 
-    if (Vect_get_line_type(Map, line) != GV_BOUNDARY)
-	G_fatal_error(_("Line %d is not a boundary"), line);
+    if (Vect_get_line_type(Map, line) != GV_BOUNDARY) {
+	G_warning(_("Line %d is not a boundary"), line);
+        return -1;
+    }
 
     topo = (struct P_topo_b *)Map->plus.Line[line]->topo;
     if (left != NULL)
 	*left = topo->left;
-
+                  
     if (right != NULL)
 	*right = topo->right;
-
+    
     return 1;
 }
 



More information about the grass-commit mailing list