GDAL

- Main Page
- Related Pages
- Classes
- Files
- Download
- Issue Tracker

- File List
- File Members

ogrsf_frmts.h
Go to the documentation of this file.
1 /******************************************************************************
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 * 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
39 #include <memory>
40
47 #if !defined(GDAL_COMPILATION) && !defined(SUPPRESS_DEPRECATION_WARNINGS)
49 #define OGR_DEPRECATED(x) CPL_WARN_DEPRECATED(x)
50 #else
51 #define OGR_DEPRECATED(x)
52 #endif
53
55 class OGRLayerAttrIndex;
56 class OGRSFDriver;
57
58 /************************************************************************/
59 /* OGRLayer */
60 /************************************************************************/
61
67 /* Note: any virtual method added to this class must also be added in the */
68 /* OGRLayerDecorator and OGRMutexedLayer classes. */
69
70 class CPL_DLL OGRLayer : public GDALMajorObject
71 {
72 private:
73 struct Private;
74 std::unique_ptr<Private> m_poPrivate;
75
76 void ConvertGeomsIfNecessary( OGRFeature *poFeature );
77
78 class CPL_DLL FeatureIterator
79 {
80 struct Private;
81 std::unique_ptr<Private> m_poPrivate;
82 public:
83 FeatureIterator(OGRLayer* poLayer, bool bStart);
84 FeatureIterator(FeatureIterator&& oOther); // declared but not defined. Needed for gcc 5.4 at least
85 ~FeatureIterator();
86 OGRFeatureUniquePtr& operator*();
87 FeatureIterator& operator++();
88 bool operator!=(const FeatureIterator& it) const;
89 };
90
91 friend inline FeatureIterator begin(OGRLayer* poLayer);
92 friend inline FeatureIterator end(OGRLayer* poLayer);
93
94 protected:
96 int m_bFilterIsEnvelope;
97 OGRGeometry *m_poFilterGeom;
98 OGRPreparedGeometry *m_pPreparedFilterGeom; /* m_poFilterGeom compiled as a prepared geometry */
99 OGREnvelope m_sFilterEnvelope;
100 int m_iGeomFieldFilter; // specify the index on which the spatial
101 // filter is active.
102
103 int FilterGeometry( OGRGeometry * );
104 //int FilterGeometry( OGRGeometry *, OGREnvelope* psGeometryEnvelope);
105 int InstallFilter( OGRGeometry * );
106
107 OGRErr GetExtentInternal(int iGeomField, OGREnvelope *psExtent, int bForce );
109
110 virtual OGRErr ISetFeature( OGRFeature *poFeature ) CPL_WARN_UNUSED_RESULT;
111 virtual OGRErr ICreateFeature( OGRFeature *poFeature ) CPL_WARN_UNUSED_RESULT;
112
113 public:
114 OGRLayer();
115 virtual ~OGRLayer();
116
127 FeatureIterator begin();
128
130 FeatureIterator end();
131
132 virtual OGRGeometry *GetSpatialFilter();
133 virtual void SetSpatialFilter( OGRGeometry * );
134 virtual void SetSpatialFilterRect( double dfMinX, double dfMinY,
135 double dfMaxX, double dfMaxY );
136
137 virtual void SetSpatialFilter( int iGeomField, OGRGeometry * );
138 virtual void SetSpatialFilterRect( int iGeomField,
139 double dfMinX, double dfMinY,
140 double dfMaxX, double dfMaxY );
141
142 virtual OGRErr SetAttributeFilter( const char * );
143
144 virtual void ResetReading() = 0;
145 virtual OGRFeature *GetNextFeature() CPL_WARN_UNUSED_RESULT = 0;
146 virtual OGRErr SetNextByIndex( GIntBig nIndex );
147 virtual OGRFeature *GetFeature( GIntBig nFID ) CPL_WARN_UNUSED_RESULT;
148
149 OGRErr SetFeature( OGRFeature *poFeature ) CPL_WARN_UNUSED_RESULT;
150 OGRErr CreateFeature( OGRFeature *poFeature ) CPL_WARN_UNUSED_RESULT;
151
152 virtual OGRErr DeleteFeature( GIntBig nFID ) CPL_WARN_UNUSED_RESULT;
153
154 virtual const char *GetName();
155 virtual OGRwkbGeometryType GetGeomType();
156 virtual OGRFeatureDefn *GetLayerDefn() = 0;
157 virtual int FindFieldIndex( const char *pszFieldName, int bExactMatch );
158
159 virtual OGRSpatialReference *GetSpatialRef();
160
161 virtual GIntBig GetFeatureCount( int bForce = TRUE );
162 virtual OGRErr GetExtent(OGREnvelope *psExtent, int bForce = TRUE) CPL_WARN_UNUSED_RESULT;
163 virtual OGRErr GetExtent(int iGeomField, OGREnvelope *psExtent,
164 int bForce = TRUE) CPL_WARN_UNUSED_RESULT;
165
166 virtual int TestCapability( const char * ) = 0;
167
168 virtual OGRErr CreateField( OGRFieldDefn *poField,
169 int bApproxOK = TRUE );
170 virtual OGRErr DeleteField( int iField );
171 virtual OGRErr ReorderFields( int* panMap );
172 virtual OGRErr AlterFieldDefn( int iField, OGRFieldDefn* poNewFieldDefn, int nFlagsIn );
173
174 virtual OGRErr CreateGeomField( OGRGeomFieldDefn *poField,
175 int bApproxOK = TRUE );
176
177 virtual OGRErr SyncToDisk();
178
179 virtual OGRStyleTable *GetStyleTable();
180 virtual void SetStyleTableDirectly( OGRStyleTable *poStyleTable );
181
182 virtual void SetStyleTable(OGRStyleTable *poStyleTable);
183
184 virtual OGRErr StartTransaction() CPL_WARN_UNUSED_RESULT;
185 virtual OGRErr CommitTransaction() CPL_WARN_UNUSED_RESULT;
186 virtual OGRErr RollbackTransaction();
187
188 virtual const char *GetFIDColumn();
189 virtual const char *GetGeometryColumn();
190
191 virtual OGRErr SetIgnoredFields( const char **papszFields );
192
193 OGRErr Intersection( OGRLayer *pLayerMethod,
194 OGRLayer *pLayerResult,
195 char** papszOptions = nullptr,
196 GDALProgressFunc pfnProgress = nullptr,
197 void * pProgressArg = nullptr );
198 OGRErr Union( OGRLayer *pLayerMethod,
199 OGRLayer *pLayerResult,
200 char** papszOptions = nullptr,
201 GDALProgressFunc pfnProgress = nullptr,
202 void * pProgressArg = nullptr );
203 OGRErr SymDifference( OGRLayer *pLayerMethod,
204 OGRLayer *pLayerResult,
205 char** papszOptions,
206 GDALProgressFunc pfnProgress,
207 void * pProgressArg );
208 OGRErr Identity( OGRLayer *pLayerMethod,
209 OGRLayer *pLayerResult,
210 char** papszOptions = nullptr,
211 GDALProgressFunc pfnProgress = nullptr,
212 void * pProgressArg = nullptr );
213 OGRErr Update( OGRLayer *pLayerMethod,
214 OGRLayer *pLayerResult,
215 char** papszOptions = nullptr,
216 GDALProgressFunc pfnProgress = nullptr,
217 void * pProgressArg = nullptr );
218 OGRErr Clip( OGRLayer *pLayerMethod,
219 OGRLayer *pLayerResult,
220 char** papszOptions = nullptr,
221 GDALProgressFunc pfnProgress = nullptr,
222 void * pProgressArg = nullptr );
223 OGRErr Erase( OGRLayer *pLayerMethod,
224 OGRLayer *pLayerResult,
225 char** papszOptions = nullptr,
226 GDALProgressFunc pfnProgress = nullptr,
227 void * pProgressArg = nullptr );
228
229 int Reference();
230 int Dereference();
231 int GetRefCount() const;
233 GIntBig GetFeaturesRead();
235
236 /* non virtual : convenience wrapper for ReorderFields() */
237 OGRErr ReorderField( int iOldFieldPos, int iNewFieldPos );
238
240 int AttributeFilterEvaluationNeedsGeometry();
241
242 /* consider these private */
243 OGRErr InitializeIndexSupport( const char * );
244 OGRLayerAttrIndex *GetIndex() { return m_poAttrIndex; }
245 int GetGeomFieldFilter() const { return m_iGeomFieldFilter; }
246 const char *GetAttrQueryString() const { return m_pszAttrQueryString; }
248
252 static inline OGRLayerH ToHandle(OGRLayer* poLayer)
253 { return reinterpret_cast<OGRLayerH>(poLayer); }
254
258 static inline OGRLayer* FromHandle(OGRLayerH hLayer)
259 { return reinterpret_cast<OGRLayer*>(hLayer); }
260
261 protected:
263 OGRStyleTable *m_poStyleTable;
264 OGRFeatureQuery *m_poAttrQuery;
265 char *m_pszAttrQueryString;
266 OGRLayerAttrIndex *m_poAttrIndex;
267
268 int m_nRefCount;
269
270 GIntBig m_nFeaturesRead;
272 };
273
285 inline OGRLayer::FeatureIterator begin(OGRLayer* poLayer) { return poLayer->begin(); }
286
290 inline OGRLayer::FeatureIterator end(OGRLayer* poLayer) { return poLayer->end(); }
291
292 /************************************************************************/
293 /* OGRDataSource */
294 /************************************************************************/
295
315 class CPL_DLL OGRDataSource : public GDALDataset
316 {
317 public:
318 OGRDataSource();
320 virtual const char *GetName() OGR_DEPRECATED("Use GDALDataset class instead") = 0;
321
322 static void DestroyDataSource( OGRDataSource * ) OGR_DEPRECATED("Use GDALDataset class instead");
324 };
325
326 /************************************************************************/
327 /* OGRSFDriver */
328 /************************************************************************/
329
348 class CPL_DLL OGRSFDriver : public GDALDriver
349 {
350 public:
352 virtual ~OGRSFDriver();
353
354 virtual const char *GetName() OGR_DEPRECATED("Use GDALDriver class instead") = 0;
355
356 virtual OGRDataSource *Open( const char *pszName, int bUpdate=FALSE ) OGR_DEPRECATED("Use GDALDriver class instead") = 0;
357
358 virtual int TestCapability( const char *pszCap ) OGR_DEPRECATED("Use GDALDriver class instead") = 0;
359
360 virtual OGRDataSource *CreateDataSource( const char *pszName,
361 char ** = nullptr ) OGR_DEPRECATED("Use GDALDriver class instead");
362 virtual OGRErr DeleteDataSource( const char *pszName ) OGR_DEPRECATED("Use GDALDriver class instead");
364 };
365
366 /************************************************************************/
367 /* OGRSFDriverRegistrar */
368 /************************************************************************/
369
383 class CPL_DLL OGRSFDriverRegistrar
384 {
385
386 OGRSFDriverRegistrar();
387 ~OGRSFDriverRegistrar();
388
389 static GDALDataset* OpenWithDriverArg(GDALDriver* poDriver,
390 GDALOpenInfo* poOpenInfo);
391 static GDALDataset* CreateVectorOnly( GDALDriver* poDriver,
392 const char * pszName,
393 char ** papszOptions );
394 static CPLErr DeleteDataSource( GDALDriver* poDriver,
395 const char * pszName );
396
397 public:
399 static OGRSFDriverRegistrar *GetRegistrar() OGR_DEPRECATED("Use GDALDriverManager class instead");
400
401 // cppcheck-suppress functionStatic
402 void RegisterDriver( OGRSFDriver * poDriver ) OGR_DEPRECATED("Use GDALDriverManager class instead");
403
404 // cppcheck-suppress functionStatic
405 int GetDriverCount( void ) OGR_DEPRECATED("Use GDALDriverManager class instead");
406 // cppcheck-suppress functionStatic
407 GDALDriver *GetDriver( int iDriver ) OGR_DEPRECATED("Use GDALDriverManager class instead");
408 // cppcheck-suppress functionStatic
409 GDALDriver *GetDriverByName( const char * ) OGR_DEPRECATED("Use GDALDriverManager class instead");
410
411 // cppcheck-suppress functionStatic
412 int GetOpenDSCount() OGR_DEPRECATED("Use GDALDriverManager class instead");
413 // cppcheck-suppress functionStatic
414 OGRDataSource *GetOpenDS( int ) OGR_DEPRECATED("Use GDALDriverManager class instead");
416 };
417
418 /* -------------------------------------------------------------------- */
419 /* Various available registration methods. */
420 /* -------------------------------------------------------------------- */
421 CPL_C_START
422
424 void OGRRegisterAllInternal();
425
426 void CPL_DLL RegisterOGRFileGDB();
427 void CPL_DLL RegisterOGRShape();
428 void CPL_DLL RegisterOGRDB2();
429 void CPL_DLL RegisterOGRNTF();
430 void CPL_DLL RegisterOGRFME();
431 void CPL_DLL RegisterOGRSDTS();
432 void CPL_DLL RegisterOGRTiger();
433 void CPL_DLL RegisterOGRS57();
434 void CPL_DLL RegisterOGRTAB();
435 void CPL_DLL RegisterOGRMIF();
436 void CPL_DLL RegisterOGROGDI();
437 void CPL_DLL RegisterOGRODBC();
438 void CPL_DLL RegisterOGRWAsP();
439 void CPL_DLL RegisterOGRPG();
440 void CPL_DLL RegisterOGRMSSQLSpatial();
441 void CPL_DLL RegisterOGRMySQL();
442 void CPL_DLL RegisterOGROCI();
443 void CPL_DLL RegisterOGRDGN();
444 void CPL_DLL RegisterOGRGML();
445 void CPL_DLL RegisterOGRLIBKML();
446 void CPL_DLL RegisterOGRKML();
447 void CPL_DLL RegisterOGRGeoJSON();
448 void CPL_DLL RegisterOGRESRIJSON();
449 void CPL_DLL RegisterOGRTopoJSON();
450 void CPL_DLL RegisterOGRAVCBin();
451 void CPL_DLL RegisterOGRAVCE00();
452 void CPL_DLL RegisterOGRREC();
453 void CPL_DLL RegisterOGRMEM();
454 void CPL_DLL RegisterOGRVRT();
455 void CPL_DLL RegisterOGRDODS();
456 void CPL_DLL RegisterOGRSQLite();
457 void CPL_DLL RegisterOGRCSV();
458 void CPL_DLL RegisterOGRILI1();
459 void CPL_DLL RegisterOGRILI2();
460 void CPL_DLL RegisterOGRGRASS();
461 void CPL_DLL RegisterOGRPGeo();
462 void CPL_DLL RegisterOGRDXF();
463 void CPL_DLL RegisterOGRCAD();
464 void CPL_DLL RegisterOGRDWG();
465 void CPL_DLL RegisterOGRDGNV8();
466 void CPL_DLL RegisterOGRSDE();
467 void CPL_DLL RegisterOGRIDB();
468 void CPL_DLL RegisterOGRGMT();
469 void CPL_DLL RegisterOGRBNA();
470 void CPL_DLL RegisterOGRGPX();
471 void CPL_DLL RegisterOGRGeoconcept();
472 void CPL_DLL RegisterOGRIngres();
473 void CPL_DLL RegisterOGRXPlane();
474 void CPL_DLL RegisterOGRNAS();
475 void CPL_DLL RegisterOGRGeoRSS();
476 void CPL_DLL RegisterOGRGTM();
477 void CPL_DLL RegisterOGRVFK();
478 void CPL_DLL RegisterOGRPGDump();
479 void CPL_DLL RegisterOGROSM();
480 void CPL_DLL RegisterOGRGPSBabel();
481 void CPL_DLL RegisterOGRSUA();
482 void CPL_DLL RegisterOGROpenAir();
483 void CPL_DLL RegisterOGRPDS();
484 void CPL_DLL RegisterOGRWFS();
485 void CPL_DLL RegisterOGRWFS3();
486 void CPL_DLL RegisterOGRSOSI();
487 void CPL_DLL RegisterOGRHTF();
488 void CPL_DLL RegisterOGRAeronavFAA();
489 void CPL_DLL RegisterOGRGeomedia();
490 void CPL_DLL RegisterOGRMDB();
491 void CPL_DLL RegisterOGREDIGEO();
492 void CPL_DLL RegisterOGRGFT();
493 void CPL_DLL RegisterOGRSVG();
494 void CPL_DLL RegisterOGRCouchDB();
495 void CPL_DLL RegisterOGRCloudant();
496 void CPL_DLL RegisterOGRIdrisi();
497 void CPL_DLL RegisterOGRARCGEN();
498 void CPL_DLL RegisterOGRSEGUKOOA();
499 void CPL_DLL RegisterOGRSEGY();
500 void CPL_DLL RegisterOGRXLS();
501 void CPL_DLL RegisterOGRODS();
502 void CPL_DLL RegisterOGRXLSX();
503 void CPL_DLL RegisterOGRElastic();
504 void CPL_DLL RegisterOGRGeoPackage();
505 void CPL_DLL RegisterOGRWalk();
506 void CPL_DLL RegisterOGRCarto();
507 void CPL_DLL RegisterOGRAmigoCloud();
508 void CPL_DLL RegisterOGRSXF();
509 void CPL_DLL RegisterOGROpenFileGDB();
510 void CPL_DLL RegisterOGRSelafin();
511 void CPL_DLL RegisterOGRJML();
512 void CPL_DLL RegisterOGRPLSCENES();
513 void CPL_DLL RegisterOGRCSW();
514 void CPL_DLL RegisterOGRMongoDB();
515 void CPL_DLL RegisterOGRVDV();
516 void CPL_DLL RegisterOGRGMLAS();
517 void CPL_DLL RegisterOGRMVT();
518 // @endcond
519
520 CPL_C_END
521
522 #endif /* ndef OGRSF_FRMTS_H_INCLUDED */
OGRDataSource
LEGACY class.
Definition: ogrsf_frmts.h:315
OGRLayerH
void * OGRLayerH
Opaque type for a layer (OGRLayer)
Definition: ogr_api.h:508
OGRFeatureUniquePtr
std::unique_ptr< OGRFeature, OGRFeatureUniquePtrDeleter > OGRFeatureUniquePtr
Unique pointer type for OGRFeature.
Definition: ogr_feature.h:779
CPL_C_START
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:341
gdal_priv.h
C++ GDAL entry points.
OGRGeomFieldDefn
Definition of a geometry field of an OGRFeatureDefn.
Definition: ogr_feature.h:182
OGRLayer::FromHandle
static OGRLayer * FromHandle(OGRLayerH hLayer)
Convert a OGRLayerH to a OGRLayer*.
Definition: ogrsf_frmts.h:258
OGRLayer::ToHandle
static OGRLayerH ToHandle(OGRLayer *poLayer)
Convert a OGRLayer* to a OGRLayerH.
Definition: ogrsf_frmts.h:252
OGRFeatureDefn
Definition of a feature class or feature layer.
Definition: ogr_feature.h:259
ogr_featurestyle.h
Simple feature style classes.
OGRFieldDefn
Definition of an attribute of an OGRFeatureDefn.
Definition: ogr_feature.h:92
OGRwkbGeometryType
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:317
OGRGeometry
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:286
GDALOpenInfo
Class for dataset open functions.
Definition: gdal_priv.h:265
OGRSpatialReference
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:139
OGRPreparedGeometry
struct _OGRPreparedGeometry OGRPreparedGeometry
Prepared geometry API (needs GEOS >= 3.1.0)
Definition: ogr_geometry.h:2906
GDALMajorObject
Object with metadata.
Definition: gdal_priv.h:132
OGRSFDriverRegistrar
LEGACY class.
Definition: ogrsf_frmts.h:383
OGRLayer
This class represents a layer of simple features, with access methods.
Definition: ogrsf_frmts.h:70
ogr_feature.h
Simple feature classes.
OGRFeature
A simple feature, including geometry and attributes.
Definition: ogr_feature.h:353
OGRStyleTable
This class represents a style table.
Definition: ogr_featurestyle.h:84
GDALDataset
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:339
CPL_C_END
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:343
GIntBig
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:246
begin
OGRLayer::FeatureIterator begin(OGRLayer *poLayer)
Return begin of feature iterator.
Definition: ogrsf_frmts.h:285
OGRErr
int OGRErr
Simple container for a bounding region.
Definition: ogr_core.h:290
OGRLayer::begin
friend FeatureIterator begin(OGRLayer *poLayer)
Return begin of feature iterator.
Definition: ogrsf_frmts.h:285
end
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition: ogrsf_frmts.h:290
OGRLayer::end
friend FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition: ogrsf_frmts.h:290
GDALDriver
Format specific driver.
Definition: gdal_priv.h:1386
CPLErr
CPLErr
Error category.
Definition: cpl_error.h:52
OGRSFDriver
LEGACY class.
Definition: ogrsf_frmts.h:348
CPL_WARN_UNUSED_RESULT
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition: cpl_port.h:935

Generated for GDAL by 1.8.8.