1 #include <grass/gis.h>
2 #include <grass/vector.h>
3 #include <grass/display.h>
4 #include <grass/glocale.h>
5 #include "local_proto.h"
6 #include "plot.h"
7
display_vert(struct Map_info * Map,int type,LATTR * lattr,double dsize)8 int display_vert(struct Map_info *Map, int type, LATTR *lattr, double dsize)
9 {
10 int ltype, i;
11 double msize;
12 struct line_pnts *Points;
13
14 msize = dsize * (D_d_to_u_col(2.0) - D_d_to_u_col(1.0)); /* do it better */
15
16 G_debug(1, "display vertices:");
17 Points = Vect_new_line_struct();
18
19 D_RGB_color(lattr->color.R, lattr->color.G, lattr->color.B);
20
21 Vect_rewind(Map);
22 Vect_set_constraint_type(Map, type);
23 while(TRUE) {
24 ltype = Vect_read_next_line(Map, Points, NULL);
25 switch (ltype) {
26 case -1:
27 G_fatal_error(_("Unable to read vector map"));
28 case -2: /* EOF */
29 return 0;
30 }
31
32 if (!(ltype & GV_LINES))
33 continue;
34
35 for (i = 0; i < Points->n_points; i++) {
36 D_plot_icon(Points->x[i], Points->y[i], G_ICON_CROSS, 0, msize);
37 }
38 }
39 Vect_remove_constraints(Map);
40
41 Vect_destroy_line_struct(Points);
42
43 return 0;
44 }
45