1 // waypoint.hxx - waypoints that can occur in routes/procedures
2 // Written by James Turner, started 2009.
4 // Copyright (C) 2009 Curtis L. Olson
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.
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.
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.
20 #ifndef FG_WAYPOINT_HXX
21 #define FG_WAYPOINT_HXX
23 #include <Airports/airports_fwd.hxx>
24 #include <Navaids/route.hxx>
25 #include <Navaids/positioned.hxx>
30 class BasicWaypt : public Waypt
34 BasicWaypt(const SGGeod& aPos, const std::string& aIdent, RouteBase* aOwner);
36 BasicWaypt(RouteBase* aOwner);
38 virtual SGGeod position() const
41 virtual std::string ident() const
45 virtual void initFromProperties(SGPropertyNode_ptr aProp);
46 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
48 virtual std::string type() const
57 * Waypoint based upon a navaid. In practice this means any Positioned
58 * element, excluding runways (see below)
60 class NavaidWaypoint : public Waypt
63 NavaidWaypoint(FGPositioned* aPos, RouteBase* aOwner);
65 NavaidWaypoint(RouteBase* aOwner);
67 virtual SGGeod position() const;
69 virtual FGPositioned* source() const
72 virtual std::string ident() const;
74 virtual void initFromProperties(SGPropertyNode_ptr aProp);
75 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
77 virtual std::string type() const
80 FGPositionedRef _navaid;
83 class OffsetNavaidWaypoint : public NavaidWaypoint
86 OffsetNavaidWaypoint(FGPositioned* aPos, RouteBase* aOwner, double aRadial, double aDistNm);
88 OffsetNavaidWaypoint(RouteBase* aOwner);
90 virtual SGGeod position() const
94 virtual void initFromProperties(SGPropertyNode_ptr aProp);
95 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
97 virtual std::string type() const
98 { return "offset-navaid"; }
104 double _radial; // true, degrees
109 * Waypoint based upon a runway.
110 * Runways are handled specially in various places, so it's cleaner
111 * to be able to distuinguish them from other navaid waypoints
113 class RunwayWaypt : public Waypt
116 RunwayWaypt(FGRunway* aPos, RouteBase* aOwner);
118 RunwayWaypt(RouteBase* aOwner);
120 virtual SGGeod position() const;
122 virtual FGPositioned* source() const;
124 virtual std::string ident() const;
126 FGRunway* runway() const
129 virtual double headingRadialDeg() const;
131 virtual std::string type() const
134 virtual void initFromProperties(SGPropertyNode_ptr aProp);
135 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
141 class Hold : public BasicWaypt
144 Hold(const SGGeod& aPos, const std::string& aIdent, RouteBase* aOwner);
146 Hold(RouteBase* aOwner);
148 void setHoldRadial(double aInboundRadial);
149 void setHoldDistance(double aDistanceNm);
150 void setHoldTime(double aTimeSec);
152 void setRightHanded();
153 void setLeftHanded();
155 double inboundRadial() const
158 bool isLeftHanded() const
159 { return !_righthanded; }
161 bool isDistance() const
162 { return _isDistance; }
164 double timeOrDistance() const
167 virtual double headingRadialDeg() const
168 { return inboundRadial(); }
170 virtual void initFromProperties(SGPropertyNode_ptr aProp);
171 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
173 virtual std::string type() const
183 class HeadingToAltitude : public Waypt
186 HeadingToAltitude(RouteBase* aOwner, const std::string& aIdent, double aMagHdg);
188 HeadingToAltitude(RouteBase* aOwner);
190 virtual void initFromProperties(SGPropertyNode_ptr aProp);
191 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
193 virtual std::string type() const
194 { return "hdgToAlt"; }
196 virtual SGGeod position() const
199 virtual std::string ident() const
202 double headingDegMagnetic() const
203 { return _magHeading; }
205 virtual double magvarDeg() const
208 virtual double headingRadialDeg() const
209 { return headingDegMagnetic(); }
215 class DMEIntercept : public Waypt
218 DMEIntercept(RouteBase* aOwner, const std::string& aIdent, const SGGeod& aPos,
219 double aCourseDeg, double aDistanceNm);
221 DMEIntercept(RouteBase* aOwner);
223 virtual void initFromProperties(SGPropertyNode_ptr aProp);
224 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
226 virtual std::string type() const
227 { return "dmeIntercept"; }
229 virtual SGGeod position() const
232 virtual std::string ident() const
235 double courseDegMagnetic() const
236 { return _magCourse; }
238 double dmeDistanceNm() const
239 { return _dmeDistanceNm; }
241 virtual double headingRadialDeg() const
242 { return courseDegMagnetic(); }
247 double _dmeDistanceNm;
250 class RadialIntercept : public Waypt
253 RadialIntercept(RouteBase* aOwner, const std::string& aIdent, const SGGeod& aPos,
254 double aCourseDeg, double aRadialDeg);
256 RadialIntercept(RouteBase* aOwner);
258 virtual void initFromProperties(SGPropertyNode_ptr aProp);
259 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
261 virtual std::string type() const
262 { return "radialIntercept"; }
264 virtual SGGeod position() const
267 virtual std::string ident() const
270 double courseDegMagnetic() const
271 { return _magCourse; }
273 double radialDegMagnetic() const
285 * Represent ATC radar vectored segment. Common at the end of published
286 * missed approach procedures, and from STAR arrival points to final approach
288 class ATCVectors : public Waypt
291 ATCVectors(RouteBase* aOwner, FGAirport* aFacility);
292 virtual ~ATCVectors();
294 ATCVectors(RouteBase* aOwner);
296 virtual void initFromProperties(SGPropertyNode_ptr aProp);
297 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
299 virtual std::string type() const
300 { return "vectors"; }
302 virtual SGGeod position() const;
304 virtual std::string ident() const;
308 * ATC facility. Using an airport here is incorrect, since often arrivals
309 * facilities will be shared between several nearby airports, but it
310 * suffices until we have a proper facility representation
312 FGAirportRef _facility;
315 } // of namespace flighgear
317 #endif // of FG_WAYPOINT_HXX