1 : /******************************************************************************
2 : * $Id: ogr_xplane_nav_reader.cpp
3 : *
4 : * Project: X-Plane nav.dat file reader header
5 : * Purpose: Definition of classes for X-Plane nav.dat file reader
6 : * Author: Even Rouault, even dot rouault at mines dash paris dot org
7 : *
8 : ******************************************************************************
9 : * Copyright (c) 2008, Even Rouault
10 : *
11 : * Permission is hereby granted, free of charge, to any person obtaining a
12 : * copy of this software and associated documentation files (the "Software"),
13 : * to deal in the Software without restriction, including without limitation
14 : * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15 : * and/or sell copies of the Software, and to permit persons to whom the
16 : * Software is furnished to do so, subject to the following conditions:
17 : *
18 : * The above copyright notice and this permission notice shall be included
19 : * in all copies or substantial portions of the Software.
20 : *
21 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 : * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 : * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 : * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 : * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 : * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27 : * DEALINGS IN THE SOFTWARE.
28 : ****************************************************************************/
29 :
30 : #ifndef _OGR_XPLANE_NAV_READER_H_INCLUDED
31 : #define _OGR_XPLANE_NAV_READER_H_INCLUDED
32 :
33 : #include "ogr_xplane.h"
34 : #include "ogr_xplane_reader.h"
35 :
36 : /************************************************************************/
37 : /* OGRXPlaneILSLayer */
38 : /************************************************************************/
39 :
40 :
41 : class OGRXPlaneILSLayer : public OGRXPlaneLayer
42 1 : {
43 : public:
44 : OGRXPlaneILSLayer();
45 : OGRFeature* AddFeature(const char* pszNavaidID,
46 : const char* pszAptICAO,
47 : const char* pszRwyNum,
48 : const char* pszSubType,
49 : double dfLat,
50 : double dfLon,
51 : double dfEle,
52 : double dfFreq,
53 : double dfRange,
54 : double dfTrueHeading);
55 : };
56 :
57 : /************************************************************************/
58 : /* OGRXPlaneVORLayer */
59 : /************************************************************************/
60 :
61 :
62 : class OGRXPlaneVORLayer : public OGRXPlaneLayer
63 1 : {
64 : public:
65 : OGRXPlaneVORLayer();
66 : OGRFeature* AddFeature(const char* pszNavaidID,
67 : const char* pszNavaidName,
68 : const char* pszSubType,
69 : double dfLat,
70 : double dfLon,
71 : double dfEle,
72 : double dfFreq,
73 : double dfRange,
74 : double dfSlavedVariation);
75 : };
76 :
77 : /************************************************************************/
78 : /* OGRXPlaneNDBLayer */
79 : /************************************************************************/
80 :
81 :
82 : class OGRXPlaneNDBLayer : public OGRXPlaneLayer
83 1 : {
84 : public:
85 : OGRXPlaneNDBLayer();
86 : OGRFeature* AddFeature(const char* pszNavaidID,
87 : const char* pszNavaidName,
88 : const char* pszSubType,
89 : double dfLat,
90 : double dfLon,
91 : double dfEle,
92 : double dfFreq,
93 : double dfRange);
94 : };
95 :
96 : /************************************************************************/
97 : /* OGRXPlaneGSLayer */
98 : /************************************************************************/
99 :
100 :
101 : class OGRXPlaneGSLayer : public OGRXPlaneLayer
102 1 : {
103 : public:
104 : OGRXPlaneGSLayer();
105 : OGRFeature* AddFeature(const char* pszNavaidID,
106 : const char* pszAptICAO,
107 : const char* pszRwyNum,
108 : double dfLat,
109 : double dfLon,
110 : double dfEle,
111 : double dfFreq,
112 : double dfRange,
113 : double dfTrueHeading,
114 : double dfSlope);
115 : };
116 :
117 : /************************************************************************/
118 : /* OGRXPlaneMarkerLayer */
119 : /************************************************************************/
120 :
121 :
122 : class OGRXPlaneMarkerLayer : public OGRXPlaneLayer
123 1 : {
124 : public:
125 : OGRXPlaneMarkerLayer();
126 : OGRFeature* AddFeature(const char* pszAptICAO,
127 : const char* pszRwyNum,
128 : const char* pszSubType,
129 : double dfLat,
130 : double dfLon,
131 : double dfEle,
132 : double dfTrueHeading);
133 : };
134 :
135 : /************************************************************************/
136 : /* OGRXPlaneDMEILSLayer */
137 : /************************************************************************/
138 :
139 :
140 : class OGRXPlaneDMEILSLayer : public OGRXPlaneLayer
141 1 : {
142 : public:
143 : OGRXPlaneDMEILSLayer();
144 : OGRFeature* AddFeature(const char* pszNavaidID,
145 : const char* pszAptICAO,
146 : const char* pszRwyNum,
147 : double dfLat,
148 : double dfLon,
149 : double dfEle,
150 : double dfFreq,
151 : double dfRange,
152 : double dfDMEBias);
153 : };
154 :
155 :
156 : /************************************************************************/
157 : /* OGRXPlaneDMELayer */
158 : /************************************************************************/
159 :
160 :
161 : class OGRXPlaneDMELayer : public OGRXPlaneLayer
162 1 : {
163 : public:
164 : OGRXPlaneDMELayer();
165 : OGRFeature* AddFeature(const char* pszNavaidID,
166 : const char* pszNavaidName,
167 : const char* pszSubType,
168 : double dfLat,
169 : double dfLon,
170 : double dfEle,
171 : double dfFreq,
172 : double dfRange,
173 : double dfDMEBias);
174 : };
175 :
176 :
177 : enum
178 : {
179 : NAVAID_NDB = 2,
180 : NAVAID_VOR = 3, /* VOR, VORTAC or VOR-DME.*/
181 : NAVAID_LOC_ILS = 4, /* Localiser that is part of a full ILS */
182 : NAVAID_LOC_STANDALONE = 5, /* Stand-alone localiser (LOC), also including a LDA (Landing Directional Aid) or SDF (Simplified Directional Facility) */
183 : NAVAID_GS = 6, /* Glideslope */
184 : NAVAID_OM = 7, /* Outer marker */
185 : NAVAID_MM = 8, /* Middle marker */
186 : NAVAID_IM = 9, /* Inner marker */
187 : NAVAID_DME_COLOC = 12, /* DME (including the DME element of an ILS, VORTAC or VOR-DME) */
188 : NAVAID_DME_STANDALONE = 13, /* DME (including the DME element of an NDB-DME) */
189 : };
190 :
191 :
192 : /************************************************************************/
193 : /* OGRXPlaneNavReader */
194 : /************************************************************************/
195 :
196 : class OGRXPlaneNavReader : public OGRXPlaneReader
197 1 : {
198 : private:
199 : OGRXPlaneILSLayer* poILSLayer;
200 : OGRXPlaneVORLayer* poVORLayer;
201 : OGRXPlaneNDBLayer* poNDBLayer;
202 : OGRXPlaneGSLayer* poGSLayer ;
203 : OGRXPlaneMarkerLayer* poMarkerLayer;
204 : OGRXPlaneDMELayer* poDMELayer;
205 : OGRXPlaneDMEILSLayer* poDMEILSLayer;
206 :
207 : private:
208 : OGRXPlaneNavReader();
209 : void ParseRecord(int nType);
210 :
211 : protected:
212 : virtual void Read();
213 :
214 : public:
215 : OGRXPlaneNavReader( OGRXPlaneDataSource* poDataSource );
216 : virtual OGRXPlaneReader* CloneForLayer(OGRXPlaneLayer* poLayer);
217 : virtual int IsRecognizedVersion( const char* pszVersionString);
218 : };
219 :
220 : #endif
|