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

Generated on Mon Aug 29 04:05:42 2005 for OGR by doxygen 1.3.6