| 1 | /* |
| 2 | * SPDX-FileName: kln89_page_apt.hxx |
| 3 | * SPDX-FileComment: this file is one of the "pages" that are used in the KLN89 GPS unit simulation. |
| 4 | * SPDX-FileCopyrightText: Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com |
| 5 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 6 | */ |
| 7 | |
| 8 | #pragma once |
| 9 | |
| 10 | #include "kln89.hxx" |
| 11 | |
| 12 | |
| 13 | class FGRunway; |
| 14 | |
| 15 | struct AptFreq { |
| 16 | std::string service; |
| 17 | unsigned short int freq; |
| 18 | }; |
| 19 | |
| 20 | class KLN89AptPage : public KLN89Page |
| 21 | { |
| 22 | public: |
| 23 | KLN89AptPage(KLN89* parent); |
| 24 | ~KLN89AptPage(); |
| 25 | |
| 26 | void Update(double dt); |
| 27 | |
| 28 | void CrsrPressed(); |
| 29 | void ClrPressed(); |
| 30 | void EntPressed(); |
| 31 | void Knob1Left1(); |
| 32 | void Knob1Right1(); |
| 33 | void Knob2Left1(); |
| 34 | void Knob2Right1(); |
| 35 | |
| 36 | void SetId(const std::string& s); |
| 37 | |
| 38 | private: |
| 39 | // Update the cached airport details |
| 40 | void UpdateAirport(const std::string& id); |
| 41 | |
| 42 | std::string _apt_id; |
| 43 | std::string _last_apt_id; |
| 44 | std::string _save_apt_id; |
| 45 | const FGAirport* ap; |
| 46 | |
| 47 | std::vector<FGRunway*> _aptRwys; |
| 48 | std::vector<AptFreq> _aptFreqs; |
| 49 | |
| 50 | iap_list_type _iaps; |
| 51 | unsigned int _curIap; // The index into _iaps of the IAP we are currently selecting |
| 52 | std::vector<GPSFlightPlan*> _approachRoutes; // The approach route(s) from the IAF(s) to the IF. |
| 53 | std::vector<GPSWaypoint*> _IAP; // The compulsory waypoints of the approach procedure (may duplicate one of the above). |
| 54 | // _IAP includes the FAF and MAF. |
| 55 | std::vector<GPSWaypoint*> _MAP; // The missed approach procedure (doesn't include the MAF). |
| 56 | unsigned int _curIaf; // The index into _approachRoutes of the IAF we are currently selecting, and then remembered as the one we selected |
| 57 | |
| 58 | // Position in rwy pages |
| 59 | unsigned int _curRwyPage; |
| 60 | unsigned int _nRwyPages; |
| 61 | |
| 62 | // Position in freq pages |
| 63 | unsigned int _curFreqPage; |
| 64 | unsigned int _nFreqPages; |
| 65 | |
| 66 | // Position in IAP list (0-based number of first IAP displayed) |
| 67 | unsigned int _iapStart; |
| 68 | // ditto for IAF list (can't test this since can't find an approach with > 3 IAF at the moment!) |
| 69 | unsigned int _iafStart; |
| 70 | // ditto for list of approach fixes when asking load confirmation |
| 71 | unsigned int _fStart; |
| 72 | |
| 73 | // Various IAP related dialog states that we might need to remember |
| 74 | bool _iafDialog; |
| 75 | bool _addDialog; |
| 76 | bool _replaceDialog; |
| 77 | }; |