[GRASS-SVN] r50086 - grass/trunk/vector/v.clean

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jan 7 08:51:03 EST 2012


Author: mmetz
Date: 2012-01-07 05:51:03 -0800 (Sat, 07 Jan 2012)
New Revision: 50086

Modified:
   grass/trunk/vector/v.clean/main.c
   grass/trunk/vector/v.clean/proto.h
Log:
v.clean: speed up tool=break (boundaries only)

Modified: grass/trunk/vector/v.clean/main.c
===================================================================
--- grass/trunk/vector/v.clean/main.c	2012-01-07 13:34:28 UTC (rev 50085)
+++ grass/trunk/vector/v.clean/main.c	2012-01-07 13:51:03 UTC (rev 50086)
@@ -345,11 +345,19 @@
 
 	switch (tools[i]) {
 	case TOOL_BREAK:
+	    if (flag.combine->answer && (otype & GV_BOUNDARY)) {
+		G_message(_("Tool: Split boundaries"));
+		split_lines(&Out, GV_BOUNDARY, pErr);
+	    }
 	    G_message(_("Tool: Break lines at intersections"));
 	    Vect_break_lines(&Out, otype, pErr);
 	    if (flag.combine->answer) {
 		G_message(_("Tool: Remove duplicates"));
 		Vect_remove_duplicates(&Out, otype, pErr);
+		if (otype & GV_BOUNDARY) {
+		    G_message(_("Tool: Merge boundaries"));
+		    Vect_merge_lines(&Out, GV_BOUNDARY, NULL, pErr);
+		}
 	    }
 	    break;
 	case TOOL_RMDUPL:
@@ -382,6 +390,10 @@
 	    if (flag.combine->answer) {
 		int nmod;
 
+		if (otype & GV_BOUNDARY) {
+		    G_message(_("Tool: Split boundaries"));
+		    split_lines(&Out, GV_BOUNDARY, pErr);
+		}
 		do {
 		    G_message(_("Tool: Break lines at intersections"));
 		    Vect_break_lines(&Out, otype, pErr);
@@ -391,6 +403,10 @@
 		    nmod =
 			Vect_clean_small_angles_at_nodes(&Out, otype, pErr);
 		} while (nmod > 0);
+		if (otype & GV_BOUNDARY) {
+		    G_message(_("Tool: Merge boundaries"));
+		    Vect_merge_lines(&Out, GV_BOUNDARY, NULL, pErr);
+		}
 	    }
 	    break;
 	case TOOL_BPOL:
@@ -419,6 +435,10 @@
 	    else {
 		int nmod;
 
+		if (otype & GV_BOUNDARY) {
+		    G_message(_("Tool: Split boundaries"));
+		    split_lines(&Out, GV_BOUNDARY, pErr);
+		}
 		while ((nmod =
 		          Vect_clean_small_angles_at_nodes(&Out, otype, pErr)) > 0) {
 		    count += nmod;
@@ -428,6 +448,10 @@
 		    Vect_remove_duplicates(&Out, otype, pErr);
 		    G_message(_("Tool: Remove small angles at nodes"));
 		}
+		if (otype & GV_BOUNDARY) {
+		    G_message(_("Tool: Merge boundaries"));
+		    Vect_merge_lines(&Out, GV_BOUNDARY, NULL, pErr);
+		}
 	    }
 	    break;
 	case TOOL_RMLINE:

Modified: grass/trunk/vector/v.clean/proto.h
===================================================================
--- grass/trunk/vector/v.clean/proto.h	2012-01-07 13:34:28 UTC (rev 50085)
+++ grass/trunk/vector/v.clean/proto.h	2012-01-07 13:51:03 UTC (rev 50086)
@@ -20,3 +20,4 @@
 int prune(struct Map_info *Out, int otype, double thresh,
 	  struct Map_info *Err);
 int remove_zero_line(struct Map_info *Map, int type, struct Map_info *Err);
+int split_lines(struct Map_info *Map, int otype, struct Map_info *Err);



More information about the grass-commit mailing list