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

Generated on Thu Mar 25 08:13:25 2004 for OGR by doxygen 1.3.6-20040222