-// magvar.hxx -- compute local magnetic variation given position,
-// altitude, and date
+// magvar.hxx -- magnetic variation wrapper class
//
-// This is an implimentation of the NIMA WMM 2000
+// Written by Curtis Olson, started July 2000.
//
-// http://www.nima.mil/GandG/ngdc-wmm2000.html
-//
-// Copyright (C) 2000 Edward A Williams <Ed_Williams@compuserve.com>
-//
-// Adapted from Excel 3.0 version 3/27/94 EAW
-// Recoded in C++ by Starry Chan
-// WMM95 added and rearranged in ANSI-C EAW 7/9/95
-// Put shell around program and made Borland & GCC compatible EAW 11/22/95
-// IGRF95 added 2/96 EAW
-// WMM2000 IGR2000 added 2/00 EAW
-// Released under GPL 3/26/00 EAW
-// Adaptions and modifications for the SimGear project 3/27/2000 CLO
+// Copyright (C) 2000 Curtis L. Olson - curt@flightgear.org
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// $Id$
-#ifndef SG_MAGVAR_HXX
-#define SG_MAGVAR_HXX
+#ifndef _MAGVAR_HXX
+#define _MAGVAR_HXX
+
+
+#ifndef __cplusplus
+# error This library requires C++
+#endif
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+
+class SGMagVar {
+
+private:
+ double magvar;
+ double magdip;
-/* Convert date to Julian day 1950-2049 */
-unsigned long int yymmdd_to_julian_days( int yy, int mm, int dd );
+public:
-/* Convert degrees to radians */
-double deg_to_rad( double deg );
+ SGMagVar();
+ ~SGMagVar();
-/* Convert radians to degrees */
-double rad_to_deg( double rad );
+ // recalculate the magnetic offset and dip
+ void update( double lon, double lat, double alt_m, double jd );
-/* return variation (in degrees) given geodetic latitude (radians), longitude
-(radians) ,height (km) and (Julian) date
-N and E lat and long are positive, S and W negative
-*/
-double SGMagVar( double lat, double lon, double h, long dat, double* field );
+ double get_magvar() const { return magvar; }
+ double get_magdip() const { return magdip; }
+};
-#endif // SG_MAGVAR_HXX
+#endif // _LIGHT_HXX