dig_defines.h 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. /*!
  2. \file include/vect/dig_defines.h
  3. Defines for diglib (part of vector library)
  4. */
  5. /*! \brief Name of vector directory */
  6. #define GV_DIRECTORY "vector"
  7. /*! \brief Format description, data location (OGR) */
  8. #define GV_FRMT_ELEMENT "frmt"
  9. /*! \brief Native format, coordinates */
  10. #define GV_COOR_ELEMENT "coor"
  11. /*! \brief Native format, header information */
  12. #define GV_HEAD_ELEMENT "head"
  13. /*! \brief Native format, link to database */
  14. #define GV_DBLN_ELEMENT "dbln"
  15. /*! \brief Native format, history file */
  16. #define GV_HIST_ELEMENT "hist"
  17. /*! \brief Native format, topology file */
  18. #define GV_TOPO_ELEMENT "topo"
  19. /*! \brief Native format, spatial index */
  20. #define GV_SIDX_ELEMENT "sidx"
  21. /*! \brief Native format, category index */
  22. #define GV_CIDX_ELEMENT "cidx"
  23. /*! \brief External format (OGR), feature index */
  24. #define GV_FIDX_ELEMENT "fidx"
  25. /*! \brief Color table */
  26. #define GV_COLR_ELEMENT "colr"
  27. /*! \brief Name of directory for alternative color tables */
  28. #define GV_COLR2_DIRECTORY "vcolr2"
  29. /*! \brief Name of the timestamp file */
  30. #define GV_TIMESTAMP_ELEMENT "timestamp"
  31. /*! \brief Sizes of types used in portable format (different names used in
  32. Vlib/ and diglib/ for the same thing)
  33. Assumptions:
  34. - double = 8 byte IEEE
  35. - float = 4 byte IEEE
  36. - long = 4 byte int
  37. - short = 2 byte int
  38. \todo To be moved to gislib?
  39. */
  40. #define PORT_DOUBLE 8
  41. #define PORT_FLOAT 4
  42. #define PORT_LONG 4
  43. #define PORT_INT 4
  44. #define PORT_SHORT 2
  45. #define PORT_CHAR 1
  46. #define PORT_OFF_T 8
  47. /*! \brief replace by PORT_* in Vlib later and remove :
  48. \todo To be removed ?
  49. */
  50. #define DBL_SIZ 8
  51. #define FLT_SIZ 4
  52. #define LNG_SIZ 4
  53. #define SHRT_SIZ 2
  54. /*! \brief Limits for portable types
  55. \todo To be moved to gislib?
  56. */
  57. #define PORT_DOUBLE_MAX 1.7976931348623157e+308
  58. #define PORT_DOUBLE_MIN 2.2250738585072014e-308
  59. #define PORT_FLOAT_MAX 3.40282347e+38F
  60. #define PORT_FLOAT_MIN 1.17549435e-38F
  61. #define PORT_LONG_MAX 2147483647L
  62. #define PORT_LONG_MIN (-2147483647L)
  63. #define PORT_INT_MAX 2147483647
  64. #define PORT_INT_MIN (-2147483647)
  65. #define PORT_SHORT_MAX 32767
  66. #define PORT_SHORT_MIN (-32768)
  67. #define PORT_CHAR_MAX 127
  68. #define PORT_CHAR_MIN (-128)
  69. /*! \brief Geometry data formats supported by lib
  70. Don't change GV_FORMAT_* values, this order is hardcoded in lib
  71. */
  72. /*! \brief GRASS native format */
  73. #define GV_FORMAT_NATIVE 0
  74. /*! \brief OGR format */
  75. #define GV_FORMAT_OGR 1
  76. /*! \brief OGR format (direct access) */
  77. #define GV_FORMAT_OGR_DIRECT 2
  78. /*! \brief PostGIS format */
  79. #define GV_FORMAT_POSTGIS 3
  80. /*! \brief GRASS topology - native format */
  81. #define GV_TOPO_NATIVE 0
  82. /*! \brief Pseudo-topology - external simple features (OGR/PostGIS) format */
  83. #define GV_TOPO_PSEUDO 1
  84. /*! \brief PostGIS topology - external PostGIS format */
  85. #define GV_TOPO_POSTGIS 2
  86. /*! \brief One table linked to vector map */
  87. #define GV_1TABLE 0
  88. /*! \brief More tables linked to vector map */
  89. #define GV_MTABLE 1
  90. /*! \brief Read-only vector map open mode */
  91. #define GV_MODE_READ 0
  92. /*! \brief Write vector map open mode */
  93. #define GV_MODE_WRITE 1
  94. /*! \brief Read-write vector map open mode */
  95. #define GV_MODE_RW 2
  96. /*! \brief Vector map open code */
  97. #define VECT_OPEN_CODE 0x5522AA22
  98. /*! \brief Vector map close code */
  99. #define VECT_CLOSED_CODE 0x22AA2255
  100. /*! \brief Vector level - without topology */
  101. #define LEVEL_1 1
  102. /*! \brief Vector level - with 2D topology */
  103. #define LEVEL_2 2
  104. /*! \brief Vector level - with 3D topology (not implemented yet) */
  105. #define LEVEL_3 3
  106. /*! \brief Topology levels - nothing to build */
  107. #define GV_BUILD_NONE 0
  108. /*! \brief Topology levels - basic level (without areas and isles) */
  109. #define GV_BUILD_BASE 1
  110. /*! \brief Topology levels - build areas */
  111. #define GV_BUILD_AREAS 2
  112. /*! \brief Topology levels - attach islands to areas */
  113. #define GV_BUILD_ATTACH_ISLES 3
  114. /*! \brief Topology levels - assign centroids to areas */
  115. #define GV_BUILD_CENTROIDS 4
  116. /*! \brief Topology levels - build everything (currently same as GV_BUILD_CENTROIDS) */
  117. #define GV_BUILD_ALL GV_BUILD_CENTROIDS
  118. /*! \brief Check if vector map is open */
  119. #define VECT_OPEN(Map) (Map->open == VECT_OPEN_CODE)
  120. /*! \brief Memory mode */
  121. #define GV_MEMORY_ALWAYS 1
  122. #define GV_MEMORY_NEVER 2
  123. #define GV_MEMORY_AUTO 3
  124. /*! \brief Coordinates file head size */
  125. #define GV_COOR_HEAD_SIZE 14
  126. #define GRASS_V_VERSION "5.0"
  127. /*! \brief The latest versions of files known by current version of
  128. the library. Used for new files */
  129. #define GV_COOR_VER_MAJOR 5
  130. #define GV_COOR_VER_MINOR 1
  131. #define GV_TOPO_VER_MAJOR 5
  132. #define GV_TOPO_VER_MINOR 1
  133. #define GV_SIDX_VER_MAJOR 5
  134. #define GV_SIDX_VER_MINOR 1
  135. #define GV_CIDX_VER_MAJOR 5
  136. #define GV_CIDX_VER_MINOR 0
  137. /*! \brief The oldest versions of the library, which are capable to
  138. read the files created by the current version */
  139. #define GV_COOR_EARLIEST_MAJOR 5
  140. #define GV_COOR_EARLIEST_MINOR 1
  141. #define GV_TOPO_EARLIEST_MAJOR 5
  142. #define GV_TOPO_EARLIEST_MINOR 1
  143. #define GV_SIDX_EARLIEST_MAJOR 5
  144. #define GV_SIDX_EARLIEST_MINOR 1
  145. #define GV_CIDX_EARLIEST_MAJOR 5
  146. #define GV_CIDX_EARLIEST_MINOR 0
  147. /*! \brief 2D/3D vector data */
  148. #define WITHOUT_Z 0
  149. #define WITH_Z 1
  150. /*! \brief Boundary side indicator left/right */
  151. #define GV_LEFT 1
  152. #define GV_RIGHT 2
  153. /*! \brief Line direction indicator forward/backward */
  154. #define GV_FORWARD 1
  155. #define GV_BACKWARD 2
  156. /*! \brief Feature types used in memory on run time (may change) */
  157. #define GV_POINT 0x01
  158. #define GV_LINE 0x02
  159. #define GV_BOUNDARY 0x04
  160. #define GV_CENTROID 0x08
  161. #define GV_FACE 0x10
  162. #define GV_KERNEL 0x20
  163. #define GV_AREA 0x40
  164. #define GV_VOLUME 0x80
  165. #define GV_POINTS (GV_POINT | GV_CENTROID )
  166. #define GV_LINES (GV_LINE | GV_BOUNDARY )
  167. /*! \brief Feature types used in store like 'coor' file or postgis type column (must not change) */
  168. #define GV_STORE_POINT 1
  169. #define GV_STORE_LINE 2
  170. #define GV_STORE_BOUNDARY 3
  171. #define GV_STORE_CENTROID 4
  172. #define GV_STORE_FACE 5
  173. #define GV_STORE_KERNEL 6
  174. #define GV_STORE_AREA 7 /* used in category index file */
  175. #define GV_STORE_VOLUME 8 /* used in category index file */
  176. /*! \brief Overlay operators */
  177. #define GV_ON_AND "AND" /* intersect */
  178. #define GV_ON_OVERLAP "OVERLAP"
  179. enum overlay_operator
  180. {
  181. GV_O_AND,
  182. GV_O_OVERLAP
  183. };
  184. typedef enum overlay_operator OVERLAY_OPERATOR;
  185. /*! \brief Maximum number of categories for one element */
  186. #define GV_NCATS_MAX PORT_INT_MAX
  187. /*! \brief Maximum field */
  188. #define GV_FIELD_MAX PORT_INT_MAX
  189. /*! \brief Maximum category value */
  190. #define GV_CAT_MAX PORT_INT_MAX
  191. /*! \brief GRASS ASCII vector format - point format */
  192. #define GV_ASCII_FORMAT_POINT 0
  193. /*! \brief GRASS ASCII vector format - standard format */
  194. #define GV_ASCII_FORMAT_STD 1
  195. /*! \brief GRASS ASCII vector format - well-known-text format */
  196. #define GV_ASCII_FORMAT_WKT 2
  197. /*! \brief Simple feature types
  198. Taken from GDAL/OGR library (ogr/ogr_core.h)
  199. */
  200. typedef enum
  201. {
  202. SF_GEOMETRY = 0, /* unknown type, non-standard */
  203. SF_POINT = 1, /* 0-dimensional geometric object */
  204. SF_LINESTRING = 2, /* 1-dimensional geometric object with linear
  205. interpolation between Points */
  206. SF_POLYGON = 3, /* planar 2-dimensional geometric object defined
  207. by 1 exterior boundary and 0 or more interior
  208. boundaries */
  209. SF_MULTIPOINT = 4, /* GeometryCollection of Points */
  210. SF_MULTILINESTRING = 5, /* GeometryCollection of LineStrings */
  211. SF_MULTIPOLYGON = 6, /* GeometryCollection of Polygons */
  212. SF_GEOMETRYCOLLECTION = 7, /* geometric object that is a collection of 1
  213. or more geometric objects */
  214. SF_NONE = 100, /* non-standard, for pure attribute records */
  215. SF_LINEARRING = 101, /* non-standard */
  216. SF_POINT25D = 0x80000001, /* 2.5D extension as per 99-402 */
  217. SF_LINESTRING25D = 0x80000002, /* 2.5D extension as per 99-402 */
  218. SF_POLYGON25D = 0x80000003, /* 2.5D extension as per 99-402 */
  219. SF_MULTIPOINT25D = 0x80000004, /* 2.5D extension as per 99-402 */
  220. SF_MULTILINESTRING25D = 0x80000005, /* 2.5D extension as per 99-402 */
  221. SF_MULTIPOLYGON25D = 0x80000006, /* 2.5D extension as per 99-402 */
  222. SF_GEOMETRYCOLLECTION25D = 0x80000007 /* 2.5D extension as per 99-402 */
  223. } SF_FeatureType;
  224. #define HEADSTR 50
  225. /*! \brief GRASS-PostGIS data provider - default fid column */
  226. #define GV_PG_FID_COLUMN "fid"
  227. /*! \brief GRASS-PostGIS data provider - default geometry column */
  228. #define GV_PG_GEOMETRY_COLUMN "geom"