sfctable.h

00001 /******************************************************************************
00002  * $Id: sfctable.h,v 1.9 2001/11/01 17:05:01 warmerda Exp $
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, warmerda@home.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  * $Log: sfctable.h,v $
00032  * Revision 1.9  2001/11/01 17:05:01  warmerda
00033  * various old additions
00034  *
00035  * Revision 1.8  1999/12/30 16:53:48  warmerda
00036  * provide app access to poSRS
00037  *
00038  * Revision 1.7  1999/11/18 19:02:20  warmerda
00039  * expanded tabs
00040  *
00041  * Revision 1.6  1999/07/08 20:26:48  warmerda
00042  * Added concept of an OGRFeatureDefn being associated with SFCTable.
00043  *
00044  * Revision 1.5  1999/06/26 05:34:17  warmerda
00045  * Added support for poSRS, and use creating geometry
00046  *
00047  * Revision 1.4  1999/06/10 19:18:22  warmerda
00048  * added support for the spatial ref schema rowset
00049  *
00050  * Revision 1.3  1999/06/08 16:04:25  warmerda
00051  * Remove short method help because it was overriding the full help.
00052  *
00053  * Revision 1.2  1999/06/08 15:41:16  warmerda
00054  * added working blob/geometry support
00055  *
00056  * Revision 1.1  1999/06/08 03:50:43  warmerda
00057  * New
00058  *
00059  */
00060 
00061 #ifndef SFCTABLE_H_INCLUDED
00062 #define SFCTABLE_H_INCLUDED
00063 
00064 #include <atldbcli.h>
00065 
00066 class OGRFeature;
00067 class OGRFeatureDefn;
00068 class OGRGeometry;
00069 class OGRSpatialReference;
00070 
00071 /************************************************************************/
00072 /*                               SFCTable                               */
00073 /************************************************************************/
00074 
00085 class SFCTable : public CTable<CDynamicAccessor>
00086 {
00087   private:
00088     int         bTriedToIdentify;
00089     int         iBindColumn;       
00090     int         iGeomColumn;       /* -1 means there is none
00091                                       this is paoColumnInfo index, not ord. */
00092 
00093     void        IdentifyGeometry(); /* find the geometry column */
00094 
00095     BYTE        *pabyLastGeometry;
00096 
00097     int         nGeomType;
00098     ULONG       nSRS_ID;
00099 
00100     int         ReadOGISColumnInfo( CSession * poCSession,
00101                                     const char * pszColumnName = NULL );
00102     int         FetchDefGeomColumn( CSession * poCSession );
00103 
00104     char        *pszTableName;
00105     char        *pszDefGeomColumn;
00106 
00107     OGRSpatialReference * poSRS;
00108 
00109     OGRFeatureDefn * poDefn;
00110     ULONG        *panColOrdinal;
00111 
00112   public:
00113                 SFCTable();
00114     virtual     ~SFCTable();
00115 
00116     HRESULT     OpenFromRowset( IRowset * pIRowset );
00117     
00118     HRESULT     Open( const CSession& session, DBID& dbid,
00119                       DBPROPSET* pPropSet = NULL );
00120 
00121     void        SetTableName( const char * );
00122     const char *GetTableName();
00123     
00124     int         ReadSchemaInfo( CDataSource *, CSession * = NULL );
00125 
00126     void        ReleaseIUnknowns();
00127     
00128     int         GetSpatialRefID();
00129     OGRSpatialReference *GetSpatialRef() { return poSRS; }
00130 
00131     int         GetGeometryColumn();
00132 
00133     int         HasGeometry();
00134 
00135     int         GetGeometryType();
00136 
00137     BYTE        *GetWKBGeometry( int * pnSize );
00138 
00139     OGRGeometry *GetOGRGeometry();
00140 
00141     OGRFeature  *GetOGRFeature();
00142 
00143     OGRFeatureDefn *GetOGRFeatureDefn();
00144 };
00145 
00146 #endif /* ndef SFCTABLE_H_INCLUDED */

Generated on Mon Jan 9 18:03:31 2006 for OGR by  doxygen 1.4.6