Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

ogrsf_frmts.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  * $Id: ogrsf_frmts.h,v 1.46 2004/11/21 22:08:49 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.46  2004/11/21 22:08:49  fwarmerdam
00032  * added Release() and DestroyDataSource() methods on OGRDataSource
00033  *
00034  * Revision 1.45  2004/10/06 19:49:14  fwarmerdam
00035  * Added Mysql registration function.
00036  *
00037  * Revision 1.44  2004/07/20 19:18:44  warmerda
00038  * added CSV
00039  *
00040  * Revision 1.43  2004/07/10 05:03:24  warmerda
00041  * added SQLite
00042  *
00043  * Revision 1.42  2004/02/11 18:03:15  warmerda
00044  * added RegisterOGRDODS()
00045  *
00046  * Revision 1.41  2003/11/06 18:27:35  warmerda
00047  * Added VRT registration point
00048  *
00049  * Revision 1.40  2003/10/09 15:28:07  warmerda
00050  * added OGRLayer::DeleteFeature() support
00051  *
00052  * Revision 1.39  2003/10/06 19:15:40  warmerda
00053  * added ODBC support
00054  *
00055  * Revision 1.38  2003/05/28 19:17:31  warmerda
00056  * fixup stuff for docs
00057  *
00058  * Revision 1.37  2003/04/22 19:36:04  warmerda
00059  * Added SyncToDisk
00060  *
00061  * Revision 1.36  2003/04/08 21:21:29  warmerda
00062  * added OGRGetDriverByName
00063  *
00064  * Revision 1.35  2003/04/08 19:31:32  warmerda
00065  * added CopyLayer and CopyDataSource entry points
00066  *
00067  * Revision 1.34  2003/03/20 20:21:48  warmerda
00068  * added drop index
00069  *
00070  * Revision 1.33  2003/03/19 20:29:06  warmerda
00071  * added shared access and reference counting
00072  *
00073  * Revision 1.32  2003/03/05 05:09:11  warmerda
00074  * added GetLayerByName() method on OGRDataSource
00075  *
00076  * Revision 1.31  2003/03/04 05:47:23  warmerda
00077  * added indexing support
00078  *
00079  * Revision 1.30  2003/03/03 05:06:08  warmerda
00080  * added support for DeleteDataSource and DeleteLayer
00081  *
00082  * Revision 1.29  2003/02/03 21:16:49  warmerda
00083  * added .rec driver
00084  *
00085  * Revision 1.28  2002/12/28 04:09:18  warmerda
00086  * added Oracle support
00087  *
00088  * Revision 1.27  2002/09/26 18:15:31  warmerda
00089  * moved capabilities macros to ogr_core.h for ogr_api.h
00090  *
00091  * Revision 1.26  2002/06/25 14:45:50  warmerda
00092  * added RegisterOGRFME()
00093  *
00094  * Revision 1.25  2002/04/25 03:42:04  warmerda
00095  * fixed spatial filter support on SQL results
00096  *
00097  * Revision 1.24  2002/04/25 02:24:13  warmerda
00098  * added ExecuteSWQ() method
00099  *
00100  * Revision 1.23  2002/02/18 20:56:24  warmerda
00101  * added AVC registration
00102  *
00103  * Revision 1.22  2002/01/25 20:47:58  warmerda
00104  * added GML registration
00105  *
00106  * Revision 1.21  2001/11/15 21:19:21  warmerda
00107  * added transaction semantics
00108  *
00109  * Revision 1.20  2001/06/19 15:50:23  warmerda
00110  * added feature attribute query support
00111  *
00112  * Revision 1.19  2001/03/15 04:01:43  danmo
00113  * Added OGRLayer::GetExtent()
00114  *
00115  * Revision 1.18  2001/02/06 17:10:28  warmerda
00116  * export entry points from DLL
00117  *
00118  * Revision 1.17  2001/01/19 21:13:50  warmerda
00119  * expanded tabs
00120  *
00121  * Revision 1.16  2000/11/28 19:00:32  warmerda
00122  * added RegisterOGRDGN
00123  *
00124  * Revision 1.15  2000/10/17 17:54:53  warmerda
00125  * added postgresql support
00126  *
00127  * Revision 1.14  2000/08/24 04:44:05  danmo
00128  * Added optional OGDI driver in OGR
00129  *
00130  * Revision 1.13  2000/08/18 21:52:53  svillene
00131  * Add OGR Representation
00132  *
00133  * Revision 1.12  1999/11/14 18:13:08  svillene
00134  * add RegisterOGRTAB RegisterOGRMIF
00135  *
00136  * Revision 1.11  1999/11/04 21:09:40  warmerda
00137  * Made a bunch of changes related to supporting creation of new
00138  * layers and data sources.
00139  *
00140  * Revision 1.10  1999/10/06 19:02:43  warmerda
00141  * Added tiger registration.
00142  *
00143  * Revision 1.9  1999/09/22 03:05:08  warmerda
00144  * added SDTS
00145  *
00146  * Revision 1.8  1999/09/09 21:04:55  warmerda
00147  * added fme support
00148  *
00149  * Revision 1.7  1999/08/28 03:12:43  warmerda
00150  * Added NTF.
00151  *
00152  * Revision 1.6  1999/07/27 00:50:39  warmerda
00153  * added a number of OGRLayer methods
00154  *
00155  * Revision 1.5  1999/07/26 13:59:05  warmerda
00156  * added feature writing api
00157  *
00158  * Revision 1.4  1999/07/21 13:23:27  warmerda
00159  * Fixed multiple inclusion protection.
00160  *
00161  * Revision 1.3  1999/07/08 20:04:58  warmerda
00162  * added GetFeatureCount
00163  *
00164  * Revision 1.2  1999/07/06 20:25:09  warmerda
00165  * added some documentation
00166  *
00167  * Revision 1.1  1999/07/05 18:59:00  warmerda
00168  * new
00169  *
00170  */
00171 
00172 #ifndef _OGRSF_FRMTS_H_INCLUDED
00173 #define _OGRSF_FRMTS_H_INCLUDED
00174 
00175 #include "ogr_feature.h"
00176 
00183 class OGRLayerAttrIndex;
00184 
00185 /************************************************************************/
00186 /*                               OGRLayer                               */
00187 /************************************************************************/
00188 
00194 class CPL_DLL OGRLayer
00195 {
00196   public:
00197                 OGRLayer();
00198     virtual     ~OGRLayer();
00199 
00200     virtual OGRGeometry *GetSpatialFilter() = 0;
00201     virtual void        SetSpatialFilter( OGRGeometry * ) = 0;
00202 
00203     virtual OGRErr      SetAttributeFilter( const char * );
00204 
00205     virtual void        ResetReading() = 0;
00206     virtual OGRFeature *GetNextFeature() = 0;
00207     virtual OGRFeature *GetFeature( long nFID );
00208     virtual OGRErr      SetFeature( OGRFeature *poFeature );
00209     virtual OGRErr      CreateFeature( OGRFeature *poFeature );
00210     virtual OGRErr      DeleteFeature( long nFID );
00211 
00212     virtual OGRFeatureDefn *GetLayerDefn() = 0;
00213 
00214     virtual OGRSpatialReference *GetSpatialRef() { return NULL; }
00215 
00216     virtual int         GetFeatureCount( int bForce = TRUE );
00217     virtual OGRErr      GetExtent(OGREnvelope *psExtent, int bForce = TRUE);
00218 
00219     virtual int         TestCapability( const char * ) = 0;
00220 
00221     virtual const char *GetInfo( const char * );
00222 
00223     virtual OGRErr      CreateField( OGRFieldDefn *poField,
00224                                      int bApproxOK = TRUE );
00225 
00226     virtual OGRErr      SyncToDisk();
00227 
00228     OGRStyleTable       *GetStyleTable(){return m_poStyleTable;}
00229     void                 SetStyleTable(OGRStyleTable *poStyleTable){m_poStyleTable = poStyleTable;}
00230 
00231     virtual OGRErr       StartTransaction();
00232     virtual OGRErr       CommitTransaction();
00233     virtual OGRErr       RollbackTransaction();
00234 
00235     int                 Reference();
00236     int                 Dereference();
00237     int                 GetRefCount() const;
00238     
00239     /* consider these private */
00240     OGRErr               InitializeIndexSupport( const char * );
00241     OGRLayerAttrIndex   *GetIndex() { return m_poAttrIndex; }
00242 
00243  protected:
00244     OGRStyleTable       *m_poStyleTable;
00245     OGRFeatureQuery     *m_poAttrQuery;
00246     OGRLayerAttrIndex   *m_poAttrIndex;
00247 
00248     int                  m_nRefCount;
00249 };
00250 
00251 
00252 /************************************************************************/
00253 /*                            OGRDataSource                             */
00254 /************************************************************************/
00255 
00266 class CPL_DLL OGRDataSource
00267 {
00268   public:
00269 
00270     OGRDataSource();
00271     virtual     ~OGRDataSource();
00272     static void         DestroyDataSource( OGRDataSource * );
00273 
00274     virtual const char  *GetName() = 0;
00275 
00276     virtual int         GetLayerCount() = 0;
00277     virtual OGRLayer    *GetLayer(int) = 0;
00278     virtual OGRLayer    *GetLayerByName(const char *);
00279     virtual OGRErr      DeleteLayer(int);
00280 
00281     virtual int         TestCapability( const char * ) = 0;
00282 
00283     virtual OGRLayer   *CreateLayer( const char *pszName, 
00284                                      OGRSpatialReference *poSpatialRef = NULL,
00285                                      OGRwkbGeometryType eGType = wkbUnknown,
00286                                      char ** papszOptions = NULL );
00287     virtual OGRLayer   *CopyLayer( OGRLayer *poSrcLayer, 
00288                                    const char *pszNewName, 
00289                                    char **papszOptions = NULL );
00290     OGRStyleTable       *GetStyleTable(){return m_poStyleTable;}
00291 
00292     virtual OGRLayer *  ExecuteSQL( const char *pszStatement,
00293                                     OGRGeometry *poSpatialFilter,
00294                                     const char *pszDialect );
00295     virtual void        ReleaseResultSet( OGRLayer * poResultsSet );
00296 
00297     virtual OGRErr      SyncToDisk();
00298 
00299     int                 Reference();
00300     int                 Dereference();
00301     int                 GetRefCount() const;
00302     int                 GetSummaryRefCount() const;
00303     OGRErr              Release();
00304 
00305   protected:
00306 
00307     OGRErr              ProcessSQLCreateIndex( const char * );
00308     OGRErr              ProcessSQLDropIndex( const char * );
00309 
00310     OGRStyleTable      *m_poStyleTable;
00311     int                 m_nRefCount;
00312 };
00313 
00314 /************************************************************************/
00315 /*                             OGRSFDriver                              */
00316 /************************************************************************/
00317 
00327 class CPL_DLL OGRSFDriver
00328 {
00329   public:
00330     virtual     ~OGRSFDriver();
00331 
00332     virtual const char  *GetName() = 0;
00333 
00334     virtual OGRDataSource *Open( const char *pszName, int bUpdate=FALSE ) = 0;
00335 
00336     virtual int         TestCapability( const char * ) = 0;
00337 
00338     virtual OGRDataSource *CreateDataSource( const char *pszName,
00339                                              char ** = NULL );
00340     virtual OGRErr      DeleteDataSource( const char *pszName );
00341 
00342     virtual OGRDataSource *CopyDataSource( OGRDataSource *poSrcDS, 
00343                                            const char *pszNewName, 
00344                                            char **papszOptions = NULL );
00345 };
00346 
00347 
00348 /************************************************************************/
00349 /*                         OGRSFDriverRegistrar                         */
00350 /************************************************************************/
00351 
00357 class CPL_DLL OGRSFDriverRegistrar
00358 {
00359     int         nDrivers;
00360     OGRSFDriver **papoDrivers;
00361 
00362                 OGRSFDriverRegistrar();
00363 
00364     int         nOpenDSCount;
00365     char        **papszOpenDSRawName;
00366     OGRDataSource **papoOpenDS;
00367     OGRSFDriver **papoOpenDSDriver;
00368 
00369   public:
00370 
00371                 ~OGRSFDriverRegistrar();
00372 
00373     static OGRSFDriverRegistrar *GetRegistrar();
00374     static OGRDataSource *Open( const char *pszName, int bUpdate=FALSE,
00375                                 OGRSFDriver ** ppoDriver = NULL );
00376 
00377     OGRDataSource *OpenShared( const char *pszName, int bUpdate=FALSE,
00378                                OGRSFDriver ** ppoDriver = NULL );
00379     OGRErr      ReleaseDataSource( OGRDataSource * );
00380 
00381     void        RegisterDriver( OGRSFDriver * poDriver );
00382 
00383     int         GetDriverCount( void );
00384     OGRSFDriver *GetDriver( int iDriver );
00385     OGRSFDriver *GetDriverByName( const char * );
00386 
00387     int         GetOpenDSCount() { return nOpenDSCount; } 
00388     OGRDataSource *GetOpenDS( int );
00389 };
00390 
00391 /* -------------------------------------------------------------------- */
00392 /*      Various available registration methods.                         */
00393 /* -------------------------------------------------------------------- */
00394 CPL_C_START
00395 void CPL_DLL OGRRegisterAll();
00396 
00397 void CPL_DLL RegisterOGRShape();
00398 void CPL_DLL RegisterOGRNTF();
00399 void CPL_DLL RegisterOGRFME();
00400 void CPL_DLL RegisterOGRSDTS();
00401 void CPL_DLL RegisterOGRTiger();
00402 void CPL_DLL RegisterOGRS57();
00403 void CPL_DLL RegisterOGRTAB();
00404 void CPL_DLL RegisterOGRMIF();
00405 void CPL_DLL RegisterOGROGDI();
00406 void CPL_DLL RegisterOGRODBC();
00407 void CPL_DLL RegisterOGRPG();
00408 void CPL_DLL RegisterOGRMySQL();
00409 void CPL_DLL RegisterOGROCI();
00410 void CPL_DLL RegisterOGRDGN();
00411 void CPL_DLL RegisterOGRGML();
00412 void CPL_DLL RegisterOGRAVCBin();
00413 void CPL_DLL RegisterOGRAVCE00();
00414 void CPL_DLL RegisterOGRFME();
00415 void CPL_DLL RegisterOGRREC();
00416 void CPL_DLL RegisterOGRMEM();
00417 void CPL_DLL RegisterOGRVRT();
00418 void CPL_DLL RegisterOGRDODS();
00419 void CPL_DLL RegisterOGRSQLite();
00420 void CPL_DLL RegisterOGRCSV();
00421 
00422 CPL_C_END
00423 
00424 
00425 #endif /* ndef _OGRSF_FRMTS_H_INCLUDED */

Generated on Tue Mar 15 07:12:56 2005 for OGR by  doxygen 1.4.0