GRASS GIS 8 Programmer's Manual  8.5.0dev(2025)-565e82de51
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
gis.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * MODULE: Grass Include Files
4  * AUTHOR(S): Original author unknown - probably CERL
5  * Justin Hickey - Thailand - jhickey@hpcc.nectec.or.th
6  * PURPOSE: This file contains definitions of variables and data types
7  * for use with most, if not all, Grass programs. This file is
8  * usually included in every Grass program.
9  * COPYRIGHT: (C) 2000-2025 by the GRASS Development Team
10  *
11  * This program is free software under the GNU General Public
12  * License (>=v2). Read the file COPYING that comes with GRASS
13  * for details.
14  *
15  *****************************************************************************/
16 
17 #ifndef GRASS_GIS_H
18 #define GRASS_GIS_H
19 
20 /*============================= Include Files ==============================*/
21 
22 /* System include files */
23 #include <stdio.h>
24 #include <stdarg.h>
25 #include <stdbool.h>
26 
27 /* Grass and local include files */
28 #include <grass/config.h>
29 #include <grass/datetime.h>
30 #include <grass/version.h>
31 
32 /*=========================== Constants/Defines ============================*/
33 
34 #if !defined __GNUC__ || __GNUC__ < 2
35 #undef __attribute__
36 #define __attribute__(x)
37 #endif
38 
39 /*!
40  \def UNUSED
41  \brief A macro for an attribute, if attached to a variable,
42  indicating that the variable is not used
43 */
44 #if (defined(__GNUC__) || defined(__APPLE__)) && !defined(_MSC_VER)
45 #define UNUSED __attribute__((unused))
46 #else
47 #define UNUSED
48 #endif
49 
50 static const char *GRASS_copyright UNUSED = "GRASS GNU GPL licensed Software";
51 
52 /*!
53  \def FALLTHROUGH
54  \brief A macro for a fallthrough statement attribute
55  */
56 #if (defined(__GNUC__) && __GNUC__ >= 7) || \
57  (defined(__clang__) && __clang_major__ >= 12)
58 #define FALLTHROUGH __attribute__((__fallthrough__))
59 #else
60 #define FALLTHROUGH ((void)0)
61 #endif
62 
63 /* GRASS version, GRASS date, git short hash of last change in GRASS headers
64  * (and anything else in include)
65  */
66 #define GIS_H_VERSION GRASS_HEADERS_VERSION
67 /* git date of last change in GRASS headers
68  * (and anything else in include)
69  */
70 #define GIS_H_DATE GRASS_HEADERS_DATE
71 
72 #define G_gisinit(pgm) G__gisinit(GIS_H_VERSION, (pgm))
73 #define G_no_gisinit() G__no_gisinit(GIS_H_VERSION)
74 
75 /* For boolean values and comparisons use the C99 type 'bool' with values 'true'
76  */
77 /* and 'false' For historical reasons 'TRUE' and 'FALSE' are still valid. */
78 #ifndef TRUE
79 #define TRUE true
80 #endif
81 
82 #ifndef FALSE
83 #define FALSE false
84 #endif
85 
86 /*! \brief Cross-platform Newline Character */
87 #define NEWLINE '\n'
88 #ifdef __MINGW32__
89 #define HOST_NEWLINE "\r\n"
90 #else
91 #define HOST_NEWLINE "\n"
92 #endif
93 
94 /*! \brief Generate warning if function return value is unused */
95 #if __GNUC__ && (__GNUC__ >= 3 && __GNUC_MINOR__ >= 4)
96 #define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
97 #else
98 #define WARN_UNUSED_RESULT
99 #endif
100 
101 /*!
102  \brief List of units
103  */
104 #define U_UNDEFINED -1
105 #define U_UNKNOWN 0
106 #define U_ACRES 1
107 #define U_HECTARES 2
108 #define U_KILOMETERS 3
109 #define U_METERS 4
110 #define U_MILES 5
111 #define U_FEET 6
112 #define U_RADIANS 7
113 #define U_DEGREES 8
114 #define U_USFEET 9
115 /* Temporal units from the datetime library */
116 #define U_YEARS DATETIME_YEAR
117 #define U_MONTHS DATETIME_MONTH
118 #define U_DAYS DATETIME_DAY
119 #define U_HOURS DATETIME_HOUR
120 #define U_MINUTES DATETIME_MINUTE
121 #define U_SECONDS DATETIME_SECOND
122 
123 /*! \brief Projection code - XY coordinate system (unreferenced data) */
124 #define PROJECTION_XY 0
125 /*! \brief Projection code - UTM */
126 #define PROJECTION_UTM 1
127 /*! \brief Projection code - State Plane */
128 #define PROJECTION_SP 2
129 /*! \brief Projection code - Latitude-Longitude */
130 #define PROJECTION_LL 3
131 /*! \brief Projection code - other projection (other then noted above) */
132 #define PROJECTION_OTHER 99
133 
134 #define PROJECTION_FILE "PROJ_INFO"
135 #define UNIT_FILE "PROJ_UNITS"
136 #define EPSG_FILE "PROJ_EPSG"
137 #define WKT_FILE "PROJ_WKT"
138 #define SRID_FILE "PROJ_SRID"
139 
140 #ifdef __MINGW32__
141 #define CONFIG_DIR "GRASS8"
142 #else
143 #define CONFIG_DIR ".grass8"
144 #endif
145 
146 #ifdef MAX
147 #undef MAX
148 #endif
149 #define MAX(a, b) ((a) > (b) ? (a) : (b))
150 
151 #ifdef MIN
152 #undef MIN
153 #endif
154 #define MIN(a, b) ((a) < (b) ? (a) : (b))
155 
156 /* define PI and friends */
157 #undef M_PI
158 #define M_PI 3.14159265358979323846 /* pi */
159 
160 #undef M_PI_2
161 #define M_PI_2 1.57079632679489661923 /* pi/2 */
162 
163 #undef M_PI_4
164 #define M_PI_4 0.78539816339744830962 /* pi/4 */
165 
166 #undef M_R2D
167 #define M_R2D 57.295779513082320877 /* 180/pi */
168 
169 #undef M_D2R
170 #define M_D2R 0.017453292519943295769 /* pi/180 */
171 
172 /* epsilon (IEEE: 2.220446e-16) */
173 #define GRASS_EPSILON 1.0e-15
174 
175 /* Location of envariment variables */
176 #define G_VAR_GISRC 0
177 #define G_VAR_MAPSET 1
178 
179 /* Where to find/store variables */
180 #define G_GISRC_MODE_FILE 0 /* files */
181 #define G_GISRC_MODE_MEMORY 1 /* memory only */
182 
183 /* for G_parser() */
184 #define TYPE_INTEGER 1
185 #define TYPE_DOUBLE 2
186 #define TYPE_STRING 3
187 #define YES 1
188 #define NO 0
189 
190 /* File/directory name lengths */
191 #define GNAME_MAX 256
192 #define GMAPSET_MAX 256
193 
194 #define GPATH_MAX 4096
195 
196 /* Basename default separator */
197 #define GBASENAME_SEP "_"
198 
199 /* Macros for type size independent integers */
200 /* Use these for portability to ensure integers are truly 32bit */
201 /* and are handled in a uniform manner */
202 
203 /* Convert integer to 4 bytes - little endian */
204 #define serialize_int32_le(buf, x) \
205  do { \
206  (buf)[0] = ((x) >> 0) & 0xFF; \
207  (buf)[1] = ((x) >> 8) & 0xFF; \
208  (buf)[2] = ((x) >> 16) & 0xFF; \
209  (buf)[3] = ((x) >> 24) & 0xFF; \
210  } while (0)
211 
212 /* Convert 4 bytes to an integer - little endian */
213 #define deserialize_int32_le(buf) \
214  (((buf)[0] << 0) | ((buf)[1] << 8) | ((buf)[2] << 16) | ((buf)[3] << 24))
215 
216 /* Convert integer to 4 bytes - big endian */
217 #define serialize_int32_be(buf, x) \
218  do { \
219  (buf)[0] = ((x) >> 24) & 0xFF; \
220  (buf)[1] = ((x) >> 16) & 0xFF; \
221  (buf)[2] = ((x) >> 8) & 0xFF; \
222  (buf)[3] = ((x) >> 0) & 0xFF; \
223  } while (0)
224 
225 /* Convert 4 bytes to an integer - big endian */
226 #define deserialize_int32_be(buf) \
227  (((buf)[0] << 24) | ((buf)[1] << 16) | ((buf)[2] << 8) | ((buf)[3] << 0))
228 
229 /* Cross-platform Directory Separator Character and null device stuff */
230 #define GRASS_DIRSEP '/'
231 #ifdef __MINGW32__
232 #define HOST_DIRSEP '\\'
233 #define G_DEV_NULL "NUL:"
234 #else
235 #define HOST_DIRSEP '/'
236 #define G_DEV_NULL "/dev/null"
237 #endif
238 
239 /*!
240  \typedef STD_OPT
241  \brief Standard option identifiers (enum)
242 
243  Identifies of all recognized standard options.
244 
245  The term <em>old</em> in the descriptions means existing map which
246  is supposed to exist before the module is called.
247  On the other hand, the term <em>new</em> in the descriptions means
248  that the map is not supposed to exist and that module will create one.
249 
250  Used by the G_parser() system.
251 
252  IMPORTANT NOTE: when adding new item to STD_OPT you should also
253  update STD_OPT_STRINGS array in general/g.parser/standard_option.c.
254 
255  */
256 typedef enum {
258  G_OPT_DB_SQL, /*!< SQL statements */
259  G_OPT_DB_WHERE, /*!< SQL where conditions */
260  G_OPT_DB_TABLE, /*!< table name */
261  G_OPT_DB_DRIVER, /*!< driver name */
262  G_OPT_DB_DATABASE, /*!< database name */
263  G_OPT_DB_SCHEMA, /*!< database schema */
264  G_OPT_DB_COLUMN, /*!< one attr column */
265  G_OPT_DB_COLUMNS, /*!< one or more attr columns */
266  G_OPT_DB_KEYCOLUMN, /*!< key column */
267 
268  G_OPT_I_GROUP, /*!< old input imagery group */
269  G_OPT_I_SUBGROUP, /*!< old input imagery subgroup */
270 
271  G_OPT_MEMORYMB, /*!< Maximum memory to be used (in MB): cache size for
272  raster rows */
273  G_OPT_R_INPUT, /*!< old input raster map */
274  G_OPT_R_INPUTS, /*!< old input raster maps */
275  G_OPT_R_OUTPUT, /*!< new output raster map */
276  G_OPT_R_OUTPUTS, /*!< new output raster maps */
277  G_OPT_R_MAP, /*!< old input raster map */
278  G_OPT_R_MAPS, /*!< old input rasters map */
279  G_OPT_R_BASE, /*!< old input base raster map */
280  G_OPT_R_COVER, /*!< old input cover raster map */
281  G_OPT_R_ELEV, /*!< old input elevation raster map */
282  G_OPT_R_ELEVS, /*!< old input elevation raster maps */
283  G_OPT_R_TYPE, /*!< raster map type */
284  G_OPT_R_INTERP_TYPE, /*!< interpolation type */
285  G_OPT_R_BASENAME_INPUT, /*!< old input basename raster maps */
286  G_OPT_R_BASENAME_OUTPUT, /*!< new output basename raster maps */
287 
288  G_OPT_R3_INPUT, /*!< old input raster3d map */
289  G_OPT_R3_INPUTS, /*!< old input raster3d maps */
290  G_OPT_R3_OUTPUT, /*!< new output raster3d map */
291  G_OPT_R3_MAP, /*!< old input raster3d map */
292  G_OPT_R3_MAPS, /*!< old input raster3d maps */
293  G_OPT_R3_TYPE, /*!< Type (FCELL or DCELL) of a new created raster3d map */
294  G_OPT_R3_PRECISION, /*!< The precision of the new generated raster3d map */
295  G_OPT_R3_TILE_DIMENSION, /*!< The tile dimension of a new generated raster3d
296  map */
297  G_OPT_R3_COMPRESSION, /*!< The kind of compression of a new created raster3d
298  map */
299 
300  G_OPT_V_INPUT, /*!< old input vector map */
301  G_OPT_V_INPUTS, /*!< old input vector maps */
302  G_OPT_V_OUTPUT, /*!< new output vector map */
303  G_OPT_V_MAP, /*!< old input vector map */
304  G_OPT_V_MAPS, /*!< old input vector maps */
305  G_OPT_V_TYPE, /*!< primitive type */
306  G_OPT_V3_TYPE, /*!< primitive type, 2D and 3D */
307  G_OPT_V_FIELD, /*!< layer number (layers used to be called fields) */
308  G_OPT_V_FIELD_ALL, /*!< layer number (layers used to be called fields) */
309  G_OPT_V_CAT, /*!< one category */
310  G_OPT_V_CATS, /*!< more categories */
311  G_OPT_V_ID, /*!< one feature id */
312  G_OPT_V_IDS, /*!< more feature ids */
313 
314  G_OPT_F_INPUT, /*!< old input file */
315  G_OPT_F_BIN_INPUT, /*!< old binary input file */
316  G_OPT_F_OUTPUT, /*!< new output file */
317  G_OPT_F_SEP, /*!< data field separator */
318 
319  G_OPT_C, /*!< color */
320  G_OPT_CN, /*!< color or none */
321  G_OPT_C_FORMAT, /*!< set color format to rgb,hex,hsv or triplet */
322 
323  G_OPT_M_UNITS, /*!< units */
324  G_OPT_M_DATATYPE, /*!< datatype */
325  G_OPT_M_MAPSET, /*!< mapset */
326  G_OPT_M_LOCATION, /*!< location */
327  G_OPT_M_DBASE, /*!< dbase */
328  G_OPT_M_COORDS, /*!< coordinates */
329  G_OPT_M_COLR, /*!< color rules */
330  G_OPT_M_DIR, /*!< directory input */
331  G_OPT_M_REGION, /*!< saved region */
332  G_OPT_M_NULL_VALUE, /*!< null value string */
333  G_OPT_M_NPROCS, /*!< number of threads for parallel computing */
334  G_OPT_M_SEED, /*!< seed for random number generator */
335 
336  G_OPT_STDS_INPUT, /*!< old input space time dataset of type strds, str3ds or
337  stvds */
338  G_OPT_STDS_INPUTS, /*!< old input space time datasets */
339  G_OPT_STDS_OUTPUT, /*!< new output space time dataset */
340  G_OPT_STRDS_INPUT, /*!< old input space time raster dataset */
341  G_OPT_STRDS_INPUTS, /*!< old input space time raster datasets */
342  G_OPT_STRDS_OUTPUT, /*!< new output space time raster dataset */
343  G_OPT_STRDS_OUTPUTS, /*!< new output space time raster datasets */
344  G_OPT_STR3DS_INPUT, /*!< old input space time raster3d dataset */
345  G_OPT_STR3DS_INPUTS, /*!< old input space time raster3d datasets */
346  G_OPT_STR3DS_OUTPUT, /*!< new output space time raster3d dataset */
347  G_OPT_STVDS_INPUT, /*!< old input space time vector dataset */
348  G_OPT_STVDS_INPUTS, /*!< old input space time vector datasets */
349  G_OPT_STVDS_OUTPUT, /*!< new output space time vector dataset */
350  G_OPT_MAP_INPUT, /*!< old input map of type raster, vector or raster3d */
351  G_OPT_MAP_INPUTS, /*!< old input maps of type raster, vector or raster3d */
352  G_OPT_STDS_TYPE, /*!< the type of a space time dataset: strds, str3ds, stvds
353  */
354  G_OPT_MAP_TYPE, /*!< The type of an input map: raster, vect, rast3d */
355  G_OPT_T_TYPE, /*!< The temporal type of a space time dataset */
356  G_OPT_T_WHERE, /*!< A temporal GIS framework SQL WHERE statement */
357  G_OPT_T_SAMPLE, /*!< Temporal sample methods */
358 
359  G_OPT_F_FORMAT, /*!< set output format to plain text or JSON */
360 } STD_OPT;
361 
362 /*!
363  \typedef STD_FLG
364  \brief Standard flag identifiers (enum)
365 
366  Identifies of all recognized standard flags.
367 
368  Used by the G_parser() system.
369  */
370 
371 /**/ typedef enum {
373  G_FLG_V_TABLE, /*!< do not create attribute table */
374  G_FLG_V_TOPO /*!< do not build topology */
376 
377 /* Parser rules for G__option_rule() */
378 enum rule_type {
385 };
386 
387 /* Message format */
388 #define G_INFO_FORMAT_STANDARD \
389  0 /* GRASS_MESSAGE_FORMAT=standard or not defined */
390 #define G_INFO_FORMAT_GUI 1 /* GRASS_MESSAGE_FORMAT=gui */
391 #define G_INFO_FORMAT_SILENT 2 /* GRASS_MESSAGE_FORMAT=silent */
392 #define G_INFO_FORMAT_PLAIN 3 /* GRASS_MESSAGE_FORMAT=plain */
393 
394 /* Icon types */
395 #define G_ICON_CROSS 0
396 #define G_ICON_BOX 1
397 #define G_ICON_ARROW 2
398 
399 /* default colors */
400 #define DEFAULT_FG_COLOR "black"
401 #define DEFAULT_BG_COLOR "white"
402 #define DEFAULT_COLOR_TABLE "viridis"
403 
404 /* error codes */
405 #define G_FATAL_EXIT 0
406 #define G_FATAL_PRINT 1
407 #define G_FATAL_RETURN 2
408 
409 /*! \brief Endian check */
410 #define ENDIAN_LITTLE 0
411 #define ENDIAN_BIG 1
412 #define ENDIAN_OTHER 2
413 
414 /* for vector maps */
415 /*!
416  \brief Name of default key column
417  */
418 #define GV_KEY_COLUMN "cat"
419 
420 /*!
421  \brief Element types identifiers (enum)
422 
423  Identifies various element types. Element can be raster map,
424  vector map, etc.
425  */
426 enum { /* Dir */
427  G_ELEMENT_RASTER = 1, /*!< raster */
428  G_ELEMENT_RASTER3D = 2, /*!< 3d raster */
429  G_ELEMENT_VECTOR = 3, /*!< vector */
430  G_ELEMENT_ASCIIVECTOR = 4, /*!< ASCII vector */
431  G_ELEMENT_LABEL = 5, /*!< labels */
432  G_ELEMENT_REGION = 6, /*!< region */
433  G_ELEMENT_GROUP = 7 /*!< group */
434 };
435 
436 /*=========================== Typedefs/Structures ==========================*/
437 
438 /*!
439  \brief 2D/3D raster map header (used also for region)
440  */
441 struct Cell_head {
442  /*! \brief Max number of bytes per raster data value minus 1 (raster header
443  only)
444 
445  Note: -1 for FP raster maps
446  */
447  int format;
448  /*! \brief Compression mode (raster header only)
449 
450  - 0: uncompressed
451  - 1: compressed
452  - -1: pre GRASS 3.0
453  */
455  /*! \brief Number of rows for 2D data */
456  int rows;
457  /*! \brief Number of rows for 3D data */
458  int rows3;
459  /*! \brief Number of columns for 2D data */
460  int cols;
461  /*! \brief Number of columns for 3D data */
462  int cols3;
463  /*! \brief number of depths for 3D data */
464  int depths;
465  /*! \brief Projection code
466 
467  - PROJECTION_XY
468  - PROJECTION_UTM
469  - PROJECTION_SP
470  - PROJECTION_LL
471  - PROJECTION_OTHER
472  */
473  int proj;
474  /*! \brief Projection zone (UTM) */
475  int zone;
476  /*! \brief Resolution - east to west cell size for 2D data */
477  double ew_res;
478  /*! \brief Resolution - east to west cell size for 3D data */
479  double ew_res3;
480  /*! \brief Resolution - north to south cell size for 2D data */
481  double ns_res;
482  /*! \brief Resolution - north to south cell size for 3D data */
483  double ns_res3;
484  /*! \brief Resolution - top to bottom cell size for 3D data */
485  double tb_res;
486  /*! \brief Extent coordinates (north) */
487  double north;
488  /*! \brief Extent coordinates (south) */
489  double south;
490  /*! \brief Extent coordinates (east) */
491  double east;
492  /*! \brief Extent coordinates (west) */
493  double west;
494  /*! \brief Extent coordinates (top) - 3D data */
495  double top;
496  /*! \brief Extent coordinates (bottom) - 3D data */
497  double bottom;
498 };
499 
500 /*
501  ** Structure for I/O of 3dview files (view.c)
502  */
503 struct G_3dview {
504  char pgm_id[40]; /* user-provided identifier */
505  float from_to[2][3]; /* eye position & lookat position */
506  float fov; /* field of view */
507  float twist; /* right_hand rotation about from_to */
508  float exag; /* terrain elevation exageration */
509  int mesh_freq; /* cells per grid line */
510  int poly_freq; /* cells per polygon */
511  int display_type; /* 1 for mesh, 2 for poly, 3 for both */
512  int lightson; /* boolean */
513  int dozero; /* boolean */
514  int colorgrid; /* boolean */
515  int shading; /* boolean */
516  int fringe; /* boolean */
517  int surfonly; /* boolean */
518  int doavg; /* boolean */
519  char grid_col[40]; /* colors */
520  char bg_col[40]; /* colors */
521  char other_col[40]; /* colors */
522  float lightpos[4]; /* east, north, height, 1.0 for local 0.0 infin */
523  float lightcol[3]; /* values between 0.0 to 1.0 for red, grn, blu */
524  float ambient;
525  float shine;
526  struct Cell_head vwin;
527 };
528 
529 struct Key_Value {
530  int nitems;
531  int nalloc;
532  char **key;
533  char **value;
534 };
535 
536 /*!
537  \brief Structure that stores option information
538 
539  The descriptions member contains pairs of option and option
540  descriptions separated by semicolon ';'.
541  For example, when options member is set using:
542  \code
543  opt->options = "break,rmdupl"
544  \endcode
545  the descriptions member should be set to:
546  \verbatim
547  "break;break lines on intersections;"
548  "rmdupl;remove duplicates"
549  \endverbatim
550 
551  Parsed descriptions are stored in the same order as options.
552 
553  GUI dependency is a list of options (separated by commas) to be updated
554  if the value is changed.
555 
556  Used by the G_parser() system.
557  */
558 struct Option {
559  const char *key; /*!< Key word used on command line */
560  int type; /*!< Option type */
561  int required; /*!< REQUIRED or OPTIONAL */
562  int multiple; /*!< Multiple entries OK */
563  const char *options; /*!< Approved values or range or NULL */
564  const char **opts; /*!< NULL or NULL terminated array of parsed options */
565  const char *key_desc; /*!< one word describing the key */
566  const char *label; /*!< Optional short label, used in GUI as item label */
567  const char *description; /*!< String describing option */
568  const char *descriptions; /*!< ';' separated pairs of option and option
569  descriptions */
570  const char **descs; /*!< parsed descriptions, array of
571  either NULL or string */
572  char *answer; /*!< Option answer */
573  const char *def; /*!< Where original answer gets saved */
574  char **answers; /*!< Option answers (for multiple=YES) */
575  struct Option *next_opt; /*!< Pointer to next option struct */
576  const char *gisprompt; /*!< Interactive prompt guidance */
577  const char *guisection; /*!< GUI Layout guidance: ';' delimited hierarchical
578  tree position */
579  const char *guidependency; /*!< GUI dependency */
580  int (*checker)(const char *); /*!< Routine to check answer or NULL */
581  int count;
582 };
583 
584 /*!
585  \brief Structure that stores flag info
586 
587  Used by the G_parser() system.
588  */
589 struct Flag {
590  char key; /*!< Key char used on command line */
591  char answer; /*!< Stores flag state: 0/1 */
592  char suppress_required; /*!< Suppresses checking of required options */
593  char suppress_overwrite; /*!< Suppresses checking of existing output */
594  const char *label; /*!< Optional short label, used in GUI as item label */
595  const char *description; /*!< String describing flag meaning */
596  const char *guisection; /*!< GUI Layout guidance: ';' delimited hierarchical
597  tree position */
598  struct Flag *next_flag; /*!< Pointer to next flag struct */
599 };
600 
601 /*!
602  \brief Structure that stores module info
603 
604  Used by the G_parser() system.
605  */
606 struct GModule {
607  const char *label; /*!< Optional short description for GUI */
608  const char *description; /*!< String describing module */
609  const char **keywords; /*!< Keywords describing module */
610  /* further items are possible: author(s), version, year */
611  int overwrite; /*!< overwrite old files */
612  int verbose; /*!< print all information about progress and so on */
613 };
614 
615 struct TimeStamp {
616  DateTime dt[2]; /* two datetimes */
617  int count;
618 };
619 
620 struct Counter {
621  int value;
622 };
623 
624 struct Popen {
625  FILE *fp;
626  int pid;
627 };
628 
629 typedef int CELL;
630 typedef double DCELL;
631 typedef float FCELL;
632 
633 /* 64 bit signed integer */
634 #if HAVE_INT64_T
635 #include <sys/types.h>
636 typedef int64_t grass_int64;
637 #elif defined(__MINGW32__)
638 typedef __int64 grass_int64;
639 #elif HAVE_LONG_LONG_INT
640 typedef long long int grass_int64;
641 #elif HAVE_LARGEFILES
642 typedef off_t grass_int64;
643 #else
644 #error "no 64 bit integer available"
645 #endif
646 
647 /* LCELL = large CELL, proposed new raster data type */
649 
652  unsigned char red;
653  unsigned char grn;
654  unsigned char blu;
655 };
656 
657 struct _Color_Rule_ {
658  struct _Color_Value_ low, high;
661 };
662 
663 struct _Color_Info_ {
665  int n_rules;
666 
667  struct {
668  unsigned char *red;
669  unsigned char *grn;
670  unsigned char *blu;
671  unsigned char *set;
672  int nalloc;
673  int active;
675 
676  struct {
678  /* pointers to color rules corresponding to the intervals btwn vals */
679  struct _Color_Rule_ **rules;
680  int nalloc;
681  int active;
683 
685 };
686 
687 struct Colors {
688  int version; /* set by read_colors: -1=old,1=new */
690  int invert;
691  int is_float; /* defined on floating point raster data? */
692  int null_set; /* the colors for null are set? */
693  unsigned char null_red;
694  unsigned char null_grn;
695  unsigned char null_blu;
696  int undef_set; /* the colors for cells not in range are set? */
697  unsigned char undef_red;
698  unsigned char undef_grn;
699  unsigned char undef_blu;
700  struct _Color_Info_ fixed;
701  struct _Color_Info_ modular;
705 };
706 
707 /*!
708  \brief List of integers
709  */
710 struct ilist {
711  /*!
712  \brief Array of values
713  */
714  int *value;
715  /*!
716  \brief Number of values in the list
717  */
718  int n_values;
719  /*!
720  \brief Allocated space for values
721  */
723 };
724 
725 /*============================== Prototypes ================================*/
726 
727 /* Since there are so many prototypes for the gis library they are stored */
728 /* in the file gisdefs.h */
729 #include <grass/defs/gis.h>
730 
731 #endif /* GRASS_GIS_H */
STD_OPT
Standard option identifiers (enum)
Definition: gis.h:256
@ G_OPT_STRDS_INPUTS
Definition: gis.h:341
@ G_OPT_M_REGION
Definition: gis.h:331
@ G_OPT_F_BIN_INPUT
Definition: gis.h:315
@ G_OPT_V_IDS
Definition: gis.h:312
@ G_OPT_DB_COLUMNS
Definition: gis.h:265
@ G_OPT_M_DIR
Definition: gis.h:330
@ G_OPT_R_BASENAME_INPUT
Definition: gis.h:285
@ G_OPT_R3_INPUTS
Definition: gis.h:289
@ G_OPT_R_ELEV
Definition: gis.h:281
@ G_OPT_R_MAPS
Definition: gis.h:278
@ G_OPT_V_CAT
Definition: gis.h:309
@ G_OPT_F_SEP
Definition: gis.h:317
@ G_OPT_R_BASENAME_OUTPUT
Definition: gis.h:286
@ G_OPT_STR3DS_INPUT
Definition: gis.h:344
@ G_OPT_R_ELEVS
Definition: gis.h:282
@ G_OPT_R_INPUTS
Definition: gis.h:274
@ G_OPT_STVDS_OUTPUT
Definition: gis.h:349
@ G_OPT_STRDS_OUTPUTS
Definition: gis.h:343
@ G_OPT_T_WHERE
Definition: gis.h:356
@ G_OPT_V_MAP
Definition: gis.h:303
@ G_OPT_DB_WHERE
Definition: gis.h:259
@ G_OPT_T_TYPE
Definition: gis.h:355
@ G_OPT_M_SEED
Definition: gis.h:334
@ G_OPT_V_CATS
Definition: gis.h:310
@ G_OPT_F_FORMAT
Definition: gis.h:359
@ G_OPT_R_COVER
Definition: gis.h:280
@ G_OPT_M_NULL_VALUE
Definition: gis.h:332
@ G_OPT_DB_KEYCOLUMN
Definition: gis.h:266
@ G_OPT_DB_COLUMN
Definition: gis.h:264
@ G_OPT_DB_SQL
Definition: gis.h:258
@ G_OPT_F_INPUT
Definition: gis.h:314
@ G_OPT_STRDS_OUTPUT
Definition: gis.h:342
@ G_OPT_V_INPUTS
Definition: gis.h:301
@ G_OPT_V_FIELD_ALL
Definition: gis.h:308
@ G_OPT_T_SAMPLE
Definition: gis.h:357
@ G_OPT_UNDEFINED
Definition: gis.h:257
@ G_OPT_V3_TYPE
Definition: gis.h:306
@ G_OPT_MAP_INPUT
Definition: gis.h:350
@ G_OPT_R3_TYPE
Definition: gis.h:293
@ G_OPT_V_MAPS
Definition: gis.h:304
@ G_OPT_STVDS_INPUT
Definition: gis.h:347
@ G_OPT_STRDS_INPUT
Definition: gis.h:340
@ G_OPT_M_NPROCS
Definition: gis.h:333
@ G_OPT_STDS_TYPE
Definition: gis.h:352
@ G_OPT_STR3DS_INPUTS
Definition: gis.h:345
@ G_OPT_R_MAP
Definition: gis.h:277
@ G_OPT_C_FORMAT
Definition: gis.h:321
@ G_OPT_M_LOCATION
Definition: gis.h:326
@ G_OPT_M_COLR
Definition: gis.h:329
@ G_OPT_MAP_INPUTS
Definition: gis.h:351
@ G_OPT_V_ID
Definition: gis.h:311
@ G_OPT_M_DBASE
Definition: gis.h:327
@ G_OPT_M_COORDS
Definition: gis.h:328
@ G_OPT_M_MAPSET
Definition: gis.h:325
@ G_OPT_R_BASE
Definition: gis.h:279
@ G_OPT_STVDS_INPUTS
Definition: gis.h:348
@ G_OPT_R3_PRECISION
Definition: gis.h:294
@ G_OPT_R3_MAP
Definition: gis.h:291
@ G_OPT_STDS_INPUT
Definition: gis.h:336
@ G_OPT_C
Definition: gis.h:319
@ G_OPT_R3_OUTPUT
Definition: gis.h:290
@ G_OPT_R3_MAPS
Definition: gis.h:292
@ G_OPT_DB_TABLE
Definition: gis.h:260
@ G_OPT_STDS_INPUTS
Definition: gis.h:338
@ G_OPT_R3_INPUT
Definition: gis.h:288
@ G_OPT_STDS_OUTPUT
Definition: gis.h:339
@ G_OPT_R_TYPE
Definition: gis.h:283
@ G_OPT_V_FIELD
Definition: gis.h:307
@ G_OPT_V_TYPE
Definition: gis.h:305
@ G_OPT_MEMORYMB
Definition: gis.h:271
@ G_OPT_DB_DATABASE
Definition: gis.h:262
@ G_OPT_CN
Definition: gis.h:320
@ G_OPT_R_OUTPUTS
Definition: gis.h:276
@ G_OPT_R_INTERP_TYPE
Definition: gis.h:284
@ G_OPT_MAP_TYPE
Definition: gis.h:354
@ G_OPT_R_INPUT
Definition: gis.h:273
@ G_OPT_R3_TILE_DIMENSION
Definition: gis.h:295
@ G_OPT_F_OUTPUT
Definition: gis.h:316
@ G_OPT_DB_SCHEMA
Definition: gis.h:263
@ G_OPT_M_UNITS
Definition: gis.h:323
@ G_OPT_DB_DRIVER
Definition: gis.h:261
@ G_OPT_I_SUBGROUP
Definition: gis.h:269
@ G_OPT_V_OUTPUT
Definition: gis.h:302
@ G_OPT_R_OUTPUT
Definition: gis.h:275
@ G_OPT_V_INPUT
Definition: gis.h:300
@ G_OPT_M_DATATYPE
Definition: gis.h:324
@ G_OPT_I_GROUP
Definition: gis.h:268
@ G_OPT_STR3DS_OUTPUT
Definition: gis.h:346
@ G_OPT_R3_COMPRESSION
Definition: gis.h:297
grass_int64 LCELL
Definition: gis.h:648
float FCELL
Definition: gis.h:631
@ G_ELEMENT_RASTER
Definition: gis.h:427
@ G_ELEMENT_VECTOR
Definition: gis.h:429
@ G_ELEMENT_GROUP
Definition: gis.h:433
@ G_ELEMENT_RASTER3D
Definition: gis.h:428
@ G_ELEMENT_REGION
Definition: gis.h:432
@ G_ELEMENT_LABEL
Definition: gis.h:431
@ G_ELEMENT_ASCIIVECTOR
Definition: gis.h:430
int64_t grass_int64
Definition: gis.h:636
rule_type
Definition: gis.h:378
@ RULE_EXCLUDES
Definition: gis.h:383
@ RULE_REQUIRES
Definition: gis.h:381
@ RULE_REQUIRED
Definition: gis.h:380
@ RULE_EXCLUSIVE
Definition: gis.h:379
@ RULE_COLLECTIVE
Definition: gis.h:384
@ RULE_REQUIRES_ALL
Definition: gis.h:382
double DCELL
Definition: gis.h:630
#define UNUSED
A macro for an attribute, if attached to a variable, indicating that the variable is not used.
Definition: gis.h:47
int CELL
Definition: gis.h:629
STD_FLG
Standard flag identifiers (enum)
Definition: gis.h:371
@ G_FLG_V_TOPO
Definition: gis.h:374
@ G_FLG_V_TABLE
Definition: gis.h:373
@ G_FLG_UNDEFINED
Definition: gis.h:372
2D/3D raster map header (used also for region)
Definition: gis.h:441
int cols3
Number of columns for 3D data.
Definition: gis.h:462
double ew_res
Resolution - east to west cell size for 2D data.
Definition: gis.h:477
double north
Extent coordinates (north)
Definition: gis.h:487
double bottom
Extent coordinates (bottom) - 3D data.
Definition: gis.h:497
int compressed
Compression mode (raster header only)
Definition: gis.h:454
int format
Max number of bytes per raster data value minus 1 (raster header only)
Definition: gis.h:447
int zone
Projection zone (UTM)
Definition: gis.h:475
int depths
number of depths for 3D data
Definition: gis.h:464
double east
Extent coordinates (east)
Definition: gis.h:491
double ew_res3
Resolution - east to west cell size for 3D data.
Definition: gis.h:479
double ns_res
Resolution - north to south cell size for 2D data.
Definition: gis.h:481
double ns_res3
Resolution - north to south cell size for 3D data.
Definition: gis.h:483
double top
Extent coordinates (top) - 3D data.
Definition: gis.h:495
int rows3
Number of rows for 3D data.
Definition: gis.h:458
int rows
Number of rows for 2D data.
Definition: gis.h:456
int cols
Number of columns for 2D data.
Definition: gis.h:460
int proj
Projection code.
Definition: gis.h:473
double south
Extent coordinates (south)
Definition: gis.h:489
double tb_res
Resolution - top to bottom cell size for 3D data.
Definition: gis.h:485
double west
Extent coordinates (west)
Definition: gis.h:493
Definition: gis.h:687
int null_set
Definition: gis.h:692
unsigned char undef_blu
Definition: gis.h:699
int is_float
Definition: gis.h:691
DCELL cmax
Definition: gis.h:703
unsigned char null_blu
Definition: gis.h:695
unsigned char undef_grn
Definition: gis.h:698
unsigned char undef_red
Definition: gis.h:697
struct _Color_Info_ fixed
Definition: gis.h:700
struct _Color_Info_ modular
Definition: gis.h:701
int version
Definition: gis.h:688
int invert
Definition: gis.h:690
int undef_set
Definition: gis.h:696
unsigned char null_grn
Definition: gis.h:694
int organizing
Definition: gis.h:704
DCELL shift
Definition: gis.h:689
unsigned char null_red
Definition: gis.h:693
DCELL cmin
Definition: gis.h:702
Definition: gis.h:620
int value
Definition: gis.h:621
Structure that stores flag info.
Definition: gis.h:589
const char * guisection
Definition: gis.h:596
char suppress_overwrite
Definition: gis.h:593
struct Flag * next_flag
Definition: gis.h:598
char suppress_required
Definition: gis.h:592
const char * description
Definition: gis.h:595
char key
Definition: gis.h:590
char answer
Definition: gis.h:591
const char * label
Definition: gis.h:594
Structure that stores module info.
Definition: gis.h:606
int verbose
Definition: gis.h:612
const char ** keywords
Definition: gis.h:609
const char * description
Definition: gis.h:608
int overwrite
Definition: gis.h:611
const char * label
Definition: gis.h:607
Definition: gis.h:503
struct Cell_head vwin
Definition: gis.h:526
int mesh_freq
Definition: gis.h:509
float from_to[2][3]
Definition: gis.h:505
float fov
Definition: gis.h:506
char pgm_id[40]
Definition: gis.h:504
char other_col[40]
Definition: gis.h:521
int colorgrid
Definition: gis.h:514
char bg_col[40]
Definition: gis.h:520
char grid_col[40]
Definition: gis.h:519
float lightcol[3]
Definition: gis.h:523
int shading
Definition: gis.h:515
int dozero
Definition: gis.h:513
int lightson
Definition: gis.h:512
float shine
Definition: gis.h:525
int display_type
Definition: gis.h:511
int poly_freq
Definition: gis.h:510
float ambient
Definition: gis.h:524
float exag
Definition: gis.h:508
float twist
Definition: gis.h:507
int fringe
Definition: gis.h:516
float lightpos[4]
Definition: gis.h:522
int surfonly
Definition: gis.h:517
int doavg
Definition: gis.h:518
Definition: gis.h:529
char ** value
Definition: gis.h:533
int nitems
Definition: gis.h:530
int nalloc
Definition: gis.h:531
char ** key
Definition: gis.h:532
Structure that stores option information.
Definition: gis.h:558
int(* checker)(const char *)
Definition: gis.h:580
const char * key
Definition: gis.h:559
struct Option * next_opt
Definition: gis.h:575
int count
Definition: gis.h:581
const char * key_desc
Definition: gis.h:565
const char ** opts
Definition: gis.h:564
const char * gisprompt
Definition: gis.h:576
const char * label
Definition: gis.h:566
int type
Definition: gis.h:560
const char * descriptions
Definition: gis.h:568
const char * def
Definition: gis.h:573
const char * description
Definition: gis.h:567
char * answer
Definition: gis.h:572
int required
Definition: gis.h:561
const char ** descs
Definition: gis.h:570
const char * options
Definition: gis.h:563
char ** answers
Definition: gis.h:574
int multiple
Definition: gis.h:562
const char * guisection
Definition: gis.h:577
const char * guidependency
Definition: gis.h:579
Definition: gis.h:624
int pid
Definition: gis.h:626
FILE * fp
Definition: gis.h:625
Definition: gis.h:615
DateTime dt[2]
Definition: gis.h:616
int count
Definition: gis.h:617
struct _Color_Info_::@3 lookup
unsigned char * red
Definition: gis.h:668
DCELL * vals
Definition: gis.h:677
struct _Color_Info_::@4 fp_lookup
DCELL max
Definition: gis.h:684
int active
Definition: gis.h:673
unsigned char * set
Definition: gis.h:671
unsigned char * blu
Definition: gis.h:670
struct _Color_Rule_ * rules
Definition: gis.h:664
unsigned char * grn
Definition: gis.h:669
struct _Color_Rule_ ** rules
Definition: gis.h:679
DCELL min
Definition: gis.h:684
int n_rules
Definition: gis.h:665
int nalloc
Definition: gis.h:672
struct _Color_Rule_ * prev
Definition: gis.h:660
struct _Color_Rule_ * next
Definition: gis.h:659
struct _Color_Value_ low high
Definition: gis.h:658
unsigned char blu
Definition: gis.h:654
unsigned char red
Definition: gis.h:652
DCELL value
Definition: gis.h:651
unsigned char grn
Definition: gis.h:653
List of integers.
Definition: gis.h:710
int n_values
Number of values in the list.
Definition: gis.h:718
int * value
Array of values.
Definition: gis.h:714
int alloc_values
Allocated space for values.
Definition: gis.h:722