gis.h 20 KB

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