distance.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /****************************************************************************
  2. *
  3. * MODULE: r.buffer
  4. *
  5. * AUTHOR(S): Michael Shapiro - CERL
  6. *
  7. * PURPOSE: This program creates distance zones from non-zero
  8. * cells in a grid layer. Distances are specified in
  9. * meters (on the command-line). Window does not have to
  10. * have square cells. Works both for planimetric
  11. * (UTM, State Plane) and lat-long.
  12. *
  13. * COPYRIGHT: (C) 2005 by the GRASS Development Team
  14. *
  15. * This program is free software under the GNU General Public
  16. * License (>=v2). Read the file COPYING that comes with GRASS
  17. * for details.
  18. *
  19. ****************************************************************************/
  20. #ifndef __DISTANCE_H__
  21. #define __DISTANCE_H__
  22. #include <grass/gis.h>
  23. struct Distance
  24. {
  25. int ncols;
  26. int prev_ncols;
  27. double dist;
  28. char *label;
  29. };
  30. typedef unsigned char MAPTYPE;
  31. #define MAX_DIST 254
  32. /* if MAPTYPE is changed to unsigned short, MAX_DIST can be set to 2^16-2
  33. * (if short is 2 bytes)
  34. */
  35. extern struct Distance *distances;
  36. extern int ndist;
  37. extern int wrap_ncols;
  38. extern MAPTYPE *map;
  39. extern struct Cell_head window;
  40. extern int minrow, maxrow, mincol, maxcol;
  41. extern char *pgm_name;
  42. extern double meters_to_grid;
  43. extern double ns_to_ew_squared;
  44. extern int count_rows_with_data;
  45. #define MAPINDEX(r,c) (r * window.cols + c)
  46. #define ZONE_INCR 2
  47. #define FEET_TO_METERS 0.3048
  48. #define MILES_TO_METERS 1609.344
  49. #define NAUT_MILES_TO_METERS 1852.0
  50. #define KILOMETERS_TO_METERS 1000.0
  51. #endif /* __DISTANCE_H__ */