]> git.mxchange.org Git - flightgear.git/blob - src/Autopilot/route_mgr.hxx
Make a subtle change to tile loading/unloading policy in order to make the tile
[flightgear.git] / src / Autopilot / route_mgr.hxx
1 // route_mgr.hxx - manage a route (i.e. a collection of waypoints)
2 //
3 // Written by Curtis Olson, started January 2004.
4 //
5 // Copyright (C) 2004  Curtis L. Olson  - curt@flightgear.org
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 //
21 // $Id$
22
23
24 #ifndef _ROUTE_MGR_HXX
25 #define _ROUTE_MGR_HXX 1
26
27 #ifndef __cplusplus
28 # error This library requires C++
29 #endif
30
31 #ifdef HAVE_CONFIG_H
32 #  include <config.h>
33 #endif
34
35 #include <simgear/compiler.h>
36
37 #include STL_STRING
38 #include <vector>
39
40 SG_USING_STD(string);
41 SG_USING_STD(vector);
42
43 #include <simgear/props/props.hxx>
44 #include <simgear/route/route.hxx>
45 #include <simgear/structure/subsystem_mgr.hxx>
46
47
48 /**
49  * Top level route manager class
50  * 
51  */
52
53 class FGRouteMgr : public SGSubsystem
54 {
55
56 private:
57
58     SGRoute *route;
59
60     // automatic inputs
61     SGPropertyNode *lon;
62     SGPropertyNode *lat;
63     SGPropertyNode *alt;
64
65     // automatic outputs
66     SGPropertyNode *true_hdg_deg;
67
68     SGPropertyNode *wp0_id;
69     SGPropertyNode *wp0_dist;
70     SGPropertyNode *wp0_eta;
71
72     SGPropertyNode *wp1_id;
73     SGPropertyNode *wp1_dist;
74     SGPropertyNode *wp1_eta;
75
76     SGPropertyNode *wpn_id;
77     SGPropertyNode *wpn_dist;
78     SGPropertyNode *wpn_eta;
79
80
81 public:
82
83     FGRouteMgr();
84     ~FGRouteMgr();
85
86     void init ();
87     void bind ();
88     void unbind ();
89     void update (double dt);
90
91     bool build ();
92
93     void add_waypoint( SGWayPoint wp ) {
94         route->add_waypoint( wp );
95     }
96
97     SGWayPoint get_waypoint( int i ) const {
98         return route->get_waypoint(i);
99     }
100
101     SGWayPoint pop_waypoint();
102
103     int size() const {
104         return route->size();
105     }
106 };
107
108
109 #endif // _ROUTE_MGR_HXX