1 : /******************************************************************************
2 : * $Id: ogr_vfk.h 24067 2012-03-04 11:27:45Z martinl $
3 : *
4 : * Project: OpenGIS Simple Features Reference Implementation
5 : * Purpose: Private definitions for OGR/VFK driver.
6 : * Author: Martin Landa, landa.martin gmail.com
7 : *
8 : ******************************************************************************
9 : * Copyright (c) 2009-2010, Martin Landa <landa.martin gmail.com>
10 : *
11 : * Permission is hereby granted, free of charge, to any person
12 : * obtaining a copy of this software and associated documentation
13 : * files (the "Software"), to deal in the Software without
14 : * restriction, including without limitation the rights to use, copy,
15 : * modify, merge, publish, distribute, sublicense, and/or sell copies
16 : * of the Software, and to permit persons to whom the Software is
17 : * furnished to do so, subject to the following conditions:
18 : *
19 : * The above copyright notice and this permission notice shall be
20 : * included in all copies or substantial portions of the Software.
21 : *
22 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 : * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 : * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 : * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
26 : * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 : * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
28 : * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29 : * SOFTWARE.
30 : ****************************************************************************/
31 :
32 : #ifndef GDAL_OGR_VFK_H_INCLUDED
33 : #define GDAL_OGR_VFK_H_INCLUDED
34 :
35 : #include <map>
36 : #include <string>
37 :
38 : #include "ogrsf_frmts.h"
39 : #include "vfkreader.h"
40 :
41 : class OGRVFKDataSource;
42 :
43 : /************************************************************************/
44 : /* OGRVFKLayer */
45 : /************************************************************************/
46 :
47 : class OGRVFKLayer:public OGRLayer
48 : {
49 : private:
50 : /* spatial reference */
51 : OGRSpatialReference *poSRS;
52 :
53 : /* feature definition */
54 : OGRFeatureDefn *poFeatureDefn;
55 :
56 : /* OGR data source */
57 : OGRVFKDataSource *poDS;
58 :
59 : /* VFK data block */
60 : IVFKDataBlock *poDataBlock;
61 :
62 : /* get next feature */
63 : int m_iNextFeature;
64 :
65 : /* private methods */
66 : OGRGeometry *CreateGeometry(IVFKFeature *);
67 : OGRFeature *GetFeature(IVFKFeature *);
68 :
69 : public:
70 : OGRVFKLayer(const char *, OGRSpatialReference *,
71 : OGRwkbGeometryType, OGRVFKDataSource *);
72 : ~OGRVFKLayer();
73 :
74 : OGRFeature *GetNextFeature();
75 : OGRFeature *GetFeature(long);
76 :
77 1378 : OGRFeatureDefn *GetLayerDefn() { return poFeatureDefn; }
78 :
79 : void ResetReading();
80 :
81 : int TestCapability(const char *);
82 : OGRSpatialReference *GetSpatialRef();
83 :
84 : int GetFeatureCount(int = TRUE);
85 : };
86 :
87 : /************************************************************************/
88 : /* OGRVFKDataSource */
89 : /************************************************************************/
90 : class OGRVFKDataSource:public OGRDataSource
91 : {
92 : private:
93 : /* list of available layers */
94 : OGRVFKLayer **papoLayers;
95 : int nLayers;
96 :
97 : char * pszName;
98 :
99 : /* input related parameters */
100 : IVFKReader *poReader;
101 :
102 : /* private methods */
103 : OGRVFKLayer *CreateLayerFromBlock(const IVFKDataBlock *);
104 :
105 : public:
106 : OGRVFKDataSource();
107 : ~OGRVFKDataSource();
108 :
109 : int Open(const char *, int);
110 :
111 2 : const char *GetName() { return pszName; }
112 :
113 192 : int GetLayerCount() { return nLayers; }
114 : OGRLayer *GetLayer(int);
115 :
116 : int TestCapability(const char *);
117 :
118 122 : IVFKReader *GetReader() const { return poReader; }
119 : };
120 :
121 : /************************************************************************/
122 : /* OGRVFKDriver */
123 : /************************************************************************/
124 : class OGRVFKDriver:public OGRSFDriver
125 389 : {
126 : public:
127 : ~OGRVFKDriver();
128 :
129 : const char *GetName();
130 : OGRDataSource *Open(const char *, int);
131 :
132 : int TestCapability(const char *);
133 : };
134 :
135 : #endif // GDAL_OGR_VFK_H_INCLUDED
|