]> git.mxchange.org Git - flightgear.git/blob - src/Navaids/routePath.hxx
Add support for helipads from apt.dat 850+
[flightgear.git] / src / Navaids / routePath.hxx
1 /**
2  * routePath.hxx - convert a route to straight line segments, for graphical
3  * output or display.
4  */
5  
6 // Written by James Turner, started 2010.
7 //
8 // Copyright (C) 2010  Curtis L. Olson
9 //
10 // This program is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU General Public License as
12 // published by the Free Software Foundation; either version 2 of the
13 // License, or (at your option) any later version.
14 //
15 // This program is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 // General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with this program; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
23
24 #ifndef FG_ROUTE_PATH_HXX
25 #define FG_ROUTE_PATH_HXX
26
27 #include <Navaids/route.hxx>
28
29 namespace flightgear
30 {
31   class Hold;
32   class FlightPlan;
33 }
34
35 typedef std::vector<SGGeod> SGGeodVec;
36
37 class RoutePath
38 {
39 public:
40   RoutePath(const flightgear::WayptVec& wpts);
41   RoutePath(const flightgear::FlightPlan* fp);
42   
43   SGGeodVec pathForIndex(int index) const;
44   
45   SGGeod positionForIndex(int index) const;
46   
47 private:
48   void commonInit();
49   
50   class PathCtx;
51   
52   SGGeodVec pathForHold(flightgear::Hold* hold) const;
53   
54   bool computedPositionForIndex(int index, SGGeod& pos) const;
55   double computeAltitudeForIndex(int index) const;
56   double computeTrackForIndex(int index) const;
57   
58   void interpolateGreatCircle(const SGGeod& aFrom, const SGGeod& aTo, SGGeodVec& r) const;
59   
60   /**
61    * Find the distance (in Nm) to climb/descend a height in feet
62    */
63   double distanceForClimb(double climbFt) const;
64   
65   double magVarFor(const SGGeod& gd) const; 
66   
67   flightgear::WayptVec _waypts;
68
69   int _pathClimbFPM; ///< climb-rate to use for pathing
70   int _pathDescentFPM; ///< descent rate to use (feet-per-minute)
71   int _pathIAS; ///< IAS (knots) to use for pathing
72   double _pathTurnRate; ///< degrees-per-second, defaults to 3, i.e 180 in a minute
73 };
74
75 #endif