sfctable.h

00001 /******************************************************************************
00002  * $Id: sfctable.h 10646 2007-01-18 02:38:10Z warmerdam $
00003  *
00004  * Project:  OpenGIS Simple Features Reference Implementation
00005  * Purpose:  SFCTable class, client side abstraction for an OLE DB spatial
00006  *           table based on ATL CTable. 
00007  * Author:   Frank Warmerdam, warmerdam@pobox.com
00008  *
00009  ******************************************************************************
00010  * Copyright (c) 1999, Les Technologies SoftMap Inc.
00011  *
00012  * Permission is hereby granted, free of charge, to any person obtaining a
00013  * copy of this software and associated documentation files (the "Software"),
00014  * to deal in the Software without restriction, including without limitation
00015  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00016  * and/or sell copies of the Software, and to permit persons to whom the
00017  * Software is furnished to do so, subject to the following conditions:
00018  *
00019  * The above copyright notice and this permission notice shall be included
00020  * in all copies or substantial portions of the Software.
00021  *
00022  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00023  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00024  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00025  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00026  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00027  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00028  * DEALINGS IN THE SOFTWARE.
00029  ****************************************************************************/
00030 
00031 #ifndef SFCTABLE_H_INCLUDED
00032 #define SFCTABLE_H_INCLUDED
00033 
00034 #include <atldbcli.h>
00035 
00036 class OGRFeature;
00037 class OGRFeatureDefn;
00038 class OGRGeometry;
00039 class OGRSpatialReference;
00040 
00041 /************************************************************************/
00042 /*                               SFCTable                               */
00043 /************************************************************************/
00044 
00055 class SFCTable : public CTable<CDynamicAccessor>
00056 {
00057   private:
00058     int         bTriedToIdentify;
00059     int         iBindColumn;       
00060     int         iGeomColumn;       /* -1 means there is none
00061                                       this is paoColumnInfo index, not ord. */
00062 
00063     void        IdentifyGeometry(); /* find the geometry column */
00064 
00065     BYTE        *pabyLastGeometry;
00066 
00067     int         nGeomType;
00068     ULONG       nSRS_ID;
00069 
00070     int         ReadOGISColumnInfo( CSession * poCSession,
00071                                     const char * pszColumnName = NULL );
00072     int         FetchDefGeomColumn( CSession * poCSession );
00073 
00074     char        *pszTableName;
00075     char        *pszDefGeomColumn;
00076 
00077     OGRSpatialReference * poSRS;
00078 
00079     OGRFeatureDefn * poDefn;
00080     ULONG        *panColOrdinal;
00081 
00082   public:
00083                 SFCTable();
00084     virtual     ~SFCTable();
00085 
00086     HRESULT     OpenFromRowset( IRowset * pIRowset );
00087     
00088     HRESULT     Open( const CSession& session, DBID& dbid,
00089                       DBPROPSET* pPropSet = NULL );
00090 
00091     void        SetTableName( const char * );
00092     const char *GetTableName();
00093     
00094     int         ReadSchemaInfo( CDataSource *, CSession * = NULL );
00095 
00096     void        ReleaseIUnknowns();
00097     
00098     int         GetSpatialRefID();
00099     OGRSpatialReference *GetSpatialRef() { return poSRS; }
00100 
00101     int         GetGeometryColumn();
00102 
00103     int         HasGeometry();
00104 
00105     int         GetGeometryType();
00106 
00107     BYTE        *GetWKBGeometry( int * pnSize );
00108 
00109     OGRGeometry *GetOGRGeometry();
00110 
00111     OGRFeature  *GetOGRFeature();
00112 
00113     OGRFeatureDefn *GetOGRFeatureDefn();
00114 };
00115 
00116 #endif /* ndef SFCTABLE_H_INCLUDED */

Generated for GDAL by doxygen 1.4.7.