gis.h 21 KB

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