#include <iosfwd>
// Simgear
-#include <simgear/math/SGMath.hxx>
#include <simgear/structure/SGReferenced.hxx>
#include <simgear/structure/SGSharedPtr.hxx>
#include <simgear/props/props.hxx>
{
// forward decls
-class Route;
+class RouteBase;
class Waypt;
class NavdataVisitor;
-
+
typedef SGSharedPtr<Waypt> WayptRef;
typedef enum {
WPT_GENERATED = 1 << 7,
WPT_DEPARTURE = 1 << 8,
- WPT_ARRIVAL = 1 << 9
+ WPT_ARRIVAL = 1 << 9,
+
+ /// waypoint generated by VNAV / speed management profile,
+ /// for step climbs or top of descent
+ WPT_PSEUDO = 1 << 10,
+ WPT_APPROACH = 1 << 11
} WayptFlag;
typedef enum {
RESTRICT_NONE,
RESTRICT_AT,
RESTRICT_ABOVE,
- RESTRICT_BELOW
+ RESTRICT_BELOW,
+ SPEED_RESTRICT_MACH, ///< encode an 'AT' restriction in Mach, not IAS
+ RESTRICT_DELETE, ///< ignore underlying restriction (on a leg)
+ RESTRICT_COMPUTED, ///< data is computed, not a real restriction
+ SPEED_COMPUTED_MACH ///< variant on above to encode a Mach value
} RouteRestriction;
+bool isMachRestrict(RouteRestriction rr);
+
/**
* Abstract base class for waypoints (and things that are treated similarly
* by navigation systems)
class Waypt : public SGReferenced
{
public:
- Route* owner() const
+ virtual ~Waypt();
+
+ RouteBase* owner() const
{ return _owner; }
/**
virtual double altitudeFt() const
{ return _altitudeFt; }
- virtual double speedKts() const
- { return _speedKts; }
-
+ virtual double speed() const
+ { return _speed; }
+
+// wrapper - asserts if restriction type is _MACH
+ double speedKts() const;
+
+// wrapper - asserts if restriction type is not _MACH
+ double speedMach() const;
+
virtual RouteRestriction altitudeRestriction() const
{ return _altRestrict; }
*/
virtual bool flag(WayptFlag aFlag) const;
+ virtual unsigned int flags() const
+ { return _flags; }
+
void setFlag(WayptFlag aFlag, bool aV = true);
/**
* Factory method
*/
- static WayptRef createFromProperties(Route* aOwner, SGPropertyNode_ptr aProp);
+ static WayptRef createFromProperties(RouteBase* aOwner, SGPropertyNode_ptr aProp);
void saveAsNode(SGPropertyNode* node) const;
bool matches(const SGGeod& aPos) const;
virtual std::string type() const = 0;
+
+ /**
+ * Magentic variation at/in the vicinity of the waypoint.
+ * For some waypoint types this will always return 0.
+ */
+ virtual double magvarDeg() const;
+
+ /**
+ * return the assoicated heading or radial for this waypoint.
+ * The exact meaning varies by type - for a hold it's the inbound radial,
+ * for a DME intercept it's the heading to hold, and so on.
+ */
+ virtual double headingRadialDeg() const;
protected:
friend class NavdataVisitor;
- Waypt(Route* aOwner);
+ Waypt(RouteBase* aOwner);
/**
* Persistence helper - read node properties from a file
*/
virtual void writeToProperties(SGPropertyNode_ptr aProp) const;
- typedef Waypt* (FactoryFunction)(Route* aOwner) ;
+ typedef Waypt* (FactoryFunction)(RouteBase* aOwner) ;
static void registerFactory(const std::string aNodeType, FactoryFunction* aFactory);
double _altitudeFt;
- double _speedKts;
+ double _speed; // knots IAS or mach
RouteRestriction _altRestrict;
RouteRestriction _speedRestrict;
private:
/**
* Create an instance of a concrete subclass, or throw an exception
*/
- static Waypt* createInstance(Route* aOwner, const std::string& aTypeName);
+ static Waypt* createInstance(RouteBase* aOwner, const std::string& aTypeName);
- Route* _owner;
+ RouteBase* _owner;
unsigned short _flags;
-
+ mutable double _magVarDeg;
};
typedef std::vector<WayptRef> WayptVec;
-class Route
+class RouteBase
{
public:
/**
static void loadAirportProcedures(const SGPath& aPath, FGAirport* aApt);
- static void dumpRouteToFile(const WayptVec& aRoute, const std::string& aName);
+ static void dumpRouteToKML(const WayptVec& aRoute, const std::string& aName);
- static void dumpRouteToLineString(const std::string& aIdent,
+ static void dumpRouteToKMLLineString(const std::string& aIdent,
const WayptVec& aRoute, std::ostream& aStream);
private: