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

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Oct 13 04:40:49 PDT 2012


Author: mmetz
Date: 2012-10-13 04:40:49 -0700 (Sat, 13 Oct 2012)
New Revision: 53385

Modified:
   grass/trunk/lib/vector/Vlib/overlay.c
Log:
Vlib overlay: adjust for new topology

Modified: grass/trunk/lib/vector/Vlib/overlay.c
===================================================================
--- grass/trunk/lib/vector/Vlib/overlay.c	2012-10-13 11:34:11 UTC (rev 53384)
+++ grass/trunk/lib/vector/Vlib/overlay.c	2012-10-13 11:40:49 UTC (rev 53385)
@@ -106,6 +106,8 @@
     struct line_pnts *Points;
     struct line_cats *ACats, *BCats, *OCats;
     struct ilist *AOList, *BOList;
+    struct boxlist *boxlist;
+    struct bound_box box;
 
     /* TODO: support Lists */
 
@@ -115,6 +117,7 @@
     OCats = Vect_new_cats_struct();
     AOList = Vect_new_list();
     BOList = Vect_new_list();
+    boxlist = Vect_new_boxlist(0);
 
     /* TODO: support all types; at present only point x point, area x point and point x area supported  */
     if ((atype & GV_LINES) || (btype & GV_LINES))
@@ -133,17 +136,15 @@
 	    if (!(altype & GV_POINTS))
 		continue;
 
-	    node =
-		Vect_find_node(BMap, Points->x[0], Points->y[0], Points->z[0],
-			       0, 1);
-	    G_debug(3, "overlay: node = %d", node);
-	    if (node == 0)
-		continue;
+	    box.E = box.W = Points->x[0];
+	    box.N = box.S = Points->y[0];
+	    box.T = box.B = Points->z[0];
+	    Vect_select_lines_by_box(BMap, &box, GV_POINTS, boxlist);
 
 	    Vect_reset_cats(OCats);
 
-	    for (j = 0; j < Vect_get_node_n_lines(BMap, node); j++) {
-		line = Vect_get_node_line(BMap, node, j);
+	    for (j = 0; j < boxlist->n_values; j++) {
+		line = boxlist->id[j];
 		bltype = Vect_read_line(BMap, NULL, BCats, line);
 		if (!(bltype & GV_POINTS))
 		    continue;
@@ -236,5 +237,13 @@
 	}
     }
 
+    Vect_destroy_line_struct(Points);
+    Vect_destroy_cats_struct(ACats);
+    Vect_destroy_cats_struct(BCats);
+    Vect_destroy_cats_struct(OCats);
+    Vect_destroy_list(AOList);
+    Vect_destroy_list(BOList);
+    Vect_destroy_boxlist(boxlist);
+
     return 0;
 }



More information about the grass-commit mailing list