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

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Aug 27 10:58:54 EDT 2010


Author: mmetz
Date: 2010-08-27 14:58:54 +0000 (Fri, 27 Aug 2010)
New Revision: 43305

Modified:
   grass/trunk/lib/vector/Vlib/clean_nodes.c
Log:
fix for special case: line ends connected to same node with same angle

Modified: grass/trunk/lib/vector/Vlib/clean_nodes.c
===================================================================
--- grass/trunk/lib/vector/Vlib/clean_nodes.c	2010-08-27 14:30:47 UTC (rev 43304)
+++ grass/trunk/lib/vector/Vlib/clean_nodes.c	2010-08-27 14:58:54 UTC (rev 43305)
@@ -61,7 +61,6 @@
 	    int line1 = -999;	/* value not important, just for debug */
 	    int clean = 1;
 
-
 	    nlines = Vect_get_node_n_lines(Map, node);
 	    G_debug(3, "nlines = %d", nlines);
 
@@ -162,6 +161,10 @@
 			Vect_line_delete_point(Points, Points->n_points - 1);	/* last */
 		    }
 
+		    /* It may happen that it is one line: node could be deleted,
+		     * in that case we have to read the node coords first */
+		    Vect_get_node_coor(Map, node, &nx, &ny, &nz);
+
 		    if (Points->n_points > 1) {
 			new_short_line =
 			    Vect_rewrite_line(Map, abs(short_line),
@@ -180,7 +183,6 @@
 			    long_line = -new_short_line;
 		    }
 
-
 		    /* Add new line (must be before rewrite of long_line otherwise node could be deleted) */
 		    long_type =
 			Vect_read_line(Map, NULL, LCats, abs(long_line));
@@ -200,7 +202,6 @@
 			type = GV_LINE;
 		    }
 
-		    Vect_get_node_coor(Map, node, &nx, &ny, &nz);
 		    Vect_reset_line(Points);
 		    Vect_append_point(Points, nx, ny, nz);
 		    Vect_append_point(Points, x, y, z);
@@ -242,7 +243,7 @@
 		angle1 = angle2;
 	    }
 
-	    if (clean)
+	    if (clean || !Vect_node_alive(Map, node))
 		break;
 	}
     }



More information about the grass-commit mailing list