]> git.mxchange.org Git - flightgear.git/blob - src/AIModel/AIFlightPlan.hxx
bc75b9ab32cfe2c85c6c53e35c2552f6ab50c2d8
[flightgear.git] / src / AIModel / AIFlightPlan.hxx
1 // FGAIFlightPlan - class for loading and storing  AI flight plans
2 // Written by David Culp, started May 2004
3 // - davidculp2@comcast.net
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License as
7 // published by the Free Software Foundation; either version 2 of the
8 // License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful, but
11 // WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 // General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 #ifndef _FG_AIFLIGHTPLAN_HXX
20 #define _FG_AIFLIGHTPLAN_HXX
21
22 #include <simgear/compiler.h>
23 #include <vector>
24 #include <string>
25 SG_USING_STD(vector);
26 SG_USING_STD(string);
27
28
29 class FGAIFlightPlan {
30
31 public:
32
33   typedef struct {
34    string name;
35    double latitude;
36    double longitude;
37    double altitude;
38    double speed;
39    double crossat;
40    bool finished;
41    bool gear_down;
42    bool flaps_down;
43    bool on_ground;
44   } waypoint;
45
46    FGAIFlightPlan(string filename);
47    ~FGAIFlightPlan();
48
49    waypoint* getPreviousWaypoint( void );
50    waypoint* getCurrentWaypoint( void );
51    waypoint* getNextWaypoint( void );
52    void IncrementWaypoint( void );
53
54    double getDistanceToGo(double lat, double lon, waypoint* wp);
55    void setLeadDistance(double speed, double bearing, waypoint* current, waypoint* next);
56    void setLeadDistance(double distance_ft);
57    double getLeadDistance( void ) const {return lead_distance;}
58    double getBearing(waypoint* previous, waypoint* next);
59    double getBearing(double lat, double lon, waypoint* next);
60
61 private:
62
63     typedef vector <waypoint*> wpt_vector_type;
64     typedef wpt_vector_type::iterator wpt_vector_iterator;
65
66     wpt_vector_type       waypoints;
67     wpt_vector_iterator   wpt_iterator;
68
69     double distance_to_go;
70     double lead_distance;
71
72 };    
73
74
75
76 #endif  // _FG_AIFLIGHTPLAN_HXX
77