Statistics
| Revision:

svn-gvsig-desktop / tags / v1_11_0_Build_1301 / libraries / libjni-gdal-macosx / include / ogrsf_frmts.h @ 43469

History | View | Annotate | Download (13.4 KB)

1 8219 nacho
/******************************************************************************
2
 * $Id$
3
 *
4
 * Project:  OpenGIS Simple Features Reference Implementation
5
 * Purpose:  Classes related to format registration, and file opening.
6
 * Author:   Frank Warmerdam, warmerda@home.com
7
 *
8
 ******************************************************************************
9
 * Copyright (c) 1999,  Les Technologies SoftMap Inc.
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  2005/01/11 15:23:01  igbrotru
44
 * *** empty log message ***
45
 *
46
 * Revision 1.44  2004/07/20 19:18:44  warmerda
47
 * added CSV
48
 *
49
 * Revision 1.43  2004/07/10 05:03:24  warmerda
50
 * added SQLite
51
 *
52
 * Revision 1.42  2004/02/11 18:03:15  warmerda
53
 * added RegisterOGRDODS()
54
 *
55
 * Revision 1.41  2003/11/06 18:27:35  warmerda
56
 * Added VRT registration point
57
 *
58
 * Revision 1.40  2003/10/09 15:28:07  warmerda
59
 * added OGRLayer::DeleteFeature() support
60
 *
61
 * Revision 1.39  2003/10/06 19:15:40  warmerda
62
 * added ODBC support
63
 *
64
 * Revision 1.38  2003/05/28 19:17:31  warmerda
65
 * fixup stuff for docs
66
 *
67
 * Revision 1.37  2003/04/22 19:36:04  warmerda
68
 * Added SyncToDisk
69
 *
70
 * Revision 1.36  2003/04/08 21:21:29  warmerda
71
 * added OGRGetDriverByName
72
 *
73
 * Revision 1.35  2003/04/08 19:31:32  warmerda
74
 * added CopyLayer and CopyDataSource entry points
75
 *
76
 * Revision 1.34  2003/03/20 20:21:48  warmerda
77
 * added drop index
78
 *
79
 * Revision 1.33  2003/03/19 20:29:06  warmerda
80
 * added shared access and reference counting
81
 *
82
 * Revision 1.32  2003/03/05 05:09:11  warmerda
83
 * added GetLayerByName() method on OGRDataSource
84
 *
85
 * Revision 1.31  2003/03/04 05:47:23  warmerda
86
 * added indexing support
87
 *
88
 * Revision 1.30  2003/03/03 05:06:08  warmerda
89
 * added support for DeleteDataSource and DeleteLayer
90
 *
91
 * Revision 1.29  2003/02/03 21:16:49  warmerda
92
 * added .rec driver
93
 *
94
 * Revision 1.28  2002/12/28 04:09:18  warmerda
95
 * added Oracle support
96
 *
97
 * Revision 1.27  2002/09/26 18:15:31  warmerda
98
 * moved capabilities macros to ogr_core.h for ogr_api.h
99
 *
100
 * Revision 1.26  2002/06/25 14:45:50  warmerda
101
 * added RegisterOGRFME()
102
 *
103
 * Revision 1.25  2002/04/25 03:42:04  warmerda
104
 * fixed spatial filter support on SQL results
105
 *
106
 * Revision 1.24  2002/04/25 02:24:13  warmerda
107
 * added ExecuteSWQ() method
108
 *
109
 * Revision 1.23  2002/02/18 20:56:24  warmerda
110
 * added AVC registration
111
 *
112
 * Revision 1.22  2002/01/25 20:47:58  warmerda
113
 * added GML registration
114
 *
115
 * Revision 1.21  2001/11/15 21:19:21  warmerda
116
 * added transaction semantics
117
 *
118
 * Revision 1.20  2001/06/19 15:50:23  warmerda
119
 * added feature attribute query support
120
 *
121
 * Revision 1.19  2001/03/15 04:01:43  danmo
122
 * Added OGRLayer::GetExtent()
123
 *
124
 * Revision 1.18  2001/02/06 17:10:28  warmerda
125
 * export entry points from DLL
126
 *
127
 * Revision 1.17  2001/01/19 21:13:50  warmerda
128
 * expanded tabs
129
 *
130
 * Revision 1.16  2000/11/28 19:00:32  warmerda
131
 * added RegisterOGRDGN
132
 *
133
 * Revision 1.15  2000/10/17 17:54:53  warmerda
134
 * added postgresql support
135
 *
136
 * Revision 1.14  2000/08/24 04:44:05  danmo
137
 * Added optional OGDI driver in OGR
138
 *
139
 * Revision 1.13  2000/08/18 21:52:53  svillene
140
 * Add OGR Representation
141
 *
142
 * Revision 1.12  1999/11/14 18:13:08  svillene
143
 * add RegisterOGRTAB RegisterOGRMIF
144
 *
145
 * Revision 1.11  1999/11/04 21:09:40  warmerda
146
 * Made a bunch of changes related to supporting creation of new
147
 * layers and data sources.
148
 *
149
 * Revision 1.10  1999/10/06 19:02:43  warmerda
150
 * Added tiger registration.
151
 *
152
 * Revision 1.9  1999/09/22 03:05:08  warmerda
153
 * added SDTS
154
 *
155
 * Revision 1.8  1999/09/09 21:04:55  warmerda
156
 * added fme support
157
 *
158
 * Revision 1.7  1999/08/28 03:12:43  warmerda
159
 * Added NTF.
160
 *
161
 * Revision 1.6  1999/07/27 00:50:39  warmerda
162
 * added a number of OGRLayer methods
163
 *
164
 * Revision 1.5  1999/07/26 13:59:05  warmerda
165
 * added feature writing api
166
 *
167
 * Revision 1.4  1999/07/21 13:23:27  warmerda
168
 * Fixed multiple inclusion protection.
169
 *
170
 * Revision 1.3  1999/07/08 20:04:58  warmerda
171
 * added GetFeatureCount
172
 *
173
 * Revision 1.2  1999/07/06 20:25:09  warmerda
174
 * added some documentation
175
 *
176
 * Revision 1.1  1999/07/05 18:59:00  warmerda
177
 * new
178
 *
179
 */
