GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
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 GV_BUILD_CENTROIDS) */
133 #define GV_BUILD_ALL GV_BUILD_CENTROIDS
134 
135 /*! \brief Check if vector map is open */
136 #define VECT_OPEN(Map) (Map->open == VECT_OPEN_CODE)
137 
138 /*! \brief Memory mode */
139 #define GV_MEMORY_ALWAYS 1
140 #define GV_MEMORY_NEVER 2
141 #define GV_MEMORY_AUTO 3
142 
143 /*! \brief Coordinates file head size */
144 #define GV_COOR_HEAD_SIZE 14
145 
146 #define GRASS_V_VERSION "5.0"
147 /*! \brief The latest versions of files known by current version of
148  the library. Used for new files */
149 #define GV_COOR_VER_MAJOR 5
150 #define GV_COOR_VER_MINOR 1
151 #define GV_TOPO_VER_MAJOR 5
152 #define GV_TOPO_VER_MINOR 1
153 #define GV_SIDX_VER_MAJOR 5
154 #define GV_SIDX_VER_MINOR 1
155 #define GV_CIDX_VER_MAJOR 5
156 #define GV_CIDX_VER_MINOR 0
157 
158 /*! \brief The oldest versions of the library, which are capable to
159  read the files created by the current version */
160 #define GV_COOR_EARLIEST_MAJOR 5
161 #define GV_COOR_EARLIEST_MINOR 1
162 #define GV_TOPO_EARLIEST_MAJOR 5
163 #define GV_TOPO_EARLIEST_MINOR 1
164 #define GV_SIDX_EARLIEST_MAJOR 5
165 #define GV_SIDX_EARLIEST_MINOR 1
166 #define GV_CIDX_EARLIEST_MAJOR 5
167 #define GV_CIDX_EARLIEST_MINOR 0
168 
169 /*! \brief 2D/3D vector data */
170 #define WITHOUT_Z 0
171 #define WITH_Z 1
172 
173 /*! \brief Boundary side indicator left/right */
174 #define GV_LEFT 1
175 #define GV_RIGHT 2
176 
177 /*! \brief Line direction indicator forward/backward */
178 #define GV_FORWARD 1
179 #define GV_BACKWARD 2
180 
181 /*! \brief Feature types used in memory on run time (may change) */
182 #define GV_POINT 0x01
183 #define GV_LINE 0x02
184 #define GV_BOUNDARY 0x04
185 #define GV_CENTROID 0x08
186 #define GV_FACE 0x10
187 #define GV_KERNEL 0x20
188 #define GV_AREA 0x40
189 #define GV_VOLUME 0x80
190 
191 #define GV_POINTS (GV_POINT | GV_CENTROID )
192 #define GV_LINES (GV_LINE | GV_BOUNDARY )
193 
194 /*! \brief Feature types used in store like 'coor' file or postgis type column (must not change) */
195 #define GV_STORE_POINT 1
196 #define GV_STORE_LINE 2
197 #define GV_STORE_BOUNDARY 3
198 #define GV_STORE_CENTROID 4
199 #define GV_STORE_FACE 5
200 #define GV_STORE_KERNEL 6
201 #define GV_STORE_AREA 7 /* used in category index file */
202 #define GV_STORE_VOLUME 8 /* used in category index file */
203 
204 /*! \brief Overlay operators */
205 #define GV_ON_AND "AND" /* intersect */
206 #define GV_ON_OVERLAP "OVERLAP"
207 
209 {
212 };
213 
215 
216 /*! \brief Maximum number of categories for one element */
217 #define GV_NCATS_MAX PORT_INT_MAX
218 /*! \brief Maximum field */
219 #define GV_FIELD_MAX PORT_INT_MAX
220 /*! \brief Maximum category value */
221 #define GV_CAT_MAX PORT_INT_MAX
222 
223 /*! \brief GRASS ASCII vector format - point format */
224 #define GV_ASCII_FORMAT_POINT 0
225 /*! \brief GRASS ASCII vector format - standard format */
226 #define GV_ASCII_FORMAT_STD 1
227 /*! \brief GRASS ASCII vector format - well-known-text format */
228 #define GV_ASCII_FORMAT_WKT 2
229 
230 /*! \brief Simple feature types
231 
232  Taken from GDAL/OGR library (ogr/ogr_core.h)
233 */
234 typedef enum
235 {
236  SF_GEOMETRY = 0, /* unknown type, non-standard */
237  SF_POINT = 1, /* 0-dimensional geometric object */
238  SF_LINESTRING = 2, /* 1-dimensional geometric object with linear
239  interpolation between Points */
240  SF_POLYGON = 3, /* planar 2-dimensional geometric object defined
241  by 1 exterior boundary and 0 or more interior
242  boundaries */
243  SF_MULTIPOINT = 4, /* GeometryCollection of Points */
244  SF_MULTILINESTRING = 5, /* GeometryCollection of LineStrings */
245  SF_MULTIPOLYGON = 6, /* GeometryCollection of Polygons */
246  SF_GEOMETRYCOLLECTION = 7, /* geometric object that is a collection of 1
247  or more geometric objects */
248  SF_NONE = 100, /* non-standard, for pure attribute records */
249  SF_LINEARRING = 101, /* non-standard */
250  SF_POINT25D = 0x80000001, /* 2.5D extension as per 99-402 */
251  SF_LINESTRING25D = 0x80000002, /* 2.5D extension as per 99-402 */
252  SF_POLYGON25D = 0x80000003, /* 2.5D extension as per 99-402 */
253  SF_MULTIPOINT25D = 0x80000004, /* 2.5D extension as per 99-402 */
254  SF_MULTILINESTRING25D = 0x80000005, /* 2.5D extension as per 99-402 */
255  SF_MULTIPOLYGON25D = 0x80000006, /* 2.5D extension as per 99-402 */
256  SF_GEOMETRYCOLLECTION25D = 0x80000007 /* 2.5D extension as per 99-402 */
258 
259 #define HEADSTR 50
260 
261 /*! \brief GRASS-PostGIS data provider - default fid column */
262 #define GV_PG_FID_COLUMN "fid"
263 /*! \brief GRASS-PostGIS data provider - default geometry column */
264 #define GV_PG_GEOMETRY_COLUMN "geom"
enum overlay_operator OVERLAY_OPERATOR
Definition: dig_defines.h:214
overlay_operator
Definition: dig_defines.h:208
SF_FeatureType
Simple feature types.
Definition: dig_defines.h:234