GDAL
ogrsf_frmts.h
Go to the documentation of this file.
1 /******************************************************************************
2  * $Id: ogrsf_frmts.h 41314 2018-01-22 17:42:51Z 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 = nullptr,
160  GDALProgressFunc pfnProgress = nullptr,
161  void * pProgressArg = nullptr );
162  OGRErr Union( OGRLayer *pLayerMethod,
163  OGRLayer *pLayerResult,
164  char** papszOptions = nullptr,
165  GDALProgressFunc pfnProgress = nullptr,
166  void * pProgressArg = nullptr );
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 = nullptr,
175  GDALProgressFunc pfnProgress = nullptr,
176  void * pProgressArg = nullptr );
177  OGRErr Update( OGRLayer *pLayerMethod,
178  OGRLayer *pLayerResult,
179  char** papszOptions = nullptr,
180  GDALProgressFunc pfnProgress = nullptr,
181  void * pProgressArg = nullptr );
182  OGRErr Clip( OGRLayer *pLayerMethod,
183  OGRLayer *pLayerResult,
184  char** papszOptions = nullptr,
185  GDALProgressFunc pfnProgress = nullptr,
186  void * pProgressArg = nullptr );
187  OGRErr Erase( OGRLayer *pLayerMethod,
188  OGRLayer *pLayerResult,
189  char** papszOptions = nullptr,
190  GDALProgressFunc pfnProgress = nullptr,
191  void * pProgressArg = nullptr );
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; }
209  int GetGeomFieldFilter() const { return m_iGeomFieldFilter; }
210  const char *GetAttrQueryString() const { return m_pszAttrQueryString; }
212 
213  protected:
215  OGRStyleTable *m_poStyleTable;
216  OGRFeatureQuery *m_poAttrQuery;
217  char *m_pszAttrQueryString;
218  OGRLayerAttrIndex *m_poAttrIndex;
219 
220  int m_nRefCount;
221 
222  GIntBig m_nFeaturesRead;
224 };
225 
226 /************************************************************************/
227 /* OGRDataSource */
228 /************************************************************************/
229 
249 class CPL_DLL OGRDataSource : public GDALDataset
250 {
251 public:
252  OGRDataSource();
254  virtual const char *GetName() OGR_DEPRECATED("Use GDALDataset class instead") = 0;
255 
256  static void DestroyDataSource( OGRDataSource * ) OGR_DEPRECATED("Use GDALDataset class instead");
258 };
259 
260 /************************************************************************/
261 /* OGRSFDriver */
262 /************************************************************************/
263 
282 class CPL_DLL OGRSFDriver : public GDALDriver
283 {
284  public:
286  virtual ~OGRSFDriver();
287 
288  virtual const char *GetName() OGR_DEPRECATED("Use GDALDriver class instead") = 0;
289 
290  virtual OGRDataSource *Open( const char *pszName, int bUpdate=FALSE ) OGR_DEPRECATED("Use GDALDriver class instead") = 0;
291 
292  virtual int TestCapability( const char *pszCap ) OGR_DEPRECATED("Use GDALDriver class instead") = 0;
293 
294  virtual OGRDataSource *CreateDataSource( const char *pszName,
295  char ** = nullptr ) OGR_DEPRECATED("Use GDALDriver class instead");
296  virtual OGRErr DeleteDataSource( const char *pszName ) OGR_DEPRECATED("Use GDALDriver class instead");
298 };
299 
300 /************************************************************************/
301 /* OGRSFDriverRegistrar */
302 /************************************************************************/
303 
317 class CPL_DLL OGRSFDriverRegistrar
318 {
319 
321  ~OGRSFDriverRegistrar();
322 
323  static GDALDataset* OpenWithDriverArg(GDALDriver* poDriver,
324  GDALOpenInfo* poOpenInfo);
325  static GDALDataset* CreateVectorOnly( GDALDriver* poDriver,
326  const char * pszName,
327  char ** papszOptions );
328  static CPLErr DeleteDataSource( GDALDriver* poDriver,
329  const char * pszName );
330 
331  public:
333  static OGRSFDriverRegistrar *GetRegistrar() OGR_DEPRECATED("Use GDALDriverManager class instead");
334 
335  // cppcheck-suppress functionStatic
336  void RegisterDriver( OGRSFDriver * poDriver ) OGR_DEPRECATED("Use GDALDriverManager class instead");
337 
338  // cppcheck-suppress functionStatic
339  int GetDriverCount( void ) OGR_DEPRECATED("Use GDALDriverManager class instead");
340  // cppcheck-suppress functionStatic
341  GDALDriver *GetDriver( int iDriver ) OGR_DEPRECATED("Use GDALDriverManager class instead");
342  // cppcheck-suppress functionStatic
343  GDALDriver *GetDriverByName( const char * ) OGR_DEPRECATED("Use GDALDriverManager class instead");
344 
345  // cppcheck-suppress functionStatic
346  int GetOpenDSCount() OGR_DEPRECATED("Use GDALDriverManager class instead");
347  // cppcheck-suppress functionStatic
348  OGRDataSource *GetOpenDS( int ) OGR_DEPRECATED("Use GDALDriverManager class instead");
350 };
351 
352 /* -------------------------------------------------------------------- */
353 /* Various available registration methods. */
354 /* -------------------------------------------------------------------- */
356 
358 void OGRRegisterAllInternal();
359 
360 void CPL_DLL RegisterOGRFileGDB();
361 void CPL_DLL RegisterOGRShape();
362 void CPL_DLL RegisterOGRDB2();
363 void CPL_DLL RegisterOGRNTF();
364 void CPL_DLL RegisterOGRFME();
365 void CPL_DLL RegisterOGRSDTS();
366 void CPL_DLL RegisterOGRTiger();
367 void CPL_DLL RegisterOGRS57();
368 void CPL_DLL RegisterOGRTAB();
369 void CPL_DLL RegisterOGRMIF();
370 void CPL_DLL RegisterOGROGDI();
371 void CPL_DLL RegisterOGRODBC();
372 void CPL_DLL RegisterOGRWAsP();
373 void CPL_DLL RegisterOGRPG();
374 void CPL_DLL RegisterOGRMSSQLSpatial();
375 void CPL_DLL RegisterOGRMySQL();
376 void CPL_DLL RegisterOGROCI();
377 void CPL_DLL RegisterOGRDGN();
378 void CPL_DLL RegisterOGRGML();
379 void CPL_DLL RegisterOGRLIBKML();
380 void CPL_DLL RegisterOGRKML();
381 void CPL_DLL RegisterOGRGeoJSON();
382 void CPL_DLL RegisterOGRESRIJSON();
383 void CPL_DLL RegisterOGRTopoJSON();
384 void CPL_DLL RegisterOGRAVCBin();
385 void CPL_DLL RegisterOGRAVCE00();
386 void CPL_DLL RegisterOGRREC();
387 void CPL_DLL RegisterOGRMEM();
388 void CPL_DLL RegisterOGRVRT();
389 void CPL_DLL RegisterOGRDODS();
390 void CPL_DLL RegisterOGRSQLite();
391 void CPL_DLL RegisterOGRCSV();
392 void CPL_DLL RegisterOGRILI1();
393 void CPL_DLL RegisterOGRILI2();
394 void CPL_DLL RegisterOGRGRASS();
395 void CPL_DLL RegisterOGRPGeo();
396 void CPL_DLL RegisterOGRDXF();
397 void CPL_DLL RegisterOGRCAD();
398 void CPL_DLL RegisterOGRDWG();
399 void CPL_DLL RegisterOGRDGNV8();
400 void CPL_DLL RegisterOGRSDE();
401 void CPL_DLL RegisterOGRIDB();
402 void CPL_DLL RegisterOGRGMT();
403 void CPL_DLL RegisterOGRBNA();
404 void CPL_DLL RegisterOGRGPX();
405 void CPL_DLL RegisterOGRGeoconcept();
406 void CPL_DLL RegisterOGRIngres();
407 void CPL_DLL RegisterOGRXPlane();
408 void CPL_DLL RegisterOGRNAS();
409 void CPL_DLL RegisterOGRGeoRSS();
410 void CPL_DLL RegisterOGRGTM();
411 void CPL_DLL RegisterOGRVFK();
412 void CPL_DLL RegisterOGRPGDump();
413 void CPL_DLL RegisterOGROSM();
414 void CPL_DLL RegisterOGRGPSBabel();
415 void CPL_DLL RegisterOGRSUA();
416 void CPL_DLL RegisterOGROpenAir();
417 void CPL_DLL RegisterOGRPDS();
418 void CPL_DLL RegisterOGRWFS();
419 void CPL_DLL RegisterOGRSOSI();
420 void CPL_DLL RegisterOGRHTF();
421 void CPL_DLL RegisterOGRAeronavFAA();
422 void CPL_DLL RegisterOGRGeomedia();
423 void CPL_DLL RegisterOGRMDB();
424 void CPL_DLL RegisterOGREDIGEO();
425 void CPL_DLL RegisterOGRGFT();
426 void CPL_DLL RegisterOGRSVG();
427 void CPL_DLL RegisterOGRCouchDB();
428 void CPL_DLL RegisterOGRCloudant();
429 void CPL_DLL RegisterOGRIdrisi();
430 void CPL_DLL RegisterOGRARCGEN();
431 void CPL_DLL RegisterOGRSEGUKOOA();
432 void CPL_DLL RegisterOGRSEGY();
433 void CPL_DLL RegisterOGRXLS();
434 void CPL_DLL RegisterOGRODS();
435 void CPL_DLL RegisterOGRXLSX();
436 void CPL_DLL RegisterOGRElastic();
437 void CPL_DLL RegisterOGRGeoPackage();
438 void CPL_DLL RegisterOGRWalk();
439 void CPL_DLL RegisterOGRCarto();
440 void CPL_DLL RegisterOGRAmigoCloud();
441 void CPL_DLL RegisterOGRSXF();
442 void CPL_DLL RegisterOGROpenFileGDB();
443 void CPL_DLL RegisterOGRSelafin();
444 void CPL_DLL RegisterOGRJML();
445 void CPL_DLL RegisterOGRPLSCENES();
446 void CPL_DLL RegisterOGRCSW();
447 void CPL_DLL RegisterOGRMongoDB();
448 void CPL_DLL RegisterOGRVDV();
449 void CPL_DLL RegisterOGRGMLAS();
450 void CPL_DLL RegisterOGRMVT();
451 // @endcond
452 
453 CPL_C_END
454 
455 #endif /* ndef OGRSF_FRMTS_H_INCLUDED */
LEGACY class.
Definition: ogrsf_frmts.h:249
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:331
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:314
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:119
Class for dataset open functions.
Definition: gdal_priv.h:248
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:136
struct _OGRPreparedGeometry OGRPreparedGeometry
Prepared geometry API (needs GEOS >= 3.1.0)
Definition: ogr_geometry.h:1860
Object with metadata.
Definition: gdal_priv.h:127
LEGACY class.
Definition: ogrsf_frmts.h:317
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:280
This class represents a style table.
Definition: ogr_featurestyle.h:84
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:324
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:333
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:236
int OGRErr
Simple container for a bounding region.
Definition: ogr_core.h:287
Format specific driver.
Definition: gdal_priv.h:1166
CPLErr
Error category.
Definition: cpl_error.h:52
LEGACY class.
Definition: ogrsf_frmts.h:282
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition: cpl_port.h:925

Generated for GDAL by doxygen 1.8.8.