svn-gvsig-desktop / tags / v2_0_0_Build_2002 / libraries / libjni-gdal-macosx / include / ogr_core.h @ 41849
History | View | Annotate | Download (10.5 KB)
1 | 8219 | nacho | /******************************************************************************
|
---|---|---|---|
2 | * $Id$
|
||
3 | *
|
||
4 | * Project: OpenGIS Simple Features Reference Implementation
|
||
5 | * Purpose: Define some core portability services for cross-platform OGR code.
|
||
6 | * Author: Frank Warmerdam, warmerdam@pobox.com
|
||
7 | *
|
||
8 | ******************************************************************************
|
||
9 | * Copyright (c) 1999, Frank Warmerdam
|
||
10 | *
|
||
11 | * Permission is hereby granted, free of charge, to any person obtaining a
|
||
12 | * copy of this software and associated documentation files (the "Software"),
|
||
13 | * to deal in the Software without restriction, including without limitation
|
||
14 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||
15 | * and/or sell copies of the Software, and to permit persons to whom the
|
||
16 | * Software is furnished to do so, subject to the following conditions:
|
||
17 | *
|
||
18 | * The above copyright notice and this permission notice shall be included
|
||
19 | * in all copies or substantial portions of the Software.
|
||
20 | *
|
||
21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||
22 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
23 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||
24 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||
27 | * DEALINGS IN THE SOFTWARE.
|
||
28 | ******************************************************************************
|
||
29 | *
|
||
30 | * $Log$
|
||
31 | * Revision 1.1 2006-10-23 06:25:39 nacho
|
||
32 | * *** empty log message ***
|
||
33 | *
|
||
34 | * Revision 1.1 2006/06/29 16:23:27 nacho
|
||
35 | * *** empty log message ***
|
||
36 | *
|
||
37 | * Revision 1.2 2006/01/09 12:50:13 nacho
|
||
38 | * *** empty log message ***
|
||
39 | *
|
||
40 | * Revision 1.1 2005/07/27 08:22:55 igbrotru
|
||
41 | * *** empty log message ***
|
||
42 | *
|
||
43 | * Revision 1.1 2004/12/28 14:06:59 igbrotru
|
||
44 | * *** empty log message ***
|
||
45 | *
|
||
46 | * Revision 1.1 2004/12/28 13:32:25 igbrotru
|
||
47 | * *** empty log message ***
|
||
48 | *
|
||
49 | * Revision 1.24 2003/10/09 15:27:41 warmerda
|
||
50 | * added OGRLayer::DeleteFeature() support
|
||
51 | *
|
||
52 | * Revision 1.23 2003/09/11 19:59:41 warmerda
|
||
53 | * avoid casting issue with UNFIX macro
|
||
54 | *
|
||
55 | * Revision 1.22 2003/08/27 15:40:37 warmerda
|
||
56 | * added support for generating DB2 V7.2 compatible WKB
|
||
57 | *
|
||
58 | * Revision 1.21 2003/08/11 03:28:04 warmerda
|
||
59 | * Export OGREnvelope C++ class with CPL_DLL as per bug 378.
|
||
60 | *
|
||
61 | * Revision 1.20 2003/06/09 13:48:54 warmerda
|
||
62 | * added DB2 V7.2 byte order hack
|
||
63 | *
|
||
64 | * Revision 1.19 2003/05/08 13:27:22 warmerda
|
||
65 | * dont use C++ comments in this c includable file
|
||
66 | *
|
||
67 | * Revision 1.18 2003/04/29 19:03:58 warmerda
|
||
68 | * removed extra comma
|
||
69 | *
|
||
70 | * Revision 1.17 2003/03/03 05:05:54 warmerda
|
||
71 | * added support for DeleteDataSource and DeleteLayer
|
||
72 | *
|
||
73 | * Revision 1.16 2003/02/19 02:57:49 warmerda
|
||
74 | * added wkbLinearRing support
|
||
75 | *
|
||
76 | * Revision 1.15 2003/01/14 20:08:49 warmerda
|
||
77 | * fixed another bug in OGREnvelope.Merge
|
||
78 | *
|
||
79 | * Revision 1.14 2003/01/07 17:51:55 warmerda
|
||
80 | * fixed OGREnvelope.Merge()
|
||
81 | *
|
||
82 | * Revision 1.13 2003/01/06 17:56:03 warmerda
|
||
83 | * Added Merge and IsInit() method on OGREnvelope
|
||
84 | *
|
||
85 | * Revision 1.12 2002/11/08 18:25:45 warmerda
|
||
86 | * remove extranious comma in enum, confuses HPUX compiler
|
||
87 | *
|
||
88 | * Revision 1.11 2002/11/08 15:42:41 warmerda
|
||
89 | * ensure type correctness of wkbFlatten
|
||
90 | *
|
||
91 | * Revision 1.10 2002/10/24 20:53:02 warmerda
|
||
92 | * expand tabs
|
||
93 | *
|
||
94 | * Revision 1.9 2002/09/26 18:13:17 warmerda
|
||
95 | * moved some defs to ogr_core.h for sharing with ogr_api.h
|
||
96 | *
|
||
97 | * Revision 1.8 2000/07/11 20:15:12 warmerda
|
||
98 | * apply CPL_DLL to OGR functions
|
||
99 | *
|
||
100 | * Revision 1.7 2000/07/09 20:47:35 warmerda
|
||
101 | * added CPL_START/END
|
||
102 | *
|
||
103 | * Revision 1.6 1999/11/18 19:02:19 warmerda
|
||
104 | * expanded tabs
|
||
105 | *
|
||
106 | * Revision 1.5 1999/07/07 04:23:07 danmo
|
||
107 | * Fixed typo in #define _OGR_..._H_INCLUDED line
|
||
108 | *
|
||
109 | * Revision 1.4 1999/07/05 18:56:52 warmerda
|
||
110 | * now includes cpl_port.h
|
||
111 | *
|
||
112 | * Revision 1.3 1999/07/05 17:19:03 warmerda
|
||
113 | * added OGRERR_UNSUPPORTED_SRS
|
||
114 | *
|
||
115 | * Revision 1.2 1999/05/31 15:00:37 warmerda
|
||
116 | * added generic OGRERR_FAILURE error code.
|
||
117 | *
|
||
118 | * Revision 1.1 1999/05/20 14:35:00 warmerda
|
||
119 | * New
|
||
120 | *
|
||
121 | */
|
||
122 | |||
123 | #ifndef _OGR_CORE_H_INCLUDED
|
||
124 | #define _OGR_CORE_H_INCLUDED
|
||
125 | |||
126 | #include "cpl_port.h" |
||
127 | |||
128 | /**
|
||
129 | * Simple container for a bounding region.
|
||
130 | */
|
||
131 | |||
132 | #ifdef __cplusplus
|
||
133 | class CPL_DLL OGREnvelope |
||
134 | { |
||
135 | public:
|
||
136 | OGREnvelope() |
||
137 | { |
||
138 | MinX = MaxX = MinY = MaxY = 0;
|
||
139 | } |
||
140 | double MinX;
|
||
141 | double MaxX;
|
||
142 | double MinY;
|
||
143 | double MaxY;
|
||
144 | |||
145 | int IsInit() { return MinX != 0 || MinY != 0 || MaxX != 0 || MaxY != 0; } |
||
146 | void Merge( OGREnvelope & sOther ) {
|
||
147 | if( IsInit() )
|
||
148 | { |
||
149 | MinX = MIN(MinX,sOther.MinX); |
||
150 | MaxX = MAX(MaxX,sOther.MaxX); |
||
151 | MinY = MIN(MinY,sOther.MinY); |
||
152 | MaxY = MAX(MaxY,sOther.MaxY); |
||
153 | } |
||
154 | else
|
||
155 | { |
||
156 | MinX = sOther.MinX; |
||
157 | MaxX = sOther.MaxX; |
||
158 | MinY = sOther.MinY; |
||
159 | MaxY = sOther.MaxY; |
||
160 | } |
||
161 | } |
||
162 | }; |
||
163 | #else
|
||
164 | typedef struct |
||
165 | { |
||
166 | double MinX;
|
||
167 | double MaxX;
|
||
168 | double MinY;
|
||
169 | double MaxY;
|
||
170 | } OGREnvelope; |
||
171 | #endif
|
||
172 | |||
173 | CPL_C_START |
||
174 | |||
175 | void CPL_DLL *OGRMalloc( size_t );
|
||
176 | void CPL_DLL *OGRCalloc( size_t, size_t );
|
||
177 | void CPL_DLL *OGRRealloc( void *, size_t ); |
||
178 | char CPL_DLL *OGRStrdup( const char * ); |
||
179 | void CPL_DLL OGRFree( void * ); |
||
180 | |||
181 | typedef int OGRErr; |
||
182 | |||
183 | #define OGRERR_NONE 0 |
||
184 | #define OGRERR_NOT_ENOUGH_DATA 1 /* not enough data to deserialize */ |
||
185 | #define OGRERR_NOT_ENOUGH_MEMORY 2 |
||
186 | #define OGRERR_UNSUPPORTED_GEOMETRY_TYPE 3 |
||
187 | #define OGRERR_UNSUPPORTED_OPERATION 4 |
||
188 | #define OGRERR_CORRUPT_DATA 5 |
||
189 | #define OGRERR_FAILURE 6 |
||
190 | #define OGRERR_UNSUPPORTED_SRS 7 |
||
191 | |||
192 | typedef int OGRBoolean; |
||
193 | |||
194 | /* -------------------------------------------------------------------- */
|
||
195 | /* ogr_geometry.h related definitions. */
|
||
196 | /* -------------------------------------------------------------------- */
|
||
197 | /**
|
||
198 | * List of well known binary geometry types. These are used within the BLOBs
|
||
199 | * but are also returned from OGRGeometry::getGeometryType() to identify the
|
||
200 | * type of a geometry object.
|
||
201 | */
|
||
202 | |||
203 | typedef enum |
||
204 | { |
||
205 | wkbUnknown = 0, /* non-standard */ |
||
206 | wkbPoint = 1, /* rest are standard WKB type codes */ |
||
207 | wkbLineString = 2,
|
||
208 | wkbPolygon = 3,
|
||
209 | wkbMultiPoint = 4,
|
||
210 | wkbMultiLineString = 5,
|
||
211 | wkbMultiPolygon = 6,
|
||
212 | wkbGeometryCollection = 7,
|
||
213 | wkbNone = 100, /* non-standard, for pure attribute records */ |
||
214 | wkbLinearRing = 101, /* non-standard, just for createGeometry() */ |
||
215 | wkbPoint25D = 0x80000001, /* 2.5D extensions as per 99-402 */ |
||
216 | wkbLineString25D = 0x80000002,
|
||
217 | wkbPolygon25D = 0x80000003,
|
||
218 | wkbMultiPoint25D = 0x80000004,
|
||
219 | wkbMultiLineString25D = 0x80000005,
|
||
220 | wkbMultiPolygon25D = 0x80000006,
|
||
221 | wkbGeometryCollection25D = 0x80000007
|
||
222 | } OGRwkbGeometryType; |
||
223 | |||
224 | #define wkb25DBit 0x80000000 |
||
225 | #define wkbFlatten(x) ((OGRwkbGeometryType) ((x) & (~wkb25DBit)))
|
||
226 | |||
227 | #define ogrZMarker 0x21125711 |
||
228 | |||
229 | const char CPL_DLL * OGRGeometryTypeToName( OGRwkbGeometryType eType ); |
||
230 | |||
231 | typedef enum |
||
232 | { |
||
233 | wkbXDR = 0, /* MSB/Sun/Motoroloa: Most Significant Byte First */ |
||
234 | wkbNDR = 1 /* LSB/Intel/Vax: Least Significant Byte First */ |
||
235 | } OGRwkbByteOrder; |
||
236 | |||
237 | #ifndef NO_HACK_FOR_IBM_DB2_V72
|
||
238 | # define HACK_FOR_IBM_DB2_V72
|
||
239 | #endif
|
||
240 | |||
241 | #ifdef HACK_FOR_IBM_DB2_V72
|
||
242 | # define DB2_V72_FIX_BYTE_ORDER(x) ((((x) & 0x31) == (x)) ? (OGRwkbByteOrder) ((x) & 0x1) : (x)) |
||
243 | # define DB2_V72_UNFIX_BYTE_ORDER(x) ((unsigned char) (OGRGeometry::bGenerate_DB2_V72_BYTE_ORDER ? ((x) | 0x30) : (x))) |
||
244 | #else
|
||
245 | # define DB2_V72_FIX_BYTE_ORDER(x) (x)
|
||
246 | # define DB2_V72_UNFIX_BYTE_ORDER(x) (x)
|
||
247 | #endif
|
||
248 | |||
249 | /************************************************************************/
|
||
250 | /* ogr_feature.h related definitions. */
|
||
251 | /************************************************************************/
|
||
252 | |||
253 | /**
|
||
254 | * List of feature field types. This list is likely to be extended in the
|
||
255 | * future ... avoid coding applications based on the assumption that all
|
||
256 | * field types can be known.
|
||
257 | */
|
||
258 | |||
259 | typedef enum |
||
260 | { |
||
261 | /** Simple 32bit integer */ OFTInteger = 0, |
||
262 | /** List of 32bit integers */ OFTIntegerList = 1, |
||
263 | /** Double Precision floating point */ OFTReal = 2, |
||
264 | /** List of doubles */ OFTRealList = 3, |
||
265 | /** String of ASCII chars */ OFTString = 4, |
||
266 | /** Array of strings */ OFTStringList = 5, |
||
267 | /** Double byte string (unsupported) */ OFTWideString = 6, |
||
268 | /** List of wide strings (unsupported) */ OFTWideStringList = 7, |
||
269 | /** Raw Binary data (unsupported) */ OFTBinary = 8 |
||
270 | } OGRFieldType; |
||
271 | |||
272 | /**
|
||
273 | * Display justification for field values.
|
||
274 | */
|
||
275 | |||
276 | typedef enum |
||
277 | { |
||
278 | OJUndefined = 0,
|
||
279 | OJLeft = 1,
|
||
280 | OJRight = 2
|
||
281 | } OGRJustification; |
||
282 | |||
283 | #define OGRNullFID -1 |
||
284 | #define OGRUnsetMarker -21121 |
||
285 | |||
286 | /************************************************************************/
|
||
287 | /* OGRField */
|
||
288 | /************************************************************************/
|
||
289 | |||
290 | /**
|
||
291 | * OGRFeature field attribute value union.
|
||
292 | */
|
||
293 | |||
294 | typedef union { |
||
295 | int Integer;
|
||
296 | double Real;
|
||
297 | char *String;
|
||
298 | /* wchar *WideString; */
|
||
299 | |||
300 | struct {
|
||
301 | int nCount;
|
||
302 | int *paList;
|
||
303 | } IntegerList; |
||
304 | |||
305 | struct {
|
||
306 | int nCount;
|
||
307 | double *paList;
|
||
308 | } RealList; |
||
309 | |||
310 | struct {
|
||
311 | int nCount;
|
||
312 | char **paList;
|
||
313 | } StringList; |
||
314 | |||
315 | /*
|
||
316 | union {
|
||
317 | int nCount;
|
||
318 | wchar *paList;
|
||
319 | } WideStringList;
|
||
320 | */
|
||
321 | |||
322 | struct {
|
||
323 | int nMarker1;
|
||
324 | int nMarker2;
|
||
325 | } Set; |
||
326 | } OGRField; |
||
327 | |||
328 | /* -------------------------------------------------------------------- */
|
||
329 | /* Constants from ogrsf_frmts.h for capabilities. */
|
||
330 | /* -------------------------------------------------------------------- */
|
||
331 | #define OLCRandomRead "RandomRead" |
||
332 | #define OLCSequentialWrite "SequentialWrite" |
||
333 | #define OLCRandomWrite "RandomWrite" |
||
334 | #define OLCFastSpatialFilter "FastSpatialFilter" |
||
335 | #define OLCFastFeatureCount "FastFeatureCount" |
||
336 | #define OLCFastGetExtent "FastGetExtent" |
||
337 | #define OLCCreateField "CreateField" |
||
338 | #define OLCTransactions "Transactions" |
||
339 | #define OLCDeleteFeature "DeleteFeature" |
||
340 | |||
341 | #define ODsCCreateLayer "CreateLayer" |
||
342 | #define ODsCDeleteLayer "DeleteLayer" |
||
343 | |||
344 | #define ODrCCreateDataSource "CreateDataSource" |
||
345 | #define ODrCDeleteDataSource "DeleteDataSource" |
||
346 | |||
347 | CPL_C_END |
||
348 | |||
349 | #endif /* ndef _OGR_CORE_H_INCLUDED */ |