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