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

Generated on Thu Nov 13 00:06:22 2003 for OGR by doxygen 1.3.4