mark_pts.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /****************************************************************/
  2. /* */
  3. /* mark_visible_points.c in ~/src/Glos */
  4. /* */
  5. /* This function marks all points that are visible in */
  6. /* any one segment on the outputmap */
  7. /* */
  8. /****************************************************************/
  9. #include <grass/gis.h>
  10. #include <grass/raster.h>
  11. #include <grass/segment.h>
  12. #include "point.h"
  13. #define PT_TO_MARK_X PT_TO_MARK->x
  14. #define PT_TO_MARK_Y PT_TO_MARK->y
  15. #define NEXT_PT_TO_MARK PT_TO_MARK->next
  16. #define PT_TO_MARK_INCL PT_TO_MARK->inclination
  17. int
  18. mark_visible_points(struct point *head, SEGMENT * seg_out_p, int row_viewpt,
  19. int col_viewpt, double color_factor, double COLOR_SHIFT)
  20. {
  21. struct point *PT_TO_MARK;
  22. FCELL data;
  23. PT_TO_MARK = head;
  24. while (PT_TO_MARK != NULL) { /* loop till end of list */
  25. segment_get(seg_out_p, &data,
  26. row_viewpt - PT_TO_MARK_Y, PT_TO_MARK_X + col_viewpt);
  27. if (data != (FCELL) 1) { /* point has not been deleted previously */
  28. /* old value
  29. data = (FCELL ) (PT_TO_MARK_INCL* 57.3 * color_factor
  30. + COLOR_SHIFT);
  31. end of old data */
  32. data = (FCELL) (PT_TO_MARK_INCL * 57.325 + 90.0);
  33. segment_put(seg_out_p, &data,
  34. row_viewpt - PT_TO_MARK_Y, PT_TO_MARK_X + col_viewpt);
  35. }
  36. PT_TO_MARK = NEXT_PT_TO_MARK; /* next visible point */
  37. }
  38. return 0;
  39. }
  40. /********* END OF FUNCTION "MARK_VISIBLE_POINTS" ****************/