1 : /******************************************************************************
2 : * $Id: ogrogdi.h 20207 2010-08-06 22:07:29Z rouault $
3 : *
4 : * Project: OGDI Bridge
5 : * Purpose: Private definitions within the OGDI driver to implement
6 : * integration with OGR.
7 : * Author: Daniel Morissette, danmo@videotron.ca
8 : * (Based on some code contributed by Frank Warmerdam :)
9 : *
10 : ******************************************************************************
11 : * Copyright (c) 2000, Daniel Morissette
12 : *
13 : * Permission is hereby granted, free of charge, to any person obtaining a
14 : * copy of this software and associated documentation files (the "Software"),
15 : * to deal in the Software without restriction, including without limitation
16 : * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 : * and/or sell copies of the Software, and to permit persons to whom the
18 : * Software is furnished to do so, subject to the following conditions:
19 : *
20 : * The above copyright notice and this permission notice shall be included
21 : * in all copies or substantial portions of the Software.
22 : *
23 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 : * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 : * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 : * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 : * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 : * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 : * DEALINGS IN THE SOFTWARE.
30 : ****************************************************************************/
31 :
32 : #ifndef _OGDOGDI_H_INCLUDED
33 : #define _OGDOGDI_H_INCLUDED
34 :
35 : #include <math.h>
36 : extern "C" {
37 : #include "ecs.h"
38 : }
39 : #include "ogrsf_frmts.h"
40 :
41 :
42 : /************************************************************************/
43 : /* OGROGDILayer */
44 : /************************************************************************/
45 : class OGROGDIDataSource;
46 :
47 : class OGROGDILayer : public OGRLayer
48 : {
49 : OGROGDIDataSource *m_poODS;
50 : int m_nClientID;
51 : char *m_pszOGDILayerName;
52 : ecs_Family m_eFamily;
53 :
54 : OGRFeatureDefn *m_poFeatureDefn;
55 : OGRSpatialReference *m_poSpatialRef;
56 : ecs_Region m_sFilterBounds;
57 :
58 : int m_iNextShapeId;
59 : int m_nTotalShapeCount;
60 : int m_nFilteredOutShapes;
61 :
62 : public:
63 : OGROGDILayer(OGROGDIDataSource *, const char *,
64 : ecs_Family);
65 : ~OGROGDILayer();
66 :
67 : virtual void SetSpatialFilter( OGRGeometry * );
68 : virtual OGRErr SetAttributeFilter( const char *pszQuery );
69 :
70 : void ResetReading();
71 : OGRFeature * GetNextFeature();
72 :
73 : OGRFeature *GetFeature( long nFeatureId );
74 :
75 381 : OGRFeatureDefn * GetLayerDefn() { return m_poFeatureDefn; }
76 :
77 : int GetFeatureCount( int );
78 :
79 : int TestCapability( const char * );
80 :
81 4 : OGRSpatialReference *GetSpatialRef() { return m_poSpatialRef; }
82 :
83 : private:
84 : void BuildFeatureDefn();
85 : };
86 :
87 : /************************************************************************/
88 : /* OGROGDIDataSource */
89 : /************************************************************************/
90 :
91 : class OGROGDIDataSource : public OGRDataSource
92 : {
93 : OGROGDILayer **m_papoLayers;
94 : int m_nLayers;
95 :
96 : int m_nClientID;
97 :
98 : ecs_Region m_sGlobalBounds;
99 : OGRSpatialReference *m_poSpatialRef;
100 :
101 : OGROGDILayer *m_poCurrentLayer;
102 :
103 : char *m_pszFullName;
104 :
105 : int m_bLaunderLayerNames;
106 :
107 : void IAddLayer( const char *pszLayerName,
108 : ecs_Family eFamily );
109 :
110 : public:
111 : OGROGDIDataSource();
112 : ~OGROGDIDataSource();
113 :
114 : int Open( const char *, int bTestOpen );
115 :
116 2 : const char *GetName() { return m_pszFullName; }
117 238 : int GetLayerCount() { return m_nLayers; }
118 : OGRLayer *GetLayer( int );
119 :
120 : int TestCapability( const char * );
121 :
122 737 : ecs_Region *GetGlobalBounds() { return &m_sGlobalBounds; }
123 285 : OGRSpatialReference*GetSpatialRef() { return m_poSpatialRef; }
124 285 : int GetClientID() { return m_nClientID; }
125 :
126 9870 : OGROGDILayer *GetCurrentLayer() { return m_poCurrentLayer; }
127 20 : void SetCurrentLayer(OGROGDILayer* poLayer) { m_poCurrentLayer = poLayer ; }
128 :
129 285 : int LaunderLayerNames() { return m_bLaunderLayerNames; }
130 : };
131 :
132 : /************************************************************************/
133 : /* OGROGDIDriver */
134 : /************************************************************************/
135 :
136 : class OGROGDIDriver : public OGRSFDriver
137 178 : {
138 : public:
139 : ~OGROGDIDriver();
140 :
141 : const char *GetName();
142 : OGRDataSource *Open( const char *, int );
143 :
144 : int TestCapability( const char * );
145 : };
146 :
147 :
148 : #endif /* _OGDOGDI_H_INCLUDED */
|