Statistics
| Revision:

svn-gvsig-desktop / tags / v1_0_2_Build_916 / libraries / libjni-gdal / include / ogr_core.h @ 12327

History | View | Annotate | Download (10.6 KB)

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