# ogrsf_frmts.h

Go to the documentation of this file.

    00001 /******************************************************************************
    00002  * $Id: ogrsf_frmts.h 25581 2013-01-29 20:42:37Z warmerdam $
    00003  *
    00004  * Project:  OpenGIS Simple Features Reference Implementation
    00005  * Purpose:  Classes related to format registration, and file opening.
    00006  * Author:   Frank Warmerdam, warmerda@home.com
    00007  *
    00008  ******************************************************************************
    00009  * Copyright (c) 1999,  Les Technologies SoftMap Inc.
    00010  *
    00011  * Permission is hereby granted, free of charge, to any person obtaining a
    00012  * copy of this software and associated documentation files (the "Software"),
    00013  * to deal in the Software without restriction, including without limitation
    00014  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
    00015  * and/or sell copies of the Software, and to permit persons to whom the
    00016  * Software is furnished to do so, subject to the following conditions:
    00017  *
    00018  * The above copyright notice and this permission notice shall be included
    00019  * in all copies or substantial portions of the Software.
    00020  *
    00021  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
    00022  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    00023  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
    00024  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    00025  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    00026  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    00027  * DEALINGS IN THE SOFTWARE.
    00028  ****************************************************************************/
    00029
    00030 #ifndef _OGRSF_FRMTS_H_INCLUDED
    00031 #define _OGRSF_FRMTS_H_INCLUDED
    00032
    00033 #include "cpl_progress.h"
    00034 #include "ogr_feature.h"
    00035 #include "ogr_featurestyle.h"
    00036
    00043 class OGRLayerAttrIndex;
    00044 class OGRSFDriver;
    00045
    00046 /************************************************************************/
    00047 /*                               OGRLayer                               */
    00048 /************************************************************************/
    00049
    00055 /* Note: any virtual method added to this class must also be added in the */
    00056 /* OGRLayerDecorator class. */
    00057
    00058 class CPL_DLL OGRLayer
    00059 {
    00060   protected:
    00061     int          m_bFilterIsEnvelope;
    00062     OGRGeometry *m_poFilterGeom;
    00063     OGRPreparedGeometry *m_pPreparedFilterGeom; /* m_poFilterGeom compiled as a prepared geometry */
    00064     OGREnvelope  m_sFilterEnvelope;
    00065
    00066     int          FilterGeometry( OGRGeometry * );
    00067     //int          FilterGeometry( OGRGeometry *, OGREnvelope* psGeometryEnvelope);
    00068     int          InstallFilter( OGRGeometry * );
    00069
    00070   public:
    00071     OGRLayer();
    00072     virtual     ~OGRLayer();
    00073
    00074     virtual OGRGeometry *GetSpatialFilter();
    00075     virtual void        SetSpatialFilter( OGRGeometry * );
    00076     virtual void        SetSpatialFilterRect( double dfMinX, double dfMinY,
    00077                                               double dfMaxX, double dfMaxY );
    00078
    00079     virtual OGRErr      SetAttributeFilter( const char * );
    00080
    00081     virtual void        ResetReading() = 0;
    00082     virtual OGRFeature *GetNextFeature() = 0;
    00083     virtual OGRErr      SetNextByIndex( long nIndex );
    00084     virtual OGRFeature *GetFeature( long nFID );
    00085     virtual OGRErr      SetFeature( OGRFeature *poFeature );
    00086     virtual OGRErr      CreateFeature( OGRFeature *poFeature );
    00087     virtual OGRErr      DeleteFeature( long nFID );
    00088
    00089     virtual const char *GetName();
    00090     virtual OGRwkbGeometryType GetGeomType();
    00091     virtual OGRFeatureDefn *GetLayerDefn() = 0;
    00092
    00093     virtual OGRSpatialReference *GetSpatialRef() { return NULL; }
    00094
    00095     virtual int         GetFeatureCount( int bForce = TRUE );
    00096     virtual OGRErr      GetExtent(OGREnvelope *psExtent, int bForce = TRUE);
    00097
    00098     virtual int         TestCapability( const char * ) = 0;
    00099
    00100     virtual const char *GetInfo( const char * );
    00101
    00102     virtual OGRErr      CreateField( OGRFieldDefn *poField,
    00103                                      int bApproxOK = TRUE );
    00104     virtual OGRErr      DeleteField( int iField );
    00105     virtual OGRErr      ReorderFields( int* panMap );
    00106     virtual OGRErr      AlterFieldDefn( int iField, OGRFieldDefn* poNewFieldDefn, int nFlags );
    00107
    00108     virtual OGRErr      SyncToDisk();
    00109
    00110     virtual OGRStyleTable *GetStyleTable();
    00111     virtual void        SetStyleTableDirectly( OGRStyleTable *poStyleTable );
    00112
    00113     virtual void        SetStyleTable(OGRStyleTable *poStyleTable);
    00114
    00115     virtual OGRErr      StartTransaction();
    00116     virtual OGRErr      CommitTransaction();
    00117     virtual OGRErr      RollbackTransaction();
    00118
    00119     virtual const char *GetFIDColumn();
    00120     virtual const char *GetGeometryColumn();
    00121
    00122     virtual OGRErr      SetIgnoredFields( const char **papszFields );
    00123
    00124     OGRErr              Intersection( OGRLayer *pLayerMethod,
    00125                                       OGRLayer *pLayerResult,
    00126                                       char** papszOptions = NULL,
    00127                                       GDALProgressFunc pfnProgress = NULL,
    00128                                       void * pProgressArg = NULL );
    00129     OGRErr              Union( OGRLayer *pLayerMethod,
    00130                                OGRLayer *pLayerResult,
    00131                                char** papszOptions = NULL,
    00132                                GDALProgressFunc pfnProgress = NULL,
    00133                                void * pProgressArg = NULL );
    00134     OGRErr              SymDifference( OGRLayer *pLayerMethod,
    00135                                        OGRLayer *pLayerResult,
    00136                                        char** papszOptions,
    00137                                        GDALProgressFunc pfnProgress,
    00138                                        void * pProgressArg );
    00139     OGRErr              Identity( OGRLayer *pLayerMethod,
    00140                                   OGRLayer *pLayerResult,
    00141                                   char** papszOptions = NULL,
    00142                                   GDALProgressFunc pfnProgress = NULL,
    00143                                   void * pProgressArg = NULL );
    00144     OGRErr              Update( OGRLayer *pLayerMethod,
    00145                                 OGRLayer *pLayerResult,
    00146                                 char** papszOptions = NULL,
    00147                                 GDALProgressFunc pfnProgress = NULL,
    00148                                 void * pProgressArg = NULL );
    00149     OGRErr              Clip( OGRLayer *pLayerMethod,
    00150                               OGRLayer *pLayerResult,
    00151                               char** papszOptions = NULL,
    00152                               GDALProgressFunc pfnProgress = NULL,
    00153                               void * pProgressArg = NULL );
    00154     OGRErr              Erase( OGRLayer *pLayerMethod,
    00155                                OGRLayer *pLayerResult,
    00156                                char** papszOptions = NULL,
    00157                                GDALProgressFunc pfnProgress = NULL,
    00158                                void * pProgressArg = NULL );
    00159
    00160     int                 Reference();
    00161     int                 Dereference();
    00162     int                 GetRefCount() const;
    00163
    00164     GIntBig             GetFeaturesRead();
    00165
    00166     /* non virtual : conveniency wrapper for ReorderFields() */
    00167     OGRErr              ReorderField( int iOldFieldPos, int iNewFieldPos );
    00168
    00169     int                 AttributeFilterEvaluationNeedsGeometry();
    00170
    00171     /* consider these private */
    00172     OGRErr               InitializeIndexSupport( const char * );
    00173     OGRLayerAttrIndex   *GetIndex() { return m_poAttrIndex; }
    00174
    00175  protected:
    00176     OGRStyleTable       *m_poStyleTable;
    00177     OGRFeatureQuery     *m_poAttrQuery;
    00178     OGRLayerAttrIndex   *m_poAttrIndex;
    00179
    00180     int                  m_nRefCount;
    00181
    00182     GIntBig              m_nFeaturesRead;
    00183 };
    00184
    00185
    00186 /************************************************************************/
    00187 /*                            OGRDataSource                             */
    00188 /************************************************************************/
    00189
    00200 class CPL_DLL OGRDataSource
    00201 {
    00202     friend class OGRSFDriverRegistrar;
    00203
    00204     void        *m_hMutex;
    00205
    00206     OGRLayer*       BuildLayerFromSelectInfo(void* psSelectInfo,
    00207                                              OGRGeometry *poSpatialFilter,
    00208                                              const char *pszDialect);
    00209
    00210   public:
    00211
    00212     OGRDataSource();
    00213     virtual     ~OGRDataSource();
    00214     static void         DestroyDataSource( OGRDataSource * );
    00215
    00216     virtual const char  *GetName() = 0;
    00217
    00218     virtual int         GetLayerCount() = 0;
    00219     virtual OGRLayer    *GetLayer(int) = 0;
    00220     virtual OGRLayer    *GetLayerByName(const char *);
    00221     virtual OGRErr      DeleteLayer(int);
    00222
    00223     virtual int         TestCapability( const char * ) = 0;
    00224
    00225     virtual OGRLayer   *CreateLayer( const char *pszName,
    00226                                      OGRSpatialReference *poSpatialRef = NULL,
    00227                                      OGRwkbGeometryType eGType = wkbUnknown,
    00228                                      char ** papszOptions = NULL );
    00229     virtual OGRLayer   *CopyLayer( OGRLayer *poSrcLayer,
    00230                                    const char *pszNewName,
    00231                                    char **papszOptions = NULL );
    00232
    00233     virtual OGRStyleTable *GetStyleTable();
    00234     virtual void        SetStyleTableDirectly( OGRStyleTable *poStyleTable );
    00235
    00236     virtual void        SetStyleTable(OGRStyleTable *poStyleTable);
    00237
    00238     virtual OGRLayer *  ExecuteSQL( const char *pszStatement,
    00239                                     OGRGeometry *poSpatialFilter,
    00240                                     const char *pszDialect );
    00241     virtual void        ReleaseResultSet( OGRLayer * poResultsSet );
    00242
    00243     virtual OGRErr      SyncToDisk();
    00244
    00245     int                 Reference();
    00246     int                 Dereference();
    00247     int                 GetRefCount() const;
    00248     int                 GetSummaryRefCount() const;
    00249     OGRErr              Release();
    00250
    00251     OGRSFDriver        *GetDriver() const;
    00252     void                SetDriver( OGRSFDriver *poDriver );
    00253
    00254   protected:
    00255
    00256     OGRErr              ProcessSQLCreateIndex( const char * );
    00257     OGRErr              ProcessSQLDropIndex( const char * );
    00258     OGRErr              ProcessSQLDropTable( const char * );
    00259     OGRErr              ProcessSQLAlterTableAddColumn( const char * );
    00260     OGRErr              ProcessSQLAlterTableDropColumn( const char * );
    00261     OGRErr              ProcessSQLAlterTableAlterColumn( const char * );
    00262     OGRErr              ProcessSQLAlterTableRenameColumn( const char * );
    00263
    00264     OGRStyleTable      *m_poStyleTable;
    00265     int                 m_nRefCount;
    00266     OGRSFDriver        *m_poDriver;
    00267 };
    00268
    00269 /************************************************************************/
    00270 /*                             OGRSFDriver                              */
    00271 /************************************************************************/
    00272
    00282 class CPL_DLL OGRSFDriver
    00283 {
    00284   public:
    00285     virtual     ~OGRSFDriver();
    00286
    00287     virtual const char  *GetName() = 0;
    00288
    00289     virtual OGRDataSource *Open( const char *pszName, int bUpdate=FALSE ) = 0;
    00290
    00291     virtual int         TestCapability( const char * ) = 0;
    00292
    00293     virtual OGRDataSource *CreateDataSource( const char *pszName,
    00294                                              char ** = NULL );
    00295     virtual OGRErr      DeleteDataSource( const char *pszName );
    00296
    00297     virtual OGRDataSource *CopyDataSource( OGRDataSource *poSrcDS,
    00298                                            const char *pszNewName,
    00299                                            char **papszOptions = NULL );
    00300 };
    00301
    00302
    00303 /************************************************************************/
    00304 /*                         OGRSFDriverRegistrar                         */
    00305 /************************************************************************/
    00306
    00315 class CPL_DLL OGRSFDriverRegistrar
    00316 {
    00317     int         nDrivers;
    00318     OGRSFDriver **papoDrivers;
    00319
    00320                 OGRSFDriverRegistrar();
    00321
    00322     int         nOpenDSCount;
    00323     char        **papszOpenDSRawName;
    00324     OGRDataSource **papoOpenDS;
    00325     OGRSFDriver **papoOpenDSDriver;
    00326     GIntBig     *panOpenDSPID;
    00327
    00328   public:
    00329
    00330                 ~OGRSFDriverRegistrar();
    00331
    00332     static OGRSFDriverRegistrar *GetRegistrar();
    00333     static OGRDataSource *Open( const char *pszName, int bUpdate=FALSE,
    00334                                 OGRSFDriver ** ppoDriver = NULL );
    00335
    00336     OGRDataSource *OpenShared( const char *pszName, int bUpdate=FALSE,
    00337                                OGRSFDriver ** ppoDriver = NULL );
    00338     OGRErr      ReleaseDataSource( OGRDataSource * );
    00339
    00340     void        RegisterDriver( OGRSFDriver * poDriver );
    00341     void        DeregisterDriver( OGRSFDriver * poDriver );
    00342
    00343     int         GetDriverCount( void );
    00344     OGRSFDriver *GetDriver( int iDriver );
    00345     OGRSFDriver *GetDriverByName( const char * );
    00346
    00347     int         GetOpenDSCount() { return nOpenDSCount; }
    00348     OGRDataSource *GetOpenDS( int );
    00349
    00350     void        AutoLoadDrivers();
    00351 };
    00352
    00353 /* -------------------------------------------------------------------- */
    00354 /*      Various available registration methods.                         */
    00355 /* -------------------------------------------------------------------- */
    00356 CPL_C_START
    00357 void CPL_DLL OGRRegisterAll();
    00358
    00359 void CPL_DLL RegisterOGRFileGDB();
    00360 void CPL_DLL RegisterOGRShape();
    00361 void CPL_DLL RegisterOGRNTF();
    00362 void CPL_DLL RegisterOGRFME();
    00363 void CPL_DLL RegisterOGRSDTS();
    00364 void CPL_DLL RegisterOGRTiger();
    00365 void CPL_DLL RegisterOGRS57();
    00366 void CPL_DLL RegisterOGRTAB();
    00367 void CPL_DLL RegisterOGRMIF();
    00368 void CPL_DLL RegisterOGROGDI();
    00369 void CPL_DLL RegisterOGRODBC();
    00370 void CPL_DLL RegisterOGRPG();
    00371 void CPL_DLL RegisterOGRMSSQLSpatial();
    00372 void CPL_DLL RegisterOGRMySQL();
    00373 void CPL_DLL RegisterOGROCI();
    00374 void CPL_DLL RegisterOGRDGN();
    00375 void CPL_DLL RegisterOGRGML();
    00376 void CPL_DLL RegisterOGRLIBKML();
    00377 void CPL_DLL RegisterOGRKML();
    00378 void CPL_DLL RegisterOGRGeoJSON();
    00379 void CPL_DLL RegisterOGRAVCBin();
    00380 void CPL_DLL RegisterOGRAVCE00();
    00381 void CPL_DLL RegisterOGRREC();
    00382 void CPL_DLL RegisterOGRMEM();
    00383 void CPL_DLL RegisterOGRVRT();
    00384 void CPL_DLL RegisterOGRDODS();
    00385 void CPL_DLL RegisterOGRSQLite();
    00386 void CPL_DLL RegisterOGRCSV();
    00387 void CPL_DLL RegisterOGRILI1();
    00388 void CPL_DLL RegisterOGRILI2();
    00389 void CPL_DLL RegisterOGRGRASS();
    00390 void CPL_DLL RegisterOGRPGeo();
    00391 void CPL_DLL RegisterOGRDXFDWG();
    00392 void CPL_DLL RegisterOGRDXF();
    00393 void CPL_DLL RegisterOGRDWG();
    00394 void CPL_DLL RegisterOGRSDE();
    00395 void CPL_DLL RegisterOGRIDB();
    00396 void CPL_DLL RegisterOGRGMT();
    00397 void CPL_DLL RegisterOGRBNA();
    00398 void CPL_DLL RegisterOGRGPX();
    00399 void CPL_DLL RegisterOGRGeoconcept();
    00400 void CPL_DLL RegisterOGRIngres();
    00401 void CPL_DLL RegisterOGRPCIDSK();
    00402 void CPL_DLL RegisterOGRXPlane();
    00403 void CPL_DLL RegisterOGRNAS();
    00404 void CPL_DLL RegisterOGRGeoRSS();
    00405 void CPL_DLL RegisterOGRGTM();
    00406 void CPL_DLL RegisterOGRVFK();
    00407 void CPL_DLL RegisterOGRPGDump();
    00408 void CPL_DLL RegisterOGROSM();
    00409 void CPL_DLL RegisterOGRGPSBabel();
    00410 void CPL_DLL RegisterOGRSUA();
    00411 void CPL_DLL RegisterOGROpenAir();
    00412 void CPL_DLL RegisterOGRPDS();
    00413 void CPL_DLL RegisterOGRWFS();
    00414 void CPL_DLL RegisterOGRSOSI();
    00415 void CPL_DLL RegisterOGRHTF();
    00416 void CPL_DLL RegisterOGRAeronavFAA();
    00417 void CPL_DLL RegisterOGRGeomedia();
    00418 void CPL_DLL RegisterOGRMDB();
    00419 void CPL_DLL RegisterOGREDIGEO();
    00420 void CPL_DLL RegisterOGRGFT();
    00421 void CPL_DLL RegisterOGRSVG();
    00422 void CPL_DLL RegisterOGRCouchDB();
    00423 void CPL_DLL RegisterOGRIdrisi();
    00424 void CPL_DLL RegisterOGRARCGEN();
    00425 void CPL_DLL RegisterOGRSEGUKOOA();
    00426 void CPL_DLL RegisterOGRSEGY();
    00427 void CPL_DLL RegisterOGRXLS();
    00428 void CPL_DLL RegisterOGRODS();
    00429 void CPL_DLL RegisterOGRXLSX();
    00430 void CPL_DLL RegisterOGRElastic();
    00431 void CPL_DLL RegisterOGRPDF();
    00432 CPL_C_END
    00433
    00434
    00435 #endif /* ndef _OGRSF_FRMTS_H_INCLUDED */

Generated for GDAL by 1.7.1.