# ogrsf_frmts.h

Go to the documentation of this file.

    00001 /******************************************************************************
    00002  * $Id: ogrsf_frmts.h 23554 2011-12-12 18:10:25Z rouault $
    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 "ogr_feature.h"
    00034 #include "ogr_featurestyle.h"
    00035
    00042 class OGRLayerAttrIndex;
    00043 class OGRSFDriver;
    00044
    00045 /************************************************************************/
    00046 /*                               OGRLayer                               */
    00047 /************************************************************************/
    00048
    00054 class CPL_DLL OGRLayer
    00055 {
    00056   protected:
    00057     int          m_bFilterIsEnvelope;
    00058     OGRGeometry *m_poFilterGeom;
    00059     OGREnvelope  m_sFilterEnvelope;
    00060
    00061     int          FilterGeometry( OGRGeometry * );
    00062     int          InstallFilter( OGRGeometry * );
    00063
    00064   public:
    00065     OGRLayer();
    00066     virtual     ~OGRLayer();
    00067
    00068     virtual OGRGeometry *GetSpatialFilter();
    00069     virtual void        SetSpatialFilter( OGRGeometry * );
    00070     virtual void        SetSpatialFilterRect( double dfMinX, double dfMinY,
    00071                                               double dfMaxX, double dfMaxY );
    00072
    00073     virtual OGRErr      SetAttributeFilter( const char * );
    00074
    00075     virtual void        ResetReading() = 0;
    00076     virtual OGRFeature *GetNextFeature() = 0;
    00077     virtual OGRErr      SetNextByIndex( long nIndex );
    00078     virtual OGRFeature *GetFeature( long nFID );
    00079     virtual OGRErr      SetFeature( OGRFeature *poFeature );
    00080     virtual OGRErr      CreateFeature( OGRFeature *poFeature );
    00081     virtual OGRErr      DeleteFeature( long nFID );
    00082
    00083     virtual const char *GetName();
    00084     virtual OGRwkbGeometryType GetGeomType();
    00085     virtual OGRFeatureDefn *GetLayerDefn() = 0;
    00086
    00087     virtual OGRSpatialReference *GetSpatialRef() { return NULL; }
    00088
    00089     virtual int         GetFeatureCount( int bForce = TRUE );
    00090     virtual OGRErr      GetExtent(OGREnvelope *psExtent, int bForce = TRUE);
    00091
    00092     virtual int         TestCapability( const char * ) = 0;
    00093
    00094     virtual const char *GetInfo( const char * );
    00095
    00096     virtual OGRErr      CreateField( OGRFieldDefn *poField,
    00097                                      int bApproxOK = TRUE );
    00098     virtual OGRErr      DeleteField( int iField );
    00099     virtual OGRErr      ReorderFields( int* panMap );
    00100     virtual OGRErr      AlterFieldDefn( int iField, OGRFieldDefn* poNewFieldDefn, int nFlags );
    00101
    00102     virtual OGRErr      SyncToDisk();
    00103
    00104     virtual OGRStyleTable *GetStyleTable();
    00105     virtual void        SetStyleTableDirectly( OGRStyleTable *poStyleTable );
    00106
    00107     virtual void        SetStyleTable(OGRStyleTable *poStyleTable);
    00108
    00109     virtual OGRErr      StartTransaction();
    00110     virtual OGRErr      CommitTransaction();
    00111     virtual OGRErr      RollbackTransaction();
    00112
    00113     virtual const char *GetFIDColumn();
    00114     virtual const char *GetGeometryColumn();
    00115
    00116     virtual OGRErr      SetIgnoredFields( const char **papszFields );
    00117
    00118     int                 Reference();
    00119     int                 Dereference();
    00120     int                 GetRefCount() const;
    00121
    00122     GIntBig             GetFeaturesRead();
    00123
    00124     /* non virtual : conveniency wrapper for ReorderFields() */
    00125     OGRErr              ReorderField( int iOldFieldPos, int iNewFieldPos );
    00126
    00127     int                 AttributeFilterEvaluationNeedsGeometry();
    00128
    00129     /* consider these private */
    00130     OGRErr               InitializeIndexSupport( const char * );
    00131     OGRLayerAttrIndex   *GetIndex() { return m_poAttrIndex; }
    00132
    00133  protected:
    00134     OGRStyleTable       *m_poStyleTable;
    00135     OGRFeatureQuery     *m_poAttrQuery;
    00136     OGRLayerAttrIndex   *m_poAttrIndex;
    00137
    00138     int                  m_nRefCount;
    00139
    00140     GIntBig              m_nFeaturesRead;
    00141 };
    00142
    00143
    00144 /************************************************************************/
    00145 /*                            OGRDataSource                             */
    00146 /************************************************************************/
    00147
    00158 class CPL_DLL OGRDataSource
    00159 {
    00160     friend class OGRSFDriverRegistrar;
    00161
    00162     void        *m_hMutex;
    00163
    00164   public:
    00165
    00166     OGRDataSource();
    00167     virtual     ~OGRDataSource();
    00168     static void         DestroyDataSource( OGRDataSource * );
    00169
    00170     virtual const char  *GetName() = 0;
    00171
    00172     virtual int         GetLayerCount() = 0;
    00173     virtual OGRLayer    *GetLayer(int) = 0;
    00174     virtual OGRLayer    *GetLayerByName(const char *);
    00175     virtual OGRErr      DeleteLayer(int);
    00176
    00177     virtual int         TestCapability( const char * ) = 0;
    00178
    00179     virtual OGRLayer   *CreateLayer( const char *pszName,
    00180                                      OGRSpatialReference *poSpatialRef = NULL,
    00181                                      OGRwkbGeometryType eGType = wkbUnknown,
    00182                                      char ** papszOptions = NULL );
    00183     virtual OGRLayer   *CopyLayer( OGRLayer *poSrcLayer,
    00184                                    const char *pszNewName,
    00185                                    char **papszOptions = NULL );
    00186
    00187     virtual OGRStyleTable *GetStyleTable();
    00188     virtual void        SetStyleTableDirectly( OGRStyleTable *poStyleTable );
    00189
    00190     virtual void        SetStyleTable(OGRStyleTable *poStyleTable);
    00191
    00192     virtual OGRLayer *  ExecuteSQL( const char *pszStatement,
    00193                                     OGRGeometry *poSpatialFilter,
    00194                                     const char *pszDialect );
    00195     virtual void        ReleaseResultSet( OGRLayer * poResultsSet );
    00196
    00197     virtual OGRErr      SyncToDisk();
    00198
    00199     int                 Reference();
    00200     int                 Dereference();
    00201     int                 GetRefCount() const;
    00202     int                 GetSummaryRefCount() const;
    00203     OGRErr              Release();
    00204
    00205     OGRSFDriver        *GetDriver() const;
    00206     void                SetDriver( OGRSFDriver *poDriver );
    00207
    00208   protected:
    00209
    00210     OGRErr              ProcessSQLCreateIndex( const char * );
    00211     OGRErr              ProcessSQLDropIndex( const char * );
    00212     OGRErr              ProcessSQLDropTable( const char * );
    00213     OGRErr              ProcessSQLAlterTableAddColumn( const char * );
    00214     OGRErr              ProcessSQLAlterTableDropColumn( const char * );
    00215     OGRErr              ProcessSQLAlterTableAlterColumn( const char * );
    00216     OGRErr              ProcessSQLAlterTableRenameColumn( const char * );
    00217
    00218     OGRStyleTable      *m_poStyleTable;
    00219     int                 m_nRefCount;
    00220     OGRSFDriver        *m_poDriver;
    00221 };
    00222
    00223 /************************************************************************/
    00224 /*                             OGRSFDriver                              */
    00225 /************************************************************************/
    00226
    00236 class CPL_DLL OGRSFDriver
    00237 {
    00238   public:
    00239     virtual     ~OGRSFDriver();
    00240
    00241     virtual const char  *GetName() = 0;
    00242
    00243     virtual OGRDataSource *Open( const char *pszName, int bUpdate=FALSE ) = 0;
    00244
    00245     virtual int         TestCapability( const char * ) = 0;
    00246
    00247     virtual OGRDataSource *CreateDataSource( const char *pszName,
    00248                                              char ** = NULL );
    00249     virtual OGRErr      DeleteDataSource( const char *pszName );
    00250
    00251     virtual OGRDataSource *CopyDataSource( OGRDataSource *poSrcDS,
    00252                                            const char *pszNewName,
    00253                                            char **papszOptions = NULL );
    00254 };
    00255
    00256
    00257 /************************************************************************/
    00258 /*                         OGRSFDriverRegistrar                         */
    00259 /************************************************************************/
    00260
    00269 class CPL_DLL OGRSFDriverRegistrar
    00270 {
    00271     int         nDrivers;
    00272     OGRSFDriver **papoDrivers;
    00273
    00274                 OGRSFDriverRegistrar();
    00275
    00276     int         nOpenDSCount;
    00277     char        **papszOpenDSRawName;
    00278     OGRDataSource **papoOpenDS;
    00279     OGRSFDriver **papoOpenDSDriver;
    00280     GIntBig     *panOpenDSPID;
    00281
    00282   public:
    00283
    00284                 ~OGRSFDriverRegistrar();
    00285
    00286     static OGRSFDriverRegistrar *GetRegistrar();
    00287     static OGRDataSource *Open( const char *pszName, int bUpdate=FALSE,
    00288                                 OGRSFDriver ** ppoDriver = NULL );
    00289
    00290     OGRDataSource *OpenShared( const char *pszName, int bUpdate=FALSE,
    00291                                OGRSFDriver ** ppoDriver = NULL );
    00292     OGRErr      ReleaseDataSource( OGRDataSource * );
    00293
    00294     void        RegisterDriver( OGRSFDriver * poDriver );
    00295     void        DeregisterDriver( OGRSFDriver * poDriver );
    00296
    00297     int         GetDriverCount( void );
    00298     OGRSFDriver *GetDriver( int iDriver );
    00299     OGRSFDriver *GetDriverByName( const char * );
    00300
    00301     int         GetOpenDSCount() { return nOpenDSCount; }
    00302     OGRDataSource *GetOpenDS( int );
    00303
    00304     void        AutoLoadDrivers();
    00305 };
    00306
    00307 /* -------------------------------------------------------------------- */
    00308 /*      Various available registration methods.                         */
    00309 /* -------------------------------------------------------------------- */
    00310 CPL_C_START
    00311 void CPL_DLL OGRRegisterAll();
    00312
    00313 void CPL_DLL RegisterOGRFileGDB();
    00314 void CPL_DLL RegisterOGRShape();
    00315 void CPL_DLL RegisterOGRNTF();
    00316 void CPL_DLL RegisterOGRFME();
    00317 void CPL_DLL RegisterOGRSDTS();
    00318 void CPL_DLL RegisterOGRTiger();
    00319 void CPL_DLL RegisterOGRS57();
    00320 void CPL_DLL RegisterOGRTAB();
    00321 void CPL_DLL RegisterOGRMIF();
    00322 void CPL_DLL RegisterOGROGDI();
    00323 void CPL_DLL RegisterOGRODBC();
    00324 void CPL_DLL RegisterOGRPG();
    00325 void CPL_DLL RegisterOGRMSSQLSpatial();
    00326 void CPL_DLL RegisterOGRMySQL();
    00327 void CPL_DLL RegisterOGROCI();
    00328 void CPL_DLL RegisterOGRDGN();
    00329 void CPL_DLL RegisterOGRGML();
    00330 void CPL_DLL RegisterOGRLIBKML();
    00331 void CPL_DLL RegisterOGRKML();
    00332 void CPL_DLL RegisterOGRGeoJSON();
    00333 void CPL_DLL RegisterOGRAVCBin();
    00334 void CPL_DLL RegisterOGRAVCE00();
    00335 void CPL_DLL RegisterOGRREC();
    00336 void CPL_DLL RegisterOGRMEM();
    00337 void CPL_DLL RegisterOGRVRT();
    00338 void CPL_DLL RegisterOGRDODS();
    00339 void CPL_DLL RegisterOGRSQLite();
    00340 void CPL_DLL RegisterOGRCSV();
    00341 void CPL_DLL RegisterOGRILI1();
    00342 void CPL_DLL RegisterOGRILI2();
    00343 void CPL_DLL RegisterOGRGRASS();
    00344 void CPL_DLL RegisterOGRPGeo();
    00345 void CPL_DLL RegisterOGRDXFDWG();
    00346 void CPL_DLL RegisterOGRDXF();
    00347 void CPL_DLL RegisterOGRDWG();
    00348 void CPL_DLL RegisterOGRSDE();
    00349 void CPL_DLL RegisterOGRIDB();
    00350 void CPL_DLL RegisterOGRGMT();
    00351 void CPL_DLL RegisterOGRBNA();
    00352 void CPL_DLL RegisterOGRGPX();
    00353 void CPL_DLL RegisterOGRGeoconcept();
    00354 void CPL_DLL RegisterOGRIngres();
    00355 void CPL_DLL RegisterOGRPCIDSK();
    00356 void CPL_DLL RegisterOGRXPlane();
    00357 void CPL_DLL RegisterOGRNAS();
    00358 void CPL_DLL RegisterOGRGeoRSS();
    00359 void CPL_DLL RegisterOGRGTM();
    00360 void CPL_DLL RegisterOGRVFK();
    00361 void CPL_DLL RegisterOGRPGDump();
    00362 void CPL_DLL RegisterOGRGPSBabel();
    00363 void CPL_DLL RegisterOGRSUA();
    00364 void CPL_DLL RegisterOGROpenAir();
    00365 void CPL_DLL RegisterOGRPDS();
    00366 void CPL_DLL RegisterOGRWFS();
    00367 void CPL_DLL RegisterOGRSOSI();
    00368 void CPL_DLL RegisterOGRHTF();
    00369 void CPL_DLL RegisterOGRAeronavFAA();
    00370 void CPL_DLL RegisterOGRGeomedia();
    00371 void CPL_DLL RegisterOGRMDB();
    00372 void CPL_DLL RegisterOGREDIGEO();
    00373 void CPL_DLL RegisterOGRGFT();
    00374 void CPL_DLL RegisterOGRSVG();
    00375 void CPL_DLL RegisterOGRCouchDB();
    00376 void CPL_DLL RegisterOGRIdrisi();
    00377 void CPL_DLL RegisterOGRARCGEN();
    00378 void CPL_DLL RegisterOGRSEGUKOOA();
    00379 void CPL_DLL RegisterOGRSEGY();
    00380 void CPL_DLL RegisterOGRXLS();
    00381 CPL_C_END
    00382
    00383
    00384 #endif /* ndef _OGRSF_FRMTS_H_INCLUDED */

Generated for GDAL by 1.5.6.