+ n.has_dme = true;
+ } else {
+ n.has_dme = false;
+ }
+
+ // Calculate the magvar from true north.
+ // cout << "Calculating magvar for navaid " << n.ident << endl;
+ if (magvar_s == "XXX") {
+ // default to mag var as of 1990-01-01 (Julian 2447892.5)
+ // cout << "lat = " << n.lat << " lon = " << n.lon << " elev_ft = "
+ // << n.elev_ft << " JD = "
+ // << julian_date << endl;
+ n.magvar = sgGetMagVar( n.lon * SGD_DEGREES_TO_RADIANS,
+ n.lat * SGD_DEGREES_TO_RADIANS,
+ n.elev_ft * SG_FEET_TO_METER,
+ julian_date )
+ * SGD_RADIANS_TO_DEGREES;
+ // cout << "Default variation at " << n.lon << ',' << n.lat
+ // << " is " << var << endl;
+#if 0
+ // I don't know what this is for - CLO 1 Feb 2001
+ if (var - int(var) >= 0.5)
+ n.magvar = int(var) + 1;
+ else if (var - int(var) <= -0.5)
+ n.magvar = int(var) - 1;
+ else
+ n.magvar = int(var);
+#endif
+ // cout << "Defaulted to magvar of " << n.magvar << endl;