]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/KLN89/kln89.hxx
Clean-up some SGMath dependencies.
[flightgear.git] / src / Instrumentation / KLN89 / kln89.hxx
index c3542f4cbe3b08a0a2f2b714c9143b19a69a30e5..c9ee874d536c2a2090bdb1ee826e2df76ee34c2a 100644 (file)
@@ -41,16 +41,37 @@ enum KLN89Mode {
        KLN89_MODE_CRSR
 };
 
+enum KLN89DistanceUnits {
+       GPS_DIST_UNITS_NM = 0,
+       GPS_DIST_UNITS_KM
+};
+
+enum KLN89SpeedUnits {
+       GPS_VEL_UNITS_KT,
+       GPS_VEL_UNITS_KPH
+};
+
+enum KLN89AltitudeUnits {
+       GPS_ALT_UNITS_FT,
+       GPS_ALT_UNITS_M
+};
+
+enum KLN89PressureUnits {
+       GPS_PRES_UNITS_IN = 1,
+       GPS_PRES_UNITS_MB,
+       GPS_PRES_UNITS_HP
+};
+
 /*
 const char* KLN89TimeCodes[20] = { "UTC", "GST", "GDT", "ATS", "ATD", "EST", "EDT", "CST", "CDT", "MST", 
                                    "MDT", "PST", "PDT", "AKS", "AKD", "HAS", "HAD", "SST", "SDT", "LCL" };
 */
 
 // Used for storing airport town and county mapped by ID, since currently FG does not store this
-typedef map<string, string> airport_id_str_map_type;
+typedef std::map<std::string, std::string> airport_id_str_map_type;
 typedef airport_id_str_map_type::iterator airport_id_str_map_iterator;
 
