gis.h 21 KB

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