Bläddra i källkod

v.clean: speed up tool=break (boundaries only)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@50086 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 13 år sedan
förälder
incheckning
ee3559e62d
2 ändrade filer med 25 tillägg och 0 borttagningar
  1. 24 0
      vector/v.clean/main.c
  2. 1 0
      vector/v.clean/proto.h

+ 24 - 0
vector/v.clean/main.c

@@ -345,11 +345,19 @@ int main(int argc, char *argv[])
 
 	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 @@ int main(int argc, char *argv[])
 	    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 @@ int main(int argc, char *argv[])
 		    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 @@ int main(int argc, char *argv[])
 	    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 @@ int main(int argc, char *argv[])
 		    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:

+ 1 - 0
vector/v.clean/proto.h

@@ -20,3 +20,4 @@ void remove_bridges(struct Map_info *Map, struct Map_info *Err);
 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);