1 // kln89_page_*.[ch]xx - this file is one of the "pages" that
2 //                       are used in the KLN89 GPS unit simulation.
3 //
4 // Written by David Luff, started 2005.
5 //
6 // Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
7 //
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as
10 // published by the Free Software Foundation; either version 2 of the
11 // License, or (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 // General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 //
22 // $Id$
23 
24 #ifndef _KLN89_PAGE_APT
25 #define _KLN89_PAGE_APT
26 
27 #include "kln89.hxx"
28 
29 class FGRunway;
30 
31 struct AptFreq {
32 	std::string service;
33 	unsigned short int freq;
34 };
35 
36 class KLN89AptPage : public KLN89Page {
37 
38 public:
39 	KLN89AptPage(KLN89* parent);
40 	~KLN89AptPage();
41 
42 	void Update(double dt);
43 
44 	void CrsrPressed();
45 	void ClrPressed();
46 	void EntPressed();
47 	void Knob1Left1();
48 	void Knob1Right1();
49 	void Knob2Left1();
50 	void Knob2Right1();
51 
52 	void SetId(const std::string& s);
53 
54 private:
55 	// Update the cached airport details
56 	void UpdateAirport(const std::string& id);
57 
58 	std::string _apt_id;
59 	std::string _last_apt_id;
60 	std::string _save_apt_id;
61 	const FGAirport* ap;
62 
63 	vector<FGRunway*> _aptRwys;
64 	vector<AptFreq> _aptFreqs;
65 
66 	iap_list_type _iaps;
67 	unsigned int _curIap;	// The index into _iaps of the IAP we are currently selecting
68 	vector<GPSFlightPlan*> _approachRoutes;	// The approach route(s) from the IAF(s) to the IF.
69 	vector<GPSWaypoint*> _IAP;	// The compulsory waypoints of the approach procedure (may duplicate one of the above).
70 								// _IAP includes the FAF and MAF.
71 	vector<GPSWaypoint*> _MAP;	// The missed approach procedure (doesn't include the MAF).
72 	unsigned int _curIaf;	// The index into _approachRoutes of the IAF we are currently selecting, and then remembered as the one we selected
73 
74 	// Position in rwy pages
75 	unsigned int _curRwyPage;
76 	unsigned int _nRwyPages;
77 
78 	// Position in freq pages
79 	unsigned int _curFreqPage;
80 	unsigned int _nFreqPages;
81 
82 	// Position in IAP list (0-based number of first IAP displayed)
83 	unsigned int _iapStart;
84 	// ditto for IAF list (can't test this since can't find an approach with > 3 IAF at the moment!)
85 	unsigned int _iafStart;
86 	// ditto for list of approach fixes when asking load confirmation
87 	unsigned int _fStart;
88 
89 	// Various IAP related dialog states that we might need to remember
90 	bool _iafDialog;
91 	bool _addDialog;
92 	bool _replaceDialog;
93 };
94 
95 #endif  // _KLN89_PAGE_APT
96