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