180
181
#ifndef _OGRSF_FRMTS_H_INCLUDED
182
#define _OGRSF_FRMTS_H_INCLUDED
183
184
#include "ogr_feature.h"
185
186
/**
187
 * \file ogrsf_frmts.h
188
 *
189
 * Classes related to registration of format support, and opening datasets.
190
 */
191
192
class OGRLayerAttrIndex;
193
194
/************************************************************************/
195
/*                               OGRLayer                               */
196
/************************************************************************/
197
198
/**
199
 * This class represents a layer of simple features, with access methods.
200
 *
201
 */
202
203
class CPL_DLL OGRLayer
204
{
205
  public:
206
                OGRLayer();
207
    virtual     ~OGRLayer();
208
209
    virtual OGRGeometry *GetSpatialFilter() = 0;
210
    virtual void        SetSpatialFilter( OGRGeometry * ) = 0;
211
212
    virtual OGRErr      SetAttributeFilter( const char * );
213
214
    virtual void        ResetReading() = 0;
215
    virtual OGRFeature *GetNextFeature() = 0;
216
    virtual OGRFeature *GetFeature( long nFID );
217
    virtual OGRErr      SetFeature( OGRFeature *poFeature );
218
    virtual OGRErr      CreateFeature( OGRFeature *poFeature );
219
    virtual OGRErr      DeleteFeature( long nFID );
220
221
    virtual OGRFeatureDefn *GetLayerDefn() = 0;
222
223
    virtual OGRSpatialReference *GetSpatialRef() { return NULL; }
224
225
    virtual int         GetFeatureCount( int bForce = TRUE );
226
    virtual OGRErr      GetExtent(OGREnvelope *psExtent, int bForce = TRUE);
227
228
    virtual int         TestCapability( const char * ) = 0;
229
230
    virtual const char *GetInfo( const char * );
231
232
    virtual OGRErr      CreateField( OGRFieldDefn *poField,
233
                                     int bApproxOK = TRUE );
234
235
    virtual OGRErr      SyncToDisk();
236
237
    OGRStyleTable       *GetStyleTable(){return m_poStyleTable;}
238
    void                 SetStyleTable(OGRStyleTable *poStyleTable){m_poStyleTable = poStyleTable;}
239
240
    virtual OGRErr       StartTransaction();
241
    virtual OGRErr       CommitTransaction();
242
    virtual OGRErr       RollbackTransaction();
243
244
    int                 Reference();
245
    int                 Dereference();
246
    int                 GetRefCount() const;
247
248
    /* consider these private */
249
    OGRErr               InitializeIndexSupport( const char * );
250
    OGRLayerAttrIndex   *GetIndex() { return m_poAttrIndex; }
251
252
 protected:
253
    OGRStyleTable       *m_poStyleTable;
254
    OGRFeatureQuery     *m_poAttrQuery;
255
    OGRLayerAttrIndex   *m_poAttrIndex;
256
257
    int                  m_nRefCount;
258
};
259
260
261
/************************************************************************/
262
/*                            OGRDataSource                             */
263
/************************************************************************/
264
265
/**
266
 * This class represents a data source.  A data source potentially
267
 * consists of many layers (OGRLayer).  A data source normally consists
268
 * of one, or a related set of files, though the name doesn't have to be
269
 * a real item in the file system.
270
 *
271
 * When an OGRDataSource is destroyed, all it's associated OGRLayers objects
272
 * are also destroyed.
273
 */
