[GRASS-SVN] r42975 - grass/trunk/lib/vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Aug 3 04:57:54 EDT 2010


Author: mmetz
Date: 2010-08-03 08:57:54 +0000 (Tue, 03 Aug 2010)
New Revision: 42975

Modified:
   grass/trunk/lib/vector/Vlib/write_nat.c
Log:
cosmetics

Modified: grass/trunk/lib/vector/Vlib/write_nat.c
===================================================================
--- grass/trunk/lib/vector/Vlib/write_nat.c	2010-08-03 03:37:52 UTC (rev 42974)
+++ grass/trunk/lib/vector/Vlib/write_nat.c	2010-08-03 08:57:54 UTC (rev 42975)
@@ -156,14 +156,11 @@
 	if (type == GV_BOUNDARY) {
 	    /* Delete neighbour areas/isles */
 	    first = 1;
-	    for (s = 1; s < 3; s++) {	/* for each node */
-		if (s == 1)
-		    node = Line->N1;	/* Node 1 */
-		else
-		    node = Line->N2;
+	    for (s = 0; s < 2; s++) {	/* for each node */
+		node = (s == 0 ? Line->N1 : Line->N2);
 		G_debug(3,
-			"  delete neighbour areas/iseles: side = %d node = %d",
-			s, node);
+			"  delete neighbour areas/isles: %s node = %d",
+			(s == 0 ? "first" : "second"), node);
 		Node = plus->Node[node];
 		n = 0;
 		for (i = 0; i < Node->n_lines; i++) {
@@ -176,7 +173,7 @@
 		if (n > 2) {	/* more than 2 boundaries at node ( >= 2 old + 1 new ) */
 		    /* Line above (to the right), it is enough to check to the right, because if area/isle
 		     *  exists it is the same to the left */
-		    if (s == 1)
+		    if (!s)
 			next_line =
 			    dig_angle_next_line(plus, line, GV_RIGHT,
 						GV_BOUNDARY);
@@ -214,14 +211,12 @@
 		    }
 		}
 	    }
-	    /* Build new areas/isles. Thas true that we deleted also adjacent areas/isles, but if
-	     *  they form new one our boundary must participate, so we need to build areas/isles
-	     *  just for our boundary */
-	    for (s = 1; s < 3; s++) {
-		if (s == 1)
-		    side = GV_LEFT;
-		else
-		    side = GV_RIGHT;
+	    /* Build new areas/isles.
+	     *  It's true that we deleted also adjacent areas/isles, but
+	     *  if they form new one our boundary must participate, so
+	     *  we need to build areas/isles just for our boundary */
+	    for (s = 0; s < 2; s++) {
+		side = (s == 0 ? GV_LEFT : GV_RIGHT);
 		G_debug(3, "  build area/isle on side = %d", side);
 
 		G_debug(3, "Build area for line = %d, side = %d", line, side);
@@ -246,7 +241,7 @@
 		    else
 			Vect_box_extend(&abox, &box);
 		}
-		new_area[s - 1] = area;
+		new_area[s] = area;
 	    }
 	    /* Reattach all centroids/isles in deleted areas + new area.
 	     *  Because isles are selected by box it covers also possible new isle created above */
@@ -261,9 +256,9 @@
 	    }
 	    /* Add to category index */
 	    if (plus->update_cidx) {
-		for (s = 1; s < 3; s++) {
-		    if (new_area[s - 1] > 0) {
-			V2__add_area_cats_to_cidx_nat(Map, new_area[s - 1]);
+		for (s = 0; s < 2; s++) {
+		    if (new_area[s] > 0) {
+			V2__add_area_cats_to_cidx_nat(Map, new_area[s]);
 		    }
 		}
 	    }
@@ -782,12 +777,11 @@
 
     /* Rebuild areas/isles and attach centroids and isles */
     if (plus->built >= GV_BUILD_AREAS && type == GV_BOUNDARY) {
-	int new_areas[4], nnew_areas;
+	int new_areas[4], nnew_areas = 0;
 
-	nnew_areas = 0;
 	/* Rebuild areas/isles */
 	for (i = 0; i < n_adjacent; i++) {
-	    side = adjacent[i] > 0 ? GV_RIGHT : GV_LEFT;
+	    side = (adjacent[i] > 0 ? GV_RIGHT : GV_LEFT);
 
 	    G_debug(3, "Build area for line = %d, side = %d", adjacent[i],
 		    side);
@@ -819,7 +813,7 @@
 	/* Reattach all centroids/isles in deleted areas + new area.
 	 *  Because isles are selected by box it covers also possible new isle created above */
 	if (!first) {		/* i.e. old area/isle was deleted or new one created */
-	    /* Reattache isles */
+	    /* Reattach isles */
 	    if (plus->built >= GV_BUILD_ATTACH_ISLES)
 		Vect_attach_isles(Map, &abox);
 



More information about the grass-commit mailing list