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 <Navaids/route.hxx>
24 #include <Navaids/positioned.hxx>
27 typedef SGSharedPtr<FGAirport> FGAirportRef;
33 class BasicWaypt : public Waypt
37 BasicWaypt(const SGGeod& aPos, const std::string& aIdent, RouteBase* aOwner);
39 BasicWaypt(RouteBase* aOwner);
41 virtual SGGeod position() const
44 virtual std::string ident() const
48 virtual void initFromProperties(SGPropertyNode_ptr aProp);
49 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
51 virtual std::string type() const
60 * Waypoint based upon a navaid. In practice this means any Positioned
61 * element, excluding runways (see below)
63 class NavaidWaypoint : public Waypt
66 NavaidWaypoint(FGPositioned* aPos, RouteBase* aOwner);
68 NavaidWaypoint(RouteBase* aOwner);
70 virtual SGGeod position() const;
72 virtual FGPositioned* source() const
75 virtual std::string ident() const;
77 virtual void initFromProperties(SGPropertyNode_ptr aProp);
78 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
80 virtual std::string type() const
83 FGPositionedRef _navaid;
86 class OffsetNavaidWaypoint : public NavaidWaypoint
89 OffsetNavaidWaypoint(FGPositioned* aPos, RouteBase* aOwner, double aRadial, double aDistNm);
91 OffsetNavaidWaypoint(RouteBase* aOwner);
93 virtual SGGeod position() const
97 virtual void initFromProperties(SGPropertyNode_ptr aProp);
98 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
100 virtual std::string type() const
101 { return "offset-navaid"; }
107 double _radial; // true, degrees
112 * Waypoint based upon a runway.
113 * Runways are handled specially in various places, so it's cleaner
114 * to be able to distuinguish them from other navaid waypoints
116 class RunwayWaypt : public Waypt
119 RunwayWaypt(FGRunway* aPos, RouteBase* aOwner);
121 RunwayWaypt(RouteBase* aOwner);
123 virtual SGGeod position() const;
125 virtual FGPositioned* source() const;
127 virtual std::string ident() const;
129 FGRunway* runway() const
132 virtual double headingRadialDeg() const;
134 virtual std::string type() const
137 virtual void initFromProperties(SGPropertyNode_ptr aProp);
138 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
144 class Hold : public BasicWaypt
147 Hold(const SGGeod& aPos, const std::string& aIdent, RouteBase* aOwner);
149 Hold(RouteBase* aOwner);
151 void setHoldRadial(double aInboundRadial);
152 void setHoldDistance(double aDistanceNm);
153 void setHoldTime(double aTimeSec);
155 void setRightHanded();
156 void setLeftHanded();
158 double inboundRadial() const
161 bool isLeftHanded() const
162 { return !_righthanded; }
164 bool isDistance() const
165 { return _isDistance; }
167 double timeOrDistance() const
170 virtual double headingRadialDeg() const
171 { return inboundRadial(); }
173 virtual void initFromProperties(SGPropertyNode_ptr aProp);
174 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
176 virtual std::string type() const
186 class HeadingToAltitude : public Waypt
189 HeadingToAltitude(RouteBase* aOwner, const std::string& aIdent, double aMagHdg);
191 HeadingToAltitude(RouteBase* aOwner);
193 virtual void initFromProperties(SGPropertyNode_ptr aProp);
194 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
196 virtual std::string type() const
197 { return "hdgToAlt"; }
199 virtual SGGeod position() const
202 virtual std::string ident() const
205 double headingDegMagnetic() const
206 { return _magHeading; }
208 virtual double magvarDeg() const
211 virtual double headingRadialDeg() const
212 { return headingDegMagnetic(); }
218 class DMEIntercept : public Waypt
221 DMEIntercept(RouteBase* aOwner, const std::string& aIdent, const SGGeod& aPos,
222 double aCourseDeg, double aDistanceNm);
224 DMEIntercept(RouteBase* aOwner);
226 virtual void initFromProperties(SGPropertyNode_ptr aProp);
227 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
229 virtual std::string type() const
230 { return "dmeIntercept"; }
232 virtual SGGeod position() const
235 virtual std::string ident() const
238 double courseDegMagnetic() const
239 { return _magCourse; }
241 double dmeDistanceNm() const
242 { return _dmeDistanceNm; }
244 virtual double headingRadialDeg() const
245 { return courseDegMagnetic(); }
250 double _dmeDistanceNm;
253 class RadialIntercept : public Waypt
256 RadialIntercept(RouteBase* aOwner, const std::string& aIdent, const SGGeod& aPos,
257 double aCourseDeg, double aRadialDeg);
259 RadialIntercept(RouteBase* aOwner);
261 virtual void initFromProperties(SGPropertyNode_ptr aProp);
262 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
264 virtual std::string type() const
265 { return "radialIntercept"; }
267 virtual SGGeod position() const
270 virtual std::string ident() const
273 double courseDegMagnetic() const
274 { return _magCourse; }
276 double radialDegMagnetic() const
288 * Represent ATC radar vectored segment. Common at the end of published
289 * missed approach procedures, and from STAR arrival points to final approach
291 class ATCVectors : public Waypt
294 ATCVectors(RouteBase* aOwner, FGAirport* aFacility);
295 virtual ~ATCVectors();
297 ATCVectors(RouteBase* aOwner);
299 virtual void initFromProperties(SGPropertyNode_ptr aProp);
300 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
302 virtual std::string type() const
303 { return "vectors"; }
305 virtual SGGeod position() const;
307 virtual std::string ident() const;
311 * ATC facility. Using an airport here is incorrect, since often arrivals
312 * facilities will be shared between several nearby airports, but it
313 * suffices until we have a proper facility representation
315 FGAirportRef _facility;
318 } // of namespace flighgear
320 #endif // of FG_WAYPOINT_HXX