#ifndef FG_POSITIONED_HXX
#define FG_POSITIONED_HXX
+#include <string>
#include <vector>
#include <simgear/structure/SGSharedPtr.hxx>
-#include <simgear/bucket/newbucket.hxx>
+#include <simgear/math/SGMath.hxx>
class FGPositioned;
+class SGPropertyNode;
typedef SGSharedPtr<FGPositioned> FGPositionedRef;
TAXIWAY,
PAVEMENT,
PARK_STAND,
+ WAYPOINT,
FIX,
VOR,
NDB,
DME,
TACAN,
OBSTACLE,
- WAYPOINT, // user-defined waypoint
- FREQ_GND,
- FREQ_TWR,
+ FREQ_GROUND,
+ FREQ_TOWER,
FREQ_ATIS,
+ FREQ_AWOS,
+ FREQ_APP_DEP,
+ FREQ_ENROUTE,
+ FREQ_CLEARANCE,
+ FREQ_UNICOM,
LAST_TYPE
} Type;
{ 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(); }
class TypeFilter : public Filter
{
public:
- TypeFilter(Type aTy) : mType(aTy) { ; }
- virtual bool pass(FGPositioned* aPos) const
- { return (mType == aPos->type()); }
+ TypeFilter(Type aTy);
+ virtual bool pass(FGPositioned* aPos) const;
+ void addType(Type aTy);
private:
- const Type mType;
+ std::vector<Type> types;
};
-
+
static List findWithinRange(const SGGeod& aPos, double aRangeNm, Filter* aFilter = NULL);
static FGPositionedRef findClosestWithIdent(const std::string& aIdent, const SGGeod& aPos, Filter* aFilter = NULL);
static FGPositionedRef findNextWithPartialId(FGPositionedRef aCur, const std::string& aId, Filter* aFilter = NULL);
/**
- * As above, but searches using an offset index
+ * Find all items with the specified ident
+ * @param aFilter - optional filter on items
*/
- static FGPositionedRef findWithPartialId(const std::string& aId, Filter* aFilter, int aOffset);
+ 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);
+
+ /**
+ * Sort an FGPositionedList by distance from a position
+ */
+ static void sortByRange(List&, const SGGeod& aPos);
/**
* Find the closest item to a position, which pass the specified filter
*/
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);
-
/**
* Map a candidate type string to a real type. Returns INVALID if the string
* does not correspond to a defined type.
* Map a type to a human-readable string
*/
static const char* nameForType(Type aTy);
+
+ 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;
};