2001-11-07 17:55:04 +00:00
|
|
|
// ATCdisplay.hxx - class to manage the graphical display of ATC messages.
|
|
|
|
// - The idea is to separate the display of ATC messages from their
|
2002-03-01 17:39:52 +00:00
|
|
|
// - generation so that the generation may come from any source.
|
2001-11-07 17:55:04 +00:00
|
|
|
//
|
|
|
|
// Written by David Luff, started October 2001.
|
|
|
|
//
|
|
|
|
// Copyright (C) 2001 David C Luff - david.luff@nottingham.ac.uk
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License as
|
|
|
|
// published by the Free Software Foundation; either version 2 of the
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful, but
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
2006-02-21 01:16:04 +00:00
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2001-11-07 17:55:04 +00:00
|
|
|
|
|
|
|
#ifndef _FG_ATC_DISPLAY_HXX
|
|
|
|
#define _FG_ATC_DISPLAY_HXX
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2003-09-24 17:20:55 +00:00
|
|
|
#include <simgear/structure/subsystem_mgr.hxx>
|
2002-03-01 17:39:52 +00:00
|
|
|
|
2001-11-07 17:55:04 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
SG_USING_STD(vector);
|
|
|
|
SG_USING_STD(string);
|
|
|
|
|
|
|
|
struct atcMessage {
|
|
|
|
string msg;
|
|
|
|
bool repeating;
|
2003-03-20 11:22:08 +00:00
|
|
|
double counter; // count of how many seconds since the message was registered
|
|
|
|
double start_count; // value of counter at which display should start (seconds)
|
|
|
|
double stop_count; // value of counter at which display should stop (seconds)
|
2001-11-07 17:55:04 +00:00
|
|
|
int id;
|
2003-03-17 11:32:51 +00:00
|
|
|
double dsp_offset;
|
2001-11-07 17:55:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// ASSUMPTION - with two radios the list won't be long so we don't need to map the id's
|
|
|
|
typedef vector<atcMessage> atcMessageList;
|
2002-01-17 00:03:02 +00:00
|
|
|
typedef atcMessageList::iterator atcMessageListIterator;
|
2001-11-07 17:55:04 +00:00
|
|
|
|
2003-09-24 17:20:55 +00:00
|
|
|
class FGATCDisplay : public SGSubsystem
|
2002-03-01 17:39:52 +00:00
|
|
|
{
|
2001-11-07 17:55:04 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool rep_msg; // Flag to indicate there is a repeating transmission to display
|
2001-11-19 23:53:36 +00:00
|
|
|
bool change_msg_flag; // Flag to indicate that the repeating message has changed
|
2003-03-17 11:32:51 +00:00
|
|
|
double dsp_offset1; // Used to set the correct position of scrolling display
|
2004-09-30 15:43:32 +00:00
|
|
|
double dsp_offset2;
|
2001-11-07 17:55:04 +00:00
|
|
|
string rep_msg_str; // The repeating transmission to play
|
|
|
|
atcMessageList msgList;
|
|
|
|
atcMessageListIterator msgList_itr;
|
|
|
|
|
|
|
|
public:
|
|
|
|
FGATCDisplay();
|
|
|
|
~FGATCDisplay();
|
|
|
|
|
|
|
|
void init();
|
|
|
|
|
2002-03-01 17:39:52 +00:00
|
|
|
void bind();
|
|
|
|
|
|
|
|
void unbind();
|
|
|
|
|
2001-11-07 17:55:04 +00:00
|
|
|
// Display any registered messages
|
2002-05-11 16:28:50 +00:00
|
|
|
void update(double dt);
|
2001-11-07 17:55:04 +00:00
|
|
|
|
2002-04-03 23:54:44 +00:00
|
|
|
// Register a single message for display after a delay of delay seconds
|
|
|
|
// Will automatically stop displaying after a suitable interval.
|
2005-10-25 13:49:55 +00:00
|
|
|
void RegisterSingleMessage(const string& msg, double delay = 0.0);
|
2001-11-07 17:55:04 +00:00
|
|
|
|
2002-03-01 17:39:52 +00:00
|
|
|
// For now we will assume only one repeating message at once
|
2001-11-07 17:55:04 +00:00
|
|
|
// This is not really robust
|
|
|
|
|
|
|
|
// Register a continuously repeating message
|
2005-10-25 13:49:55 +00:00
|
|
|
void RegisterRepeatingMessage(const string& msg);
|
2001-11-07 17:55:04 +00:00
|
|
|
|
|
|
|
// Change a repeating message - assume that the message changes after the string has finished for now
|
2005-10-25 13:49:55 +00:00
|
|
|
void ChangeRepeatingMessage(const string& newmsg);
|
2001-11-07 17:55:04 +00:00
|
|
|
|
|
|
|
// Cancel the current repeating message
|
|
|
|
void CancelRepeatingMessage();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _FG_ATC_DISPLAY_HXX
|