274
275
class CPL_DLL OGRDataSource
276
{
277
  public:
278
279
    OGRDataSource();
280
    virtual     ~OGRDataSource();
281
282
    virtual const char  *GetName() = 0;
283
284
    virtual int         GetLayerCount() = 0;
285
    virtual OGRLayer    *GetLayer(int) = 0;
286
    virtual OGRLayer    *GetLayerByName(const char *);
287
    virtual OGRErr      DeleteLayer(int);
288
289
    virtual int         TestCapability( const char * ) = 0;
290
291
    virtual OGRLayer   *CreateLayer( const char *pszName,
292
                                     OGRSpatialReference *poSpatialRef = NULL,
293
                                     OGRwkbGeometryType eGType = wkbUnknown,
294
                                     char ** papszOptions = NULL );
295
    virtual OGRLayer   *CopyLayer( OGRLayer *poSrcLayer,
296
                                   const char *pszNewName,
297
                                   char **papszOptions = NULL );
298
    OGRStyleTable       *GetStyleTable(){return m_poStyleTable;}
299
300
    virtual OGRLayer *  ExecuteSQL( const char *pszStatement,
301
                                    OGRGeometry *poSpatialFilter,
302
                                    const char *pszDialect );
303
    virtual void        ReleaseResultSet( OGRLayer * poResultsSet );
304
305
    virtual OGRErr      SyncToDisk();
306
307
    int                 Reference();
308
    int                 Dereference();
309
    int                 GetRefCount() const;
310
    int                 GetSummaryRefCount() const;
311
312
  protected:
313
314
    OGRErr              ProcessSQLCreateIndex( const char * );
315
    OGRErr              ProcessSQLDropIndex( const char * );
316
317
    OGRStyleTable      *m_poStyleTable;
318
    int                 m_nRefCount;
319
};
320
321
/************************************************************************/
322
/*                             OGRSFDriver                              */
323
/************************************************************************/
324
325
/**
326
 * Represents an operational format driver.
327
 *
328
 * One OGRSFDriver derived class will normally exist for each file format
329
 * registered for use, regardless of whether a file has or will be opened.
330
 * The list of available drivers is normally managed by the
331
 * OGRSFDriverRegistrar.
332
 */
