Browse Source

v.overlay: area-area needs more cleaning

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@53691 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 12 years ago
parent
commit
63007073c6
1 changed files with 22 additions and 0 deletions
  1. 22 0
      vector/v.overlay/area_area.c

+ 22 - 0
vector/v.overlay/area_area.c

@@ -51,6 +51,28 @@ int area_area(struct Map_info *In, int *field, struct Map_info *Out,
     /* ?: May be result of Vect_break_lines() + Vect_remove_duplicates() any dangle or bridge?
      * In that case, calls to Vect_remove_dangles() and Vect_remove_bridges() would be also necessary */
 
+    Vect_build_partial(Out, GV_BUILD_AREAS);
+    nlines = Vect_get_num_lines(Out);
+    ret = 0;
+    for (line = 1; line <= nlines; line++) {
+	if (!Vect_line_alive(Out, line))
+	    continue;
+	if (Vect_get_line_type(Out, line) == GV_BOUNDARY) {
+	    int left, rite;
+	    
+	    Vect_get_line_areas(Out, line, &left, &rite);
+	    
+	    if (left == 0 || rite == 0) {
+		ret = 1;
+		break;
+	    }
+	}
+    }
+    if (ret) {
+	Vect_remove_dangles(Out, GV_BOUNDARY, -1, NULL);
+	Vect_remove_bridges(Out, NULL, NULL, NULL);
+    }
+
     /* Attach islands */
     G_message(_("Attaching islands..."));
     Vect_build_partial(Out, GV_BUILD_ATTACH_ISLES);