GDAL
ogrsf_frmts.h
Go to the documentation of this file.
1 /******************************************************************************
2  * $Id: ogrsf_frmts.h 37968 2017-04-12 07:16:55Z rouault $
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  * Copyright (c) 2007-2014, Even Rouault <even dot rouault at mines-paris dot org>
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining a
13  * copy of this software and associated documentation files (the "Software"),
14  * to deal in the Software without restriction, including without limitation
15  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16  * and/or sell copies of the Software, and to permit persons to whom the
17  * Software is furnished to do so, subject to the following conditions:
18  *
19  * The above copyright notice and this permission notice shall be included
20  * in all copies or substantial portions of the Software.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
28  * DEALINGS IN THE SOFTWARE.
29  ****************************************************************************/
30 
31 #ifndef OGRSF_FRMTS_H_INCLUDED
32 #define OGRSF_FRMTS_H_INCLUDED
33 
34 #include "cpl_progress.h"
35 #include "ogr_feature.h"
36 #include "ogr_featurestyle.h"
37 #include "gdal_priv.h"
38 
45 #if !defined(GDAL_COMPILATION) && !defined(SUPPRESS_DEPRECATION_WARNINGS)
47 #define OGR_DEPRECATED(x) CPL_WARN_DEPRECATED(x)
48 #else
49 #define OGR_DEPRECATED(x)
50 #endif
51 
53 class OGRLayerAttrIndex;
54 class OGRSFDriver;
55 
56 /************************************************************************/
57 /* OGRLayer */
58 /************************************************************************/
59 
65 /* Note: any virtual method added to this class must also be added in the */
66 /* OGRLayerDecorator and OGRMutexedLayer classes. */
67 
68 class CPL_DLL OGRLayer : public GDALMajorObject
69 {
70  private:
71  void ConvertGeomsIfNecessary( OGRFeature *poFeature );
72 
73  protected:
75  int m_bFilterIsEnvelope;
76  OGRGeometry *m_poFilterGeom;
77  OGRPreparedGeometry *m_pPreparedFilterGeom; /* m_poFilterGeom compiled as a prepared geometry */
78  OGREnvelope m_sFilterEnvelope;
79  int m_iGeomFieldFilter; // specify the index on which the spatial
80  // filter is active.
81 
82  int FilterGeometry( OGRGeometry * );
83  //int FilterGeometry( OGRGeometry *, OGREnvelope* psGeometryEnvelope);
84  int InstallFilter( OGRGeometry * );
85 
86  OGRErr GetExtentInternal(int iGeomField, OGREnvelope *psExtent, int bForce );
88 
89  virtual OGRErr ISetFeature( OGRFeature *poFeature ) CPL_WARN_UNUSED_RESULT;
90  virtual OGRErr ICreateFeature( OGRFeature *poFeature ) CPL_WARN_UNUSED_RESULT;
91 
92  public:
93  OGRLayer();
94  virtual ~OGRLayer();
95 
96  virtual OGRGeometry *GetSpatialFilter();
97  virtual void SetSpatialFilter( OGRGeometry * );
98  virtual void SetSpatialFilterRect( double dfMinX, double dfMinY,
99  double dfMaxX, double dfMaxY );
100 
101  virtual void SetSpatialFilter( int iGeomField, OGRGeometry * );
102  virtual void SetSpatialFilterRect( int iGeomField,
103  double dfMinX, double dfMinY,
104  double dfMaxX, double dfMaxY );
105 
106  virtual OGRErr SetAttributeFilter( const char * );
107 
108  virtual void ResetReading() = 0;
109  virtual OGRFeature *GetNextFeature() CPL_WARN_UNUSED_RESULT = 0;
110  virtual OGRErr SetNextByIndex( GIntBig nIndex );
111  virtual OGRFeature *GetFeature( GIntBig nFID ) CPL_WARN_UNUSED_RESULT;
112 
113  OGRErr SetFeature( OGRFeature *poFeature ) CPL_WARN_UNUSED_RESULT;
114  OGRErr CreateFeature( OGRFeature *poFeature ) CPL_WARN_UNUSED_RESULT;
115 
116  virtual OGRErr DeleteFeature( GIntBig nFID ) CPL_WARN_UNUSED_RESULT;
117 
118  virtual const char *GetName();
119  virtual OGRwkbGeometryType GetGeomType();
120  virtual OGRFeatureDefn *GetLayerDefn() = 0;
121  virtual int FindFieldIndex( const char *pszFieldName, int bExactMatch );
122 
123  virtual OGRSpatialReference *GetSpatialRef();
124 
125  virtual GIntBig GetFeatureCount( int bForce = TRUE );
126  virtual OGRErr GetExtent(OGREnvelope *psExtent, int bForce = TRUE) CPL_WARN_UNUSED_RESULT;
127  virtual OGRErr GetExtent(int iGeomField, OGREnvelope *psExtent,
128  int bForce = TRUE) CPL_WARN_UNUSED_RESULT;
129 
130  virtual int TestCapability( const char * ) = 0;
131 
132  virtual OGRErr CreateField( OGRFieldDefn *poField,
133  int bApproxOK = TRUE );
134  virtual OGRErr DeleteField( int iField );
135  virtual OGRErr ReorderFields( int* panMap );
136  virtual OGRErr AlterFieldDefn( int iField, OGRFieldDefn* poNewFieldDefn, int nFlagsIn );
137 
138  virtual OGRErr CreateGeomField( OGRGeomFieldDefn *poField,
139  int bApproxOK = TRUE );
140 
141  virtual OGRErr SyncToDisk();
142 
143  virtual OGRStyleTable *GetStyleTable();
144  virtual void SetStyleTableDirectly( OGRStyleTable *poStyleTable );
145 
146  virtual void SetStyleTable(OGRStyleTable *poStyleTable);
147 
148  virtual OGRErr StartTransaction() CPL_WARN_UNUSED_RESULT;
149  virtual OGRErr CommitTransaction() CPL_WARN_UNUSED_RESULT;
150  virtual OGRErr RollbackTransaction();
151 
152  virtual const char *GetFIDColumn();
153  virtual const char *GetGeometryColumn();
154 
155  virtual OGRErr SetIgnoredFields( const char **papszFields );
156 
157  OGRErr Intersection( OGRLayer *pLayerMethod,
158  OGRLayer *pLayerResult,
159  char** papszOptions = NULL,
160  GDALProgressFunc pfnProgress = NULL,
161  void * pProgressArg = NULL );
162  OGRErr Union( OGRLayer *pLayerMethod,
163  OGRLayer *pLayerResult,
164  char** papszOptions = NULL,
165  GDALProgressFunc pfnProgress = NULL,
166  void * pProgressArg = NULL );
167  OGRErr SymDifference( OGRLayer *pLayerMethod,
168  OGRLayer *pLayerResult,
169  char** papszOptions,
170  GDALProgressFunc pfnProgress,
171  void * pProgressArg );
172  OGRErr Identity( OGRLayer *pLayerMethod,
173  OGRLayer *pLayerResult,
174  char** papszOptions = NULL,
175  GDALProgressFunc pfnProgress = NULL,
176  void * pProgressArg = NULL );
177  OGRErr Update( OGRLayer *pLayerMethod,
178  OGRLayer *pLayerResult,
179  char** papszOptions = NULL,
180  GDALProgressFunc pfnProgress = NULL,
181  void * pProgressArg = NULL );
182  OGRErr Clip( OGRLayer *pLayerMethod,
183  OGRLayer *pLayerResult,
184  char** papszOptions = NULL,
185  GDALProgressFunc pfnProgress = NULL,
186  void * pProgressArg = NULL );
187  OGRErr Erase( OGRLayer *pLayerMethod,
188  OGRLayer *pLayerResult,
189  char** papszOptions = NULL,
190  GDALProgressFunc pfnProgress = NULL,
191  void * pProgressArg = NULL );
192 
193  int Reference();
194  int Dereference();
195  int GetRefCount() const;
197  GIntBig GetFeaturesRead();
199 
200  /* non virtual : convenience wrapper for ReorderFields() */
201  OGRErr ReorderField( int iOldFieldPos, int iNewFieldPos );
202 
204  int AttributeFilterEvaluationNeedsGeometry();
205 
206  /* consider these private */
207  OGRErr InitializeIndexSupport( const char * );
208  OGRLayerAttrIndex *GetIndex() { return m_poAttrIndex; }
210 
211  protected:
213  OGRStyleTable *m_poStyleTable;
214  OGRFeatureQuery *m_poAttrQuery;
215  char *m_pszAttrQueryString;
216  OGRLayerAttrIndex *m_poAttrIndex;
217 
218  int m_nRefCount;
219 
220  GIntBig m_nFeaturesRead;
222 };
223 
224 /************************************************************************/
225 /* OGRDataSource */
226 /************************************************************************/
227 
247 class CPL_DLL OGRDataSource : public GDALDataset
248 {
249 public:
250  OGRDataSource();
252  virtual const char *GetName() OGR_DEPRECATED("Use GDALDataset class instead") = 0;
253 
254  static void DestroyDataSource( OGRDataSource * ) OGR_DEPRECATED("Use GDALDataset class instead");
256 };
257 
258 /************************************************************************/
259 /* OGRSFDriver */
260 /************************************************************************/
261 
280 class CPL_DLL OGRSFDriver : public GDALDriver
281 {
282  public:
284  virtual ~OGRSFDriver();
285 
286  virtual const char *GetName() OGR_DEPRECATED("Use GDALDriver class instead") = 0;
287 
288  virtual OGRDataSource *Open( const char *pszName, int bUpdate=FALSE ) OGR_DEPRECATED("Use GDALDriver class instead") = 0;
289 
290  virtual int TestCapability( const char *pszCap ) OGR_DEPRECATED("Use GDALDriver class instead") = 0;
291 
292  virtual OGRDataSource *CreateDataSource( const char *pszName,
293  char ** = NULL ) OGR_DEPRECATED("Use GDALDriver class instead");
294  virtual OGRErr DeleteDataSource( const char *pszName ) OGR_DEPRECATED("Use GDALDriver class instead");
296 };
297 
298 /************************************************************************/
299 /* OGRSFDriverRegistrar */
300 /************************************************************************/
301 
315 class CPL_DLL OGRSFDriverRegistrar
316 {
317 
319  ~OGRSFDriverRegistrar();
320 
321  static GDALDataset* OpenWithDriverArg(GDALDriver* poDriver,
322  GDALOpenInfo* poOpenInfo);
323  static GDALDataset* CreateVectorOnly( GDALDriver* poDriver,
324  const char * pszName,
325  char ** papszOptions );
326  static CPLErr DeleteDataSource( GDALDriver* poDriver,
327  const char * pszName );
328 
329  public:
331  static OGRSFDriverRegistrar *GetRegistrar() OGR_DEPRECATED("Use GDALDriverManager class instead");
332 
333  // cppcheck-suppress functionStatic
334  void RegisterDriver( OGRSFDriver * poDriver ) OGR_DEPRECATED("Use GDALDriverManager class instead");
335 
336  // cppcheck-suppress functionStatic
337  int GetDriverCount( void ) OGR_DEPRECATED("Use GDALDriverManager class instead");
338  // cppcheck-suppress functionStatic
339  GDALDriver *GetDriver( int iDriver ) OGR_DEPRECATED("Use GDALDriverManager class instead");
340  // cppcheck-suppress functionStatic
341  GDALDriver *GetDriverByName( const char * ) OGR_DEPRECATED("Use GDALDriverManager class instead");
342 
343  // cppcheck-suppress functionStatic
344  int GetOpenDSCount() OGR_DEPRECATED("Use GDALDriverManager class instead");
345  // cppcheck-suppress functionStatic
346  OGRDataSource *GetOpenDS( int ) OGR_DEPRECATED("Use GDALDriverManager class instead");
348 };
349 
350 /* -------------------------------------------------------------------- */
351 /* Various available registration methods. */
352 /* -------------------------------------------------------------------- */
354 void CPL_DLL OGRRegisterAll();
355 
357 void OGRRegisterAllInternal();
358 
359 void CPL_DLL RegisterOGRFileGDB();
360 void CPL_DLL RegisterOGRShape();
361 void CPL_DLL RegisterOGRDB2();
362 void CPL_DLL RegisterOGRNTF();
363 void CPL_DLL RegisterOGRFME();
364 void CPL_DLL RegisterOGRSDTS();
365 void CPL_DLL RegisterOGRTiger();
366 void CPL_DLL RegisterOGRS57();
367 void CPL_DLL RegisterOGRTAB();
368 void CPL_DLL RegisterOGRMIF();
369 void CPL_DLL RegisterOGROGDI();
370 void CPL_DLL RegisterOGRODBC();
371 void CPL_DLL RegisterOGRWAsP();
372 void CPL_DLL RegisterOGRPG();
373 void CPL_DLL RegisterOGRMSSQLSpatial();
374 void CPL_DLL RegisterOGRMySQL();
375 void CPL_DLL RegisterOGROCI();
376 void CPL_DLL RegisterOGRDGN();
377 void CPL_DLL RegisterOGRGML();
378 void CPL_DLL RegisterOGRLIBKML();
379 void CPL_DLL RegisterOGRKML();
380 void CPL_DLL RegisterOGRGeoJSON();
381 void CPL_DLL RegisterOGRAVCBin();
382 void CPL_DLL RegisterOGRAVCE00();
383 void CPL_DLL RegisterOGRREC();
384 void CPL_DLL RegisterOGRMEM();
385 void CPL_DLL RegisterOGRVRT();
386 void CPL_DLL RegisterOGRDODS();
387 void CPL_DLL RegisterOGRSQLite();
388 void CPL_DLL RegisterOGRCSV();
389 void CPL_DLL RegisterOGRILI1();
390 void CPL_DLL RegisterOGRILI2();
391 void CPL_DLL RegisterOGRGRASS();
392 void CPL_DLL RegisterOGRPGeo();
393 void CPL_DLL RegisterOGRDXF();
394 void CPL_DLL RegisterOGRCAD();
395 void CPL_DLL RegisterOGRDWG();
396 void CPL_DLL RegisterOGRDGNV8();
397 void CPL_DLL RegisterOGRSDE();
398 void CPL_DLL RegisterOGRIDB();
399 void CPL_DLL RegisterOGRGMT();
400 void CPL_DLL RegisterOGRBNA();
401 void CPL_DLL RegisterOGRGPX();
402 void CPL_DLL RegisterOGRGeoconcept();
403 void CPL_DLL RegisterOGRIngres();
404 void CPL_DLL RegisterOGRXPlane();
405 void CPL_DLL RegisterOGRNAS();
406 void CPL_DLL RegisterOGRGeoRSS();
407 void CPL_DLL RegisterOGRGTM();
408 void CPL_DLL RegisterOGRVFK();
409 void CPL_DLL RegisterOGRPGDump();
410 void CPL_DLL RegisterOGROSM();
411 void CPL_DLL RegisterOGRGPSBabel();
412 void CPL_DLL RegisterOGRSUA();
413 void CPL_DLL RegisterOGROpenAir();
414 void CPL_DLL RegisterOGRPDS();
415 void CPL_DLL RegisterOGRWFS();
416 void CPL_DLL RegisterOGRSOSI();
417 void CPL_DLL RegisterOGRHTF();
418 void CPL_DLL RegisterOGRAeronavFAA();
419 void CPL_DLL RegisterOGRGeomedia();
420 void CPL_DLL RegisterOGRMDB();
421 void CPL_DLL RegisterOGREDIGEO();
422 void CPL_DLL RegisterOGRGFT();
423 void CPL_DLL RegisterOGRSVG();
424 void CPL_DLL RegisterOGRCouchDB();
425 void CPL_DLL RegisterOGRCloudant();
426 void CPL_DLL RegisterOGRIdrisi();
427 void CPL_DLL RegisterOGRARCGEN();
428 void CPL_DLL RegisterOGRSEGUKOOA();
429 void CPL_DLL RegisterOGRSEGY();
430 void CPL_DLL RegisterOGRXLS();
431 void CPL_DLL RegisterOGRODS();
432 void CPL_DLL RegisterOGRXLSX();
433 void CPL_DLL RegisterOGRElastic();
434 void CPL_DLL RegisterOGRGeoPackage();
435 void CPL_DLL RegisterOGRWalk();
436 void CPL_DLL RegisterOGRCarto();
437 void CPL_DLL RegisterOGRAmigoCloud();
438 void CPL_DLL RegisterOGRSXF();
439 void CPL_DLL RegisterOGROpenFileGDB();
440 void CPL_DLL RegisterOGRSelafin();
441 void CPL_DLL RegisterOGRJML();
442 void CPL_DLL RegisterOGRPLSCENES();
443 void CPL_DLL RegisterOGRCSW();
444 void CPL_DLL RegisterOGRMongoDB();
445 void CPL_DLL RegisterOGRVDV();
446 void CPL_DLL RegisterOGRGMLAS();
447 // @endcond
448 
449 CPL_C_END
450 
451 #endif /* ndef OGRSF_FRMTS_H_INCLUDED */
LEGACY class.
Definition: ogrsf_frmts.h:247
void OGRRegisterAll()
Register all drivers.
Definition: ogrregisterall.cpp:38
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:352
C++ GDAL entry points.
Definition of a geometry field of an OGRFeatureDefn.
Definition: ogr_feature.h:141
Definition of a feature class or feature layer.
Definition: ogr_feature.h:207
Simple feature style classes.
Definition of an attribute of an OGRFeatureDefn.
Definition: ogr_feature.h:62
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:312
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:118
Class for dataset open functions.
Definition: gdal_priv.h:246
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:132
struct _OGRPreparedGeometry OGRPreparedGeometry
Prepared geometry API (needs GEOS >= 3.1.0)
Definition: ogr_geometry.h:1840
Object with metadata.
Definition: gdal_priv.h:125
LEGACY class.
Definition: ogrsf_frmts.h:315
This class represents a layer of simple features, with access methods.
Definition: ogrsf_frmts.h:68
Simple feature classes.
A simple feature, including geometry and attributes.
Definition: ogr_feature.h:279
This class represents a style table.
Definition: ogr_featurestyle.h:83
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:322
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:354
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:250
int OGRErr
Simple container for a bounding region.
Definition: ogr_core.h:285
Format specific driver.
Definition: gdal_priv.h:1160
CPLErr
Error category.
Definition: cpl_error.h:52
LEGACY class.
Definition: ogrsf_frmts.h:280
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition: cpl_port.h:999

Generated for GDAL by doxygen 1.8.8.