1
0
Fork 0

A bit of fg->sg namespace changing.

This commit is contained in:
curt 2000-09-27 20:16:22 +00:00
parent 2c59508156
commit 32528d0cd6
29 changed files with 68 additions and 56 deletions

View file

@ -33,7 +33,7 @@
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/math/fg_geodesy.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/misc/fgpath.hxx>
#include <Airports/simple.hxx>

View file

@ -31,7 +31,7 @@
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/math/fg_geodesy.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include <Cockpit/radiostack.hxx>
#include <Controls/controls.hxx>

View file

@ -72,7 +72,7 @@ FGRadioStack::~FGRadioStack() {
void FGRadioStack::update( double lon, double lat, double elev ) {
need_update = false;
Point3D aircraft = fgGeodToCart( Point3D( lon, lat, elev ) );
Point3D aircraft = sgGeodToCart( Point3D( lon, lat, elev ) );
Point3D station;
double az1, az2, s;

View file

@ -47,7 +47,7 @@ HISTORY
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/math/fg_geodesy.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/misc/fgpath.hxx>
#include <Aircraft/aircraft.hxx>
@ -181,9 +181,9 @@ int FGBalloonSim::copy_from_BalloonSim() {
double alt = temp[2] * METER_TO_FEET;
double lat_geod, tmp_alt, sl_radius1, sl_radius2, tmp_lat_geoc;
fgGeocToGeod( lat_geoc, EQUATORIAL_RADIUS_M + alt * FEET_TO_METER,
sgGeocToGeod( lat_geoc, EQUATORIAL_RADIUS_M + alt * FEET_TO_METER,
&lat_geod, &tmp_alt, &sl_radius1 );
fgGeodToGeoc( lat_geod, alt * FEET_TO_METER, &sl_radius2, &tmp_lat_geoc );
sgGeodToGeoc( lat_geod, alt * FEET_TO_METER, &sl_radius2, &tmp_lat_geoc );
FG_LOG( FG_FLIGHT, FG_DEBUG, "lon = " << lon << " lat_geod = " << lat_geod
<< " lat_geoc = " << lat_geoc

View file

@ -31,7 +31,7 @@
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/math/fg_geodesy.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/misc/fgpath.hxx>
#include <Scenery/scenery.hxx>
@ -326,9 +326,9 @@ int FGJSBsim::copy_from_JSBsim() {
double alt = FDMExec.GetPosition()->Geth();
double lat_geod, tmp_alt, sl_radius1, sl_radius2, tmp_lat_geoc;
fgGeocToGeod( lat_geoc, EQUATORIAL_RADIUS_M + alt * FEET_TO_METER,
sgGeocToGeod( lat_geoc, EQUATORIAL_RADIUS_M + alt * FEET_TO_METER,
&lat_geod, &tmp_alt, &sl_radius1 );
fgGeodToGeoc( lat_geod, alt * FEET_TO_METER, &sl_radius2, &tmp_lat_geoc );
sgGeodToGeoc( lat_geod, alt * FEET_TO_METER, &sl_radius2, &tmp_lat_geoc );
FG_LOG( FG_FLIGHT, FG_DEBUG, "lon = " << lon << " lat_geod = " << lat_geod
<< " lat_geoc = " << lat_geoc

View file

@ -21,7 +21,7 @@
// $Id$
#include <simgear/math/fg_geodesy.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/math/point3d.hxx>
#include <simgear/math/polar3d.hxx>
@ -79,7 +79,7 @@ int FGMagicCarpet::update( int multiloop ) {
// << endl;
double sl_radius, lat_geoc;
fgGeodToGeoc( get_Latitude(), get_Altitude(), &sl_radius, &lat_geoc );
sgGeodToGeoc( get_Latitude(), get_Altitude(), &sl_radius, &lat_geoc );
// update altitude
double real_climb_rate = -controls.get_elevator() * 5000; // feet/sec

View file

@ -25,7 +25,7 @@
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/math/fg_geodesy.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include <FDM/LaRCsim/ls_interface.h>
#include <Main/options.hxx>
@ -127,7 +127,7 @@ void fgFDMForceAltitude(int model, double alt_meters) {
double lat_geoc;
// Set the FG variables first
fgGeodToGeoc( base_fdm_state.get_Latitude(), alt_meters,
sgGeodToGeoc( base_fdm_state.get_Latitude(), alt_meters,
&sea_level_radius_meters, &lat_geoc);
base_fdm_state.set_Altitude( alt_meters * METER_TO_FEET );

View file

@ -49,9 +49,9 @@
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/math/fg_geodesy.hxx>
#include <simgear/math/point3d.hxx>
#include <simgear/math/polar3d.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/misc/fgpath.hxx>
#include <simgear/timing/sg_time.hxx>
@ -445,7 +445,7 @@ bool fgInitSubsystems( void ) {
/*
geod_pos = Point3D( cur_fdm_state->get_Longitude(), cur_fdm_state->get_Latitude(), 0.0);
tmp_abs_view_pos = fgGeodToCart(geod_pos);
tmp_abs_view_pos = sgGeodToCart(geod_pos);
FG_LOG( FG_GENERAL, FG_DEBUG,
"Initial abs_view_pos = " << tmp_abs_view_pos );
@ -481,7 +481,7 @@ bool fgInitSubsystems( void ) {
double sea_level_radius_meters;
double lat_geoc;
// Set the FG variables first
fgGeodToGeoc( cur_fdm_state->get_Latitude(), cur_fdm_state->get_Altitude(),
sgGeodToGeoc( cur_fdm_state->get_Latitude(), cur_fdm_state->get_Altitude(),
&sea_level_radius_meters, &lat_geoc);
cur_fdm_state->set_Geocentric_Position( lat_geoc, cur_fdm_state->get_Longitude(),
cur_fdm_state->get_Altitude() +
@ -758,7 +758,7 @@ void fgReInitSubsystems( void )
double sea_level_radius_meters;
double lat_geoc;
// Set the FG variables first
fgGeodToGeoc( cur_fdm_state->get_Latitude(), cur_fdm_state->get_Altitude(),
sgGeodToGeoc( cur_fdm_state->get_Latitude(), cur_fdm_state->get_Altitude(),
&sea_level_radius_meters, &lat_geoc);
cur_fdm_state->set_Geocentric_Position( lat_geoc, cur_fdm_state->get_Longitude(),
cur_fdm_state->get_Altitude() +

View file

@ -38,6 +38,7 @@
#include <Network/native.hxx>
#include <Network/garmin.hxx>
#include <Network/nmea.hxx>
#include <Network/props.hxx>
#include <Network/pve.hxx>
#include <Network/ray.hxx>
#include <Network/rul.hxx>
@ -81,6 +82,9 @@ static FGProtocol *parse_port_config( const string& config )
} else if ( protocol == "nmea" ) {
FGNMEA *nmea = new FGNMEA;
io = nmea;
} else if ( protocol == "props" ) {
FGProps *props = new FGProps;
io = props;
} else if ( protocol == "pve" ) {
FGPVE *pve = new FGPVE;
io = pve;

View file

@ -66,7 +66,6 @@
#include <simgear/constants.h> // for VERSION
#include <simgear/debug/logstream.hxx>
#include <simgear/math/fg_geodesy.hxx>
#include <simgear/math/polar3d.hxx>
#include <simgear/math/fg_random.h>
#include <simgear/misc/fgpath.hxx>

View file

@ -829,6 +829,8 @@ int fgOPTIONS::parse_option( const string& arg ) {
parse_channel( "garmin", arg.substr(9) );
} else if ( arg.find( "--nmea=" ) != string::npos ) {
parse_channel( "nmea", arg.substr(7) );
} else if ( arg.find( "--props=" ) != string::npos ) {
parse_channel( "props", arg.substr(8) );
} else if ( arg.find( "--pve=" ) != string::npos ) {
parse_channel( "pve", arg.substr(6) );
} else if ( arg.find( "--ray=" ) != string::npos ) {

View file

@ -213,7 +213,7 @@ void FGView::UpdateViewMath( const FGInterface& f ) {
f.get_Lat_geocentric(),
f.get_Sea_level_radius() * FEET_TO_METER );
cur_zero_elev = fgPolarToCart3d(p) - scenery.center;
cur_zero_elev = sgPolarToCart3d(p) - scenery.center;
// calculate view position in current FG view coordinate system
// p.lon & p.lat are already defined earlier, p.radius was set to
@ -225,7 +225,7 @@ void FGView::UpdateViewMath( const FGInterface& f ) {
p.setz( p.radius() + scenery.cur_elev + 0.5 * METER_TO_FEET );
}
abs_view_pos = fgPolarToCart3d(p);
abs_view_pos = sgPolarToCart3d(p);
view_pos = abs_view_pos - scenery.center;
@ -286,7 +286,7 @@ void FGView::UpdateViewMath( const FGInterface& f ) {
// Alternative method to Derive local up vector based on
// *geodetic* coordinates
// alt_up = fgPolarToCart(FG_Longitude, FG_Latitude, 1.0);
// alt_up = sgPolarToCart(FG_Longitude, FG_Latitude, 1.0);
// printf( " Alt Up = (%.4f, %.4f, %.4f)\n",
// alt_up.x, alt_up.y, alt_up.z);

View file

@ -23,7 +23,7 @@
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/fgstream.hxx>
#include <simgear/math/fg_geodesy.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include "fixlist.hxx"

View file

@ -26,7 +26,7 @@
#include <simgear/compiler.h>
#include <simgear/math/fg_geodesy.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/misc/fgstream.hxx>
#ifdef FG_HAVE_STD_INCLUDES
@ -136,7 +136,7 @@ operator >> ( istream& in, FGILS& i )
Point3D geod, cart;
geod = Point3D( i.loclon * DEG_TO_RAD, i.loclat * DEG_TO_RAD, i.gselev );
cart = fgGeodToCart( geod );
cart = sgGeodToCart( geod );
i.x = cart.x();
i.y = cart.y();
i.z = cart.z();
@ -147,7 +147,7 @@ operator >> ( istream& in, FGILS& i )
i.has_gs = true;
geod = Point3D( i.gslon * DEG_TO_RAD, i.gslat * DEG_TO_RAD, i.gselev );
cart = fgGeodToCart( geod );
cart = sgGeodToCart( geod );
i.gs_x = cart.x();
i.gs_y = cart.y();
i.gs_z = cart.z();
@ -160,7 +160,7 @@ operator >> ( istream& in, FGILS& i )
i.has_dme = true;
geod = Point3D( i.dmelon * DEG_TO_RAD, i.dmelat * DEG_TO_RAD, i.gselev);
cart = fgGeodToCart( geod );
cart = sgGeodToCart( geod );
i.dme_x = cart.x();
i.dme_y = cart.y();
i.dme_z = cart.z();

View file

@ -23,7 +23,7 @@
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/fgstream.hxx>
#include <simgear/math/fg_geodesy.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include "ilslist.hxx"
@ -117,7 +117,7 @@ bool FGILSList::query( double lon, double lat, double elev, double freq,
ils_list_iterator last = stations.end();
// double az1, az2, s;
Point3D aircraft = fgGeodToCart( Point3D(lon, lat, elev) );
Point3D aircraft = sgGeodToCart( Point3D(lon, lat, elev) );
Point3D station;
double d;
for ( ; current != last ; ++current ) {

View file

@ -26,7 +26,7 @@
#include <simgear/compiler.h>
#include <simgear/math/fg_geodesy.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/misc/fgstream.hxx>
#ifdef FG_HAVE_STD_INCLUDES
@ -102,7 +102,7 @@ operator >> ( istream& in, FGNav& n )
// generate cartesian coordinates
Point3D geod( n.lon * DEG_TO_RAD, n.lat * DEG_TO_RAD, n.elev );
Point3D cart = fgGeodToCart( geod );
Point3D cart = sgGeodToCart( geod );
n.x = cart.x();
n.y = cart.y();
n.z = cart.z();

View file

@ -23,7 +23,7 @@
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/fgstream.hxx>
#include <simgear/math/fg_geodesy.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include "navlist.hxx"
@ -119,7 +119,7 @@ bool FGNavList::query( double lon, double lat, double elev, double freq,
nav_list_iterator last = stations.end();
// double az1, az2, s;
Point3D aircraft = fgGeodToCart( Point3D(lon, lat, elev) );
Point3D aircraft = sgGeodToCart( Point3D(lon, lat, elev) );
Point3D station;
double d;
for ( ; current != last ; ++current ) {

View file

@ -22,7 +22,7 @@
#include <simgear/debug/logstream.hxx>
#include <simgear/math/fg_geodesy.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/io/iochannel.hxx>
#include <FDM/flight.hxx>
@ -269,7 +269,7 @@ bool FGGarmin::parse_message() {
FG_LOG( FG_IO, FG_INFO, " lon = " << lon );
double sl_radius, lat_geoc;
fgGeodToGeoc( cur_fdm_state->get_Latitude(),
sgGeodToGeoc( cur_fdm_state->get_Latitude(),
cur_fdm_state->get_Altitude(),
&sl_radius, &lat_geoc );
cur_fdm_state->set_Geocentric_Position( lat_geoc,

View file

@ -22,7 +22,6 @@
#include <simgear/debug/logstream.hxx>
#include <simgear/math/fg_geodesy.hxx>
#include <simgear/io/iochannel.hxx>
#include "native.hxx"

View file

@ -22,7 +22,7 @@
#include <simgear/debug/logstream.hxx>
#include <simgear/math/fg_geodesy.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/io/iochannel.hxx>
#include <FDM/flight.hxx>
@ -274,7 +274,7 @@ bool FGNMEA::parse_message() {
FG_LOG( FG_IO, FG_INFO, " lon = " << lon );
double sl_radius, lat_geoc;
fgGeodToGeoc( cur_fdm_state->get_Latitude(),
sgGeodToGeoc( cur_fdm_state->get_Latitude(),
cur_fdm_state->get_Altitude(),
&sl_radius, &lat_geoc );
cur_fdm_state->set_Geocentric_Position( lat_geoc,

View file

@ -60,6 +60,7 @@ bool FGProps::open() {
bool FGProps::process_command( const char *cmd ) {
cout << "processing command = " << cmd << endl;
string_list tokens;
tokens.clear();
@ -76,6 +77,8 @@ bool FGProps::process_command( const char *cmd ) {
if ( command == "ls" ) {
}
return true;
}
@ -83,11 +86,17 @@ bool FGProps::process_command( const char *cmd ) {
bool FGProps::process() {
SGIOChannel *io = get_io_channel();
cout << "processing incoming props command" << endl;
if ( get_direction() == SG_IO_BI ) {
cout << " (bi directional)" << endl;
while ( io->read( buf, max_cmd_len ) > 0 ) {
FG_LOG( FG_IO, FG_ALERT, "Success reading data." );
process_command( buf );
}
} else {
FG_LOG( FG_IO, FG_ALERT,
"in or out direction not supported for FGProps." );
}
return true;

View file

@ -22,8 +22,9 @@
#include <stdio.h> // sprintf()
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/math/fg_geodesy.hxx>
#include <simgear/io/iochannel.hxx>
#include <FDM/flight.hxx>

View file

@ -24,7 +24,6 @@
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/io/iochannel.hxx>
#include <simgear/math/fg_geodesy.hxx>
#include <FDM/flight.hxx>

View file

@ -24,9 +24,9 @@
#include <stdio.h> // sprintf()
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/io/iochannel.hxx>
#include <simgear/math/fg_geodesy.hxx>
#include <FDM/flight.hxx>

View file

@ -46,10 +46,10 @@
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/math/fg_geodesy.hxx>
#include <simgear/math/fg_random.h>
#include <simgear/math/point3d.hxx>
#include <simgear/math/polar3d.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/misc/fgstream.hxx>
#include <simgear/misc/stopwatch.hxx>
#include <simgear/misc/texcoord.hxx>
@ -107,7 +107,7 @@ static Point3D local_calc_tex_coords(const Point3D& node, const Point3D& ref) {
node[1] + ref.y(),
node[2] + ref.z() );
pp = fgCartToPolar3d(cp);
pp = sgCartToPolar3d(cp);
// tmplon = pp.lon() * RAD_TO_DEG;
// tmplat = pp.lat() * RAD_TO_DEG;
@ -165,7 +165,7 @@ ssgBranch *fgGenTile( const string& path, FGTileEntry *t) {
double height = b.get_height();
double width = b.get_width();
Point3D center = fgGeodToCart(Point3D(clon*DEG_TO_RAD,clat*DEG_TO_RAD,0.0));
Point3D center = sgGeodToCart(Point3D(clon*DEG_TO_RAD,clat*DEG_TO_RAD,0.0));
t->center = center;
// cout << "center = " << center << endl;;
@ -186,7 +186,7 @@ ssgBranch *fgGenTile( const string& path, FGTileEntry *t) {
Point3D cart[4], rel[4];
t->nodes.clear();
for ( i = 0; i < 4; ++i ) {
cart[i] = fgGeodToCart(rad[i]);
cart[i] = sgGeodToCart(rad[i]);
rel[i] = cart[i] - center;
t->nodes.push_back( rel[i] );
// cout << "corner " << i << " = " << cart[i] << endl;

View file

@ -34,9 +34,9 @@
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/math/fg_geodesy.hxx>
#include <simgear/math/point3d.hxx>
#include <simgear/math/polar3d.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/math/vector.hxx>
// #include <Aircraft/aircraft.hxx>
@ -177,9 +177,9 @@ FGTileMgr::current_elev_ssg( const Point3D& abs_view_pos,
int hitcount = hit_list.num_hits();
for ( int i = 0; i < hitcount; ++i ) {
geoc = fgCartToPolar3d( scenery.center + hit_list.get_point(i) );
geoc = sgCartToPolar3d( scenery.center + hit_list.get_point(i) );
double lat_geod, alt, sea_level_r;
fgGeocToGeod(geoc.lat(), geoc.radius(), &lat_geod,
sgGeocToGeod(geoc.lat(), geoc.radius(), &lat_geod,
&alt, &sea_level_r);
if ( alt > result && alt < 10000 ) {
result = alt;
@ -464,7 +464,7 @@ int FGTileMgr::update( double lon, double lat ) {
Point3D geod_pos = Point3D( longitude * DEG_TO_RAD,
latitude * DEG_TO_RAD,
0.0);
Point3D tmp_abs_view_pos = fgGeodToCart( geod_pos );
Point3D tmp_abs_view_pos = sgGeodToCart( geod_pos );
scenery.center = tmp_abs_view_pos;
// cout << "abs_view_pos = " << tmp_abs_view_pos << endl;
prep_ssg_nodes();

View file

@ -50,7 +50,6 @@ FG_USING_STD(string);
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/math/fg_geodesy.hxx>
#include <simgear/math/interpolater.hxx>
#include <simgear/math/polar3d.hxx>
#include <simgear/misc/fgpath.hxx>

View file

@ -54,9 +54,9 @@
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/ephemeris/ephemeris.hxx>
#include <simgear/math/fg_geodesy.hxx>
#include <simgear/math/point3d.hxx>
#include <simgear/math/polar3d.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/math/vector.hxx>
#include <Main/globals.hxx>
@ -350,10 +350,10 @@ void fgUpdateMoonPos( void ) {
// fgMoonPosition(t->cur_time, &l->moon_lon, &moon_gd_lat);
fgMoonPositionGST(t->getGst(), &l->moon_lon, &moon_gd_lat);
fgGeodToGeoc(moon_gd_lat, 0.0, &sl_radius, &l->moon_gc_lat);
sgGeodToGeoc(moon_gd_lat, 0.0, &sl_radius, &l->moon_gc_lat);
p = Point3D( l->moon_lon, l->moon_gc_lat, sl_radius );
l->fg_moonpos = fgPolarToCart3d(p);
l->fg_moonpos = sgPolarToCart3d(p);
FG_LOG( FG_EVENT, FG_INFO, " t->cur_time = " << t->get_cur_time() );
FG_LOG( FG_EVENT, FG_INFO,

View file

@ -56,9 +56,9 @@
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/ephemeris/ephemeris.hxx>
#include <simgear/math/fg_geodesy.hxx>
#include <simgear/math/point3d.hxx>
#include <simgear/math/polar3d.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/math/vector.hxx>
#include <Main/globals.hxx>
@ -67,7 +67,7 @@
#include "sunpos.hxx"
#undef E
// #undef E // should no longer be needed
#define MeanObliquity (23.440592*(FG_2PI/360))
static void ecliptic_to_equatorial(double, double, double *, double *);
@ -258,10 +258,10 @@ void fgUpdateSunPos( void ) {
fgSunPositionGST(t->getGst(), &l->sun_lon, &sun_gd_lat);
fgGeodToGeoc(sun_gd_lat, 0.0, &sl_radius, &l->sun_gc_lat);
sgGeodToGeoc(sun_gd_lat, 0.0, &sl_radius, &l->sun_gc_lat);
p = Point3D( l->sun_lon, l->sun_gc_lat, sl_radius );
l->fg_sunpos = fgPolarToCart3d(p);
l->fg_sunpos = sgPolarToCart3d(p);
FG_LOG( FG_EVENT, FG_INFO, " t->cur_time = " << t->get_cur_time() );
FG_LOG( FG_EVENT, FG_INFO,