#include <vector>
#include <map>
-#include <Navaids/navrecord.hxx>
-#include <Navaids/navlist.hxx>
-#include <Navaids/fixlist.hxx>
-#include <Airports/simple.hxx>
#include <simgear/structure/subsystem_mgr.hxx>
-
-using namespace std;
+#include <Navaids/positioned.hxx>
class SGTime;
+class FGPositioned;
+
+// XXX fix me
+class FGNavRecord;
+class FGAirport;
+class FGFix;
enum GPSDistanceUnits {
GPS_DIST_UNITS_NM = 0,
struct GPSWaypoint {
GPSWaypoint();
+
+ GPSWaypoint(const std::string& aIdent, float lat, float lon, GPSWpType aType);
+
+ static GPSWaypoint* createFromPositioned(const FGPositioned* aFix);
+
~GPSWaypoint();
string GetAprId(); // Returns the id with i, f, m or h added if appropriate. (Initial approach fix, final approach fix, etc)
string id;
DCLGPS(RenderArea2D* instrument);
virtual ~DCLGPS() = 0;
- virtual void draw();
+ virtual void draw(osg::State& state);
virtual void init();
virtual void bind();
//
// Data and lookup functions
- // All waypoints mapped by id.
- gps_waypoint_map _waypoints;
-private:
- // Worker function for the below.
- const GPSWaypoint* ActualFindFirstById(const string& id, bool exact = false);
+
+
protected:
// Find first of any type of waypoint by id. (TODO - Possibly we should return multiple waypoints here).
- const GPSWaypoint* FindFirstById(const string& id, bool &multi, bool exact = false);
+ GPSWaypoint* FindFirstById(const string& id) const;
+ GPSWaypoint* FindFirstByExactId(const string& id) const;
+
FGNavRecord* FindFirstVorById(const string& id, bool &multi, bool exact = false);
FGNavRecord* FindFirstNDBById(const string& id, bool &multi, bool exact = false);
const FGAirport* FindFirstAptById(const string& id, bool &multi, bool exact = false);
// Find the closest VOR to a position in RADIANS.
FGNavRecord* FindClosestVor(double lat_rad, double lon_rad);
+ // helper to implement the above FindFirstXXX methods
+ FGPositioned* FindTypedFirstById(const std::string& id, FGPositioned::Type ty, bool &multi, bool exact);
+
// Position, orientation and velocity.
// These should be read from FG's built-in GPS logic if possible.
// Use the property node pointers below to do this.