gis.h 22 KB

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