]> git.mxchange.org Git - flightgear.git/blobdiff - src/Time/sunsolver.cxx
Provide an initial heuristic for airports for which we haven't collected any usage...
[flightgear.git] / src / Time / sunsolver.cxx
index 2de1905a17abcbea21f637bba39aa658705210a1..a83422759ef9bfcbe8252d76bc88f2b8ec6eb9a8 100644 (file)
 #      include <config.h>
 #endif
 
-#ifdef SG_HAVE_STD_INCLUDES
-#  include <cmath>
-#  include <ctime>
-#else
-#  include <math.h>
-#  include <time.h>
-#endif
+#include <cmath>
+#include <ctime>
+#include <cassert>
 
 #include <simgear/math/SGMath.hxx>
-#include <simgear/ephemeris/ephemeris.hxx>
 #include <simgear/timing/sg_time.hxx>
 
 #include <Main/globals.hxx>
+#include <Main/fg_props.hxx>
 
-#include "tmp.hxx"
 #include "sunsolver.hxx"
 
 
@@ -61,12 +56,14 @@ void fgSunPositionGST(double gst, double *lon, double *lat) {
     double alpha, delta;
     double tmp;
 
-    double beta = globals->get_ephem()->get_sun()->getLat();
-    double r = globals->get_ephem()->get_sun()->getDistance();
-    double xs = globals->get_ephem()->get_sun()->getxs();
-    double ys = globals->get_ephem()->get_sun()->getys();
-    double ye = globals->get_ephem()->get_sun()->getye();
-    double ze = globals->get_ephem()->get_sun()->getze();
+    SGPropertyNode* sun = fgGetNode("/ephemeris/sun");
+    assert(sun);
+    double beta = sun->getDoubleValue("lat-deg");
+    // double r = globals->get_ephem()->get_sun()->getDistance();
+    double xs = sun->getDoubleValue("xs");
+    double ys = sun->getDoubleValue("ys");
+    double ye = sun->getDoubleValue("ye");
+    double ze = sun->getDoubleValue("ze");
     alpha = atan2(ys - tan(beta)*ze/ys, xs);
     delta = asin(sin(beta)*ye/ys + cos(beta)*ze);