[GRASS-SVN] r52094 - grass/trunk/lib/vector/neta

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jun 16 01:35:48 PDT 2012


Author: mmetz
Date: 2012-06-16 01:35:47 -0700 (Sat, 16 Jun 2012)
New Revision: 52094

Modified:
   grass/trunk/lib/vector/neta/utils.c
Log:
neta lib bugfix

Modified: grass/trunk/lib/vector/neta/utils.c
===================================================================
--- grass/trunk/lib/vector/neta/utils.c	2012-06-16 08:35:00 UTC (rev 52093)
+++ grass/trunk/lib/vector/neta/utils.c	2012-06-16 08:35:47 UTC (rev 52094)
@@ -170,6 +170,7 @@
 			  struct ilist *nodes, int *nodes_to_features)
 {
     int nlines, nnodes, i;
+    struct line_pnts *Points = Vect_new_line_struct();
 
     nlines = Vect_get_num_lines(map);
     nnodes = Vect_get_num_nodes(map);
@@ -177,17 +178,21 @@
 	for (i = 1; i <= nnodes; i++)
 	    nodes_to_features[i] = -1;
 
-    for (i = 1; i <= nlines; i++)
+    for (i = 1; i <= nlines; i++) {
 	if (varray->c[i]) {
-	    int type = Vect_read_line(map, NULL, NULL, i);
+	    int type = Vect_read_line(map, Points, NULL, i);
 
 	    if (type == GV_POINT) {
 		int node;
 
-		Vect_get_line_nodes(map, i, &node, NULL);
-		Vect_list_append(nodes, node);
-		if (nodes_to_features)
-		    nodes_to_features[node] = i;
+		node = Vect_find_node(map, Points->x[0], Points->y[0], Points->z[0], 0, 0);
+		if (node) {
+		    Vect_list_append(nodes, node);
+		    if (nodes_to_features)
+			nodes_to_features[node] = i;
+		}
+		else
+		    G_warning(_("Point %d is not connected!"), i);
 	    }
 	    else {
 		int node1, node2;
@@ -199,6 +204,8 @@
 		    nodes_to_features[node1] = nodes_to_features[node2] = i;
 	    }
 	}
+    }
+    Vect_destroy_line_struct(Points);
 }
 
 /*!



More information about the grass-commit mailing list