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, Route* aOwner);
41 BasicWaypt(const SGWayPoint& aWP, Route* aOwner);
43 BasicWaypt(Route* 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, Route* aOwner);
72 NavaidWaypoint(Route* 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, Route* aOwner, double aRadial, double aDistNm);
95 OffsetNavaidWaypoint(Route* 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, Route* aOwner);
125 RunwayWaypt(Route* aOwner);
127 virtual SGGeod position() const;
129 virtual FGPositioned* source() const;
131 virtual std::string ident() const;
133 FGRunway* runway() const
137 virtual std::string type() const
140 virtual void initFromProperties(SGPropertyNode_ptr aProp);
141 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
147 class Hold : public BasicWaypt
150 Hold(const SGGeod& aPos, const std::string& aIdent, Route* aOwner);
154 void setHoldRadial(double aInboundRadial);
155 void setHoldDistance(double aDistanceNm);
156 void setHoldTime(double aTimeSec);
158 void setRightHanded();
159 void setLeftHanded();
161 double inboundRadial() const
164 bool isLeftHanded() const
165 { return !_righthanded; }
167 bool isDistance() const
168 { return _isDistance; }
170 double timeOrDistance() const
174 virtual void initFromProperties(SGPropertyNode_ptr aProp);
175 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
177 virtual std::string type() const
187 class HeadingToAltitude : public Waypt
190 HeadingToAltitude(Route* aOwner, const std::string& aIdent, double aMagHdg);
192 HeadingToAltitude(Route* aOwner);
194 virtual void initFromProperties(SGPropertyNode_ptr aProp);
195 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
197 virtual std::string type() const
198 { return "hdgToAlt"; }
200 virtual SGGeod position() const
203 virtual std::string ident() const
206 double headingDegMagnetic() const
207 { return _magHeading; }
209 virtual double magvarDeg() const
217 class DMEIntercept : public Waypt
220 DMEIntercept(Route* aOwner, const std::string& aIdent, const SGGeod& aPos,
221 double aCourseDeg, double aDistanceNm);
223 DMEIntercept(Route* aOwner);
225 virtual void initFromProperties(SGPropertyNode_ptr aProp);
226 virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
228 virtual std::string type() const
229 { return "dmeIntercept"; }
231 virtual SGGeod position() const
234 virtual std::string ident() const
237 double courseDegMagnetic() const
238 { return _magCourse; }
240 double dmeDistanceNm() const
241 { return _dmeDistanceNm; }
247 double _dmeDistanceNm;
250 class RadialIntercept : public Waypt
253 RadialIntercept(Route* aOwner, const std::string& aIdent, const SGGeod& aPos,
254 double aCourseDeg, double aRadialDeg);
256 RadialIntercept(Route* 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(Route* aOwner, FGAirport* aFacility);
292 virtual ~ATCVectors();
294 ATCVectors(Route* 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