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

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Mar 1 04:00:30 PST 2017


Author: hcho
Date: 2017-03-01 04:00:30 -0800 (Wed, 01 Mar 2017)
New Revision: 70711

Modified:
   grass/trunk/lib/vector/Vlib/sindex.c
Log:
Vlib: Don't select duplicate areas

Modified: grass/trunk/lib/vector/Vlib/sindex.c
===================================================================
--- grass/trunk/lib/vector/Vlib/sindex.c	2017-03-01 11:45:44 UTC (rev 70710)
+++ grass/trunk/lib/vector/Vlib/sindex.c	2017-03-01 12:00:30 UTC (rev 70711)
@@ -44,7 +44,7 @@
 	    Box->E, Box->W, Box->T, Box->B);
     plus = &(Map->plus);
 
-    list->n_values = 0;
+    Vect_reset_list(list);
 
     ntypes = mtype = 0;
     /* count the number of different primitives in Map */
@@ -203,7 +203,7 @@
 
     plus = &(Map->plus);
 
-    list->n_values = 0;
+    Vect_reset_list(list);
 
     dig_select_nodes(plus, Box, list);
     G_debug(3, "  %d nodes selected", list->n_values);
@@ -238,7 +238,7 @@
     /* TODO: this function was not tested with isles */
     G_debug(3, "Vect_select_lines_by_polygon() nisles = %d", nisles);
 
-    List->n_values = 0;
+    Vect_reset_list(List);
     if (!LPoints)
 	LPoints = Vect_new_line_struct();
     if (!LocList) {
@@ -279,14 +279,14 @@
 	    }
 	}
 	if (intersect) {
-	    G_ilist_add(List, line);
+	    Vect_list_append(List, line);
 	    continue;
 	}
 
 	/* Check intersections of the line with area/isles boundary */
 	/* Outer boundary */
 	if (Vect_line_check_intersection(LPoints, Polygon, 0)) {
-	    G_ilist_add(List, line);
+	    Vect_list_append(List, line);
 	    continue;
 	}
 
@@ -298,7 +298,7 @@
 	    }
 	}
 	if (intersect) {
-	    G_ilist_add(List, line);
+	    Vect_list_append(List, line);
 	}
     }
 
@@ -313,8 +313,6 @@
 
    Polygons should be closed, i.e. first and last points must be identical.
 
-   Warning : values in list may be duplicate!
-
    \param Map vector map
    \param Polygon outer ring
    \param nisles number of islands or 0
@@ -334,7 +332,7 @@
     /* TODO: this function was not tested with isles */
     G_debug(3, "Vect_select_areas_by_polygon() nisles = %d", nisles);
 
-    List->n_values = 0;
+    Vect_reset_list(List);
     if (!BoundList)
 	BoundList = Vect_new_list();
 
@@ -352,23 +350,23 @@
 	G_debug(4, "boundary = %d left = %d right = %d", line, left, right);
 
 	if (left > 0) {
-	    G_ilist_add(List, left);
+	    Vect_list_append(List, left);
 	}
 	else if (left < 0) {	/* island */
 	    area = Vect_get_isle_area(Map, abs(left));
 	    G_debug(4, "  left island -> area = %d", area);
 	    if (area > 0)
-		G_ilist_add(List, area);
+		Vect_list_append(List, area);
 	}
 
 	if (right > 0) {
-	    G_ilist_add(List, right);
+	    Vect_list_append(List, right);
 	}
 	else if (right < 0) {	/* island */
 	    area = Vect_get_isle_area(Map, abs(right));
 	    G_debug(4, "  right island -> area = %d", area);
 	    if (area > 0)
-		G_ilist_add(List, area);
+		Vect_list_append(List, area);
 	}
     }
 
@@ -376,7 +374,7 @@
      * we find the area by one polygon point and add it to the list */
     area = Vect_find_area(Map, Polygon->x[0], Polygon->y[0]);
     if (area > 0)
-	G_ilist_add(List, area);
+	Vect_list_append(List, area);
 
     G_debug(3, "  %d areas selected by polygon", List->n_values);
 



More information about the grass-commit mailing list