Route Manager internals

From FlightGear wiki
Revision as of 08:19, 17 October 2009 by Zakalawe (talk | contribs)
Jump to navigation Jump to search

Internal documentation for people wanting to work with the route manger. This page should be read in conjunction with the equivalent GPS internals page.

The major change in the route manager is that waypoints are no longer popped when they are sequenced. Instead, the current waypoint index is incremented. This change is necessary to allow the route manager to function as the flight plan backend of real-world GPS and navigation devices, which, for example, show previous waypoints and route on a moving map display.

Since most real navigation systems deal in legs, not waypoints, the active leg is defined as that between waypoints[currentWpt - 1] and waypoints[currentWpt]</tt?. This is why current waypoint property is initialised to '1' on activating a route, and why activating a route adds the current location (usually the departure runway) as waypoint 0 - taken together, the user and GPS see the expected first leg from the runway to the first waypoint they entered.

Compatibility

To keep older aircraft and instruments work, the properties wp[0], wp[1] and wp-last are maintained, implicitly updated to refer to the current waypoint, the next waypoint and the final waypoint.