[GRASS-SVN] r64486 - grass/branches/releasebranch_6_4/lib/vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Feb 6 12:34:03 PST 2015


Author: mmetz
Date: 2015-02-06 12:34:03 -0800 (Fri, 06 Feb 2015)
New Revision: 64486

Modified:
   grass/branches/releasebranch_6_4/lib/vector/Vlib/build_nat.c
Log:
Vlib: fix reattaching centroids and isles

Modified: grass/branches/releasebranch_6_4/lib/vector/Vlib/build_nat.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/vector/Vlib/build_nat.c	2015-02-06 20:33:08 UTC (rev 64485)
+++ grass/branches/releasebranch_6_4/lib/vector/Vlib/build_nat.c	2015-02-06 20:34:03 UTC (rev 64486)
@@ -313,6 +313,10 @@
 
     for (i = 0; i < List->n_values; i++) {
 	isle = List->value[i];
+	if (plus->Isle[isle]->area > 0) {
+	    dig_area_del_isle(plus, plus->Isle[isle]->area, isle);
+	    plus->Isle[isle]->area = 0;
+	}
 	Vect_attach_isle(Map, isle);
     }
     return 0;
@@ -364,10 +368,6 @@
      * to check if original area exist, unregister centroid from previous area.
      * To simplify code, this is implemented so that centroid is always firs unregistered 
      * and if new area is found, it is registered again.
-     *
-     * This problem can be avoided altogether if properly attached centroids
-     * are skipped
-     * MM 2009
      */
 
     Vect_select_lines_by_box(Map, box, GV_CENTROID, List);
@@ -378,15 +378,14 @@
 	centr = List->value[i];
 	Line = plus->Line[centr];
 
-	/* only attach unregistered and duplicate centroids because 
-	 * 1) all properly attached centroids are properly attached, really! Don't touch.
-	 * 2) Vect_find_area() below does not always return the correct area
-	 * 3) it's faster
-	 */
-	if (Line->left > 0)
-	    continue; 
-
+	/* Unregister centroid */
 	orig_area = Line->left;
+	if ( orig_area > 0 ) {
+	    if ( plus->Area[orig_area] != NULL ) {
+		plus->Area[orig_area]->centroid = 0;
+	    }
+	}
+	Line->left = 0;
 
 	sel_area = Vect_find_area(Map, Line->E, Line->N);
 	G_debug(3, "  centroid %d is in area %d", centr, sel_area);



More information about the grass-commit mailing list