Statistics
| Revision:

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

History | View | Annotate | Download (13.4 KB)

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