1 : /******************************************************************************
2 : * $Id: ogrogdi.h 19711 2010-05-14 21:26:42Z 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 :
61 : public:
62 : OGROGDILayer(OGROGDIDataSource *, const char *,
63 : ecs_Family);
64 : ~OGROGDILayer();
65 :
66 : virtual void SetSpatialFilter( OGRGeometry * );
67 :
68 : void ResetReading();
69 : OGRFeature * GetNextFeature();
70 :
71 : OGRFeature *GetFeature( long nFeatureId );
72 :
73 20 : OGRFeatureDefn * GetLayerDefn() { return m_poFeatureDefn; }
74 :
75 : int GetFeatureCount( int );
76 :
77 : int TestCapability( const char * );
78 :
79 0 : OGRSpatialReference *GetSpatialRef() { return m_poSpatialRef; }
80 :
81 : private:
82 : void BuildFeatureDefn();
83 : };
84 :
85 : /************************************************************************/
86 : /* OGROGDIDataSource */
87 : /************************************************************************/
88 :
89 : class OGROGDIDataSource : public OGRDataSource
90 : {
91 : OGROGDILayer **m_papoLayers;
92 : int m_nLayers;
93 :
94 : int m_nClientID;
95 :
96 : ecs_Region m_sGlobalBounds;
97 : OGRSpatialReference *m_poSpatialRef;
98 :
99 : OGROGDILayer *m_poCurrentLayer;
100 :
101 : char *m_pszFullName;
102 :
103 : int m_bLaunderLayerNames;
104 :
105 : void IAddLayer( const char *pszLayerName,
106 : ecs_Family eFamily );
107 :
108 : public:
109 : OGROGDIDataSource();
110 : ~OGROGDIDataSource();
111 :
112 : int Open( const char *, int bTestOpen );
113 :
114 1 : const char *GetName() { return m_pszFullName; }
115 17 : int GetLayerCount() { return m_nLayers; }
116 : OGRLayer *GetLayer( int );
117 :
118 : int TestCapability( const char * );
119 :
120 127 : ecs_Region *GetGlobalBounds() { return &m_sGlobalBounds; }
121 57 : OGRSpatialReference*GetSpatialRef() { return m_poSpatialRef; }
122 57 : int GetClientID() { return m_nClientID; }
123 :
124 70 : OGROGDILayer *GetCurrentLayer() { return m_poCurrentLayer; }
125 5 : void SetCurrentLayer(OGROGDILayer* poLayer) { m_poCurrentLayer = poLayer ; }
126 :
127 57 : int LaunderLayerNames() { return m_bLaunderLayerNames; }
128 : };
129 :
130 : /************************************************************************/
131 : /* OGROGDIDriver */
132 : /************************************************************************/
133 :
134 : class OGROGDIDriver : public OGRSFDriver
135 80 : {
136 : public:
137 : ~OGROGDIDriver();
138 :
139 : const char *GetName();
140 : OGRDataSource *Open( const char *, int );
141 :
142 : int TestCapability( const char * );
143 : };
144 :
145 :
146 : #endif /* _OGDOGDI_H_INCLUDED */
|