FlightGear next
waypoint.hxx
Go to the documentation of this file.
1// waypoint.hxx - waypoints that can occur in routes/procedures
2// Written by James Turner, started 2009.
3//
4// Copyright (C) 2009 Curtis L. Olson
5//
6// This program is free software; you can redistribute it and/or
7// modify it under the terms of the GNU General Public License as
8// published by the Free Software Foundation; either version 2 of the
9// License, or (at your option) any later version.
10//
11// This program is distributed in the hope that it will be useful, but
12// WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// General Public License for more details.
15//
16// You should have received a copy of the GNU General Public License
17// along with this program; if not, write to the Free Software
18// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
20#ifndef FG_WAYPOINT_HXX
21#define FG_WAYPOINT_HXX
22
24#include <Navaids/route.hxx>
26#include <Navaids/airways.hxx>
27
28namespace flightgear
29{
30
31class BasicWaypt : public Waypt
32{
33public:
34
35 BasicWaypt(const SGGeod& aPos, const std::string& aIdent, RouteBase* aOwner);
36
37 BasicWaypt(RouteBase* aOwner);
38
39 virtual SGGeod position() const
40 { return _pos; }
41
42 virtual std::string ident() const
43 { return _ident; }
44
45 std::string icaoDescription() const override;
46protected:
47 bool initFromProperties(SGPropertyNode_ptr aProp) override;
48 void writeToProperties(SGPropertyNode_ptr aProp) const override;
49
50 virtual std::string type() const
51 { return "basic"; }
52
53 SGGeod _pos;
54 std::string _ident;
55
56};
57
62class NavaidWaypoint : public Waypt
63{
64public:
66
68
69 virtual SGGeod position() const;
70
71 virtual FGPositioned* source() const
72 { return _navaid; }
73
74 virtual std::string ident() const;
75
76 protected:
77 bool initFromProperties(SGPropertyNode_ptr aProp) override;
78 void writeToProperties(SGPropertyNode_ptr aProp) const override;
79
80 virtual std::string type() const
81 { return "navaid"; }
82
84};
85
87{
88public:
89 OffsetNavaidWaypoint(FGPositioned* aPos, RouteBase* aOwner, double aRadial, double aDistNm);
90
92
93 virtual SGGeod position() const
94 { return _geod; }
95
96protected:
97 bool initFromProperties(SGPropertyNode_ptr aProp) override;
98 void writeToProperties(SGPropertyNode_ptr aProp) const override;
99
100 virtual std::string type() const
101 { return "offset-navaid"; }
102
103private:
104 void init();
105
106 SGGeod _geod;
107 double _radial; // true, degrees
108 double _distanceNm;
109};
110
116class RunwayWaypt : public Waypt
117{
118public:
119 RunwayWaypt(FGRunway* aPos, RouteBase* aOwner);
120
121 RunwayWaypt(RouteBase* aOwner);
122
123 virtual SGGeod position() const;
124
125 virtual FGPositioned* source() const;
126
127 virtual std::string ident() const;
128
130 { return _runway; }
131
132 virtual double headingRadialDeg() const;
133protected:
134 virtual std::string type() const
135 { return "runway"; }
136
137 bool initFromProperties(SGPropertyNode_ptr aProp) override;
138 void writeToProperties(SGPropertyNode_ptr aProp) const override;
139
140private:
141 FGRunway* _runway;
142};
143
144class Hold : public BasicWaypt
145{
146public:
147 Hold(const SGGeod& aPos, const std::string& aIdent, RouteBase* aOwner);
148
149 Hold(RouteBase* aOwner);
150
151 void setHoldRadial(double aInboundRadial);
152 void setHoldDistance(double aDistanceNm);
153 void setHoldTime(double aTimeSec);
154
155 void setRightHanded();
156 void setLeftHanded();
157
158 double inboundRadial() const
159 { return _bearing; }
160
161 bool isLeftHanded() const
162 { return !_righthanded; }
163
164 bool isDistance() const
165 { return _isDistance; }
166
167 double timeOrDistance() const
168 { return _holdTD;}
169
170 virtual double headingRadialDeg() const
171 { return inboundRadial(); }
172protected:
173 bool initFromProperties(SGPropertyNode_ptr aProp) override;
174 void writeToProperties(SGPropertyNode_ptr aProp) const override;
175
176 virtual std::string type() const
177 { return "hold"; }
178
179private:
180 double _bearing;
181 bool _righthanded;
182 bool _isDistance;
183 double _holdTD;
184};
185
187{
188public:
189 HeadingToAltitude(RouteBase* aOwner, const std::string& aIdent, double aMagHdg);
190
192
193 bool initFromProperties(SGPropertyNode_ptr aProp) override;
194 void writeToProperties(SGPropertyNode_ptr aProp) const override;
195
196 virtual std::string type() const
197 { return "hdgToAlt"; }
198
199 virtual SGGeod position() const
200 { return SGGeod(); }
201
202 virtual std::string ident() const
203 { return _ident; }
204
205 double headingDegMagnetic() const
206 { return _magHeading; }
207
208 virtual double magvarDeg() const
209 { return 0.0; }
210
211 virtual double headingRadialDeg() const
212 { return headingDegMagnetic(); }
213private:
214 std::string _ident;
215 double _magHeading;
216};
217
218class DMEIntercept : public Waypt
219{
220public:
221 DMEIntercept(RouteBase* aOwner, const std::string& aIdent, const SGGeod& aPos,
222 double aCourseDeg, double aDistanceNm);
223
224 DMEIntercept(RouteBase* aOwner);
225
226 bool initFromProperties(SGPropertyNode_ptr aProp) override;
227 void writeToProperties(SGPropertyNode_ptr aProp) const override;
228
229 virtual std::string type() const
230 { return "dmeIntercept"; }
231
232 virtual SGGeod position() const
233 { return _pos; }
234
235 virtual std::string ident() const
236 { return _ident; }
237
238 double courseDegMagnetic() const
239 { return _magCourse; }
240
241 double dmeDistanceNm() const
242 { return _dmeDistanceNm; }
243
244 virtual double headingRadialDeg() const
245 { return courseDegMagnetic(); }
246private:
247 std::string _ident;
248 SGGeod _pos;
249 double _magCourse;
250 double _dmeDistanceNm;
251};
252
253class RadialIntercept : public Waypt
254{
255public:
256 RadialIntercept(RouteBase* aOwner, const std::string& aIdent, const SGGeod& aPos,
257 double aCourseDeg, double aRadialDeg);
258
259 RadialIntercept(RouteBase* aOwner);
260
261 bool initFromProperties(SGPropertyNode_ptr aProp) override;
262 void writeToProperties(SGPropertyNode_ptr aProp) const override;
263
264 virtual std::string type() const
265 { return "radialIntercept"; }
266
267 virtual SGGeod position() const
268 { return _pos; }
269
270 virtual std::string ident() const
271 { return _ident; }
272
273 double courseDegMagnetic() const
274 { return _magCourse; }
275
276 double radialDegMagnetic() const
277 { return _radial; }
278
279 virtual double headingRadialDeg() const
280 { return courseDegMagnetic(); }
281private:
282 std::string _ident;
283 SGGeod _pos;
284 double _magCourse;
285 double _radial;
286};
287
288
293class ATCVectors : public Waypt
294{
295public:
296 ATCVectors(RouteBase* aOwner, FGAirport* aFacility);
297 virtual ~ATCVectors();
298
299 ATCVectors(RouteBase* aOwner);
300
301 bool initFromProperties(SGPropertyNode_ptr aProp) override;
302 void writeToProperties(SGPropertyNode_ptr aProp) const override;
303
304 virtual std::string type() const
305 { return "vectors"; }
306
307 virtual SGGeod position() const;
308
309 virtual std::string ident() const;
310
311private:
317 FGAirportRef _facility;
318};
319
324class Discontinuity : public Waypt
325{
326public:
327 virtual ~Discontinuity();
328 Discontinuity(RouteBase* aOwner);
329
330 bool initFromProperties(SGPropertyNode_ptr aProp) override;
331 void writeToProperties(SGPropertyNode_ptr aProp) const override;
332
333 virtual std::string type() const
334 { return "discontinuity"; }
335
336 virtual SGGeod position() const;
337
338 virtual std::string ident() const;
339
340 virtual double magvarDeg() const
341 { return 0.0; }
342private:
343};
344
345class Via : public Waypt
346{
347public:
348 Via(RouteBase* aOwner);
350 virtual ~Via();
351
352 bool initFromProperties(SGPropertyNode_ptr aProp) override;
353 void writeToProperties(SGPropertyNode_ptr aProp) const override;
354
355 std::string type() const override
356 { return "via"; }
357
358 SGGeod position() const override;
359
360 std::string ident() const override;
361
363 { return _airway; }
364
365 FGPositioned* source() const override
366 { return _to.ptr(); }
367
368 WayptVec expandToWaypoints(WayptRef aPreceeding) const;
369private:
370 AirwayRef _airway;
371 FGPositionedRef _to;
372};
373
374} // of namespace flighgear
375
376#endif // of FG_WAYPOINT_HXX
SGSharedPtr< FGAirport > FGAirportRef
ATCVectors(RouteBase *aOwner, FGAirport *aFacility)
Definition waypoint.cxx:469
virtual SGGeod position() const
Definition waypoint.cxx:485
virtual std::string type() const
Definition waypoint.hxx:304
bool initFromProperties(SGPropertyNode_ptr aProp) override
Persistence helper - read node properties from a file.
Definition waypoint.cxx:495
void writeToProperties(SGPropertyNode_ptr aProp) const override
Persistence helper - save this element to a node.
Definition waypoint.cxx:504
virtual std::string ident() const
Identifier assoicated with the waypoint.
Definition waypoint.cxx:490
void writeToProperties(SGPropertyNode_ptr aProp) const override
Persistence helper - save this element to a node.
Definition waypoint.cxx:66
virtual std::string type() const
Definition waypoint.hxx:50
virtual SGGeod position() const
Definition waypoint.hxx:39
bool initFromProperties(SGPropertyNode_ptr aProp) override
Persistence helper - read node properties from a file.
Definition waypoint.cxx:50
virtual std::string ident() const
Identifier assoicated with the waypoint.
Definition waypoint.hxx:42
BasicWaypt(const SGGeod &aPos, const std::string &aIdent, RouteBase *aOwner)
std::string icaoDescription() const override
icaoDescription - description of the waypoint in ICAO route plan format
Definition waypoint.cxx:75
double dmeDistanceNm() const
Definition waypoint.hxx:241
bool initFromProperties(SGPropertyNode_ptr aProp) override
Persistence helper - read node properties from a file.
Definition waypoint.cxx:389
virtual std::string type() const
Definition waypoint.hxx:229
virtual SGGeod position() const
Definition waypoint.hxx:232
double courseDegMagnetic() const
Definition waypoint.hxx:238
virtual std::string ident() const
Identifier assoicated with the waypoint.
Definition waypoint.hxx:235
DMEIntercept(RouteBase *aOwner, const std::string &aIdent, const SGGeod &aPos, double aCourseDeg, double aDistanceNm)
virtual double headingRadialDeg() const
return the assoicated heading or radial for this waypoint.
Definition waypoint.hxx:244
void writeToProperties(SGPropertyNode_ptr aProp) const override
Persistence helper - save this element to a node.
Definition waypoint.cxx:408
Discontinuity(RouteBase *aOwner)
Definition waypoint.cxx:514
virtual std::string type() const
Definition waypoint.hxx:333
virtual double magvarDeg() const
Magentic variation at/in the vicinity of the waypoint.
Definition waypoint.hxx:340
void writeToProperties(SGPropertyNode_ptr aProp) const override
Persistence helper - save this element to a node.
Definition waypoint.cxx:540
virtual std::string ident() const
Identifier assoicated with the waypoint.
Definition waypoint.cxx:530
bool initFromProperties(SGPropertyNode_ptr aProp) override
Persistence helper - read node properties from a file.
Definition waypoint.cxx:535
virtual SGGeod position() const
Definition waypoint.cxx:525
virtual double magvarDeg() const
Magentic variation at/in the vicinity of the waypoint.
Definition waypoint.hxx:208
virtual SGGeod position() const
Definition waypoint.hxx:199
double headingDegMagnetic() const
Definition waypoint.hxx:205
HeadingToAltitude(RouteBase *aOwner, const std::string &aIdent, double aMagHdg)
virtual std::string ident() const
Identifier assoicated with the waypoint.
Definition waypoint.hxx:202
virtual std::string type() const
Definition waypoint.hxx:196
virtual double headingRadialDeg() const
return the assoicated heading or radial for this waypoint.
Definition waypoint.hxx:211
void writeToProperties(SGPropertyNode_ptr aProp) const override
Persistence helper - save this element to a node.
Definition waypoint.cxx:364
bool initFromProperties(SGPropertyNode_ptr aProp) override
Persistence helper - read node properties from a file.
Definition waypoint.cxx:349
virtual double headingRadialDeg() const
return the assoicated heading or radial for this waypoint.
Definition waypoint.hxx:170
void writeToProperties(SGPropertyNode_ptr aProp) const override
Persistence helper - save this element to a node.
Definition waypoint.cxx:323
virtual std::string type() const
Definition waypoint.hxx:176
double timeOrDistance() const
Definition waypoint.hxx:167
void setHoldRadial(double aInboundRadial)
Definition waypoint.cxx:283
bool initFromProperties(SGPropertyNode_ptr aProp) override
Persistence helper - read node properties from a file.
Definition waypoint.cxx:310
Hold(const SGGeod &aPos, const std::string &aIdent, RouteBase *aOwner)
bool isLeftHanded() const
Definition waypoint.hxx:161
double inboundRadial() const
Definition waypoint.hxx:158
void setHoldDistance(double aDistanceNm)
Definition waypoint.cxx:288
bool isDistance() const
Definition waypoint.hxx:164
void setHoldTime(double aTimeSec)
Definition waypoint.cxx:294
void setRightHanded()
Definition waypoint.cxx:300
void writeToProperties(SGPropertyNode_ptr aProp) const override
Persistence helper - save this element to a node.
Definition waypoint.cxx:144
FGPositionedRef _navaid
Definition waypoint.hxx:83
bool initFromProperties(SGPropertyNode_ptr aProp) override
Persistence helper - read node properties from a file.
Definition waypoint.cxx:107
virtual std::string type() const
Definition waypoint.hxx:80
virtual std::string ident() const
Identifier assoicated with the waypoint.
Definition waypoint.cxx:102
virtual SGGeod position() const
Definition waypoint.cxx:97
virtual FGPositioned * source() const
The Positioned associated with this element, if one exists.
Definition waypoint.hxx:71
NavaidWaypoint(FGPositioned *aPos, RouteBase *aOwner)
Definition waypoint.cxx:82
void writeToProperties(SGPropertyNode_ptr aProp) const override
Persistence helper - save this element to a node.
Definition waypoint.cxx:192
virtual SGGeod position() const
Definition waypoint.hxx:93
bool initFromProperties(SGPropertyNode_ptr aProp) override
Persistence helper - read node properties from a file.
Definition waypoint.cxx:176
OffsetNavaidWaypoint(FGPositioned *aPos, RouteBase *aOwner, double aRadial, double aDistNm)
Definition waypoint.cxx:154
virtual std::string type() const
Definition waypoint.hxx:100
double courseDegMagnetic() const
Definition waypoint.hxx:273
virtual double headingRadialDeg() const
return the assoicated heading or radial for this waypoint.
Definition waypoint.hxx:279
bool initFromProperties(SGPropertyNode_ptr aProp) override
Persistence helper - read node properties from a file.
Definition waypoint.cxx:437
virtual std::string type() const
Definition waypoint.hxx:264
void writeToProperties(SGPropertyNode_ptr aProp) const override
Persistence helper - save this element to a node.
Definition waypoint.cxx:456
virtual SGGeod position() const
Definition waypoint.hxx:267
double radialDegMagnetic() const
Definition waypoint.hxx:276
RadialIntercept(RouteBase *aOwner, const std::string &aIdent, const SGGeod &aPos, double aCourseDeg, double aRadialDeg)
virtual std::string ident() const
Identifier assoicated with the waypoint.
Definition waypoint.hxx:270
void writeToProperties(SGPropertyNode_ptr aProp) const override
Persistence helper - save this element to a node.
Definition waypoint.cxx:260
virtual std::string type() const
Definition waypoint.hxx:134
FGRunway * runway() const
Definition waypoint.hxx:129
RunwayWaypt(FGRunway *aPos, RouteBase *aOwner)
Definition waypoint.cxx:201
virtual double headingRadialDeg() const
return the assoicated heading or radial for this waypoint.
Definition waypoint.cxx:228
virtual SGGeod position() const
Definition waypoint.cxx:213
virtual std::string ident() const
Identifier assoicated with the waypoint.
Definition waypoint.cxx:218
bool initFromProperties(SGPropertyNode_ptr aProp) override
Persistence helper - read node properties from a file.
Definition waypoint.cxx:233
virtual FGPositioned * source() const
The Positioned associated with this element, if one exists.
Definition waypoint.cxx:223
std::string type() const override
Definition waypoint.hxx:355
Via(RouteBase *aOwner)
Definition waypoint.cxx:557
WayptVec expandToWaypoints(WayptRef aPreceeding) const
Definition waypoint.cxx:625
void writeToProperties(SGPropertyNode_ptr aProp) const override
Persistence helper - save this element to a node.
Definition waypoint.cxx:613
FGPositioned * source() const override
The Positioned associated with this element, if one exists.
Definition waypoint.hxx:365
SGGeod position() const override
Definition waypoint.cxx:547
std::string ident() const override
Identifier assoicated with the waypoint.
Definition waypoint.cxx:552
virtual ~Via()
Definition waypoint.cxx:569
bool initFromProperties(SGPropertyNode_ptr aProp) override
Persistence helper - read node properties from a file.
Definition waypoint.cxx:573
AirwayRef airway() const
Definition waypoint.hxx:362
Waypt(RouteBase *aOwner)
Definition route.cxx:189
FlightPlan.hxx - defines a full flight-plan object, including departure, cruise, arrival information ...
Definition Addon.cxx:53
SGSharedPtr< FGPositioned > FGPositionedRef
Definition airways.cxx:49
SGSharedPtr< Waypt > WayptRef
SGSharedPtr< Airway > AirwayRef
Definition airways.hxx:40
std::vector< WayptRef > WayptVec