- 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,v 1.57 2006/01/27 00:09:07 fwarmerdam Exp $
    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  * $Log: ogrsf_frmts.h,v $
    00031  * Revision 1.57  2006/01/27 00:09:07  fwarmerdam
    00032  * added Get{FID,Geometry}Column() support
    00033  *
    00034  * Revision 1.56  2005/11/22 17:01:09  fwarmerdam
    00035  * added SDE support
    00036  *
    00037  * Revision 1.55  2005/11/10 21:37:28  fwarmerdam
    00038  * added DXF/DWG support
    00039  *
    00040  * Revision 1.54  2005/10/25 19:58:53  fwarmerdam
    00041  * added driver tracking on datasource
    00042  *
    00043  * Revision 1.53  2005/09/05 19:31:45  fwarmerdam
    00044  * Added PGeo driver.
    00045  *
    00046  * Revision 1.52  2005/08/05 15:34:34  fwarmerdam
    00047  * added grass
    00048  *
    00049  * Revision 1.51  2005/07/08 22:10:56  pka
    00050  * Initial import of OGR Interlis driver
    00051  *
    00052  * Revision 1.50  2005/02/22 12:40:37  fwarmerdam
    00053  * added base OGRLayer spatial filter support
    00054  *
    00055  * Revision 1.49  2005/02/02 20:00:01  fwarmerdam
    00056  * added SetNextByIndex support
    00057  *
    00058  * Revision 1.48  2005/01/19 20:29:10  fwarmerdam
    00059  * added autoloaddrivers on ogrsfdriverregistrar
    00060  *
    00061  * Revision 1.47  2005/01/03 22:16:44  fwarmerdam
    00062  * added OGRLayer::SetSpatialFilterRect()
    00063  *
    00064  * Revision 1.46  2004/11/21 22:08:49  fwarmerdam
    00065  * added Release() and DestroyDataSource() methods on OGRDataSource
    00066  *
    00067  * Revision 1.45  2004/10/06 19:49:14  fwarmerdam
    00068  * Added Mysql registration function.
    00069  *
    00070  * Revision 1.44  2004/07/20 19:18:44  warmerda
    00071  * added CSV
    00072  *
    00073  * Revision 1.43  2004/07/10 05:03:24  warmerda
    00074  * added SQLite
    00075  *
    00076  * Revision 1.42  2004/02/11 18:03:15  warmerda
    00077  * added RegisterOGRDODS()
    00078  */
    00079
    00080 #ifndef _OGRSF_FRMTS_H_INCLUDED
    00081 #define _OGRSF_FRMTS_H_INCLUDED
    00082
    00083 #include "ogr_feature.h"
    00084
    00091 class OGRLayerAttrIndex;
    00092 class OGRSFDriver;
    00093
    00094 /************************************************************************/
    00095 /*                               OGRLayer                               */
    00096 /************************************************************************/
    00097
    00103 class CPL_DLL OGRLayer
    00104 {
    00105   protected:
    00106     int          m_bFilterIsEnvelope;
    00107     OGRGeometry  *m_poFilterGeom;
    00108     OGREnvelope  m_sFilterEnvelope;
    00109
    00110     int          FilterGeometry( OGRGeometry * );
    00111     int          InstallFilter( OGRGeometry * );
    00112
    00113   public:
    00114     OGRLayer();
    00115     virtual     ~OGRLayer();
    00116
    00117     virtual OGRGeometry *GetSpatialFilter();
    00118     virtual void        SetSpatialFilter( OGRGeometry * );
    00119     virtual void        SetSpatialFilterRect( double dfMinX, double dfMinY,
    00120                                               double dfMaxX, double dfMaxY );
    00121
    00122     virtual OGRErr      SetAttributeFilter( const char * );
    00123
    00124     virtual void        ResetReading() = 0;
    00125     virtual OGRFeature *GetNextFeature() = 0;
    00126     virtual OGRErr      SetNextByIndex( long nIndex );
    00127     virtual OGRFeature *GetFeature( long nFID );
    00128     virtual OGRErr      SetFeature( OGRFeature *poFeature );
    00129     virtual OGRErr      CreateFeature( OGRFeature *poFeature );
    00130     virtual OGRErr      DeleteFeature( long nFID );
    00131
    00132     virtual OGRFeatureDefn *GetLayerDefn() = 0;
    00133
    00134     virtual OGRSpatialReference *GetSpatialRef() { return NULL; }
    00135
    00136     virtual int         GetFeatureCount( int bForce = TRUE );
    00137     virtual OGRErr      GetExtent(OGREnvelope *psExtent, int bForce = TRUE);
    00138
    00139     virtual int         TestCapability( const char * ) = 0;
    00140
    00141     virtual const char *GetInfo( const char * );
    00142
    00143     virtual OGRErr      CreateField( OGRFieldDefn *poField,
    00144                                      int bApproxOK = TRUE );
    00145
    00146     virtual OGRErr      SyncToDisk();
    00147
    00148     OGRStyleTable       *GetStyleTable(){return m_poStyleTable;}
    00149     void                 SetStyleTable(OGRStyleTable *poStyleTable){m_poStyleTable = poStyleTable;}
    00150
    00151     virtual OGRErr       StartTransaction();
    00152     virtual OGRErr       CommitTransaction();
    00153     virtual OGRErr       RollbackTransaction();
    00154
    00155     virtual const char *GetFIDColumn();
    00156     virtual const char *GetGeometryColumn();
    00157
    00158     int                 Reference();
    00159     int                 Dereference();
    00160     int                 GetRefCount() const;
    00161
    00162     GIntBig             GetFeaturesRead();
    00163
    00164     /* consider these private */
    00165     OGRErr               InitializeIndexSupport( const char * );
    00166     OGRLayerAttrIndex   *GetIndex() { return m_poAttrIndex; }
    00167
    00168  protected:
    00169     OGRStyleTable       *m_poStyleTable;
    00170     OGRFeatureQuery     *m_poAttrQuery;
    00171     OGRLayerAttrIndex   *m_poAttrIndex;
    00172
    00173     int                  m_nRefCount;
    00174
    00175     GIntBig              m_nFeaturesRead;
    00176 };
    00177
    00178
    00179 /************************************************************************/
    00180 /*                            OGRDataSource                             */
    00181 /************************************************************************/
    00182
    00193 class CPL_DLL OGRDataSource
    00194 {
    00195     friend class OGRSFDriverRegistrar;
    00196
    00197   public:
    00198
    00199     OGRDataSource();
    00200     virtual     ~OGRDataSource();
    00201     static void         DestroyDataSource( OGRDataSource * );
    00202
    00203     virtual const char  *GetName() = 0;
    00204
    00205     virtual int         GetLayerCount() = 0;
    00206     virtual OGRLayer    *GetLayer(int) = 0;
    00207     virtual OGRLayer    *GetLayerByName(const char *);
    00208     virtual OGRErr      DeleteLayer(int);
    00209
    00210     virtual int         TestCapability( const char * ) = 0;
    00211
    00212     virtual OGRLayer   *CreateLayer( const char *pszName,
    00213                                      OGRSpatialReference *poSpatialRef = NULL,
    00214                                      OGRwkbGeometryType eGType = wkbUnknown,
    00215                                      char ** papszOptions = NULL );
    00216     virtual OGRLayer   *CopyLayer( OGRLayer *poSrcLayer,
    00217                                    const char *pszNewName,
    00218                                    char **papszOptions = NULL );
    00219     OGRStyleTable       *GetStyleTable(){return m_poStyleTable;}
    00220
    00221     virtual OGRLayer *  ExecuteSQL( const char *pszStatement,
    00222                                     OGRGeometry *poSpatialFilter,
    00223                                     const char *pszDialect );
    00224     virtual void        ReleaseResultSet( OGRLayer * poResultsSet );
    00225
    00226     virtual OGRErr      SyncToDisk();
    00227
    00228     int                 Reference();
    00229     int                 Dereference();
    00230     int                 GetRefCount() const;
    00231     int                 GetSummaryRefCount() const;
    00232     OGRErr              Release();
    00233
    00234     OGRSFDriver        *GetDriver() const;
    00235
    00236   protected:
    00237
    00238     OGRErr              ProcessSQLCreateIndex( const char * );
    00239     OGRErr              ProcessSQLDropIndex( const char * );
    00240
    00241     OGRStyleTable      *m_poStyleTable;
    00242     int                 m_nRefCount;
    00243     OGRSFDriver        *m_poDriver;
    00244 };
    00245
    00246 /************************************************************************/
    00247 /*                             OGRSFDriver                              */
    00248 /************************************************************************/
    00249
    00259 class CPL_DLL OGRSFDriver
    00260 {
    00261   public:
    00262     virtual     ~OGRSFDriver();
    00263
    00264     virtual const char  *GetName() = 0;
    00265
    00266     virtual OGRDataSource *Open( const char *pszName, int bUpdate=FALSE ) = 0;
    00267
    00268     virtual int         TestCapability( const char * ) = 0;
    00269
    00270     virtual OGRDataSource *CreateDataSource( const char *pszName,
    00271                                              char ** = NULL );
    00272     virtual OGRErr      DeleteDataSource( const char *pszName );
    00273
    00274     virtual OGRDataSource *CopyDataSource( OGRDataSource *poSrcDS,
    00275                                            const char *pszNewName,
    00276                                            char **papszOptions = NULL );
    00277 };
    00278
    00279
    00280 /************************************************************************/
    00281 /*                         OGRSFDriverRegistrar                         */
    00282 /************************************************************************/
    00283
    00289 class CPL_DLL OGRSFDriverRegistrar
    00290 {
    00291     int         nDrivers;
    00292     OGRSFDriver **papoDrivers;
    00293
    00294                 OGRSFDriverRegistrar();
    00295
    00296     int         nOpenDSCount;
    00297     char        **papszOpenDSRawName;
    00298     OGRDataSource **papoOpenDS;
    00299     OGRSFDriver **papoOpenDSDriver;
    00300
    00301   public:
    00302
    00303                 ~OGRSFDriverRegistrar();
    00304
    00305     static OGRSFDriverRegistrar *GetRegistrar();
    00306     static OGRDataSource *Open( const char *pszName, int bUpdate=FALSE,
    00307                                 OGRSFDriver ** ppoDriver = NULL );
    00308
    00309     OGRDataSource *OpenShared( const char *pszName, int bUpdate=FALSE,
    00310                                OGRSFDriver ** ppoDriver = NULL );
    00311     OGRErr      ReleaseDataSource( OGRDataSource * );
    00312
    00313     void        RegisterDriver( OGRSFDriver * poDriver );
    00314
    00315     int         GetDriverCount( void );
    00316     OGRSFDriver *GetDriver( int iDriver );
    00317     OGRSFDriver *GetDriverByName( const char * );
    00318
    00319     int         GetOpenDSCount() { return nOpenDSCount; }
    00320     OGRDataSource *GetOpenDS( int );
    00321
    00322     void        AutoLoadDrivers();
    00323 };
    00324
    00325 /* -------------------------------------------------------------------- */
    00326 /*      Various available registration methods.                         */
    00327 /* -------------------------------------------------------------------- */
    00328 CPL_C_START
    00329 void CPL_DLL OGRRegisterAll();
    00330
    00331 void CPL_DLL RegisterOGRShape();
    00332 void CPL_DLL RegisterOGRNTF();
    00333 void CPL_DLL RegisterOGRFME();
    00334 void CPL_DLL RegisterOGRSDTS();
    00335 void CPL_DLL RegisterOGRTiger();
    00336 void CPL_DLL RegisterOGRS57();
    00337 void CPL_DLL RegisterOGRTAB();
    00338 void CPL_DLL RegisterOGRMIF();
    00339 void CPL_DLL RegisterOGROGDI();
    00340 void CPL_DLL RegisterOGRODBC();
    00341 void CPL_DLL RegisterOGRPG();
    00342 void CPL_DLL RegisterOGRMySQL();
    00343 void CPL_DLL RegisterOGROCI();
    00344 void CPL_DLL RegisterOGRDGN();
    00345 void CPL_DLL RegisterOGRGML();
    00346 void CPL_DLL RegisterOGRAVCBin();
    00347 void CPL_DLL RegisterOGRAVCE00();
    00348 void CPL_DLL RegisterOGRFME();
    00349 void CPL_DLL RegisterOGRREC();
    00350 void CPL_DLL RegisterOGRMEM();
    00351 void CPL_DLL RegisterOGRVRT();
    00352 void CPL_DLL RegisterOGRDODS();
    00353 void CPL_DLL RegisterOGRSQLite();
    00354 void CPL_DLL RegisterOGRCSV();
    00355 void CPL_DLL RegisterOGRILI1();
    00356 void CPL_DLL RegisterOGRILI2();
    00357 void CPL_DLL RegisterOGRGRASS();
    00358 void CPL_DLL RegisterOGRPGeo();
    00359 void CPL_DLL RegisterOGRDXFDWG();
    00360 void CPL_DLL RegisterOGRSDE();
    00361
    00362 CPL_C_END
    00363
    00364
    00365 #endif /* ndef _OGRSF_FRMTS_H_INCLUDED */

Generated for GDAL by 1.4.5.