Changes to support voice ATIS
This commit is contained in:
parent
fe6784af51
commit
df089b80f8
2 changed files with 301 additions and 258 deletions
283
src/ATC/atis.cxx
283
src/ATC/atis.cxx
|
@ -55,22 +55,23 @@ SG_USING_STD(cout);
|
||||||
#include "atislist.hxx"
|
#include "atislist.hxx"
|
||||||
#include "ATCdisplay.hxx"
|
#include "ATCdisplay.hxx"
|
||||||
#include "ATCutils.hxx"
|
#include "ATCutils.hxx"
|
||||||
|
#include "ATCmgr.hxx"
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
FGATIS::FGATIS()
|
FGATIS::FGATIS()
|
||||||
: type(0),
|
: type(0),
|
||||||
lon(0.0), lat(0.0),
|
lon(0.0), lat(0.0),
|
||||||
elev(0.0),
|
elev(0.0),
|
||||||
x(0.0), y(0.0), z(0.0),
|
x(0.0), y(0.0), z(0.0),
|
||||||
freq(0),
|
freq(0),
|
||||||
range(0),
|
range(0),
|
||||||
display(false),
|
display(false),
|
||||||
displaying(false),
|
displaying(false),
|
||||||
ident(""),
|
ident(""),
|
||||||
name(""),
|
name(""),
|
||||||
transmission(""),
|
transmission(""),
|
||||||
trans_ident(""),
|
trans_ident(""),
|
||||||
atis_failed(false)
|
atis_failed(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,110 +81,142 @@ FGATIS::~FGATIS() {
|
||||||
|
|
||||||
// Main update function - checks whether we are displaying or not the correct message.
|
// Main update function - checks whether we are displaying or not the correct message.
|
||||||
void FGATIS::Update() {
|
void FGATIS::Update() {
|
||||||
if(display) {
|
if(display) {
|
||||||
if(displaying) {
|
if(displaying) {
|
||||||
// Check if we need to update the message
|
// Check if we need to update the message
|
||||||
// - basically every hour and if the weather changes significantly at the station
|
// - basically every hour and if the weather changes significantly at the station
|
||||||
//globals->get_ATC_display()->ChangeRepeatingMessage(transmission);
|
//globals->get_ATC_display()->ChangeRepeatingMessage(transmission);
|
||||||
|
} else {
|
||||||
|
// We need to get and display the message
|
||||||
|
UpdateTransmission();
|
||||||
|
//cout << "ATIS.CXX - calling ATCMgr to render transmission..." << endl;
|
||||||
|
globals->get_ATC_mgr()->Render(transmission, true);
|
||||||
|
displaying = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// We need to get and display the message
|
// We shouldn't be displaying
|
||||||
UpdateTransmission();
|
if(displaying) {
|
||||||
globals->get_ATC_display()->RegisterRepeatingMessage(transmission);
|
//cout << "ATIS.CXX - calling NoRender()..." << endl;
|
||||||
displaying = true;
|
globals->get_ATC_mgr()->NoRender();
|
||||||
|
displaying = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// We shouldn't be displaying
|
|
||||||
if(displaying) {
|
|
||||||
globals->get_ATC_display()->CancelRepeatingMessage();
|
|
||||||
displaying = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets the actual broadcast ATIS transmission.
|
// Sets the actual broadcast ATIS transmission.
|
||||||
void FGATIS::UpdateTransmission() {
|
void FGATIS::UpdateTransmission() {
|
||||||
double visibility;
|
double visibility;
|
||||||
char buf[10];
|
char buf[10];
|
||||||
int phonetic_id;
|
int phonetic_id;
|
||||||
string phonetic_id_string;
|
string phonetic_id_string;
|
||||||
string time_str = fgGetString("sim/time/gmt-string");
|
string time_str = fgGetString("sim/time/gmt-string");
|
||||||
int hours;
|
int hours;
|
||||||
// int minutes;
|
// int minutes;
|
||||||
|
|
||||||
#ifdef FG_WEATHERCM
|
#ifdef FG_WEATHERCM
|
||||||
sgVec3 position = { lat, lon, elev };
|
sgVec3 position = { lat, lon, elev };
|
||||||
FGPhysicalProperty stationweather = WeatherDatabase->get(position);
|
FGPhysicalProperty stationweather = WeatherDatabase->get(position);
|
||||||
#else
|
#else
|
||||||
FGEnvironment stationweather =
|
FGEnvironment stationweather =
|
||||||
globals->get_environment_mgr()->getEnvironment(lat, lon, elev);
|
globals->get_environment_mgr()->getEnvironment(lat, lon, elev);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
transmission = "";
|
transmission = "";
|
||||||
|
|
||||||
// Start with the transmitted station name.
|
// UK CAA radiotelephony manual indicated ATIS transmissions start with "This is"
|
||||||
transmission += name;
|
// Not sure about rest of the world though.
|
||||||
// Add "Information"
|
transmission += "This_is ";
|
||||||
transmission += " Information";
|
// transmitted station name.
|
||||||
|
transmission += name;
|
||||||
|
// Add "Information"
|
||||||
|
transmission += " information";
|
||||||
|
|
||||||
//cout << "In atis.cxx, time_str = " << time_str << '\n';
|
//cout << "In atis.cxx, time_str = " << time_str << '\n';
|
||||||
// Add the recording identifier
|
// Add the recording identifier
|
||||||
// For now we will assume we only transmit every hour
|
// For now we will assume we only transmit every hour
|
||||||
hours = atoi((time_str.substr(1,2)).c_str()); //Warning - this is fragile if the
|
hours = atoi((time_str.substr(1,2)).c_str()); //Warning - this is fragile if the
|
||||||
//time string format changes
|
//time string format changes
|
||||||
//cout << "In atis.cxx, hours = " << hours << endl;
|
//cout << "In atis.cxx, hours = " << hours << endl;
|
||||||
phonetic_id = current_atislist->GetCallSign(ident, hours, 0);
|
phonetic_id = current_atislist->GetCallSign(ident, hours, 0);
|
||||||
phonetic_id_string = GetPhoneticIdent(phonetic_id);
|
phonetic_id_string = GetPhoneticIdent(phonetic_id);
|
||||||
transmission += " ";
|
transmission += " ";
|
||||||
transmission += phonetic_id_string;
|
transmission += phonetic_id_string;
|
||||||
|
|
||||||
// Output the recording time. - we'll just output the last whole hour for now.
|
// Output the recording time. - we'll just output the last whole hour for now.
|
||||||
// FIXME - this only gets GMT time but that appears to be all the clock outputs for now
|
// FIXME - this only gets GMT time but that appears to be all the clock outputs for now
|
||||||
//cout << "in atis.cxx, time = " << time_str << endl;
|
//cout << "in atis.cxx, time = " << time_str << endl;
|
||||||
transmission = transmission + " Weather " + time_str.substr(0,3) + "00 hours Zulu";
|
transmission = transmission + " / Weather " + ConvertNumToSpokenDigits((time_str.substr(0,3) + "00")) + " hours zulu";
|
||||||
|
|
||||||
// Get the temperature
|
// Get the temperature
|
||||||
// (Hardwire it for now since the global property returns the temperature at the current altitude
|
// (Hardwire it for now since the global property returns the temperature at the current altitude
|
||||||
//temperature = fgGetDouble("/environment/weather/temperature-K");
|
//temperature = fgGetDouble("/environment/weather/temperature-K");
|
||||||
#ifdef FG_WEATHERCM
|
#ifdef FG_WEATHERCM
|
||||||
sprintf(buf, "%i", int(stationweather.Temperature - 273.15));
|
sprintf(buf, "%i", int(stationweather.Temperature - 273.15));
|
||||||
#else
|
#else
|
||||||
sprintf(buf, "%d", int(stationweather.get_temperature_degc()));
|
// HACK ALERT - at the moment the new environment subsystem returns bogus temperatures
|
||||||
#endif
|
// FIXME - take out this hack when this gets fixed upstream
|
||||||
transmission += " Temperature ";
|
int temp = (int)stationweather.get_temperature_degc();
|
||||||
transmission += buf;
|
if((temp < -50) || (temp > 60)) {
|
||||||
transmission += " degrees Celsius";
|
temp = 15;
|
||||||
|
}
|
||||||
|
// original:
|
||||||
|
//sprintf(buf, "%d", int(stationweather.get_temperature_degc()));
|
||||||
|
// hack:
|
||||||
|
sprintf(buf, "%d", temp);
|
||||||
|
#endif
|
||||||
|
transmission += " / Temperature ";
|
||||||
|
if(temp < 0) {
|
||||||
|
transmission += "minus ";
|
||||||
|
}
|
||||||
|
string tempstr1 = buf;
|
||||||
|
string tempstr2;
|
||||||
|
transmission += ConvertNumToSpokenDigits(tempstr1);
|
||||||
|
transmission += " degrees_Celsius";
|
||||||
|
|
||||||
// Get the visibility
|
// Get the visibility
|
||||||
#ifdef FG_WEATHERCM
|
#ifdef FG_WEATHERCM
|
||||||
visibility = fgGetDouble("/environment/visibility-m");
|
visibility = fgGetDouble("/environment/visibility-m");
|
||||||
#else
|
#else
|
||||||
visibility = stationweather.get_visibility_m();
|
visibility = stationweather.get_visibility_m();
|
||||||
#endif
|
#endif
|
||||||
sprintf(buf, "%i", int(visibility/1600));
|
sprintf(buf, "%i", int(visibility/1600));
|
||||||
transmission += " Visibility ";
|
transmission += " / Visibility ";
|
||||||
transmission += buf;
|
tempstr1 = buf;
|
||||||
|
transmission += ConvertNumToSpokenDigits(tempstr1);
|
||||||
transmission += " miles";
|
transmission += " miles";
|
||||||
|
|
||||||
// Get the cloudbase
|
// Get the cloudbase
|
||||||
// FIXME: kludge for now
|
// FIXME: kludge for now
|
||||||
if (strcmp(fgGetString("/environment/clouds/layer[0]/type"), "clear")) {
|
if (strcmp(fgGetString("/environment/clouds/layer[0]/type"), "clear")) {
|
||||||
double cloudbase =
|
double cloudbase =
|
||||||
fgGetDouble("/environment/clouds/layer[0]/elevation-ft");
|
fgGetDouble("/environment/clouds/layer[0]/elevation-ft");
|
||||||
// For some reason the altitude returned doesn't seem to correspond to the actual cloud altitude.
|
// For some reason the altitude returned doesn't seem to correspond to the actual cloud altitude.
|
||||||
char buf3[10];
|
char buf3[10];
|
||||||
// cout << "cloudbase = " << cloudbase << endl;
|
char buf4[10];
|
||||||
sprintf(buf3, "%i", int(cloudbase));
|
// cout << "cloudbase = " << cloudbase << endl;
|
||||||
transmission = transmission + " Cloudbase " + buf3 + " feet";
|
sprintf(buf3, "%i", int(cloudbase)/1000);
|
||||||
|
sprintf(buf4, "%i", ((int)cloudbase % 1000)/100);
|
||||||
|
transmission += " / Cloudbase";
|
||||||
|
if(int(cloudbase)/1000) {
|
||||||
|
tempstr1 = buf3;
|
||||||
|
transmission = transmission + " " + ConvertNumToSpokenDigits(tempstr1) + " thousand";
|
||||||
|
}
|
||||||
|
if(((int)cloudbase % 1000)/100) {
|
||||||
|
tempstr1 = buf4;
|
||||||
|
transmission = transmission + " " + ConvertNumToSpokenDigits(tempstr1) + " hundred";
|
||||||
|
}
|
||||||
|
transmission += " feet";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the pressure / altimeter
|
// Get the pressure / altimeter
|
||||||
|
|
||||||
#ifndef FG_WEATHERCM
|
#ifndef FG_WEATHERCM
|
||||||
double altimeter = stationweather.get_pressure_sea_level_inhg();
|
double altimeter = stationweather.get_pressure_sea_level_inhg();
|
||||||
sprintf(buf, "%.2f", altimeter);
|
sprintf(buf, "%.2f", altimeter);
|
||||||
transmission += " Altimeter ";
|
transmission += " / Altimeter ";
|
||||||
transmission += buf;
|
tempstr1 = buf;
|
||||||
#endif
|
transmission += ConvertNumToSpokenDigits(tempstr1);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Based on the airport-id and wind get the active runway
|
// Based on the airport-id and wind get the active runway
|
||||||
//FGRunway *r;
|
//FGRunway *r;
|
||||||
|
@ -192,54 +225,64 @@ void FGATIS::UpdateTransmission() {
|
||||||
path.append( "runways.mk4" );
|
path.append( "runways.mk4" );
|
||||||
FGRunways runways( path.c_str() );
|
FGRunways runways( path.c_str() );
|
||||||
|
|
||||||
#ifdef FG_WEATHERCM
|
#ifdef FG_WEATHERCM
|
||||||
//Set the heading to into the wind
|
//Set the heading to into the wind
|
||||||
double wind_x = stationweather.Wind[0];
|
double wind_x = stationweather.Wind[0];
|
||||||
double wind_y = stationweather.Wind[1];
|
double wind_y = stationweather.Wind[1];
|
||||||
|
|
||||||
double speed = sqrt( wind_x*wind_x + wind_y*wind_y ) * SG_METER_TO_NM / (60.0*60.0);
|
double speed = sqrt( wind_x*wind_x + wind_y*wind_y ) * SG_METER_TO_NM / (60.0*60.0);
|
||||||
double hdg;
|
double hdg;
|
||||||
|
|
||||||
//If no wind use 270degrees
|
//If no wind use 270degrees
|
||||||
if(speed == 0) {
|
if(speed == 0) {
|
||||||
hdg = 270;
|
hdg = 270;
|
||||||
transmission += " Winds light and variable";
|
transmission += " / Winds_light_and_variable";
|
||||||
} else {
|
} else {
|
||||||
// //normalize the wind to get the direction
|
// //normalize the wind to get the direction
|
||||||
//wind_x /= speed; wind_y /= speed;
|
//wind_x /= speed; wind_y /= speed;
|
||||||
|
|
||||||
hdg = - atan2 ( wind_x, wind_y ) * SG_RADIANS_TO_DEGREES ;
|
hdg = - atan2 ( wind_x, wind_y ) * SG_RADIANS_TO_DEGREES ;
|
||||||
if (hdg < 0.0)
|
if (hdg < 0.0)
|
||||||
hdg += 360.0;
|
hdg += 360.0;
|
||||||
|
|
||||||
//add a description of the wind to the transmission
|
//add a description of the wind to the transmission
|
||||||
char buf2[72];
|
char buf5[10];
|
||||||
sprintf(buf2, "%s %i %s %i %s", " Winds ", int(speed), " knots from ", int(hdg), " degrees");
|
char buf6[10];
|
||||||
transmission += buf2;
|
sprintf(buf5, "%i", int(speed));
|
||||||
|
sprintf(buf6, "%i", int(hdg));
|
||||||
|
tempstr1 = buf5;
|
||||||
|
tempstr2 = buf6;
|
||||||
|
transmission = transmission + " / Winds " + ConvertNumToSpokenDigits(tempstr1) + " knots from "
|
||||||
|
+ ConvertNumToSpokenDigits(tempstr2) + " degrees";
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
double speed = stationweather.get_wind_speed_kt();
|
double speed = stationweather.get_wind_speed_kt();
|
||||||
double hdg = stationweather.get_wind_from_heading_deg();
|
double hdg = stationweather.get_wind_from_heading_deg();
|
||||||
if (speed == 0) {
|
if (speed == 0) {
|
||||||
transmission += " Winds light and variable";
|
transmission += " / Winds_light_and_variable";
|
||||||
} else {
|
} else {
|
||||||
// FIXME: get gust factor in somehow
|
// FIXME: get gust factor in somehow
|
||||||
char buf2[72];
|
char buf5[10];
|
||||||
sprintf(buf2, "%s %i %s %i %s", " Winds ", int(speed),
|
char buf6[10];
|
||||||
" knots from ", int(hdg), " degrees");
|
sprintf(buf5, "%i", int(speed));
|
||||||
transmission += buf2;
|
sprintf(buf6, "%i", int(hdg));
|
||||||
|
tempstr1 = buf5;
|
||||||
|
tempstr2 = buf6;
|
||||||
|
transmission = transmission + " / Winds " + ConvertNumToSpokenDigits(tempstr1) + " knots from "
|
||||||
|
+ ConvertNumToSpokenDigits(tempstr2) + " degrees";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
string rwy_no = runways.search(ident, int(hdg));
|
string rwy_no = runways.search(ident, int(hdg));
|
||||||
if(rwy_no != (string)"NN") {
|
if(rwy_no != (string)"NN") {
|
||||||
transmission += " Landing and departing runway ";
|
transmission += " / Landing_and_departing_runway ";
|
||||||
transmission += rwy_no;
|
transmission += ConvertRwyNumToSpokenString(atoi(rwy_no.c_str()));
|
||||||
//cout << "in atis.cxx, r.rwy_no = " << rwy_no << " r.id = " << r->id << " r.heading = " << r->heading << endl;
|
//cout << "in atis.cxx, r.rwy_no = " << rwy_no << " r.id = " << r->id << " r.heading = " << r->heading << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Anything else?
|
// Anything else?
|
||||||
|
|
||||||
transmission += " Advise controller on initial contact you have ";
|
transmission += " / Advise_controller_on_initial_contact_you_have ";
|
||||||
transmission += phonetic_id_string;
|
transmission += phonetic_id_string;
|
||||||
|
transmission += " /// ";
|
||||||
}
|
}
|
||||||
|
|
192
src/ATC/atis.hxx
192
src/ATC/atis.hxx
|
@ -33,14 +33,14 @@
|
||||||
|
|
||||||
#ifdef SG_HAVE_STD_INCLUDES
|
#ifdef SG_HAVE_STD_INCLUDES
|
||||||
# include <istream>
|
# include <istream>
|
||||||
#include <iomanip>
|
# include <iomanip>
|
||||||
#elif defined( SG_HAVE_NATIVE_SGI_COMPILERS )
|
#elif defined( SG_HAVE_NATIVE_SGI_COMPILERS )
|
||||||
# include <iostream.h>
|
# include <iostream.h>
|
||||||
#elif defined( __BORLANDC__ ) || (__APPLE__)
|
#elif defined( __BORLANDC__ ) || (__APPLE__)
|
||||||
# include <iostream>
|
# include <iostream>
|
||||||
#else
|
#else
|
||||||
# include <istream.h>
|
# include <istream.h>
|
||||||
#include <iomanip.h>
|
# include <iomanip.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ! defined( SG_HAVE_NATIVE_SGI_COMPILERS )
|
#if ! defined( SG_HAVE_NATIVE_SGI_COMPILERS )
|
||||||
|
@ -58,130 +58,130 @@ SG_USING_STD(string);
|
||||||
|
|
||||||
class FGATIS : public FGATC {
|
class FGATIS : public FGATC {
|
||||||
|
|
||||||
char type;
|
char type;
|
||||||
double lon, lat;
|
double lon, lat;
|
||||||
double elev;
|
double elev;
|
||||||
double x, y, z;
|
double x, y, z;
|
||||||
int freq;
|
int freq;
|
||||||
int range;
|
int range;
|
||||||
bool display; // Flag to indicate whether we should be outputting to the ATC display.
|
bool display; // Flag to indicate whether we should be outputting to the ATC display.
|
||||||
bool displaying; // Flag to indicate whether we are outputting to the ATC display.
|
bool displaying; // Flag to indicate whether we are outputting to the ATC display.
|
||||||
string ident; // Code of the airport its at.
|
string ident; // Code of the airport its at.
|
||||||
string name; // Name transmitted in the broadcast.
|
string name; // Name transmitted in the broadcast.
|
||||||
string transmission; // The actual ATIS transmission
|
string transmission; // The actual ATIS transmission
|
||||||
// This is not stored in default.atis but is generated
|
// This is not stored in default.atis but is generated
|
||||||
// from the prevailing conditions when required.
|
// from the prevailing conditions when required.
|
||||||
|
|
||||||
// for failure modeling
|
// for failure modeling
|
||||||
string trans_ident; // transmitted ident
|
string trans_ident; // transmitted ident
|
||||||
bool atis_failed; // atis failed?
|
bool atis_failed; // atis failed?
|
||||||
|
|
||||||
// Aircraft position
|
// Aircraft position
|
||||||
// ATIS is actually a special case in that unlike other ATC eg.tower it doesn't actually know about
|
// ATIS is actually a special case in that unlike other ATC eg.tower it doesn't actually know about
|
||||||
// or the whereabouts of the aircraft it is transmitting to. However, to ensure consistancy of
|
// or the whereabouts of the aircraft it is transmitting to. However, to ensure consistancy of
|
||||||
// operation with the other ATC classes the ATIS class must calculate range to the aircraft in order
|
// operation with the other ATC classes the ATIS class must calculate range to the aircraft in order
|
||||||
// to decide whether to render the transmission - hence the users plane details must be stored.
|
// to decide whether to render the transmission - hence the users plane details must be stored.
|
||||||
//SGPropertyNode *airplane_lon_node;
|
//SGPropertyNode *airplane_lon_node;
|
||||||
//SGPropertyNode *airplane_lat_node;
|
//SGPropertyNode *airplane_lat_node;
|
||||||
//SGPropertyNode *airplane_elev_node;
|
//SGPropertyNode *airplane_elev_node;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
FGATIS(void);
|
FGATIS(void);
|
||||||
~FGATIS(void);
|
~FGATIS(void);
|
||||||
|
|
||||||
//run the ATIS instance
|
//run the ATIS instance
|
||||||
void Update(void);
|
void Update(void);
|
||||||
|
|
||||||
//Indicate that this instance should be outputting to the ATC display
|
//Indicate that this instance should be outputting to the ATC display
|
||||||
inline void SetDisplay(void) {display = true;}
|
inline void SetDisplay(void) {display = true;}
|
||||||
|
|
||||||
//Indicate that this instance should not be outputting to the ATC display
|
//Indicate that this instance should not be outputting to the ATC display
|
||||||
inline void SetNoDisplay(void) {display = false;}
|
inline void SetNoDisplay(void) {display = false;}
|
||||||
|
|
||||||
inline char get_type() const { return type; }
|
inline char get_type() const { return type; }
|
||||||
inline double get_lon() const { return lon; }
|
inline double get_lon() const { return lon; }
|
||||||
inline double get_lat() const { return lat; }
|
inline double get_lat() const { return lat; }
|
||||||
inline double get_elev() const { return elev; }
|
inline double get_elev() const { return elev; }
|
||||||
inline double get_x() const { return x; }
|
inline double get_x() const { return x; }
|
||||||
inline double get_y() const { return y; }
|
inline double get_y() const { return y; }
|
||||||
inline double get_z() const { return z; }
|
inline double get_z() const { return z; }
|
||||||
inline int get_freq() const { return freq; }
|
inline int get_freq() const { return freq; }
|
||||||
inline int get_range() const { return range; }
|
inline int get_range() const { return range; }
|
||||||
inline const char* GetIdent() { return ident.c_str(); }
|
inline const char* GetIdent() { return ident.c_str(); }
|
||||||
inline string get_trans_ident() { return trans_ident; }
|
inline string get_trans_ident() { return trans_ident; }
|
||||||
inline atc_type GetType() { return ATIS; }
|
inline atc_type GetType() { return ATIS; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//Update the transmission string
|
//Update the transmission string
|
||||||
void UpdateTransmission(void);
|
void UpdateTransmission(void);
|
||||||
|
|
||||||
/* inline void set_type( char t ) { type = t; }
|
/* inline void set_type( char t ) { type = t; }
|
||||||
inline void set_lon( double l ) { lon = l; }
|
inline void set_lon( double l ) { lon = l; }
|
||||||
inline void set_lat( double l ) { lat = l; }
|
inline void set_lat( double l ) { lat = l; }
|
||||||
inline void set_elev( double e ) { elev = e; }
|
inline void set_elev( double e ) { elev = e; }
|
||||||
inline void set_freq( int f ) { freq = f; }
|
inline void set_freq( int f ) { freq = f; }
|
||||||
inline void set_range( int r ) { range = r; }
|
inline void set_range( int r ) { range = r; }
|
||||||
inline void set_dme( bool b ) { dme = b; }
|
inline void set_dme( bool b ) { dme = b; }
|
||||||
inline void set_ident( char *i ) { strncpy( ident, i, 5 ); } */
|
inline void set_ident( char *i ) { strncpy( ident, i, 5 ); } */
|
||||||
|
|
||||||
friend istream& operator>> ( istream&, FGATIS& );
|
friend istream& operator>> ( istream&, FGATIS& );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
inline istream&
|
inline istream&
|
||||||
operator >> ( istream& in, FGATIS& a )
|
operator >> ( istream& in, FGATIS& a )
|
||||||
{
|
{
|
||||||
double f;
|
double f;
|
||||||
char ch;
|
char ch;
|
||||||
|
|
||||||
static bool first_time = true;
|
static bool first_time = true;
|
||||||
static double julian_date = 0;
|
static double julian_date = 0;
|
||||||
static const double MJD0 = 2415020.0;
|
static const double MJD0 = 2415020.0;
|
||||||
if ( first_time ) {
|
if ( first_time ) {
|
||||||
julian_date = sgTimeCurrentMJD(0, 0) + MJD0;
|
julian_date = sgTimeCurrentMJD(0, 0) + MJD0;
|
||||||
first_time = false;
|
first_time = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
in >> a.type;
|
in >> a.type;
|
||||||
|
|
||||||
if ( a.type == '[' )
|
if ( a.type == '[' )
|
||||||
return in >> skipeol;
|
return in >> skipeol;
|
||||||
|
|
||||||
in >> a.lat >> a.lon >> a.elev >> f >> a.range
|
in >> a.lat >> a.lon >> a.elev >> f >> a.range
|
||||||
>> a.ident;
|
>> a.ident;
|
||||||
|
|
||||||
a.name = "";
|
a.name = "";
|
||||||
in >> ch;
|
|
||||||
a.name += ch;
|
|
||||||
while(1) {
|
|
||||||
//in >> noskipws
|
|
||||||
in.unsetf(ios::skipws);
|
|
||||||
in >> ch;
|
in >> ch;
|
||||||
a.name += ch;
|
a.name += ch;
|
||||||
if((ch == '"') || (ch == 0x0A)) {
|
while(1) {
|
||||||
break;
|
//in >> noskipws
|
||||||
} // we shouldn't need the 0x0A but it makes a nice safely in case someone leaves off the "
|
in.unsetf(ios::skipws);
|
||||||
}
|
in >> ch;
|
||||||
in.setf(ios::skipws);
|
a.name += ch;
|
||||||
//cout << "atis.name = " << a.name << '\n';
|
if((ch == '"') || (ch == 0x0A)) {
|
||||||
|
break;
|
||||||
|
} // we shouldn't need the 0x0A but it makes a nice safely in case someone leaves off the "
|
||||||
|
}
|
||||||
|
in.setf(ios::skipws);
|
||||||
|
//cout << "atis.name = " << a.name << '\n';
|
||||||
|
|
||||||
a.freq = (int)(f*100.0 + 0.5);
|
a.freq = (int)(f*100.0 + 0.5);
|
||||||
|
|
||||||
// cout << a.ident << endl;
|
// cout << a.ident << endl;
|
||||||
|
|
||||||
// generate cartesian coordinates
|
// generate cartesian coordinates
|
||||||
Point3D geod( a.lon * SGD_DEGREES_TO_RADIANS, a.lat * SGD_DEGREES_TO_RADIANS, a.elev );
|
Point3D geod( a.lon * SGD_DEGREES_TO_RADIANS, a.lat * SGD_DEGREES_TO_RADIANS, a.elev );
|
||||||
Point3D cart = sgGeodToCart( geod );
|
Point3D cart = sgGeodToCart( geod );
|
||||||
a.x = cart.x();
|
a.x = cart.x();
|
||||||
a.y = cart.y();
|
a.y = cart.y();
|
||||||
a.z = cart.z();
|
a.z = cart.z();
|
||||||
|
|
||||||
a.trans_ident = a.ident;
|
a.trans_ident = a.ident;
|
||||||
a.atis_failed = false;
|
a.atis_failed = false;
|
||||||
|
|
||||||
return in >> skipeol;
|
return in >> skipeol;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _FG_ATIS_HXX
|
#endif // _FG_ATIS_HXX
|
||||||
|
|
Loading…
Reference in a new issue