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