#define FG_FLIGHTPLAN_HXX
#include <Navaids/route.hxx>
-#include <Airports/simple.hxx>
+#include <Airports/airport.hxx>
-typedef SGSharedPtr<FGAirport> FGAirportRef;
-
namespace flightgear
{
class Transition;
-
+class FlightPlan;
+
+typedef SGSharedPtr<FlightPlan> FlightPlanRef;
+
class FlightPlan : public RouteBase
{
public:
virtual void departureChanged() { }
virtual void arrivalChanged() { }
virtual void waypointsChanged() { }
-
+ virtual void cleared() { }
virtual void currentWaypointChanged() { }
-
+ virtual void endOfFlightPlan() { }
protected:
Delegate();
void runArrivalChanged();
void runWaypointsChanged();
void runCurrentWaypointChanged();
-
+ void runCleared();
+ void runFinished();
+
friend class FlightPlan;
bool _deleteWithPlan;
void setCurrentIndex(int index);
+ void finish();
+
Leg* currentLeg() const;
Leg* nextLeg() const;
Leg* previousLeg() const;
double totalDistanceNm() const
{ return _totalDistance; }
+ /**
+ * given a waypoint index, and an offset in NM, find the geodetic
+ * position on the route path. I.e the point 10nm before or after
+ * a particular waypoint.
+ */
+ SGGeod pointAlongRoute(int aIndex, double aOffsetNm) const;
+
/**
* Create a WayPoint from a string in the following format:
* - simple identifier
_waypointsChanged,
_currentWaypointChanged;
- bool loadPlainTextRoute(const SGPath& path);
+ bool loadXmlFormat(const SGPath& path);
+ bool loadGpxFormat(const SGPath& path);
+ bool loadPlainTextFormat(const SGPath& path);
void loadVersion1XMLRoute(SGPropertyNode_ptr routeData);
void loadVersion2XMLRoute(SGPropertyNode_ptr routeData);
FGAirportRef _departure, _destination;
FGRunway* _departureRunway, *_destinationRunway;
- SID* _sid;
- STAR* _star;
- Approach* _approach;
+ SGSharedPtr<SID> _sid;
+ SGSharedPtr<STAR> _star;
+ SGSharedPtr<Approach> _approach;
std::string _sidTransition, _starTransition;
double _totalDistance;