From: James Turner Date: Thu, 17 Jun 2010 20:39:10 +0000 (+0100) Subject: Extend Magvar interface to use SGGeod. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b846e33ee398025f179d4357345a5be7587aa728;p=simgear.git Extend Magvar interface to use SGGeod. --- diff --git a/simgear/magvar/magvar.cxx b/simgear/magvar/magvar.cxx index 095c9718..2744e20e 100644 --- a/simgear/magvar/magvar.cxx +++ b/simgear/magvar/magvar.cxx @@ -50,7 +50,7 @@ void SGMagVar::update( double lon, double lat, double alt_m, double jd ) { void SGMagVar::update( const SGGeod& geod, double jd ) { - update(geod.getLongitudeDeg(), geod.getLatitudeDeg(), + update(geod.getLongitudeRad(), geod.getLatitudeRad(), geod.getElevationM(), jd); } @@ -62,3 +62,10 @@ double sgGetMagVar( double lon, double lat, double alt_m, double jd ) { double field[6]; return calc_magvar( lat, lon, alt_m / 1000.0, (long)jd, field ); } + +double sgGetMagVar( const SGGeod& pos, double jd ) +{ + return sgGetMagVar(pos.getLongitudeRad(), pos.getLatitudeRad(), + pos.getElevationM(), jd); +} + diff --git a/simgear/magvar/magvar.hxx b/simgear/magvar/magvar.hxx index 6a97e5ea..605bece7 100644 --- a/simgear/magvar/magvar.hxx +++ b/simgear/magvar/magvar.hxx @@ -103,5 +103,9 @@ public: */ double sgGetMagVar( double lon, double lat, double alt_m, double jd ); +/** + * overload version of the above to take a SGGeod + */ +double sgGetMagVar( const SGGeod& pos, double jd ); #endif // _MAGVAR_HXX