[GRASS-SVN] r70308 - grass/trunk/display/d.vect

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jan 8 10:14:07 PST 2017


Author: martinl
Date: 2017-01-08 10:14:07 -0800 (Sun, 08 Jan 2017)
New Revision: 70308

Modified:
   grass/trunk/display/d.vect/zcoor.c
Log:
d.vect: fix show z-coordinates (display=zcoor) also for vectors open on level 1 (no topology)


Modified: grass/trunk/display/d.vect/zcoor.c
===================================================================
--- grass/trunk/display/d.vect/zcoor.c	2017-01-08 16:32:23 UTC (rev 70307)
+++ grass/trunk/display/d.vect/zcoor.c	2017-01-08 18:14:07 UTC (rev 70308)
@@ -31,22 +31,29 @@
 	D_encoding(lattr->enc);
 
     Vect_rewind(Map);
-
-    num = Vect_get_num_lines(Map);
-    G_debug(1, "n_lines = %d", num);
     /* Points - no nodes registered */
-    for (el = 1; el <= num; el++) {
-	if (!Vect_line_alive(Map, el))
-	    continue;
-	ltype = Vect_read_line(Map, Points, NULL, el);
-	if ((ltype != GV_POINT) && (ltype & type))
-	    continue;
-	G_debug(3, "point = %d", el);
-	
-	sprintf(text, "%.2f", Points->z[0]);
-	show_label(&Points->x[0], &Points->y[0], lattr, text);
+    while (TRUE) {
+        ltype = Vect_read_next_line(Map, Points, NULL);
+        if (ltype == -1) {
+            G_warning(_("Unable to read vector map"));
+            return 1;
+        }
+        else if (ltype == -2) {
+            break;
+        }
+        if ((ltype != GV_POINT) && (ltype & type))
+            continue;
+        
+        sprintf(text, "%.2f", Points->z[0]);
+        show_label(&Points->x[0], &Points->y[0], lattr, text);
     }
+    Vect_destroy_line_struct(Points);
     
+    if (Vect_level(Map) < 2) {
+        /* no topology */
+        return 0;
+    }
+    
     num = Vect_get_num_nodes(Map);
     G_debug(1, "n_nodes = %d", num);
 
@@ -61,7 +68,5 @@
 	show_label(&xl, &yl, lattr, text);
     }
 
-    Vect_destroy_line_struct(Points);
-    
     return 0;
 }



More information about the grass-commit mailing list