gis.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712
  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-2021 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) || (__APPLE__ && __LP64__)
  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 "GRASS8"
  109. #else
  110. #define CONFIG_DIR ".grass8"
  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_STDS_INPUT, /*!< old input space time dataset of type strds, str3ds or stvds */
  259. G_OPT_STDS_INPUTS, /*!< old input space time datasets */
  260. G_OPT_STDS_OUTPUT, /*!< new output space time dataset */
  261. G_OPT_STRDS_INPUT, /*!< old input space time raster dataset */
  262. G_OPT_STRDS_INPUTS, /*!< old input space time raster datasets */
  263. G_OPT_STRDS_OUTPUT, /*!< new output space time raster dataset */
  264. G_OPT_STRDS_OUTPUTS, /*!< new output space time raster datasets */
  265. G_OPT_STR3DS_INPUT, /*!< old input space time raster3d dataset */
  266. G_OPT_STR3DS_INPUTS, /*!< old input space time raster3d datasets */
  267. G_OPT_STR3DS_OUTPUT, /*!< new output space time raster3d dataset */
  268. G_OPT_STVDS_INPUT, /*!< old input space time vector dataset */
  269. G_OPT_STVDS_INPUTS, /*!< old input space time vector datasets */
  270. G_OPT_STVDS_OUTPUT, /*!< new output space time vector dataset */
  271. G_OPT_MAP_INPUT, /*!< old input map of type raster, vector or raster3d */
  272. G_OPT_MAP_INPUTS, /*!< old input maps of type raster, vector or raster3d */
  273. G_OPT_STDS_TYPE, /*!< the type of a space time dataset: strds, str3ds, stvds */
  274. G_OPT_MAP_TYPE, /*!< The type of an input map: raster, vect, rast3d */
  275. G_OPT_T_TYPE, /*!< The temporal type of a space time dataset */
  276. G_OPT_T_WHERE, /*!< A temporal GIS framework SQL WHERE statement */
  277. G_OPT_T_SAMPLE /*!< Temporal sample methods */
  278. } STD_OPT;
  279. /*!
  280. \typedef STD_FLG
  281. \brief Standard flag identifiers (enum)
  282. Identifies of all recognized standard flags.
  283. Used by the G_parser() system.
  284. */
  285. /**/ typedef enum
  286. {
  287. G_FLG_UNDEFINED,
  288. G_FLG_V_TABLE, /*!< do not create attribute table */
  289. G_FLG_V_TOPO /*!< do not build topology */
  290. } STD_FLG;
  291. /* Parser rules for G__option_rule() */
  292. enum rule_type {
  293. RULE_EXCLUSIVE,
  294. RULE_REQUIRED,
  295. RULE_REQUIRES,
  296. RULE_REQUIRES_ALL,
  297. RULE_EXCLUDES,
  298. RULE_COLLECTIVE
  299. };
  300. /* Message format */
  301. #define G_INFO_FORMAT_STANDARD 0 /* GRASS_MESSAGE_FORMAT=standard or not defined */
  302. #define G_INFO_FORMAT_GUI 1 /* GRASS_MESSAGE_FORMAT=gui */
  303. #define G_INFO_FORMAT_SILENT 2 /* GRASS_MESSAGE_FORMAT=silent */
  304. #define G_INFO_FORMAT_PLAIN 3 /* GRASS_MESSAGE_FORMAT=plain */
  305. /* Icon types */
  306. #define G_ICON_CROSS 0
  307. #define G_ICON_BOX 1
  308. #define G_ICON_ARROW 2
  309. /* default colors */
  310. #define DEFAULT_FG_COLOR "black"
  311. #define DEFAULT_BG_COLOR "white"
  312. #define DEFAULT_COLOR_TABLE "viridis"
  313. /* error codes */
  314. #define G_FATAL_EXIT 0
  315. #define G_FATAL_PRINT 1
  316. #define G_FATAL_RETURN 2
  317. /*! \brief Endian check */
  318. #define ENDIAN_LITTLE 0
  319. #define ENDIAN_BIG 1
  320. #define ENDIAN_OTHER 2
  321. /* for vector maps */
  322. /*!
  323. \brief Name of default key column
  324. */
  325. #define GV_KEY_COLUMN "cat"
  326. /*!
  327. \brief Element types identifiers (enum)
  328. Identifies various element types. Element can be raster map,
  329. vector map, etc.
  330. */
  331. enum
  332. { /* Dir */
  333. G_ELEMENT_RASTER = 1, /*!< raster */
  334. G_ELEMENT_RASTER3D = 2, /*!< 3d raster */
  335. G_ELEMENT_VECTOR = 3, /*!< vector */
  336. G_ELEMENT_ASCIIVECTOR = 4, /*!< ASCII vector */
  337. G_ELEMENT_LABEL = 5, /*!< labels */
  338. G_ELEMENT_REGION = 6, /*!< region */
  339. G_ELEMENT_GROUP = 7 /*!< group */
  340. };
  341. /*=========================== Typedefs/Structures ==========================*/
  342. /*!
  343. \brief 2D/3D raster map header (used also for region)
  344. */
  345. struct Cell_head
  346. {
  347. /*! \brief Max number of bytes per raster data value minus 1 (raster header only)
  348. Note: -1 for FP raster maps
  349. */
  350. int format;
  351. /*! \brief Compression mode (raster header only)
  352. - 0: uncompressed
  353. - 1: compressed
  354. - -1: pre GRASS 3.0
  355. */
  356. int compressed;
  357. /*! \brief Number of rows for 2D data */
  358. int rows;
  359. /*! \brief Number of rows for 3D data */
  360. int rows3;
  361. /*! \brief Number of columns for 2D data */
  362. int cols;
  363. /*! \brief Number of columns for 3D data */
  364. int cols3;
  365. /*! \brief number of depths for 3D data */
  366. int depths;
  367. /*! \brief Projection code
  368. - PROJECTION_XY
  369. - PROJECTION_UTM
  370. - PROJECTION_SP
  371. - PROJECTION_LL
  372. - PROJECTION_OTHER
  373. */
  374. int proj;
  375. /*! \brief Projection zone (UTM) */
  376. int zone;
  377. /*! \brief Resolution - east to west cell size for 2D data */
  378. double ew_res;
  379. /*! \brief Resolution - east to west cell size for 3D data */
  380. double ew_res3;
  381. /*! \brief Resolution - north to south cell size for 2D data */
  382. double ns_res;
  383. /*! \brief Resolution - north to south cell size for 3D data */
  384. double ns_res3;
  385. /*! \brief Resolution - top to bottom cell size for 3D data */
  386. double tb_res;
  387. /*! \brief Extent coordinates (north) */
  388. double north;
  389. /*! \brief Extent coordinates (south) */
  390. double south;
  391. /*! \brief Extent coordinates (east) */
  392. double east;
  393. /*! \brief Extent coordinates (west) */
  394. double west;
  395. /*! \brief Extent coordinates (top) - 3D data*/
  396. double top;
  397. /*! \brief Extent coordinates (bottom) - 3D data */
  398. double bottom;
  399. };
  400. /*
  401. ** Structure for I/O of 3dview files (view.c)
  402. */
  403. struct G_3dview
  404. {
  405. char pgm_id[40]; /* user-provided identifier */
  406. float from_to[2][3]; /* eye position & lookat position */
  407. float fov; /* field of view */
  408. float twist; /* right_hand rotation about from_to */
  409. float exag; /* terrain elevation exageration */
  410. int mesh_freq; /* cells per grid line */
  411. int poly_freq; /* cells per polygon */
  412. int display_type; /* 1 for mesh, 2 for poly, 3 for both */
  413. int lightson; /* boolean */
  414. int dozero; /* boolean */
  415. int colorgrid; /* boolean */
  416. int shading; /* boolean */
  417. int fringe; /* boolean */
  418. int surfonly; /* boolean */
  419. int doavg; /* boolean */
  420. char grid_col[40]; /* colors */
  421. char bg_col[40]; /* colors */
  422. char other_col[40]; /* colors */
  423. float lightpos[4]; /* east, north, height, 1.0 for local 0.0 infin */
  424. float lightcol[3]; /* values between 0.0 to 1.0 for red, grn, blu */
  425. float ambient;
  426. float shine;
  427. struct Cell_head vwin;
  428. };
  429. struct Key_Value
  430. {
  431. int nitems;
  432. int nalloc;
  433. char **key;
  434. char **value;
  435. };
  436. /*!
  437. \brief Structure that stores option information
  438. The descriptions member contains pairs of option and option
  439. descriptions separated by semicolon ';'.
  440. For example, when options member is set using:
  441. \code
  442. opt->options = "break,rmdupl"
  443. \endcode
  444. the descriptions member should be set to:
  445. \verbatim
  446. "break;break lines on intersections;"
  447. "rmdupl;remove duplicates"
  448. \endverbatim
  449. Parsed descriptions are stored in the same order as options.
  450. GUI dependency is a list of options (separated by commas) to be updated
  451. if the value is changed.
  452. Used by the G_parser() system.
  453. */
  454. struct Option
  455. {
  456. const char *key; /*!< Key word used on command line */
  457. int type; /*!< Option type */
  458. int required; /*!< REQUIRED or OPTIONAL */
  459. int multiple; /*!< Multiple entries OK */
  460. const char *options; /*!< Approved values or range or NULL */
  461. const char **opts; /*!< NULL or NULL terminated array of parsed options */
  462. const char *key_desc; /*!< one word describing the key */
  463. const char *label; /*!< Optional short label, used in GUI as item label */
  464. const char *description; /*!< String describing option */
  465. const char *descriptions; /*!< ';' separated pairs of option and option descriptions */
  466. const char **descs; /*!< parsed descriptions, array of either NULL or string */
  467. char *answer; /*!< Option answer */
  468. const char *def; /*!< Where original answer gets saved */
  469. char **answers; /*!< Option answers (for multiple=YES) */
  470. struct Option *next_opt; /*!< Pointer to next option struct */
  471. const char *gisprompt; /*!< Interactive prompt guidance */
  472. const char *guisection; /*!< GUI Layout guidance: ';' delimited hierarchical tree position */
  473. const char *guidependency; /*!< GUI dependency */
  474. int (*checker)(const char *);/*!< Routine to check answer or NULL */
  475. int count;
  476. };
  477. /*!
  478. \brief Structure that stores flag info
  479. Used by the G_parser() system.
  480. */
  481. struct Flag
  482. {
  483. char key; /*!< Key char used on command line */
  484. char answer; /*!< Stores flag state: 0/1 */
  485. char suppress_required; /*!< Suppresses checking of required options */
  486. char suppress_overwrite; /*!< Suppresses checking of existing output */
  487. const char *label; /*!< Optional short label, used in GUI as item label */
  488. const char *description; /*!< String describing flag meaning */
  489. const char *guisection; /*!< GUI Layout guidance: ';' delimited hierarchical tree position */
  490. struct Flag *next_flag; /*!< Pointer to next flag struct */
  491. };
  492. /*!
  493. \brief Structure that stores module info
  494. Used by the G_parser() system.
  495. */
  496. struct GModule
  497. {
  498. const char *label; /*!< Optional short description for GUI */
  499. const char *description; /*!< String describing module */
  500. const char **keywords; /*!< Keywords describing module */
  501. /* further items are possible: author(s), version, year */
  502. int overwrite; /*!< overwrite old files */
  503. int verbose; /*!< print all information about progress and so on */
  504. };
  505. struct TimeStamp
  506. {
  507. DateTime dt[2]; /* two datetimes */
  508. int count;
  509. };
  510. struct Counter {
  511. int value;
  512. };
  513. struct Popen {
  514. FILE *fp;
  515. int pid;
  516. };
  517. typedef int CELL;
  518. typedef double DCELL;
  519. typedef float FCELL;
  520. /* 64 bit signed integer */
  521. #if HAVE_INT64_T
  522. #include <sys/types.h>
  523. typedef int64_t grass_int64;
  524. #elif defined(__MINGW32__)
  525. typedef __int64 grass_int64;
  526. #elif HAVE_LONG_LONG_INT
  527. typedef long long int grass_int64;
  528. #elif HAVE_LARGEFILES
  529. typedef off_t grass_int64;
  530. #else
  531. #error "no 64 bit integer available"
  532. #endif
  533. /* LCELL = large CELL, proposed new raster data type */
  534. typedef grass_int64 LCELL;
  535. struct _Color_Value_
  536. {
  537. DCELL value;
  538. unsigned char red;
  539. unsigned char grn;
  540. unsigned char blu;
  541. };
  542. struct _Color_Rule_
  543. {
  544. struct _Color_Value_ low, high;
  545. struct _Color_Rule_ *next;
  546. struct _Color_Rule_ *prev;
  547. };
  548. struct _Color_Info_
  549. {
  550. struct _Color_Rule_ *rules;
  551. int n_rules;
  552. struct
  553. {
  554. unsigned char *red;
  555. unsigned char *grn;
  556. unsigned char *blu;
  557. unsigned char *set;
  558. int nalloc;
  559. int active;
  560. } lookup;
  561. struct
  562. {
  563. DCELL *vals;
  564. /* pointers to color rules corresponding to the intervals btwn vals */
  565. struct _Color_Rule_ **rules;
  566. int nalloc;
  567. int active;
  568. } fp_lookup;
  569. DCELL min, max;
  570. };
  571. struct Colors
  572. {
  573. int version; /* set by read_colors: -1=old,1=new */
  574. DCELL shift;
  575. int invert;
  576. int is_float; /* defined on floating point raster data? */
  577. int null_set; /* the colors for null are set? */
  578. unsigned char null_red;
  579. unsigned char null_grn;
  580. unsigned char null_blu;
  581. int undef_set; /* the colors for cells not in range are set? */
  582. unsigned char undef_red;
  583. unsigned char undef_grn;
  584. unsigned char undef_blu;
  585. struct _Color_Info_ fixed;
  586. struct _Color_Info_ modular;
  587. DCELL cmin;
  588. DCELL cmax;
  589. int organizing;
  590. };
  591. /*!
  592. \brief List of integers
  593. */
  594. struct ilist
  595. {
  596. /*!
  597. \brief Array of values
  598. */
  599. int *value;
  600. /*!
  601. \brief Number of values in the list
  602. */
  603. int n_values;
  604. /*!
  605. \brief Allocated space for values
  606. */
  607. int alloc_values;
  608. };
  609. /*============================== Prototypes ================================*/
  610. /* Since there are so many prototypes for the gis library they are stored */
  611. /* in the file gisdefs.h */
  612. #include <grass/defs/gis.h>
  613. #endif /* GRASS_GIS_H */