]> git.mxchange.org Git - flightgear.git/blob - src/ATC/atis.hxx
AI plane should go around instead of landing on user if user dawdles on runway now
[flightgear.git] / src / ATC / atis.hxx
1 // atis.hxx -- ATIS class
2 //
3 // Written by David Luff, started October 2001.
4 // Based on nav.hxx by Curtis Olson, started April 2000.
5 //
6 // Copyright (C) 2001  David C. Luff - david.luff@nottingham.ac.uk
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., 675 Mass Ave, Cambridge, MA 02139, USA.
21
22
23 #ifndef _FG_ATIS_HXX
24 #define _FG_ATIS_HXX
25
26 #include <stdio.h>
27 #include <string>
28
29 #include <simgear/compiler.h>
30 #include <simgear/math/sg_geodesy.hxx>
31 #include <simgear/misc/sgstream.hxx>
32 #include <simgear/magvar/magvar.hxx>
33 #include <simgear/timing/sg_time.hxx>
34
35 #ifdef SG_HAVE_STD_INCLUDES
36 #  include <istream>
37 #  include <iomanip>
38 #elif defined( __BORLANDC__ ) || (__APPLE__)
39 #  include <iostream>
40 #else
41 #  include <istream.h>
42 #  include <iomanip.h>
43 #endif
44
45 SG_USING_STD(istream);
46 SG_USING_STD(string);
47
48 #include "ATC.hxx"
49
50 //DCL - a complete guess for now.
51 #define FG_ATIS_DEFAULT_RANGE 30
52         
53 class FGATIS : public FGATC {
54         
55         //atc_type type;
56         bool display;           // Flag to indicate whether we should be outputting to the ATC display.
57         bool displaying;                // Flag to indicate whether we are outputting to the ATC display.
58         string transmission;    // The actual ATIS transmission
59         // This is not stored in default.atis but is generated
60         // from the prevailing conditions when required.
61         
62         // for failure modeling
63         string trans_ident;             // transmitted ident
64         bool atis_failed;               // atis failed?
65         
66         // Aircraft position
67         // ATIS is actually a special case in that unlike other ATC eg.tower it doesn't actually know about
68         // or the whereabouts of the aircraft it is transmitting to.  However, to ensure consistancy of
69         // operation with the other ATC classes the ATIS class must calculate range to the aircraft in order
70         // to decide whether to render the transmission - hence the users plane details must be stored.
71         //SGPropertyNode *airplane_lon_node; 
72         //SGPropertyNode *airplane_lat_node;
73         //SGPropertyNode *airplane_elev_node; 
74         
75         public:
76         
77         FGATIS(void);
78         ~FGATIS(void);
79         
80         //run the ATIS instance
81         void Update(double dt);
82         
83         //Indicate that this instance should be outputting to the ATC display
84         inline void SetDisplay(void) {display = true;}
85         
86         //Indicate that this instance should not be outputting to the ATC display
87         inline void SetNoDisplay(void) {display = false;}
88         
89         inline atc_type GetType() { return ATIS; }
90         //inline void set_type(const atc_type tp) {type = tp;}
91         inline string get_trans_ident() { return trans_ident; }
92         inline void set_refname(string r) { refname = r; } 
93         
94         private:
95         
96         string refname;         // Holds the refname of a transmission in progress
97         
98         //Update the transmission string
99         void UpdateTransmission(void);
100         
101         friend istream& operator>> ( istream&, FGATIS& );
102 };
103
104 #endif // _FG_ATIS_HXX