root/spike/sfcom_oledb/client/sfctable.h
| Revision 12207, 3.9 kB (checked in by warmerdam, 1 year ago) | |
|---|---|
| |
| Line | |
|---|---|
| 1 | /****************************************************************************** |
| 2 | * $Id$ |
| 3 | * |
| 4 | * Project: OpenGIS Simple Features Reference Implementation |
| 5 | * Purpose: SFCTable class, client side abstraction for an OLE DB spatial |
| 6 | * table based on ATL CTable. |
| 7 | * Author: Frank Warmerdam, warmerdam@pobox.com |
| 8 | * |
| 9 | ****************************************************************************** |
| 10 | * Copyright (c) 1999, Les Technologies SoftMap Inc. |
| 11 | * |
| 12 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 13 | * copy of this software and associated documentation files (the "Software"), |
| 14 | * to deal in the Software without restriction, including without limitation |
| 15 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 16 | * and/or sell copies of the Software, and to permit persons to whom the |
| 17 | * Software is furnished to do so, subject to the following conditions: |
| 18 | * |
| 19 | * The above copyright notice and this permission notice shall be included |
| 20 | * in all copies or substantial portions of the Software. |
| 21 | * |
| 22 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 23 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 24 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 25 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 26 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 27 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 28 | * DEALINGS IN THE SOFTWARE. |
| 29 | ****************************************************************************/ |
| 30 | |
| 31 | #ifndef SFCTABLE_H_INCLUDED |
| 32 | #define SFCTABLE_H_INCLUDED |
| 33 | |
| 34 | #include <atldbcli.h> |
| 35 | |
| 36 | class OGRFeature; |
| 37 | class OGRFeatureDefn; |
| 38 | class OGRGeometry; |
| 39 | class OGRSpatialReference; |
| 40 | |
| 41 | /************************************************************************/ |
| 42 | /* SFCTable */ |
| 43 | /************************************************************************/ |
| 44 | |
| 45 | /** |
| 46 | * Abstract representation of a rowset (table) with spatial features. |
| 47 | * |
| 48 | * This class is intended to simplify access to spatial rowsets, and to |
| 49 | * centralize all the rules for selecting geometry columns, getting the |
| 50 | * spatial reference system of a rowset, and special feature access short |
| 51 | * cuts with selected providers. It is based on the ATL CTable class |
| 52 | * with a dynamic accessor. |
| 53 | */ |
| 54 | |
| 55 | class SFCTable : public CTable<CDynamicAccessor> |
| 56 | { |
| 57 | private: |
| 58 | int bTriedToIdentify; |
| 59 | int iBindColumn; |
| 60 | int iGeomColumn; /* -1 means there is none |
| 61 | this is paoColumnInfo index, not ord. */ |
| 62 | |
| 63 | void IdentifyGeometry(); /* find the geometry column */ |
| 64 | |
| 65 | BYTE *pabyLastGeometry; |
| 66 | |
| 67 | int nGeomType; |
| 68 | ULONG nSRS_ID; |
| 69 | |
| 70 | int ReadOGISColumnInfo( CSession * poCSession, |
| 71 | const char * pszColumnName = NULL ); |
| 72 | int FetchDefGeomColumn( CSession * poCSession ); |
| 73 | |
| 74 | char *pszTableName; |
| 75 | char *pszDefGeomColumn; |
| 76 | |
| 77 | OGRSpatialReference * poSRS; |
| 78 | |
| 79 | OGRFeatureDefn * poDefn; |
| 80 | ULONG *panColOrdinal; |
| 81 | |
| 82 | public: |
| 83 | SFCTable(); |
| 84 | virtual ~SFCTable(); |
| 85 | |
| 86 | HRESULT OpenFromRowset( IRowset * pIRowset ); |
| 87 | |
| 88 | HRESULT Open( const CSession& session, DBID& dbid, |
| 89 | DBPROPSET* pPropSet = NULL ); |
| 90 | |
| 91 | void SetTableName( const char * ); |
| 92 | const char *GetTableName(); |
| 93 | |
| 94 | int ReadSchemaInfo( CDataSource *, CSession * = NULL ); |
| 95 | |
| 96 | void ReleaseIUnknowns(); |
| 97 | |
| 98 | int GetSpatialRefID(); |
| 99 | OGRSpatialReference *GetSpatialRef() { return poSRS; } |
| 100 | |
| 101 | int GetGeometryColumn(); |
| 102 | |
| 103 | int HasGeometry(); |
| 104 | |
| 105 | int GetGeometryType(); |
| 106 | |
| 107 | BYTE *GetWKBGeometry( int * pnSize ); |
| 108 | |
| 109 | OGRGeometry *GetOGRGeometry(); |
| 110 | |
| 111 | OGRFeature *GetOGRFeature(); |
| 112 | |
| 113 | OGRFeatureDefn *GetOGRFeatureDefn(); |
| 114 | }; |
| 115 | |
| 116 | #endif /* ndef SFCTABLE_H_INCLUDED */ |
Note: See TracBrowser for help on using the browser.