333
334
class CPL_DLL OGRSFDriver
335
{
336
  public:
337
    virtual     ~OGRSFDriver();
338
339
    virtual const char  *GetName() = 0;
340
341
    virtual OGRDataSource *Open( const char *pszName, int bUpdate=FALSE ) = 0;
342
343
    virtual int         TestCapability( const char * ) = 0;
344
345
    virtual OGRDataSource *CreateDataSource( const char *pszName,
346
                                             char ** = NULL );
347
    virtual OGRErr      DeleteDataSource( const char *pszName );
348
349
    virtual OGRDataSource *CopyDataSource( OGRDataSource *poSrcDS,
350
                                           const char *pszNewName,
351
                                           char **papszOptions = NULL );
352
};
353
354
355
/************************************************************************/
356
/*                         OGRSFDriverRegistrar                         */
357
/************************************************************************/
358
359
/**
360
 * Singleton manager for drivers.
361
 *
362
 */
363
364
class CPL_DLL OGRSFDriverRegistrar
365
{
366
    int         nDrivers;
367
    OGRSFDriver **papoDrivers;
368
369
                OGRSFDriverRegistrar();
370
371
    int         nOpenDSCount;
372
    char        **papszOpenDSRawName;
373
    OGRDataSource **papoOpenDS;
374
    OGRSFDriver **papoOpenDSDriver;
375
376
  public:
377
378
                ~OGRSFDriverRegistrar();
379
380
    static OGRSFDriverRegistrar *GetRegistrar();
381
    static OGRDataSource *Open( const char *pszName, int bUpdate=FALSE,
382
                                OGRSFDriver ** ppoDriver = NULL );
383
384
    OGRDataSource *OpenShared( const char *pszName, int bUpdate=FALSE,
385
                               OGRSFDriver ** ppoDriver = NULL );
386
    OGRErr      ReleaseDataSource( OGRDataSource * );
387
388
    void        RegisterDriver( OGRSFDriver * poDriver );
389
390
    int         GetDriverCount( void );
391
    OGRSFDriver *GetDriver( int iDriver );
392
    OGRSFDriver *GetDriverByName( const char * );
393
394
    int         GetOpenDSCount() { return nOpenDSCount; }
395
    OGRDataSource *GetOpenDS( int );
396
};
397
398
/* -------------------------------------------------------------------- */
399
/*      Various available registration methods.                         */
400
/* -------------------------------------------------------------------- */
401
CPL_C_START
402
void CPL_DLL OGRRegisterAll();
403
404
void CPL_DLL RegisterOGRShape();
405
void CPL_DLL RegisterOGRNTF();
406
void CPL_DLL RegisterOGRFME();
407
void CPL_DLL RegisterOGRSDTS();
408
void CPL_DLL RegisterOGRTiger();
409
void CPL_DLL RegisterOGRS57();
410
void CPL_DLL RegisterOGRTAB();
411
void CPL_DLL RegisterOGRMIF();
412
void CPL_DLL RegisterOGROGDI();
413
void CPL_DLL RegisterOGRODBC();
414
void CPL_DLL RegisterOGRPG();
415
void CPL_DLL RegisterOGROCI();
416
void CPL_DLL RegisterOGRDGN();
417
void CPL_DLL RegisterOGRGML();
418
void CPL_DLL RegisterOGRAVCBin();
419
void CPL_DLL RegisterOGRAVCE00();
420
void CPL_DLL RegisterOGRFME();
421
void CPL_DLL RegisterOGRREC();
422
void CPL_DLL RegisterOGRMEM();
423
void CPL_DLL RegisterOGRVRT();
424
void CPL_DLL RegisterOGRDODS();
425
void CPL_DLL RegisterOGRSQLite();
426
void CPL_DLL RegisterOGRCSV();
427
428
CPL_C_END
429
430
431
#endif /* ndef _OGRSF_FRMTS_H_INCLUDED */