1 // route_mgr.hxx - manage a route (i.e. a collection of waypoints)
3 // Written by Curtis Olson, started January 2004.
5 // Copyright (C) 2004 Curtis L. Olson - http://www.flightgear.org/~curt
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.
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 #ifndef _ROUTE_MGR_HXX
25 #define _ROUTE_MGR_HXX 1
28 # error This library requires C++
35 #include <simgear/compiler.h>
43 #include <simgear/props/props.hxx>
44 #include <simgear/route/route.hxx>
45 #include <simgear/structure/subsystem_mgr.hxx>
49 * Top level route manager class
53 class FGRouteMgr : public SGSubsystem
61 SGPropertyNode_ptr lon;
62 SGPropertyNode_ptr lat;
63 SGPropertyNode_ptr alt;
66 SGPropertyNode_ptr true_hdg_deg;
67 SGPropertyNode_ptr target_altitude_ft;
68 SGPropertyNode_ptr altitude_lock;
70 SGPropertyNode_ptr wp0_id;
71 SGPropertyNode_ptr wp0_dist;
72 SGPropertyNode_ptr wp0_eta;
74 SGPropertyNode_ptr wp1_id;
75 SGPropertyNode_ptr wp1_dist;
76 SGPropertyNode_ptr wp1_eta;
78 SGPropertyNode_ptr wpn_id;
79 SGPropertyNode_ptr wpn_dist;
80 SGPropertyNode_ptr wpn_eta;
83 class Listener : public SGPropertyChangeListener {
85 Listener(FGRouteMgr *m) : mgr(m) {}
86 virtual void valueChanged (SGPropertyNode * prop);
91 SGPropertyNode_ptr input;
93 SGPropertyNode_ptr mirror;
96 int make_waypoint( SGWayPoint **wp, const string& target );
109 void update (double dt);
113 int new_waypoint( const string& tgt_alt, int n = -1 );
114 void add_waypoint( const SGWayPoint& wp, int n = -1 );
115 SGWayPoint pop_waypoint( int i = 0 );
117 SGWayPoint get_waypoint( int i ) const {
118 return route->get_waypoint(i);
122 return route->size();
128 #endif // _ROUTE_MGR_HXX