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