[GRASS-SVN] r53688 - grass/trunk/vector/v.overlay

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Nov 5 04:43:38 PST 2012


Author: mmetz
Date: 2012-11-05 04:43:38 -0800 (Mon, 05 Nov 2012)
New Revision: 53688

Modified:
   grass/trunk/vector/v.overlay/area_area.c
   grass/trunk/vector/v.overlay/line_area.c
   grass/trunk/vector/v.overlay/local.h
   grass/trunk/vector/v.overlay/main.c
Log:
v.overlay speed-up

Modified: grass/trunk/vector/v.overlay/area_area.c
===================================================================
--- grass/trunk/vector/v.overlay/area_area.c	2012-11-05 10:01:25 UTC (rev 53687)
+++ grass/trunk/vector/v.overlay/area_area.c	2012-11-05 12:43:38 UTC (rev 53688)
@@ -17,7 +17,7 @@
 
 int area_area(struct Map_info *In, int *field, struct Map_info *Out,
 	      struct field_info *Fi, dbDriver * driver, int operator,
-	      int *ofield, ATTRIBUTES * attr)
+	      int *ofield, ATTRIBUTES * attr, struct ilist *BList)
 {
     int ret, input, line, nlines, area, nareas;
     int in_area, in_centr, out_cat;
@@ -37,7 +37,7 @@
      * and Vect_clean_small_angles_at_nodes() until no more small dangles are found */
     do {
 	G_message(_("Breaking lines..."));
-	Vect_break_lines(Out, GV_LINE | GV_BOUNDARY, NULL);
+	Vect_break_lines_list(Out, NULL, BList, GV_LINE | GV_BOUNDARY, NULL);
 
 	/* Probably not necessary for LINE x AREA */
 	G_message(_("Removing duplicates..."));

Modified: grass/trunk/vector/v.overlay/line_area.c
===================================================================
--- grass/trunk/vector/v.overlay/line_area.c	2012-11-05 10:01:25 UTC (rev 53687)
+++ grass/trunk/vector/v.overlay/line_area.c	2012-11-05 12:43:38 UTC (rev 53688)
@@ -51,7 +51,7 @@
 
 int line_area(struct Map_info *In, int *field, struct Map_info *Out,
 	      struct field_info *Fi, dbDriver * driver, int operator,
-	      int *ofield, ATTRIBUTES * attr)
+	      int *ofield, ATTRIBUTES * attr, struct ilist *BList)
 {
     int line, nlines, ncat;
     struct line_pnts *Points;
@@ -67,7 +67,7 @@
     db_init_string(&stmt);
 
     G_message(_("Breaking lines..."));
-    Vect_break_lines(Out, GV_LINE | GV_BOUNDARY, NULL);
+    Vect_break_lines_list(Out, NULL, BList, GV_LINE | GV_BOUNDARY, NULL);
 
     /* Basic topology needed only */
     Vect_build_partial(Out, GV_BUILD_BASE);

Modified: grass/trunk/vector/v.overlay/local.h
===================================================================
--- grass/trunk/vector/v.overlay/local.h	2012-11-05 10:01:25 UTC (rev 53687)
+++ grass/trunk/vector/v.overlay/local.h	2012-11-05 12:43:38 UTC (rev 53688)
@@ -32,7 +32,7 @@
 
 int area_area(struct Map_info *In, int *field, struct Map_info *Out,
 	      struct field_info *Fi, dbDriver * driver, int operator,
-	      int *ofield, ATTRIBUTES * attr);
+	      int *ofield, ATTRIBUTES * attr, struct ilist *BList);
 int line_area(struct Map_info *In, int *field, struct Map_info *Out,
 	      struct field_info *Fi, dbDriver * driver, int operator,
-	      int *ofield, ATTRIBUTES * attr);
+	      int *ofield, ATTRIBUTES * attr, struct ilist *BList);

Modified: grass/trunk/vector/v.overlay/main.c
===================================================================
--- grass/trunk/vector/v.overlay/main.c	2012-11-05 10:01:25 UTC (rev 53687)
+++ grass/trunk/vector/v.overlay/main.c	2012-11-05 12:43:38 UTC (rev 53688)
@@ -40,6 +40,7 @@
     struct Map_info In[2], Out;
     struct line_pnts *Points;
     struct line_cats *Cats;
+    struct ilist *BList;
     char *desc;
 
     struct field_info *Fi = NULL;
@@ -194,8 +195,10 @@
     }
 
     /* Copy lines to output */
+    BList = Vect_new_list();
+    Vect_build_partial(&Out, GV_BUILD_BASE);
     for (input = 0; input < 2; input++) {
-	int ncats, index, nlines_out;
+	int ncats, index, nlines_out, newline;
 
 	Vect_set_open_level(2);
 	Vect_open_old2(&(In[input]), in_opt[input]->answer, "", field_opt[input]->answer);
@@ -223,7 +226,9 @@
 		    continue;
 	    }
 
-	    Vect_write_line(&Out, ltype, Points, Cats);
+	    newline = Vect_write_line(&Out, ltype, Points, Cats);
+	    if (input == 1)
+		G_ilist_add(BList, newline);
 	    nlines_out++;
 	}
 	if (nlines_out == 0) {
@@ -485,10 +490,10 @@
 
     /* AREA x AREA */
     if (type[0] == GV_AREA) {
-	area_area(In, field, &Out, Fi, driver, operator, ofield, attr);
+	area_area(In, field, &Out, Fi, driver, operator, ofield, attr, BList);
     }
     else {			/* LINE x AREA */
-	line_area(In, field, &Out, Fi, driver, operator, ofield, attr);
+	line_area(In, field, &Out, Fi, driver, operator, ofield, attr, BList);
     }
 
     G_message(_("Rebuilding topology..."));



More information about the grass-commit mailing list