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