- Main Page
- Classes
- Files
- Directories
- Related Pages

- File List
- File Members

# ogrsf_frmts.h

Go to the documentation of this file.

    00001 /******************************************************************************
    00002  * $Id: ogrsf_frmts.h 14301 2008-04-13 19:34:14Z 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 "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 OGRFeatureDefn *GetLayerDefn() = 0;
    00084
    00085     virtual OGRSpatialReference *GetSpatialRef() { return NULL; }
    00086
    00087     virtual int         GetFeatureCount( int bForce = TRUE );
    00088     virtual OGRErr      GetExtent(OGREnvelope *psExtent, int bForce = TRUE);
    00089
    00090     virtual int         TestCapability( const char * ) = 0;
    00091
    00092     virtual const char *GetInfo( const char * );
    00093
    00094     virtual OGRErr      CreateField( OGRFieldDefn *poField,
    00095                                      int bApproxOK = TRUE );
    00096
    00097     virtual OGRErr      SyncToDisk();
    00098
    00099     OGRStyleTable       *GetStyleTable(){ return m_poStyleTable; }
    00100     void                SetStyleTableDirectly( OGRStyleTable *poStyleTable )
    00101                             { if ( m_poStyleTable ) delete m_poStyleTable;
    00102                               m_poStyleTable = poStyleTable; }
    00103     void                SetStyleTable(OGRStyleTable *poStyleTable)
    00104                             {
    00105                                 if ( m_poStyleTable ) delete m_poStyleTable;
    00106                                 if ( poStyleTable )
    00107                                     m_poStyleTable = poStyleTable->Clone();
    00108                             }
    00109
    00110     virtual OGRErr      StartTransaction();
    00111     virtual OGRErr      CommitTransaction();
    00112     virtual OGRErr      RollbackTransaction();
    00113
    00114     virtual const char *GetFIDColumn();
    00115     virtual const char *GetGeometryColumn();
    00116
    00117     int                 Reference();
    00118     int                 Dereference();
    00119     int                 GetRefCount() const;
    00120
    00121     GIntBig             GetFeaturesRead();
    00122
    00123     /* consider these private */
    00124     OGRErr               InitializeIndexSupport( const char * );
    00125     OGRLayerAttrIndex   *GetIndex() { return m_poAttrIndex; }
    00126
    00127  protected:
    00128     OGRStyleTable       *m_poStyleTable;
    00129     OGRFeatureQuery     *m_poAttrQuery;
    00130     OGRLayerAttrIndex   *m_poAttrIndex;
    00131
    00132     int                  m_nRefCount;
    00133
    00134     GIntBig              m_nFeaturesRead;
    00135 };
    00136
    00137
    00138 /************************************************************************/
    00139 /*                            OGRDataSource                             */
    00140 /************************************************************************/
    00141
    00152 class CPL_DLL OGRDataSource
    00153 {
    00154     friend class OGRSFDriverRegistrar;
    00155
    00156     void        *m_hMutex;
    00157
    00158   public:
    00159
    00160     OGRDataSource();
    00161     virtual     ~OGRDataSource();
    00162     static void         DestroyDataSource( OGRDataSource * );
    00163
    00164     virtual const char  *GetName() = 0;
    00165
    00166     virtual int         GetLayerCount() = 0;
    00167     virtual OGRLayer    *GetLayer(int) = 0;
    00168     virtual OGRLayer    *GetLayerByName(const char *);
    00169     virtual OGRErr      DeleteLayer(int);
    00170
    00171     virtual int         TestCapability( const char * ) = 0;
    00172
    00173     virtual OGRLayer   *CreateLayer( const char *pszName,
    00174                                      OGRSpatialReference *poSpatialRef = NULL,
    00175                                      OGRwkbGeometryType eGType = wkbUnknown,
    00176                                      char ** papszOptions = NULL );
    00177     virtual OGRLayer   *CopyLayer( OGRLayer *poSrcLayer,
    00178                                    const char *pszNewName,
    00179                                    char **papszOptions = NULL );
    00180
    00181     OGRStyleTable       *GetStyleTable(){ return m_poStyleTable; }
    00182     void                SetStyleTableDirectly( OGRStyleTable *poStyleTable )
    00183                             { if ( m_poStyleTable ) delete m_poStyleTable;
    00184                               m_poStyleTable = poStyleTable; }
    00185     void                SetStyleTable(OGRStyleTable *poStyleTable)
    00186                             {
    00187                                 if ( m_poStyleTable ) delete m_poStyleTable;
    00188                                 if ( poStyleTable )
    00189                                     m_poStyleTable = poStyleTable->Clone();
    00190                             }
    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
    00213     OGRStyleTable      *m_poStyleTable;
    00214     int                 m_nRefCount;
    00215     OGRSFDriver        *m_poDriver;
    00216 };
    00217
    00218 /************************************************************************/
    00219 /*                             OGRSFDriver                              */
    00220 /************************************************************************/
    00221
    00231 class CPL_DLL OGRSFDriver
    00232 {
    00233   public:
    00234     virtual     ~OGRSFDriver();
    00235
    00236     virtual const char  *GetName() = 0;
    00237
    00238     virtual OGRDataSource *Open( const char *pszName, int bUpdate=FALSE ) = 0;
    00239
    00240     virtual int         TestCapability( const char * ) = 0;
    00241
    00242     virtual OGRDataSource *CreateDataSource( const char *pszName,
    00243                                              char ** = NULL );
    00244     virtual OGRErr      DeleteDataSource( const char *pszName );
    00245
    00246     virtual OGRDataSource *CopyDataSource( OGRDataSource *poSrcDS,
    00247                                            const char *pszNewName,
    00248                                            char **papszOptions = NULL );
    00249 };
    00250
    00251
    00252 /************************************************************************/
    00253 /*                         OGRSFDriverRegistrar                         */
    00254 /************************************************************************/
    00255
    00264 class CPL_DLL OGRSFDriverRegistrar
    00265 {
    00266     int         nDrivers;
    00267     OGRSFDriver **papoDrivers;
    00268
    00269                 OGRSFDriverRegistrar();
    00270
    00271     int         nOpenDSCount;
    00272     char        **papszOpenDSRawName;
    00273     OGRDataSource **papoOpenDS;
    00274     OGRSFDriver **papoOpenDSDriver;
    00275     GIntBig     *panOpenDSPID;
    00276
    00277   public:
    00278
    00279                 ~OGRSFDriverRegistrar();
    00280
    00281     static OGRSFDriverRegistrar *GetRegistrar();
    00282     static OGRDataSource *Open( const char *pszName, int bUpdate=FALSE,
    00283                                 OGRSFDriver ** ppoDriver = NULL );
    00284
    00285     OGRDataSource *OpenShared( const char *pszName, int bUpdate=FALSE,
    00286                                OGRSFDriver ** ppoDriver = NULL );
    00287     OGRErr      ReleaseDataSource( OGRDataSource * );
    00288
    00289     void        RegisterDriver( OGRSFDriver * poDriver );
    00290
    00291     int         GetDriverCount( void );
    00292     OGRSFDriver *GetDriver( int iDriver );
    00293     OGRSFDriver *GetDriverByName( const char * );
    00294
    00295     int         GetOpenDSCount() { return nOpenDSCount; }
    00296     OGRDataSource *GetOpenDS( int );
    00297
    00298     void        AutoLoadDrivers();
    00299 };
    00300
    00301 /* -------------------------------------------------------------------- */
    00302 /*      Various available registration methods.                         */
    00303 /* -------------------------------------------------------------------- */
    00304 CPL_C_START
    00305 void CPL_DLL OGRRegisterAll();
    00306
    00307 void CPL_DLL RegisterOGRShape();
    00308 void CPL_DLL RegisterOGRNTF();
    00309 void CPL_DLL RegisterOGRFME();
    00310 void CPL_DLL RegisterOGRSDTS();
    00311 void CPL_DLL RegisterOGRTiger();
    00312 void CPL_DLL RegisterOGRS57();
    00313 void CPL_DLL RegisterOGRTAB();
    00314 void CPL_DLL RegisterOGRMIF();
    00315 void CPL_DLL RegisterOGROGDI();
    00316 void CPL_DLL RegisterOGRODBC();
    00317 void CPL_DLL RegisterOGRPG();
    00318 void CPL_DLL RegisterOGRMySQL();
    00319 void CPL_DLL RegisterOGROCI();
    00320 void CPL_DLL RegisterOGRDGN();
    00321 void CPL_DLL RegisterOGRGML();
    00322 void CPL_DLL RegisterOGRKML();
    00323 void CPL_DLL RegisterOGRGeoJSON();
    00324 void CPL_DLL RegisterOGRAVCBin();
    00325 void CPL_DLL RegisterOGRAVCE00();
    00326 void CPL_DLL RegisterOGRREC();
    00327 void CPL_DLL RegisterOGRMEM();
    00328 void CPL_DLL RegisterOGRVRT();
    00329 void CPL_DLL RegisterOGRDODS();
    00330 void CPL_DLL RegisterOGRSQLite();
    00331 void CPL_DLL RegisterOGRCSV();
    00332 void CPL_DLL RegisterOGRILI1();
    00333 void CPL_DLL RegisterOGRILI2();
    00334 void CPL_DLL RegisterOGRGRASS();
    00335 void CPL_DLL RegisterOGRPGeo();
    00336 void CPL_DLL RegisterOGRDXFDWG();
    00337 void CPL_DLL RegisterOGRSDE();
    00338 void CPL_DLL RegisterOGRIDB();
    00339 void CPL_DLL RegisterOGRGMT();
    00340 void CPL_DLL RegisterOGRBNA();
    00341 void CPL_DLL RegisterOGRGPX();
    00342 void CPL_DLL RegisterOGRGeoconcept();
    00343 void CPL_DLL RegisterOGRIngres();
    00344 void CPL_DLL RegisterOGRXPlane();
    00345 void CPL_DLL RegisterOGRNAS();
    00346
    00347 CPL_C_END
    00348
    00349
    00350 #endif /* ndef _OGRSF_FRMTS_H_INCLUDED */

Generated for GDAL by 1.5.1.