points.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #include "globals.h"
  2. #include "local_proto.h"
  3. #include <grass/display.h>
  4. int display_points(int in_color)
  5. {
  6. display_points_in_view(VIEW_MAP1, in_color,
  7. group.points.e1, group.points.n1,
  8. group.points.status, group.points.count);
  9. display_points_in_view(VIEW_MAP1_ZOOM, in_color,
  10. group.points.e1, group.points.n1,
  11. group.points.status, group.points.count);
  12. display_points_in_view(VIEW_MAP2, in_color,
  13. group.points.e2, group.points.n2,
  14. group.points.status, group.points.count);
  15. display_points_in_view(VIEW_MAP2_ZOOM, in_color,
  16. group.points.e2, group.points.n2,
  17. group.points.status, group.points.count);
  18. return 0;
  19. }
  20. int display_points_in_view(View * view, int in_color,
  21. double *east, double *north, int *status,
  22. int count)
  23. {
  24. if (!view->cell.configured)
  25. return 1;
  26. while (count-- > 0) {
  27. if (in_color && (*status > 0))
  28. R_standard_color(GREEN);
  29. else if (in_color && (*status == 0))
  30. R_standard_color(RED);
  31. else
  32. R_standard_color(GREY);
  33. status++;
  34. display_one_point(view, *east++, *north++);
  35. }
  36. return 0;
  37. }
  38. int display_one_point(View * view, double east, double north)
  39. {
  40. int row, col, x, y;
  41. row = northing_to_row(&view->cell.head, north) + .5;
  42. col = easting_to_col(&view->cell.head, east) + .5;
  43. y = row_to_view(view, row);
  44. x = col_to_view(view, col);
  45. if (In_view(view, x, y))
  46. dot(x, y);
  47. return 0;
  48. }