]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/gps.hxx
Fix bug 191, uninitialised HUD color.
[flightgear.git] / src / Instrumentation / gps.hxx
index 56936974d02351ea8f143590a8f12b682bb02fdb..f69a70a76be4b6fcc0922b92210e2fe5d13f3ef7 100644 (file)
@@ -7,11 +7,15 @@
 #ifndef __INSTRUMENTS_GPS_HXX
 #define __INSTRUMENTS_GPS_HXX 1
 
+#include <cassert>
+#include <memory>
+
 #include <simgear/props/props.hxx>
 #include <simgear/structure/subsystem_mgr.hxx>
 #include <simgear/math/SGMath.hxx>
 
-#include "Navaids/positioned.hxx"
+#include <Navaids/positioned.hxx>
+#include <Instrumentation/rnav_waypt_controller.hxx>
 
 // forward decls
 class SGRoute;
@@ -71,20 +75,29 @@ private:
  * /instrumentation/gps/magnetic-bug-error-deg
 
  */
-class GPS : public SGSubsystem
+class GPS : public SGSubsystem, public flightgear::RNAV
 {
-
 public:
-
     GPS (SGPropertyNode *node);
     GPS ();
     virtual ~GPS ();
 
+  // SGSubsystem interface
     virtual void init ();
     virtual void update (double delta_time_sec);
     
     virtual void bind();
     virtual void unbind();
+
+  // RNAV interface
+    virtual SGGeod position();
+    virtual double trackDeg();
+    virtual double groundSpeedKts();
+    virtual double vspeedFPM();
+    virtual double magvarDeg();
+    virtual double selectedMagCourse();
+    virtual double overflightArmDistanceM();
+    
 private:
     friend class GPSListener;
     friend class SearchFilter;
@@ -186,7 +199,6 @@ private:
     void clearOutput();
 
     void updateBasicData(double dt);
-    void updateWaypoints();
 
     void updateTrackingBug();
     void updateReferenceNavaid(double dt);
@@ -262,7 +274,7 @@ private:
   double getScratchDistance() const;
   double getScratchMagBearing() const;
   double getScratchTrueBearing() const;
-  bool getScratchHasNext() const { return _searchHasNext; }
+  bool getScratchHasNext() const;
   
   double getSelectedCourse() const { return _selectedCourse; }
   void setSelectedCourse(double crs);
@@ -273,7 +285,6 @@ private:
   double getLegDistance() const;
   double getLegCourse() const;
   double getLegMagCourse() const;
-  double getAltDistanceRatio() const;
   
   double getTrueTrack() const { return _last_true_track; }
   double getMagTrack() const;
@@ -323,6 +334,7 @@ private:
 
 // members
   SGPropertyNode_ptr _gpsNode;
+  SGPropertyNode_ptr _currentWayptNode;
   SGPropertyNode_ptr _magvar_node;
   SGPropertyNode_ptr _serviceable_node;
   SGPropertyNode_ptr _electrical_node;
@@ -377,10 +389,8 @@ private:
   
   SGGeodProperty _position;
   SGGeod _wp0_position;
-  SGGeod _wp1_position;
   SGGeod _indicated_pos;
-  std::string _wp0Ident, _wp0Name, _wp1Ident, _wp1Name;
-  double _wp1DistanceM, _wp1TrueBearing;
+  double _legDistanceNm;
   
 // scratch data
   SGGeod _scratchPos;
@@ -392,8 +402,6 @@ private:
   std::string _searchQuery;
   FGPositioned::Type _searchType;
   bool _searchExact;
-  bool _searchOrderByRange;
-  bool _searchResultsCached;
   FGPositioned::List _searchResults;
   bool _searchIsRoute; ///< set if 'search' is actually the current route
   bool _searchHasNext; ///< is there a result after this one?
@@ -410,9 +418,14 @@ private:
     SGGeod _turnPt;
     SGGeod _turnCentre;
   
+  std::auto_ptr<flightgear::WayptController> _wayptController;
+  
   SGPropertyNode_ptr _realismSimpleGps; ///< should the GPS be simple or realistic?
+  flightgear::WayptRef _prevWaypt;
+  flightgear::WayptRef _currentWaypt;
   
 // autopilot drive properties
+  SGPropertyNode_ptr _apDrivingFlag;
   SGPropertyNode_ptr _apTrueHeading;
   SGPropertyNode_ptr _apTargetAltitudeFt;
   SGPropertyNode_ptr _apAltitudeLock;