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