-typedef vector<KLN89Page*> kln89_page_list_type;
+typedef std::vector<KLN89Page*> kln89_page_list_type;
 typedef kln89_page_list_type::iterator kln89_page_list_itr;
 
 class KLN89 : public DCLGPS {
@@ -67,6 +88,7 @@ class KLN89 : public DCLGPS {
        friend class KLN89CalPage;
        friend class KLN89SetPage;
        friend class KLN89OthPage;
+       friend class KLN89AltPage;
        friend class KLN89DirPage;
        friend class KLN89NrstPage;
        
@@ -79,6 +101,20 @@ public:
        void init();
        void update(double dt);
        
+       // Set Units
+       // m if true, ft if false
+       inline void SetAltUnitsSI(bool b) { _altUnits = (b ? GPS_ALT_UNITS_M : GPS_ALT_UNITS_FT); }
+       // Returns true if alt units are SI (m), false if ft
+       inline bool GetAltUnitsSI() { return(_altUnits == GPS_ALT_UNITS_M ? true : false); }
+       // km and k/h if true, nm and kt if false
+       inline void SetDistVelUnitsSI(bool b) { _distUnits = (b ? GPS_DIST_UNITS_KM : GPS_DIST_UNITS_NM); _velUnits = (b ? GPS_VEL_UNITS_KPH : GPS_VEL_UNITS_KT); }
+       // Returns true if dist/vel units are SI
+       inline bool GetDistVelUnitsSI() { return(_distUnits == GPS_DIST_UNITS_KM && _velUnits == GPS_VEL_UNITS_KPH ? true : false); }
+       // Set baro units - 1 = in, 2 = mB, 3 = hP   Wrapping if for the convienience of the GPS setter.
+       void SetBaroUnits(int n, bool wrap = false);
+       // Get baro units: 1 = in, 2 = mB, 3 = hP
+       inline int GetBaroUnits() { return((int)_baroUnits); }
+       
        inline void SetTurnAnticipation(bool b) { _turnAnticipationEnabled = b; }
        inline bool GetTurnAnticipation() { return(_turnAnticipationEnabled); }
 
@@ -87,6 +123,11 @@ public:
        
        inline void SetAltAlertEnabled(bool b) { _altAlertEnabled = b; }
        inline bool GetAltAlertEnabled() { return(_altAlertEnabled); }
+
+       void SetMinDisplayBrightness(int n);    // Set minDisplayBrightness (between 1 and 9)
+       void DecrementMinDisplayBrightness();   // Decrease by 1
+       void IncrementMinDisplayBrightness();   // Increase by 1
+       inline int GetMinDisplayBrightness() { return(_minDisplayBrightness); }
        
        inline bool GetMsgAlert() const { return(!_messageStack.empty()); }
        
@@ -109,14 +150,14 @@ private:
        void ToggleOBSMode();
        
        // Initiate Direct To operation to the supplied ID.
-       void DtoInitiate(const string& id);
+       void DtoInitiate(const std::string& id);
 
        //----------------------- Drawing functions which take CHARACTER units -------------------------
        // Render string s in display field field at position x, y
        // WHERE POSITION IS IN CHARACTER UNITS!
        // zero y at bottom?
        // invert: -1 => no inversion, 0 -> n => 1 char - s[invert] gets inverted, 99 => entire string gets inverted 
-       void DrawText(const string& s, int field, int px, int py, bool bold = false, int invert = -1);
+       void DrawText(const std::string& s, int field, int px, int py, bool bold = false, int invert = -1);
        
        void DrawLatitude(double d, int field, int px, int py);
        void DrawLongitude(double d, int field, int px, int py);
@@ -221,6 +262,8 @@ private:
        bool _jumpRestoreCrsr;  // Indicates that jump back at this point should restore cursor mode.
        
        // Misc pages that aren't in the cyclic list.
+       // ALT
+       KLN89Page* _alt_page;
        // Direct To
        KLN89Page* _dir_page;
        // Nearest
@@ -264,7 +307,7 @@ private:
        // Draw an airport or waypoint label on the moving map
        // Specify position by the map pixel co-ordinate of the left or right, bottom, of the *visible* portion of the label.
        // The black background quad will automatically overlap this by 1 pixel.
-       void DrawLabel(const string& s, int x1, int y1, bool right_align = false);
+       void DrawLabel(const std::string& s, int x1, int y1, bool right_align = false);
        
        int GetLabelQuadrant(double h);
        int GetLabelQuadrant(double h1, double h2);
@@ -273,7 +316,7 @@ private:
        void DrawLine(int x1, int y1, int x2, int y2);
        
        // Draw normal sized text on the moving map
-       void DrawMapText(const string& s, int x, int y, bool draw_background = false);
+       void DrawMapText(const std::string& s, int x, int y, bool draw_background = false);
        
        void DrawMapUpArrow(int x, int y);
        
@@ -292,6 +335,25 @@ private:
        // Sometimes the datapages can be used to review a waypoint whilst the user makes a decision,
        // and we need to remember why.
        bool _dtoReview;        // Set true when we a reviewing a waypoint for DTO operation.
+       
+       // Configuration settings that the user can set via. the KLN89 SET pages.
+       KLN89SpeedUnits _velUnits;
+       KLN89DistanceUnits _distUnits;
+       KLN89PressureUnits _baroUnits;
+       KLN89AltitudeUnits _altUnits;
+       bool _suaAlertEnabled;          // Alert user to potential SUA entry
+       bool _altAlertEnabled;          // Alert user to min safe alt violation
+       int _minDisplayBrightness;      // Minimum display brightness in low light.
+       char _defaultFirstChar;         // Default first waypoint character.
+       
+       // The user-settable barometric pressure.
+       // This can be set in the range 22.00 -> 32.99", or 745 -> 1117mB/hPa.
+       // For user input, we maintain a single integer value that is either between 2200 and 3299 (")
+       // or between 745 and 1117 (mB/hPa).  It gets converted from one to the other only when the
+       // units are changed.
+       // For internal VNAV calculations (which we don't currently do) this will be converted to a floating
+       // point value before use.
+       int _userBaroSetting;
 };
 
 #endif  // _KLN89_HXX