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;
35 class BasicWaypt : public Waypt
39 BasicWaypt(const SGGeod& aPos, const std::string& aIdent, RouteBase* aOwner);
41 BasicWaypt(const SGWayPoint& aWP, RouteBase* aOwner);
43 BasicWaypt(RouteBase* aOwner);
45 virtual SGGeod position() const
48 virtual std::string ident() const
52 virtual void initFromProperties(SGPropertyNode_ptr aProp);
53 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
55 virtual std::string type() const
64 * Waypoint based upon a navaid. In practice this means any Positioned
65 * element, excluding runways (see below)
67 class NavaidWaypoint : public Waypt
70 NavaidWaypoint(FGPositioned* aPos, RouteBase* aOwner);
72 NavaidWaypoint(RouteBase* aOwner);
74 virtual SGGeod position() const;
76 virtual FGPositioned* source() const
79 virtual std::string ident() const;
81 virtual void initFromProperties(SGPropertyNode_ptr aProp);
82 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
84 virtual std::string type() const
87 FGPositionedRef _navaid;
90 class OffsetNavaidWaypoint : public NavaidWaypoint
93 OffsetNavaidWaypoint(FGPositioned* aPos, RouteBase* aOwner, double aRadial, double aDistNm);
95 OffsetNavaidWaypoint(RouteBase* aOwner);
97 virtual SGGeod position() const
101 virtual void initFromProperties(SGPropertyNode_ptr aProp);
102 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
104 virtual std::string type() const
105 { return "offset-navaid"; }
111 double _radial; // true, degrees
116 * Waypoint based upon a runway.
117 * Runways are handled specially in various places, so it's cleaner
118 * to be able to distuinguish them from other navaid waypoints
120 class RunwayWaypt : public Waypt
123 RunwayWaypt(FGRunway* aPos, RouteBase* aOwner);
125 RunwayWaypt(RouteBase* aOwner);
127 virtual SGGeod position() const;
129 virtual FGPositioned* source() const;
131 virtual std::string ident() const;
133 FGRunway* runway() const
136 virtual double headingRadialDeg() const;
138 virtual std::string type() const
141 virtual void initFromProperties(SGPropertyNode_ptr aProp);
142 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
148 class Hold : public BasicWaypt
151 Hold(const SGGeod& aPos, const std::string& aIdent, RouteBase* aOwner);
153 Hold(RouteBase* aOwner);
155 void setHoldRadial(double aInboundRadial);
156 void setHoldDistance(double aDistanceNm);
157 void setHoldTime(double aTimeSec);
159 void setRightHanded();
160 void setLeftHanded();
162 double inboundRadial() const
165 bool isLeftHanded() const
166 { return !_righthanded; }
168 bool isDistance() const
169 { return _isDistance; }
171 double timeOrDistance() const
174 virtual double headingRadialDeg() const
175 { return inboundRadial(); }
177 virtual void initFromProperties(SGPropertyNode_ptr aProp);
178 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
180 virtual std::string type() const
190 class HeadingToAltitude : public Waypt
193 HeadingToAltitude(RouteBase* aOwner, const std::string& aIdent, double aMagHdg);
195 HeadingToAltitude(RouteBase* aOwner);
197 virtual void initFromProperties(SGPropertyNode_ptr aProp);
198 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
200 virtual std::string type() const
201 { return "hdgToAlt"; }
203 virtual SGGeod position() const
206 virtual std::string ident() const
209 double headingDegMagnetic() const
210 { return _magHeading; }
212 virtual double magvarDeg() const
215 virtual double headingRadialDeg() const
216 { return headingDegMagnetic(); }
222 class DMEIntercept : public Waypt
225 DMEIntercept(RouteBase* aOwner, const std::string& aIdent, const SGGeod& aPos,
226 double aCourseDeg, double aDistanceNm);
228 DMEIntercept(RouteBase* aOwner);
230 virtual void initFromProperties(SGPropertyNode_ptr aProp);
231 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
233 virtual std::string type() const
234 { return "dmeIntercept"; }
236 virtual SGGeod position() const
239 virtual std::string ident() const
242 double courseDegMagnetic() const
243 { return _magCourse; }
245 double dmeDistanceNm() const
246 { return _dmeDistanceNm; }
248 virtual double headingRadialDeg() const
249 { return courseDegMagnetic(); }
254 double _dmeDistanceNm;
257 class RadialIntercept : public Waypt
260 RadialIntercept(RouteBase* aOwner, const std::string& aIdent, const SGGeod& aPos,
261 double aCourseDeg, double aRadialDeg);
263 RadialIntercept(RouteBase* aOwner);
265 virtual void initFromProperties(SGPropertyNode_ptr aProp);
266 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
268 virtual std::string type() const
269 { return "radialIntercept"; }
271 virtual SGGeod position() const
274 virtual std::string ident() const
277 double courseDegMagnetic() const
278 { return _magCourse; }
280 double radialDegMagnetic() const
292 * Represent ATC radar vectored segment. Common at the end of published
293 * missed approach procedures, and from STAR arrival points to final approach
295 class ATCVectors : public Waypt
298 ATCVectors(RouteBase* aOwner, FGAirport* aFacility);
299 virtual ~ATCVectors();
301 ATCVectors(RouteBase* aOwner);
303 virtual void initFromProperties(SGPropertyNode_ptr aProp);
304 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
306 virtual std::string type() const
307 { return "vectors"; }
309 virtual SGGeod position() const;
311 virtual std::string ident() const;
315 * ATC facility. Using an airport here is incorrect, since often arrivals
316 * facilities will be shared between several nearby airports, but it
317 * suffices until we have a proper facility representation
319 FGAirportRef _facility;
322 } // of namespace flighgear
324 #endif // of FG_WAYPOINT_HXX