]> git.mxchange.org Git - flightgear.git/blob - src/ATC/ATCdisplay.hxx
make attribute strings lowercase with hyphen instead of underscore;
[flightgear.git] / src / ATC / ATCdisplay.hxx
1 // ATCdisplay.hxx - class to manage the graphical display of ATC messages.
2 //                - The idea is to separate the display of ATC messages from their
3 //                - generation so that the generation may come from any source.
4 //
5 // Written by David Luff, started October 2001.
6 //
7 // Copyright (C) 2001  David C Luff - david.luff@nottingham.ac.uk
8 //
9 // This program is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License as
11 // published by the Free Software Foundation; either version 2 of the
12 // License, or (at your option) any later version.
13 //
14 // This program is distributed in the hope that it will be useful, but
15 // WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 // General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with this program; if not, write to the Free Software
21 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
22
23 #ifndef _FG_ATC_DISPLAY_HXX
24 #define _FG_ATC_DISPLAY_HXX
25
26 #ifdef HAVE_CONFIG_H
27 #  include <config.h>
28 #endif
29
30 #include <osg/State>
31 #include <simgear/structure/subsystem_mgr.hxx>
32
33 #include <vector>
34 #include <string>
35
36 SG_USING_STD(vector);
37 SG_USING_STD(string);
38
39 struct atcMessage {
40     string msg;
41     bool repeating;
42     double counter;             // count of how many seconds since the message was registered
43     double start_count; // value of counter at which display should start (seconds)
44     double stop_count;  // value of counter at which display should stop (seconds)
45     int id;
46         double dsp_offset;
47 };
48
49 // ASSUMPTION - with two radios the list won't be long so we don't need to map the id's
50 typedef vector<atcMessage> atcMessageList;
51 typedef atcMessageList::iterator atcMessageListIterator;
52
53 class FGATCDisplay : public SGSubsystem 
54 {
55
56 private:
57     bool rep_msg;               // Flag to indicate there is a repeating transmission to display
58     bool change_msg_flag;       // Flag to indicate that the repeating message has changed
59     double dsp_offset1;         // Used to set the correct position of scrolling display
60     double dsp_offset2;
61     string rep_msg_str;         // The repeating transmission to play
62     atcMessageList msgList;
63     atcMessageListIterator msgList_itr;
64
65 public:
66     FGATCDisplay();
67     ~FGATCDisplay();
68
69     void init();
70
71     void bind();
72
73     void unbind();
74
75     // Display any registered messages
76     void update(double dt, osg::State&);
77     void update(double dt);
78
79     // Register a single message for display after a delay of delay seconds
80     // Will automatically stop displaying after a suitable interval.
81     void RegisterSingleMessage(const string& msg, double delay = 0.0);
82
83     // For now we will assume only one repeating message at once
84     // This is not really robust
85
86     // Register a continuously repeating message
87     void RegisterRepeatingMessage(const string& msg);
88
89     // Change a repeating message - assume that the message changes after the string has finished for now
90     void ChangeRepeatingMessage(const string& newmsg); 
91
92     // Cancel the current repeating message
93     void CancelRepeatingMessage();
94 };
95
96 #endif // _FG_ATC_DISPLAY_HXX