X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FNavaids%2Fpositioned.hxx;h=f6f61229a78750118aea77e719e12f5ceefacdcc;hb=0e53e2cbb1e7f511c40121ade43a539d15e0e155;hp=37f8910c1bd616a09221ef81e08ba9dafc684c8b;hpb=919d1625df82c002d1ddcc5b4b787580e48ac499;p=flightgear.git diff --git a/src/Navaids/positioned.hxx b/src/Navaids/positioned.hxx index 37f8910c1..f6f61229a 100644 --- a/src/Navaids/positioned.hxx +++ b/src/Navaids/positioned.hxx @@ -24,7 +24,7 @@ #include #include -#include +#include class FGPositioned; @@ -43,6 +43,7 @@ public: TAXIWAY, PAVEMENT, PARK_STAND, + WAYPOINT, FIX, VOR, NDB, @@ -55,7 +56,6 @@ public: DME, TACAN, OBSTACLE, - WAYPOINT, // user-defined waypoint FREQ_GND, FREQ_TWR, FREQ_ATIS, @@ -84,12 +84,10 @@ public: { return mPosition; } /** - * Compute the cartesian position associated with this object + * The cartesian position associated with this object */ - SGVec3d cart() const; + const SGVec3d& cart() const; - SGBucket bucket() const; - double latitude() const { return mPosition.getLatitudeDeg(); } @@ -159,27 +157,20 @@ public: static FGPositionedRef findNextWithPartialId(FGPositionedRef aCur, const std::string& aId, Filter* aFilter = NULL); /** - * As above, but searches using an offset index - */ - static FGPositionedRef findWithPartialId(const std::string& aId, Filter* aFilter, int aOffset, bool& aNext); - - /** - * As above, but search names instead of idents + * Find all items with the specified ident + * @param aFilter - optional filter on items */ - static FGPositionedRef findWithPartialName(const std::string& aName, Filter* aFilter, int aOffset, bool& aNext); + static List findAllWithIdent(const std::string& aIdent, Filter* aFilter = NULL, bool aExact = true); /** - * Find all items with the specified ident, and return then sorted by - * distance from a position - * - * @param aFilter - optional filter on items + * As above, but searches names instead of idents */ - static List findAllWithIdentSortedByRange(const std::string& aIdent, const SGGeod& aPos, Filter* aFilter = NULL); + static List findAllWithName(const std::string& aName, Filter* aFilter = NULL, bool aExact = true); /** - * As above, but searches names instead of idents + * Sort an FGPositionedList by distance from a position */ - static List findAllWithNameSortedByRange(const std::string& aName, const SGGeod& aPos, Filter* aFilter = NULL); + static void sortByRange(List&, const SGGeod& aPos); /** * Find the closest item to a position, which pass the specified filter @@ -203,18 +194,6 @@ public: */ static List findClosestN(const SGGeod& aPos, unsigned int aN, double aCutoffNm, Filter* aFilter = NULL); - /** - * Find the closest match based on partial id (with an offset to allow selecting the n-th closest). - * Cutoff distance is limited internally, to avoid making this very slow. - */ - static FGPositionedRef findClosestWithPartialId(const SGGeod& aPos, const std::string& aId, Filter* aFilter, int aOffset, bool& aNext); - - /** - * As above, but matches on name - */ - static FGPositionedRef findClosestWithPartialName(const SGGeod& aPos, const std::string& aName, Filter* aFilter, int aOffset, bool& aNext); - - /** * Map a candidate type string to a real type. Returns INVALID if the string * does not correspond to a defined type. @@ -229,12 +208,15 @@ public: static FGPositioned* createUserWaypoint(const std::string& aIdent, const SGGeod& aPos); protected: - FGPositioned(Type ty, const std::string& aIdent, const SGGeod& aPos, bool aIndex = true); + FGPositioned(Type ty, const std::string& aIdent, const SGGeod& aPos); + + void init(bool aIndexed); // can't be const right now, navrecord at least needs to fix up the position // after navaids are parsed SGGeod mPosition; + SGVec3d mCart; // once mPosition is const, this can be const too const Type mType; const std::string mIdent; };