vert.c 1.0 KB

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