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