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