X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FNetwork%2Fatlas.cxx;h=4a2cd9d64911be983546731be43460db784e7d11;hb=a61f34667fdb43198f707e719f56f5bbaf2fb7b5;hp=f0738a12f208e42ed3ab8009a8b11353c4b3861a;hpb=157eb857ef36636a316947fe1eb3d9a8bea1959b;p=flightgear.git diff --git a/src/Network/atlas.cxx b/src/Network/atlas.cxx index f0738a12f..4a2cd9d64 100644 --- a/src/Network/atlas.cxx +++ b/src/Network/atlas.cxx @@ -24,14 +24,14 @@ # include "config.h" #endif +#include + #include #include #include +#include - - - -#include +#include #include
#include
#include
@@ -40,9 +40,11 @@ FGAtlas::FGAtlas() { + fdm = new FlightProperties; } FGAtlas::~FGAtlas() { + delete fdm; } @@ -65,7 +67,6 @@ static char calc_atlas_cksum(char *sentence) { return sum; } - // generate Atlas message bool FGAtlas::gen_message() { // cout << "generating atlas message" << endl; @@ -94,7 +95,7 @@ bool FGAtlas::gen_message() { t->getGmt()->tm_hour, t->getGmt()->tm_min, t->getGmt()->tm_sec ); char lat[20]; - double latd = cur_fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES; + double latd = fdm->get_Latitude() * SGD_RADIANS_TO_DEGREES; if ( latd < 0.0 ) { latd *= -1.0; dir = 'S'; @@ -106,7 +107,7 @@ bool FGAtlas::gen_message() { sprintf( lat, "%02d%06.3f,%c", abs(deg), min, dir); char lon[20]; - double lond = cur_fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES; + double lond = fdm->get_Longitude() * SGD_RADIANS_TO_DEGREES; if ( lond < 0.0 ) { lond *= -1.0; dir = 'W'; @@ -118,17 +119,17 @@ bool FGAtlas::gen_message() { sprintf( lon, "%03d%06.3f,%c", abs(deg), min, dir); char speed[10]; - sprintf( speed, "%05.1f", cur_fdm_state->get_V_equiv_kts() ); + sprintf( speed, "%05.1f", fdm->get_V_equiv_kts() ); char heading[10]; - sprintf( heading, "%05.1f", cur_fdm_state->get_Psi() * SGD_RADIANS_TO_DEGREES ); + sprintf( heading, "%05.1f", fdm->get_Psi() * SGD_RADIANS_TO_DEGREES ); char altitude_m[10]; sprintf( altitude_m, "%02d", - (int)(cur_fdm_state->get_Altitude() * SG_FEET_TO_METER) ); + (int)(fdm->get_Altitude() * SG_FEET_TO_METER) ); char altitude_ft[10]; - sprintf( altitude_ft, "%02d", (int)cur_fdm_state->get_Altitude() ); + sprintf( altitude_ft, "%02d", (int)fdm->get_Altitude() ); char date[10]; sprintf( date, "%02d%02d%02d", t->getGmt()->tm_mday, @@ -275,7 +276,7 @@ bool FGAtlas::parse_message() { lat *= -1; } - cur_fdm_state->set_Latitude( lat * SGD_DEGREES_TO_RADIANS ); + fdm->set_Latitude( lat * SGD_DEGREES_TO_RADIANS ); SG_LOG( SG_IO, SG_INFO, " lat = " << lat ); // lon val @@ -304,17 +305,17 @@ bool FGAtlas::parse_message() { lon *= -1; } - cur_fdm_state->set_Longitude( lon * SGD_DEGREES_TO_RADIANS ); + fdm->set_Longitude( lon * SGD_DEGREES_TO_RADIANS ); SG_LOG( SG_IO, SG_INFO, " lon = " << lon ); #if 0 double sl_radius, lat_geoc; - sgGeodToGeoc( cur_fdm_state->get_Latitude(), - cur_fdm_state->get_Altitude(), + sgGeodToGeoc( fdm->get_Latitude(), + fdm->get_Altitude(), &sl_radius, &lat_geoc ); - cur_fdm_state->set_Geocentric_Position( lat_geoc, - cur_fdm_state->get_Longitude(), - sl_radius + cur_fdm_state->get_Altitude() ); + fdm->set_Geocentric_Position( lat_geoc, + fdm->get_Longitude(), + sl_radius + fdm->get_Altitude() ); #endif // speed @@ -326,8 +327,8 @@ bool FGAtlas::parse_message() { string speed_str = msg.substr(begin, end - begin); begin = end + 1; speed = atof( speed_str.c_str() ); - cur_fdm_state->set_V_calibrated_kts( speed ); - // cur_fdm_state->set_V_ground_speed( speed ); + fdm->set_V_calibrated_kts( speed ); + // fdm->set_V_ground_speed( speed ); SG_LOG( SG_IO, SG_INFO, " speed = " << speed ); // heading @@ -339,8 +340,8 @@ bool FGAtlas::parse_message() { string hdg_str = msg.substr(begin, end - begin); begin = end + 1; heading = atof( hdg_str.c_str() ); - cur_fdm_state->set_Euler_Angles( cur_fdm_state->get_Phi(), - cur_fdm_state->get_Theta(), + fdm->set_Euler_Angles( fdm->get_Phi(), + fdm->get_Theta(), heading * SGD_DEGREES_TO_RADIANS ); SG_LOG( SG_IO, SG_INFO, " heading = " << heading ); } else if ( sentence == "GPGGA" ) { @@ -380,7 +381,7 @@ bool FGAtlas::parse_message() { lat *= -1; } - // cur_fdm_state->set_Latitude( lat * SGD_DEGREES_TO_RADIANS ); + // fdm->set_Latitude( lat * SGD_DEGREES_TO_RADIANS ); SG_LOG( SG_IO, SG_INFO, " lat = " << lat ); // lon val @@ -409,7 +410,7 @@ bool FGAtlas::parse_message() { lon *= -1; } - // cur_fdm_state->set_Longitude( lon * SGD_DEGREES_TO_RADIANS ); + // fdm->set_Longitude( lon * SGD_DEGREES_TO_RADIANS ); SG_LOG( SG_IO, SG_INFO, " lon = " << lon ); // junk @@ -465,7 +466,7 @@ bool FGAtlas::parse_message() { altitude *= SG_METER_TO_FEET; } - cur_fdm_state->set_Altitude( altitude ); + fdm->set_Altitude( altitude ); SG_LOG( SG_IO, SG_INFO, " altitude = " << altitude );