[GRASS-SVN] r70309 - grass/branches/releasebranch_7_2/display/d.vect
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jan 8 10:23:48 PST 2017
Author: martinl
Date: 2017-01-08 10:23:48 -0800 (Sun, 08 Jan 2017)
New Revision: 70309
Modified:
grass/branches/releasebranch_7_2/display/d.vect/zcoor.c
Log:
d.vect: fix show z-coordinates (display=zcoor) also for vectors open on level 1 (no topology)
(merge r70308 from trunk)
Modified: grass/branches/releasebranch_7_2/display/d.vect/zcoor.c
===================================================================
--- grass/branches/releasebranch_7_2/display/d.vect/zcoor.c 2017-01-08 18:14:07 UTC (rev 70308)
+++ grass/branches/releasebranch_7_2/display/d.vect/zcoor.c 2017-01-08 18:23:48 UTC (rev 70309)
@@ -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