gis.h 20 KB

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