#include <set>
+#include <simgear/math/sg_types.hxx> // for string_list
+
#include <Navaids/route.hxx>
#include <Airports/runways.hxx>
// forward decls
class NavdataVisitor;
-class Procedure : public Route
+typedef std::vector<FGRunwayRef> RunwayVec;
+
+typedef enum {
+ PROCEDURE_INVALID,
+ PROCEDURE_APPROACH_ILS,
+ PROCEDURE_APPROACH_VOR,
+ PROCEDURE_APPROACH_NDB,
+ PROCEDURE_APPROACH_RNAV,
+ PROCEDURE_SID,
+ PROCEDURE_STAR,
+ PROCEDURE_TRANSITION,
+ PROCEDURE_RUNWAY_TRANSITION
+} ProcedureType;
+
+class Procedure : public RouteBase
{
-public:
-
+public:
+ virtual ProcedureType type() const = 0;
+
virtual std::string ident() const
{ return _ident; }
+
+ virtual FGAirport* airport() const = 0;
+
+ virtual RunwayVec runways() const
+ { return RunwayVec(); }
protected:
Procedure(const std::string& aIdent);
/**
* Encapsulate a transition segment
*/
-class Transition : public Route
+class Transition : public Procedure
{
public:
- bool route(Waypt* aEnroute, WayptVec& aPath);
+ virtual ~Transition() { ; }
+
+ bool route(WayptVec& aPath);
Procedure* parent() const
{ return _parent; }
+ virtual FGAirport* airport() const;
+
/**
* Return the enroute end of the transition
*/
*/
WayptRef procedureEnd() const;
- virtual std::string ident() const
- { return _ident; }
+
+ virtual ProcedureType type() const
+ { return _type; }
+
+ void mark(WayptFlag f);
private:
friend class NavdataVisitor;
- Transition(const std::string& aIdent, Procedure* aPr, const WayptVec& aWps);
+ Transition(const std::string& aIdent, ProcedureType ty, Procedure* aPr);
- std::string _ident;
+ void setPrimary(const WayptVec& aWps);
+
+ ProcedureType _type;
Procedure* _parent;
WayptVec _primary;
};
+typedef SGSharedPtr<Transition> TransitionRef;
+
/**
* Describe an approach procedure, including the missed approach
* segment
class Approach : public Procedure
{
public:
+ virtual ~Approach() { ; }
+
FGRunwayRef runway()
{ return _runway; }
+ static bool isApproach(ProcedureType ty);
+
+ virtual FGAirport* airport() const;
+
+ virtual RunwayVec runways() const;
+
/**
* Build a route from a valid IAF to the runway, including the missed
* segment. Return false if no valid transition from the specified IAF
const WayptVec& missed() const
{ return _missed; }
+ virtual ProcedureType type() const
+ { return _type; }
+
+ static Approach* createTempApproach(const std::string& aIdent, FGRunway* aRunway, const WayptVec& aPath);
private:
friend class NavdataVisitor;
- Approach(const std::string& aIdent);
+ Approach(const std::string& aIdent, ProcedureType ty);
void setRunway(FGRunwayRef aRwy);
void setPrimaryAndMissed(const WayptVec& aPrimary, const WayptVec& aMissed);
void addTransition(Transition* aTrans);
FGRunwayRef _runway;
+ ProcedureType _type;
- typedef std::map<WayptRef, Transition*> WptTransitionMap;
+ typedef std::map<WayptRef, TransitionRef> WptTransitionMap;
WptTransitionMap _transitions;
WayptVec _primary; // unify these?
class ArrivalDeparture : public Procedure
{
public:
+ virtual FGAirport* airport() const
+ { return _airport; }
+
/**
* Predicate, test if this procedure applies to the requested runway
*/
- virtual bool isForRunway(FGRunwayRef aWay) const;
+ virtual bool isForRunway(const FGRunway* aWay) const;
+
+ virtual RunwayVec runways() const;
/**
* Find a path between the runway and enroute structure. Waypoints
* corresponding to the appropriate transitions and segments will be created.
*/
- virtual bool route(FGRunwayRef aWay, Waypt* aEnroute, WayptVec& aPath) = 0;
+ virtual bool route(FGRunwayRef aWay, Transition* trans, WayptVec& aPath) = 0;
const WayptVec& common() const
{ return _common; }
+ string_list transitionIdents() const;
+
/**
* Given an enroute location, find the best enroute transition point for
* this arrival/departure. Best is currently determined as 'closest to the
* for the route-manager and similar code that that needs to talk about
* transitions in a human-meaningful way (including persistence).
*/
- WayptRef findTransitionByName(const std::string& aIdent) const;
+ Transition* findTransitionByName(const std::string& aIdent) const;
Transition* findTransitionByEnroute(Waypt* aEnroute) const;
protected:
- bool commonRoute(Waypt* aEnroute, WayptVec& aPath, FGRunwayRef aRwy);
-
- ArrivalDeparture(const std::string& aIdent);
+ bool commonRoute(Transition* t, WayptVec& aPath, FGRunwayRef aRwy);
+ ArrivalDeparture(const std::string& aIdent, FGAirport* apt);
void addRunway(FGRunwayRef aRwy);
- typedef std::map<FGRunwayRef, Transition*> RunwayTransitionMap;
+ typedef std::map<FGRunwayRef, TransitionRef> RunwayTransitionMap;
RunwayTransitionMap _runways;
+ virtual WayptFlag flagType() const = 0;
+
+ void setCommon(const WayptVec& aWps);
+
private:
friend class NavdataVisitor;
void addTransition(Transition* aTrans);
- void setCommon(const WayptVec& aWps);
-
void addRunwayTransition(FGRunwayRef aRwy, Transition* aTrans);
+ FGAirport* _airport;
WayptVec _common;
- typedef std::map<WayptRef, Transition*> WptTransitionMap;
+ typedef std::map<WayptRef, TransitionRef> WptTransitionMap;
WptTransitionMap _enrouteTransitions;
class SID : public ArrivalDeparture
{
-public:
- virtual bool route(FGRunwayRef aWay, Waypt* aEnroute, WayptVec& aPath);
+public:
+ virtual ~SID() { ; }
+
+ virtual bool route(FGRunwayRef aWay, Transition* aTrans, WayptVec& aPath);
+
+ virtual ProcedureType type() const
+ { return PROCEDURE_SID; }
+
+ static SID* createTempSID(const std::string& aIdent, FGRunway* aRunway, const WayptVec& aPath);
+protected:
+ virtual WayptFlag flagType() const
+ { return WPT_DEPARTURE; }
private:
friend class NavdataVisitor;
- SID(const std::string& aIdent);
+ SID(const std::string& aIdent, FGAirport* apt);
};
class STAR : public ArrivalDeparture
{
-public:
- virtual bool route(FGRunwayRef aWay, Waypt* aEnroute, WayptVec& aPath);
+public:
+ virtual ~STAR() { ; }
+
+ virtual bool route(FGRunwayRef aWay, Transition* aTrans, WayptVec& aPath);
+
+ virtual ProcedureType type() const
+ { return PROCEDURE_STAR; }
+
+protected:
+ virtual WayptFlag flagType() const
+ { return WPT_ARRIVAL; }
private:
friend class NavdataVisitor;
- STAR(const std::string& aIdent);
+ STAR(const std::string& aIdent, FGAirport* apt);
};
} // of namespace