From b846e33ee398025f179d4357345a5be7587aa728 Mon Sep 17 00:00:00 2001 From: James Turner Date: Thu, 17 Jun 2010 21:39:10 +0100 Subject: [PATCH] Extend Magvar interface to use SGGeod. --- simgear/magvar/magvar.cxx | 9 ++++++++- simgear/magvar/magvar.hxx | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) 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 -- 2.39.5