StelCore.cpp   StelCore.cpp 
skipping to change at line 40 skipping to change at line 40
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelPainter.hpp" #include "StelPainter.hpp"
#include "StelLocationMgr.hpp" #include "StelLocationMgr.hpp"
#include "StelObserver.hpp" #include "StelObserver.hpp"
#include "StelObjectMgr.hpp" #include "StelObjectMgr.hpp"
#include "Planet.hpp" #include "Planet.hpp"
#include "SolarSystem.hpp" #include "SolarSystem.hpp"
#include "LandscapeMgr.hpp" #include "LandscapeMgr.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include "StelActionMgr.hpp" #include "StelActionMgr.hpp"
#include "precession.h"
#include <QSettings> #include <QSettings>
#include <QDebug> #include <QDebug>
#include <QMetaEnum> #include <QMetaEnum>
// Init statics transfo matrices // Init statics transfo matrices
// See vsop87.doc: // See vsop87.doc:
const Mat4d StelCore::matJ2000ToVsop87(Mat4d::xrotation(-23.439280305555555 5556*(M_PI/180)) * Mat4d::zrotation(0.0000275*(M_PI/180))); const Mat4d StelCore::matJ2000ToVsop87(Mat4d::xrotation(-23.439280305555555 5556*(M_PI/180)) * Mat4d::zrotation(0.0000275*(M_PI/180)));
const Mat4d StelCore::matVsop87ToJ2000(matJ2000ToVsop87.transpose()); const Mat4d StelCore::matVsop87ToJ2000(matJ2000ToVsop87.transpose());
const Mat4d StelCore::matJ2000ToGalactic(-0.054875539726, 0.494109453312, - 0.867666135858, 0, -0.873437108010, -0.444829589425, -0.198076386122, 0, -0 .483834985808, 0.746982251810, 0.455983795705, 0, 0, 0, 0, 1); const Mat4d StelCore::matJ2000ToGalactic(-0.054875539726, 0.494109453312, - 0.867666135858, 0, -0.873437108010, -0.444829589425, -0.198076386122, 0, -0 .483834985808, 0.746982251810, 0.455983795705, 0, 0, 0, 0, 1);
const Mat4d StelCore::matGalacticToJ2000(matJ2000ToGalactic.transpose()); const Mat4d StelCore::matGalacticToJ2000(matJ2000ToGalactic.transpose());
const double StelCore::JD_SECOND=0.000011574074074074074074; const double StelCore::JD_SECOND=0.000011574074074074074074; // 1/(24*60*60
const double StelCore::JD_MINUTE=0.00069444444444444444444; )=1/86400
const double StelCore::JD_HOUR =0.041666666666666666666; const double StelCore::JD_MINUTE=0.00069444444444444444444; // 1/(24*60)
=1/1440
const double StelCore::JD_HOUR =0.041666666666666666666; // 1/24
const double StelCore::JD_DAY =1.; const double StelCore::JD_DAY =1.;
const double StelCore::ONE_OVER_JD_SECOND = 24 * 60 * 60; const double StelCore::ONE_OVER_JD_SECOND = 24 * 60 * 60; // 86400
StelCore::StelCore() StelCore::StelCore()
: skyDrawer(NULL) : skyDrawer(NULL)
, movementMgr(NULL) , movementMgr(NULL)
, geodesicGrid(NULL) , geodesicGrid(NULL)
, currentProjectionType(ProjectionStereographic) , currentProjectionType(ProjectionStereographic)
, currentDeltaTAlgorithm(EspenakMeeus) , currentDeltaTAlgorithm(EspenakMeeus)
, position(NULL) , position(NULL)
, flagUseNutation(true)
, flagUseTopocentricCoordinates(true)
, timeSpeed(JD_SECOND) , timeSpeed(JD_SECOND)
, JDay(0.) , JD(0.,0.)
, presetSkyTime(0.) , presetSkyTime(0.)
, secondsOfLastJDayUpdate(0.) , secondsOfLastJDUpdate(0.)
, JDayOfLastJDayUpdate(0.) , jdOfLastJDUpdate(0.)
, deltaTCustomNDot(-26.0) , deltaTCustomNDot(-26.0)
, deltaTCustomYear(1820.0) , deltaTCustomYear(1820.0)
{ {
toneConverter = new StelToneReproducer(); toneConverter = new StelToneReproducer();
QSettings* conf = StelApp::getInstance().getSettings(); QSettings* conf = StelApp::getInstance().getSettings();
// Create and initialize the default projector params // Create and initialize the default projector params
QString tmpstr = conf->value("projection/viewport").toString(); QString tmpstr = conf->value("projection/viewport").toString();
currentProjectorParams.maskType = StelProjector::stringToMaskType(tm pstr); currentProjectorParams.maskType = StelProjector::stringToMaskType(tm pstr);
const int viewport_width = conf->value("projection/viewport_width", currentProjectorParams.viewportXywh[2]).toInt(); const int viewport_width = conf->value("projection/viewport_width", currentProjectorParams.viewportXywh[2]).toInt();
const int viewport_height = conf->value("projection/viewport_height" , currentProjectorParams.viewportXywh[3]).toInt(); const int viewport_height = conf->value("projection/viewport_height" , currentProjectorParams.viewportXywh[3]).toInt();
const int viewport_x = conf->value("projection/viewport_x", 0).toInt (); const int viewport_x = conf->value("projection/viewport_x", 0).toInt ();
const int viewport_y = conf->value("projection/viewport_y", 0).toInt (); const int viewport_y = conf->value("projection/viewport_y", 0).toInt ();
currentProjectorParams.viewportXywh.set(viewport_x,viewport_y,viewpo rt_width,viewport_height); currentProjectorParams.viewportXywh.set(viewport_x,viewport_y,viewpo rt_width,viewport_height);
const float viewportCenterX = conf->value("projection/viewport_cente r_x",0.5f*viewport_width).toFloat(); const float viewportCenterX = conf->value("projection/viewport_cente r_x",0.5f*viewport_width).toFloat();
const float viewportCenterY = conf->value("projection/viewport_cente r_y",0.5f*viewport_height).toFloat(); const float viewportCenterY = conf->value("projection/viewport_cente r_y",0.5f*viewport_height).toFloat();
currentProjectorParams.viewportCenter.set(viewportCenterX, viewportC enterY); currentProjectorParams.viewportCenter.set(viewportCenterX, viewportC enterY);
const float viewportCenterOffsetX = conf->value("projection/viewport
_center_offset_x",0.f).toFloat();
const float viewportCenterOffsetY = conf->value("projection/viewport
_center_offset_y",0.f).toFloat();
currentProjectorParams.viewportCenterOffset.set(viewportCenterOffset
X, viewportCenterOffsetY);
currentProjectorParams.viewportFovDiameter = conf->value("projection /viewport_fov_diameter", qMin(viewport_width,viewport_height)).toFloat(); currentProjectorParams.viewportFovDiameter = conf->value("projection /viewport_fov_diameter", qMin(viewport_width,viewport_height)).toFloat();
currentProjectorParams.flipHorz = conf->value("projection/flip_horz" ,false).toBool(); currentProjectorParams.flipHorz = conf->value("projection/flip_horz" ,false).toBool();
currentProjectorParams.flipVert = conf->value("projection/flip_vert" ,false).toBool(); currentProjectorParams.flipVert = conf->value("projection/flip_vert" ,false).toBool();
currentProjectorParams.gravityLabels = conf->value("viewing/flag_gra vity_labels").toBool(); currentProjectorParams.gravityLabels = conf->value("viewing/flag_gra vity_labels").toBool();
currentProjectorParams.devicePixelsPerPixel = StelApp::getInstance() .getDevicePixelsPerPixel(); currentProjectorParams.devicePixelsPerPixel = StelApp::getInstance() .getDevicePixelsPerPixel();
flagUseNutation=conf->value("astro/flag_nutation", true).toBool();
flagUseTopocentricCoordinates=conf->value("astro/flag_topocentric_co
ordinates", true).toBool();
} }
StelCore::~StelCore() StelCore::~StelCore()
{ {
delete toneConverter; toneConverter=NULL; delete toneConverter; toneConverter=NULL;
delete geodesicGrid; geodesicGrid=NULL; delete geodesicGrid; geodesicGrid=NULL;
delete skyDrawer; skyDrawer=NULL; delete skyDrawer; skyDrawer=NULL;
delete position; position=NULL; delete position; position=NULL;
} }
skipping to change at line 159 skipping to change at line 169
// Time stuff // Time stuff
setTimeNow(); setTimeNow();
// We want to be able to handle the old style preset time, recorded as a double // We want to be able to handle the old style preset time, recorded as a double
// jday, or as a more human readable string... // jday, or as a more human readable string...
QString presetTimeStr = conf->value("navigation/preset_sky_time",245 1545.).toString(); QString presetTimeStr = conf->value("navigation/preset_sky_time",245 1545.).toString();
presetSkyTime = presetTimeStr.toDouble(&ok); presetSkyTime = presetTimeStr.toDouble(&ok);
if (ok) if (ok)
{ {
qDebug() << "navigation/preset_sky_time is a double - treati ng as jday:" << presetSkyTime; qDebug() << "navigation/preset_sky_time is a double - treati ng as jday:" << QString::number(presetSkyTime, 'f', 5);
} }
else else
{ {
qDebug() << "navigation/preset_sky_time was not a double, tr eating as string date:" << presetTimeStr; qDebug() << "navigation/preset_sky_time was not a double, tr eating as string date:" << presetTimeStr;
presetSkyTime = StelUtils::qDateTimeToJd(QDateTime::fromStri ng(presetTimeStr)); presetSkyTime = StelUtils::qDateTimeToJd(QDateTime::fromStri ng(presetTimeStr));
} }
setInitTodayTime(QTime::fromString(conf->value("navigation/today_tim e", "22:00").toString())); setInitTodayTime(QTime::fromString(conf->value("navigation/today_tim e", "22:00").toString()));
startupTimeMode = conf->value("navigation/startup_time_mode", "actua l").toString().toLower(); startupTimeMode = conf->value("navigation/startup_time_mode", "actua l").toString().toLower();
if (startupTimeMode=="preset") if (startupTimeMode=="preset")
setJDay(presetSkyTime - StelUtils::getGMTShiftFromQT(presetS kyTime) * JD_HOUR); setJD(presetSkyTime - StelUtils::getGMTShiftFromQT(presetSky Time) * JD_HOUR);
else if (startupTimeMode=="today") else if (startupTimeMode=="today")
setTodayTime(getInitTodayTime()); setTodayTime(getInitTodayTime());
// Compute transform matrices between coordinates systems // Compute transform matrices between coordinates systems
updateTransformMatrices(); updateTransformMatrices();
movementMgr = new StelMovementMgr(this); movementMgr = new StelMovementMgr(this);
movementMgr->init(); movementMgr->init();
currentProjectorParams.fov = movementMgr->getInitFov(); currentProjectorParams.fov = movementMgr->getInitFov();
StelApp::getInstance().getModuleMgr().registerModule(movementMgr); StelApp::getInstance().getModuleMgr().registerModule(movementMgr);
skipping to change at line 200 skipping to change at line 210
StelActionMgr* actionsMgr = StelApp::getInstance().getStelActionMana ger(); StelActionMgr* actionsMgr = StelApp::getInstance().getStelActionMana ger();
actionsMgr->addAction("actionIncrease_Time_Speed", timeGroup, N_("In crease time speed"), this, "increaseTimeSpeed()", "L"); actionsMgr->addAction("actionIncrease_Time_Speed", timeGroup, N_("In crease time speed"), this, "increaseTimeSpeed()", "L");
actionsMgr->addAction("actionDecrease_Time_Speed", timeGroup, N_("De crease time speed"), this, "decreaseTimeSpeed()", "J"); actionsMgr->addAction("actionDecrease_Time_Speed", timeGroup, N_("De crease time speed"), this, "decreaseTimeSpeed()", "J");
actionsMgr->addAction("actionIncrease_Time_Speed_Less", timeGroup, N _("Increase time speed (a little)"), this, "increaseTimeSpeedLess()", "Shif t+L"); actionsMgr->addAction("actionIncrease_Time_Speed_Less", timeGroup, N _("Increase time speed (a little)"), this, "increaseTimeSpeedLess()", "Shif t+L");
actionsMgr->addAction("actionDecrease_Time_Speed_Less", timeGroup, N _("Decrease time speed (a little)"), this, "decreaseTimeSpeedLess()", "Shif t+J"); actionsMgr->addAction("actionDecrease_Time_Speed_Less", timeGroup, N _("Decrease time speed (a little)"), this, "decreaseTimeSpeedLess()", "Shif t+J");
actionsMgr->addAction("actionSet_Real_Time_Speed", timeGroup, N_("Se t normal time rate"), this, "toggleRealTimeSpeed()", "K"); actionsMgr->addAction("actionSet_Real_Time_Speed", timeGroup, N_("Se t normal time rate"), this, "toggleRealTimeSpeed()", "K");
actionsMgr->addAction("actionSet_Time_Rate_Zero", timeGroup, N_("Set time rate to zero"), this, "setZeroTimeSpeed()", "7"); actionsMgr->addAction("actionSet_Time_Rate_Zero", timeGroup, N_("Set time rate to zero"), this, "setZeroTimeSpeed()", "7");
actionsMgr->addAction("actionReturn_To_Current_Time", timeGroup, N_( "Set time to now"), this, "setTimeNow()", "8"); actionsMgr->addAction("actionReturn_To_Current_Time", timeGroup, N_( "Set time to now"), this, "setTimeNow()", "8");
actionsMgr->addAction("actionAdd_Solar_Hour", timeGroup, N_("Add 1 s olar hour"), this, "addHour()", "Ctrl+="); actionsMgr->addAction("actionAdd_Solar_Hour", timeGroup, N_("Add 1 s olar hour"), this, "addHour()", "Ctrl+=");
actionsMgr->addAction("actionAdd_Solar_Day", timeGroup, N_("Add 1 so lar day"), this, "addDay()", "="); actionsMgr->addAction("actionAdd_Solar_Day", timeGroup, N_("Add 1 so lar day"), this, "addDay()", "=");
actionsMgr->addAction("actionAdd_Solar_Week", timeGroup, N_("Add 1 s olar week"), this, "addWeek()", "]"); actionsMgr->addAction("actionAdd_Solar_Week", timeGroup, N_("Add 7 s olar days"), this, "addWeek()", "]");
actionsMgr->addAction("actionSubtract_Solar_Hour", timeGroup, N_("Su btract 1 solar hour"), this, "subtractHour()", "Ctrl+-"); actionsMgr->addAction("actionSubtract_Solar_Hour", timeGroup, N_("Su btract 1 solar hour"), this, "subtractHour()", "Ctrl+-");
actionsMgr->addAction("actionSubtract_Solar_Day", timeGroup, N_("Sub tract 1 solar day"), this, "subtractDay()", "-"); actionsMgr->addAction("actionSubtract_Solar_Day", timeGroup, N_("Sub tract 1 solar day"), this, "subtractDay()", "-");
actionsMgr->addAction("actionSubtract_Solar_Week", timeGroup, N_("Su btract 1 solar week"), this, "subtractWeek()", "["); actionsMgr->addAction("actionSubtract_Solar_Week", timeGroup, N_("Su btract 7 solar days"), this, "subtractWeek()", "[");
actionsMgr->addAction("actionAdd_Sidereal_Day", timeGroup, N_("Add 1 sidereal day"), this, "addSiderealDay()", "Alt+="); actionsMgr->addAction("actionAdd_Sidereal_Day", timeGroup, N_("Add 1 sidereal day"), this, "addSiderealDay()", "Alt+=");
actionsMgr->addAction("actionAdd_Sidereal_Week", timeGroup, N_("Add
1 sidereal week"), this, "addSiderealWeek()", "Alt+]");
actionsMgr->addAction("actionAdd_Sidereal_Month", timeGroup, N_("Add
1 sidereal month"), this, "addSiderealMonth()", "Alt+Shift+]");
actionsMgr->addAction("actionAdd_Sidereal_Year", timeGroup, N_("Add 1 sidereal year"), this, "addSiderealYear()", "Ctrl+Alt+Shift+]"); actionsMgr->addAction("actionAdd_Sidereal_Year", timeGroup, N_("Add 1 sidereal year"), this, "addSiderealYear()", "Ctrl+Alt+Shift+]");
actionsMgr->addAction("actionAdd_Sidereal_Century", timeGroup, N_("A dd 1 sidereal century"), this, "addSiderealCentury()"); actionsMgr->addAction("actionAdd_Sidereal_Century", timeGroup, N_("A dd 100 sidereal years"), this, "addSiderealYears()");
actionsMgr->addAction("actionAdd_Synodic_Month", timeGroup, N_("Add 1 synodic month"), this, "addSynodicMonth()"); actionsMgr->addAction("actionAdd_Synodic_Month", timeGroup, N_("Add 1 synodic month"), this, "addSynodicMonth()");
actionsMgr->addAction("actionAdd_Draconic_Month", timeGroup, N_("Add 1 draconic month"), this, "addDraconicMonth()"); actionsMgr->addAction("actionAdd_Draconic_Month", timeGroup, N_("Add 1 draconic month"), this, "addDraconicMonth()");
actionsMgr->addAction("actionAdd_Draconic_Year", timeGroup, N_("Add 1 draconic year"), this, "addDraconicYear()"); actionsMgr->addAction("actionAdd_Draconic_Year", timeGroup, N_("Add 1 draconic year"), this, "addDraconicYear()");
actionsMgr->addAction("actionAdd_Anomalistic_Month", timeGroup, N_(" Add 1 anomalistic month"), this, "addAnomalisticMonth()"); actionsMgr->addAction("actionAdd_Anomalistic_Month", timeGroup, N_(" Add 1 anomalistic month"), this, "addAnomalisticMonth()");
actionsMgr->addAction("actionAdd_Tropical_Month", timeGroup, N_("Add actionsMgr->addAction("actionAdd_Anomalistic_Year", timeGroup, N_("A
1 mean tropical month"), this, "addTropicalMonth()"); dd 1 anomalistic year"), this, "addAnomalisticYear()");
actionsMgr->addAction("actionAdd_Tropical_Year", timeGroup, N_("Add actionsMgr->addAction("actionAdd_Anomalistic_Century", timeGroup, N_
1 mean tropical year"), this, "addTropicalYear()"); ("Add 100 anomalistic years"), this, "addAnomalisticYears()");
actionsMgr->addAction("actionAdd_Tropical_Century", timeGroup, N_("A actionsMgr->addAction("actionAdd_Mean_Tropical_Month", timeGroup, N_
dd 1 mean tropical century"), this, "addTropicalCentury()"); ("Add 1 mean tropical month"), this, "addMeanTropicalMonth()");
actionsMgr->addAction("actionAdd_Mean_Tropical_Year", timeGroup, N_(
"Add 1 mean tropical year"), this, "addMeanTropicalYear()");
actionsMgr->addAction("actionAdd_Mean_Tropical_Century", timeGroup,
N_("Add 100 mean tropical years"), this, "addMeanTropicalYears()");
actionsMgr->addAction("actionAdd_Tropical_Year", timeGroup, N_("Add
1 tropical year"), this, "addTropicalYear()");
actionsMgr->addAction("actionAdd_Julian_Year", timeGroup, N_("Add 1
Julian year"), this, "addJulianYear()");
actionsMgr->addAction("actionAdd_Julian_Century", timeGroup, N_("Add
1 Julian century"), this, "addJulianYears()");
actionsMgr->addAction("actionAdd_Gaussian_Year", timeGroup, N_("Add
1 Gaussian year"), this, "addGaussianYear()");
actionsMgr->addAction("actionSubtract_Sidereal_Day", timeGroup, N_(" Subtract 1 sidereal day"), this, "subtractSiderealDay()", "Alt+-"); actionsMgr->addAction("actionSubtract_Sidereal_Day", timeGroup, N_(" Subtract 1 sidereal day"), this, "subtractSiderealDay()", "Alt+-");
actionsMgr->addAction("actionSubtract_Sidereal_Week", timeGroup, N_(
"Subtract 1 sidereal week"), this, "subtractSiderealWeek()", "Alt+[");
actionsMgr->addAction("actionSubtract_Sidereal_Month", timeGroup, N_
("Subtract 1 sidereal month"), this, "subtractSiderealMonth()", "Alt+Shift+
[");
actionsMgr->addAction("actionSubtract_Sidereal_Year", timeGroup, N_( "Subtract 1 sidereal year"), this, "subtractSiderealYear()", "Ctrl+Alt+Shif t+["); actionsMgr->addAction("actionSubtract_Sidereal_Year", timeGroup, N_( "Subtract 1 sidereal year"), this, "subtractSiderealYear()", "Ctrl+Alt+Shif t+[");
actionsMgr->addAction("actionSubtract_Sidereal_Century", timeGroup, N_("Subtract 1 sidereal century"), this, "subtractSiderealCentury()"); actionsMgr->addAction("actionSubtract_Sidereal_Century", timeGroup, N_("Subtract 100 sidereal years"), this, "subtractSiderealYears()");
actionsMgr->addAction("actionSubtract_Synodic_Month", timeGroup, N_( "Subtract 1 synodic month"), this, "subtractSynodicMonth()"); actionsMgr->addAction("actionSubtract_Synodic_Month", timeGroup, N_( "Subtract 1 synodic month"), this, "subtractSynodicMonth()");
actionsMgr->addAction("actionSubtract_Draconic_Month", timeGroup, N_ ("Subtract 1 draconic month"), this, "subtractDraconicMonth()"); actionsMgr->addAction("actionSubtract_Draconic_Month", timeGroup, N_ ("Subtract 1 draconic month"), this, "subtractDraconicMonth()");
actionsMgr->addAction("actionSubtract_Draconic_Year", timeGroup, N_( "Subtract 1 draconic year"), this, "subtractDraconicYear()"); actionsMgr->addAction("actionSubtract_Draconic_Year", timeGroup, N_( "Subtract 1 draconic year"), this, "subtractDraconicYear()");
actionsMgr->addAction("actionSubtract_Anomalistic_Month", timeGroup, N_("Subtract 1 anomalistic month"), this, "subtractAnomalisticMonth()"); actionsMgr->addAction("actionSubtract_Anomalistic_Month", timeGroup, N_("Subtract 1 anomalistic month"), this, "subtractAnomalisticMonth()");
actionsMgr->addAction("actionSubtract_Tropical_Month", timeGroup, N_ actionsMgr->addAction("actionSubtract_Anomalistic_Year", timeGroup,
("Subtract 1 mean tropical month"), this, "subtractTropicalMonth()"); N_("Subtract 1 anomalistic year"), this, "subtractAnomalisticYear()");
actionsMgr->addAction("actionSubtract_Tropical_Year", timeGroup, N_( actionsMgr->addAction("actionSubtract_Anomalistic_Century", timeGrou
"Subtract 1 mean tropical year"), this, "subtractTropicalYear()"); p, N_("Subtract 100 anomalistic years"), this, "subtractAnomalisticYears()"
actionsMgr->addAction("actionSubtract_Tropical_Century", timeGroup, );
N_("Subtract 1 mean tropical century"), this, "subtractTropicalCentury()"); actionsMgr->addAction("actionSubtract_Mean_Tropical_Month", timeGrou
p, N_("Subtract 1 mean tropical month"), this, "subtractMeanTropicalMonth()
");
actionsMgr->addAction("actionSubtract_Mean_Tropical_Year", timeGroup
, N_("Subtract 1 mean tropical year"), this, "subtractMeanTropicalYear()");
actionsMgr->addAction("actionSubtract_Mean_Tropical_Century", timeGr
oup, N_("Subtract 100 mean tropical years"), this, "subtractMeanTropicalYea
rs()");
actionsMgr->addAction("actionSubtract_Tropical_Year", timeGroup, N_(
"Subtract 1 tropical year"), this, "subtractTropicalYear()");
actionsMgr->addAction("actionSubtract_Julian_Year", timeGroup, N_("S
ubtract 1 Julian year"), this, "subtractJulianYear()");
actionsMgr->addAction("actionSubtract_Julian_Century", timeGroup, N_
("Subtract 1 Julian century"), this, "subtractJulianYears()");
actionsMgr->addAction("actionSubtract_Gaussian_Year", timeGroup, N_(
"Subtract 1 Gaussian year"), this, "subtractGaussianYear()");
actionsMgr->addAction("actionSet_Home_Planet_To_Selected", movementG roup, N_("Set home planet to selected planet"), this, "moveObserverToSelect ed()", "Ctrl+G"); actionsMgr->addAction("actionSet_Home_Planet_To_Selected", movementG roup, N_("Set home planet to selected planet"), this, "moveObserverToSelect ed()", "Ctrl+G");
actionsMgr->addAction("actionGo_Home_Global", movementGroup, N_("Go to home"), this, "returnToHome()", "Ctrl+H"); actionsMgr->addAction("actionGo_Home_Global", movementGroup, N_("Go to home"), this, "returnToHome()", "Ctrl+H");
actionsMgr->addAction("actionHorizontal_Flip", displayGroup, N_("Fli p scene horizontally"), this, "flipHorz", "Ctrl+Shift+H", "", true); actionsMgr->addAction("actionHorizontal_Flip", displayGroup, N_("Fli p scene horizontally"), this, "flipHorz", "Ctrl+Shift+H", "", true);
actionsMgr->addAction("actionVertical_Flip", displayGroup, N_("Flip scene vertically"), this, "flipVert", "Ctrl+Shift+V", "", true); actionsMgr->addAction("actionVertical_Flip", displayGroup, N_("Flip scene vertically"), this, "flipVert", "Ctrl+Shift+V", "", true);
} }
QString StelCore::getDefaultProjectionTypeKey() const QString StelCore::getDefaultProjectionTypeKey() const
{ {
skipping to change at line 297 skipping to change at line 315
break; break;
case ProjectionCylinder: case ProjectionCylinder:
prj = StelProjectorP(new StelProjectorCylinder(model ViewTransform)); prj = StelProjectorP(new StelProjectorCylinder(model ViewTransform));
break; break;
case ProjectionMercator: case ProjectionMercator:
prj = StelProjectorP(new StelProjectorMercator(model ViewTransform)); prj = StelProjectorP(new StelProjectorMercator(model ViewTransform));
break; break;
case ProjectionOrthographic: case ProjectionOrthographic:
prj = StelProjectorP(new StelProjectorOrthographic(m odelViewTransform)); prj = StelProjectorP(new StelProjectorOrthographic(m odelViewTransform));
break; break;
case ProjectionSinusoidal:
prj = StelProjectorP(new StelProjectorSinusoidal(mod
elViewTransform));
break;
default: default:
qWarning() << "Unknown projection type: " << (int)(p rojType) << "using ProjectionStereographic instead"; qWarning() << "Unknown projection type: " << (int)(p rojType) << "using ProjectionStereographic instead";
prj = StelProjectorP(new StelProjectorStereographic( modelViewTransform)); prj = StelProjectorP(new StelProjectorStereographic( modelViewTransform));
Q_ASSERT(0); Q_ASSERT(0);
} }
prj->init(currentProjectorParams); prj->init(currentProjectorParams);
return prj; return prj;
} }
// Get an instance of projector using the current display parameters from N avigation, StelMovementMgr // Get an instance of projector using the current display parameters from N avigation, StelMovementMgr
StelProjectorP StelCore::getProjection(FrameType frameType, RefractionMode refractionMode) const StelProjectorP StelCore::getProjection(FrameType frameType, RefractionMode refractionMode) const
{ {
switch (frameType) switch (frameType)
{ {
case FrameAltAz: case FrameAltAz:
return getProjection(getAltAzModelViewTransform(refr actionMode)); return getProjection(getAltAzModelViewTransform(refr actionMode));
case FrameHeliocentricEcliptic: case FrameHeliocentricEclipticJ2000:
return getProjection(getHeliocentricEclipticModelVie wTransform(refractionMode)); return getProjection(getHeliocentricEclipticModelVie wTransform(refractionMode));
case FrameObservercentricEcliptic: case FrameObservercentricEclipticJ2000:
return getProjection(getObservercentricEclipticModel return getProjection(getObservercentricEclipticJ2000
ViewTransform(refractionMode)); ModelViewTransform(refractionMode));
case FrameObservercentricEclipticOfDate:
return getProjection(getObservercentricEclipticOfDat
eModelViewTransform(refractionMode));
case FrameEquinoxEqu: case FrameEquinoxEqu:
return getProjection(getEquinoxEquModelViewTransform (refractionMode)); return getProjection(getEquinoxEquModelViewTransform (refractionMode));
case FrameJ2000: case FrameJ2000:
return getProjection(getJ2000ModelViewTransform(refr actionMode)); return getProjection(getJ2000ModelViewTransform(refr actionMode));
case FrameGalactic: case FrameGalactic:
return getProjection(getGalacticModelViewTransform( refractionMode)); return getProjection(getGalacticModelViewTransform( refractionMode));
default: default:
qDebug() << "Unknown reference frame type: " << (int )frameType << "."; qDebug() << "Unknown reference frame type: " << (int )frameType << ".";
} }
Q_ASSERT(0); Q_ASSERT(0);
skipping to change at line 366 skipping to change at line 389
{ {
return movementMgr; return movementMgr;
} }
SphericalCap StelCore::getVisibleSkyArea() const SphericalCap StelCore::getVisibleSkyArea() const
{ {
const LandscapeMgr* landscapeMgr = GETSTELMODULE(LandscapeMgr); const LandscapeMgr* landscapeMgr = GETSTELMODULE(LandscapeMgr);
Vec3d up(0, 0, 1); Vec3d up(0, 0, 1);
up = altAzToJ2000(up, RefractionOff); up = altAzToJ2000(up, RefractionOff);
// Limit star drawing to above landscape's minimal altitude (was con st=-0.035, Bug lp:1469407)
if (landscapeMgr->getIsLandscapeFullyVisible()) if (landscapeMgr->getIsLandscapeFullyVisible())
{ {
return SphericalCap(up, -0.035f); return SphericalCap(up, landscapeMgr->getLandscapeSinMinAlti tudeLimit());
} }
return SphericalCap(up, -1.f); return SphericalCap(up, -1.f);
} }
void StelCore::setClippingPlanes(double znear, double zfar) void StelCore::setClippingPlanes(double znear, double zfar)
{ {
currentProjectorParams.zNear=znear;currentProjectorParams.zFar=zfar; currentProjectorParams.zNear=znear;currentProjectorParams.zFar=zfar;
} }
void StelCore::getClippingPlanes(double* zn, double* zf) const void StelCore::getClippingPlanes(double* zn, double* zf) const
{ {
*zn = currentProjectorParams.zNear; *zn = currentProjectorParams.zNear;
*zf = currentProjectorParams.zFar; *zf = currentProjectorParams.zFar;
} }
// Handle the resizing of the window // Handle the resizing of the window
void StelCore::windowHasBeenResized(float x, float y, float width, float he ight) void StelCore::windowHasBeenResized(float x, float y, float width, float he ight)
{ {
// Maximize display when resized since it invalidates previous optio ns anyway // Maximize display when resized since it invalidates previous optio ns anyway
currentProjectorParams.viewportXywh.set(x, y, width, height); currentProjectorParams.viewportXywh.set(x, y, width, height);
currentProjectorParams.viewportCenter.set(x+0.5*width, y+0.5*height) ; currentProjectorParams.viewportCenter.set(x+(0.5+currentProjectorPar ams.viewportCenterOffset.v[0])*width, y+(0.5+currentProjectorParams.viewpor tCenterOffset.v[1])*height);
currentProjectorParams.viewportFovDiameter = qMin(width,height); currentProjectorParams.viewportFovDiameter = qMin(width,height);
} }
/************************************************************************* /*************************************************************************
Update all the objects in function of the time Update all the objects in function of the time
*************************************************************************/ *************************************************************************/
void StelCore::update(double deltaTime) void StelCore::update(double deltaTime)
{ {
// Update the position of observation and time and recompute planet positions etc... // Update the position of observation and time and recompute planet positions etc...
updateTime(deltaTime); updateTime(deltaTime);
skipping to change at line 491 skipping to change at line 515
void StelCore::setMaskType(StelProjector::StelProjectorMaskType m) void StelCore::setMaskType(StelProjector::StelProjectorMaskType m)
{ {
currentProjectorParams.maskType = m; currentProjectorParams.maskType = m;
} }
void StelCore::setFlagGravityLabels(bool gravity) void StelCore::setFlagGravityLabels(bool gravity)
{ {
currentProjectorParams.gravityLabels = gravity; currentProjectorParams.gravityLabels = gravity;
} }
void StelCore::setDefautAngleForGravityText(float a) void StelCore::setDefaultAngleForGravityText(float a)
{ {
currentProjectorParams.defautAngleForGravityText = a; currentProjectorParams.defaultAngleForGravityText = a;
} }
void StelCore::setFlipHorz(bool flip) void StelCore::setFlipHorz(bool flip)
{ {
currentProjectorParams.flipHorz = flip; currentProjectorParams.flipHorz = flip;
} }
void StelCore::setFlipVert(bool flip) void StelCore::setFlipVert(bool flip)
{ {
currentProjectorParams.flipVert = flip; currentProjectorParams.flipVert = flip;
skipping to change at line 634 skipping to change at line 658
Vec3d StelCore::j2000ToGalactic(const Vec3d& v) const Vec3d StelCore::j2000ToGalactic(const Vec3d& v) const
{ {
return matJ2000ToGalactic*v; return matJ2000ToGalactic*v;
} }
//! Transform vector from heliocentric ecliptic coordinate to altazimuthal //! Transform vector from heliocentric ecliptic coordinate to altazimuthal
Vec3d StelCore::heliocentricEclipticToAltAz(const Vec3d& v, RefractionMode refMode) const Vec3d StelCore::heliocentricEclipticToAltAz(const Vec3d& v, RefractionMode refMode) const
{ {
if (refMode==RefractionOff || skyDrawer==NULL || (refMode==Refractio nAuto && skyDrawer->getFlagHasAtmosphere()==false)) if (refMode==RefractionOff || skyDrawer==NULL || (refMode==Refractio nAuto && skyDrawer->getFlagHasAtmosphere()==false))
return matHeliocentricEclipticToAltAz*v; return matHeliocentricEclipticJ2000ToAltAz*v;
Vec3d r(v); Vec3d r(v);
r.transfo4d(matHeliocentricEclipticToAltAz); r.transfo4d(matHeliocentricEclipticJ2000ToAltAz);
skyDrawer->getRefraction().forward(r); skyDrawer->getRefraction().forward(r);
return r; return r;
} }
//! Transform from heliocentric coordinate to equatorial at current equinox (for the planet where the observer stands) //! Transform from heliocentric coordinate to equatorial at current equinox (for the planet where the observer stands)
Vec3d StelCore::heliocentricEclipticToEquinoxEqu(const Vec3d& v) const Vec3d StelCore::heliocentricEclipticToEquinoxEqu(const Vec3d& v) const
{ {
return matHeliocentricEclipticToEquinoxEqu*v; return matHeliocentricEclipticToEquinoxEqu*v;
} }
/*
//! Transform vector from heliocentric coordinate to false equatorial : equ atorial //! Transform vector from heliocentric coordinate to false equatorial : equ atorial
//! coordinate but centered on the observer position (usefull for objects c //! coordinate but centered on the observer position (useful for objects cl
lose to earth) ose to earth)
//! Unused as of V0.13
Vec3d StelCore::heliocentricEclipticToEarthPosEquinoxEqu(const Vec3d& v) co nst Vec3d StelCore::heliocentricEclipticToEarthPosEquinoxEqu(const Vec3d& v) co nst
{ {
return matAltAzToEquinoxEqu*matHeliocentricEclipticToAltAz*v; return matAltAzToEquinoxEqu*matHeliocentricEclipticToAltAz*v;
} }
*/
StelProjector::ModelViewTranformP StelCore::getHeliocentricEclipticModelVie wTransform(RefractionMode refMode) const StelProjector::ModelViewTranformP StelCore::getHeliocentricEclipticModelVie wTransform(RefractionMode refMode) const
{ {
if (refMode==RefractionOff || skyDrawer==NULL || (refMode==Refractio nAuto && skyDrawer->getFlagHasAtmosphere()==false)) if (refMode==RefractionOff || skyDrawer==NULL || (refMode==Refractio nAuto && skyDrawer->getFlagHasAtmosphere()==false))
return StelProjector::ModelViewTranformP(new StelProjector:: Mat4dTransform(matAltAzModelView*matHeliocentricEclipticToAltAz)); return StelProjector::ModelViewTranformP(new StelProjector:: Mat4dTransform(matAltAzModelView*matHeliocentricEclipticJ2000ToAltAz));
Refraction* refr = new Refraction(skyDrawer->getRefraction()); Refraction* refr = new Refraction(skyDrawer->getRefraction());
// The pretransform matrix will convert from input coordinates to Al tAz needed by the refraction function. // The pretransform matrix will convert from input coordinates to Al tAz needed by the refraction function.
refr->setPreTransfoMat(matHeliocentricEclipticToAltAz); refr->setPreTransfoMat(matHeliocentricEclipticJ2000ToAltAz);
refr->setPostTransfoMat(matAltAzModelView); refr->setPostTransfoMat(matAltAzModelView);
return StelProjector::ModelViewTranformP(refr); return StelProjector::ModelViewTranformP(refr);
} }
//! Get the modelview matrix for observer-centric ecliptic (Vsop87) drawing //! Get the modelview matrix for observer-centric ecliptic J2000 (Vsop87A)
StelProjector::ModelViewTranformP StelCore::getObservercentricEclipticModel drawing
ViewTransform(RefractionMode refMode) const StelProjector::ModelViewTranformP StelCore::getObservercentricEclipticJ2000
ModelViewTransform(RefractionMode refMode) const
{ {
if (refMode==RefractionOff || skyDrawer==NULL || (refMode==Refractio nAuto && skyDrawer->getFlagHasAtmosphere()==false)) if (refMode==RefractionOff || skyDrawer==NULL || (refMode==Refractio nAuto && skyDrawer->getFlagHasAtmosphere()==false))
return StelProjector::ModelViewTranformP(new StelProjector:: Mat4dTransform(matAltAzModelView*matJ2000ToAltAz*matVsop87ToJ2000)); return StelProjector::ModelViewTranformP(new StelProjector:: Mat4dTransform(matAltAzModelView*matJ2000ToAltAz*matVsop87ToJ2000));
Refraction* refr = new Refraction(skyDrawer->getRefraction()); Refraction* refr = new Refraction(skyDrawer->getRefraction());
// The pretransform matrix will convert from input coordinates to Al tAz needed by the refraction function. // The pretransform matrix will convert from input coordinates to Al tAz needed by the refraction function.
refr->setPreTransfoMat(matJ2000ToAltAz*matVsop87ToJ2000); refr->setPreTransfoMat(matJ2000ToAltAz*matVsop87ToJ2000);
refr->setPostTransfoMat(matAltAzModelView); refr->setPostTransfoMat(matAltAzModelView);
return StelProjector::ModelViewTranformP(refr); return StelProjector::ModelViewTranformP(refr);
} }
//! Get the modelview matrix for observer-centric ecliptic-of-date drawing
StelProjector::ModelViewTranformP StelCore::getObservercentricEclipticOfDat
eModelViewTransform(RefractionMode refMode) const
{
double eps_A=getPrecessionAngleVondrakCurrentEpsilonA();
if (refMode==RefractionOff || skyDrawer==NULL || (refMode==Refractio
nAuto && skyDrawer->getFlagHasAtmosphere()==false))
return StelProjector::ModelViewTranformP(new StelProjector::
Mat4dTransform(matAltAzModelView*matEquinoxEquToAltAz* Mat4d::xrotation(eps
_A)));
Refraction* refr = new Refraction(skyDrawer->getRefraction());
// The pretransform matrix will convert from input coordinates to Al
tAz needed by the refraction function.
refr->setPreTransfoMat(matEquinoxEquToAltAz* Mat4d::xrotation(eps_A)
);
refr->setPostTransfoMat(matAltAzModelView);
return StelProjector::ModelViewTranformP(refr);
}
//! Get the modelview matrix for observer-centric equatorial at equinox dra wing //! Get the modelview matrix for observer-centric equatorial at equinox dra wing
StelProjector::ModelViewTranformP StelCore::getEquinoxEquModelViewTransform (RefractionMode refMode) const StelProjector::ModelViewTranformP StelCore::getEquinoxEquModelViewTransform (RefractionMode refMode) const
{ {
if (refMode==RefractionOff || skyDrawer==NULL || (refMode==Refractio nAuto && skyDrawer->getFlagHasAtmosphere()==false)) if (refMode==RefractionOff || skyDrawer==NULL || (refMode==Refractio nAuto && skyDrawer->getFlagHasAtmosphere()==false))
return StelProjector::ModelViewTranformP(new StelProjector:: Mat4dTransform(matAltAzModelView*matEquinoxEquToAltAz)); return StelProjector::ModelViewTranformP(new StelProjector:: Mat4dTransform(matAltAzModelView*matEquinoxEquToAltAz));
Refraction* refr = new Refraction(skyDrawer->getRefraction()); Refraction* refr = new Refraction(skyDrawer->getRefraction());
// The pretransform matrix will convert from input coordinates to Al tAz needed by the refraction function. // The pretransform matrix will convert from input coordinates to Al tAz needed by the refraction function.
refr->setPreTransfoMat(matEquinoxEquToAltAz); refr->setPreTransfoMat(matEquinoxEquToAltAz);
refr->setPostTransfoMat(matAltAzModelView); refr->setPostTransfoMat(matAltAzModelView);
return StelProjector::ModelViewTranformP(refr); return StelProjector::ModelViewTranformP(refr);
skipping to change at line 728 skipping to change at line 768
{ {
if (refMode==RefractionOff || skyDrawer==NULL || (refMode==Refractio nAuto && skyDrawer->getFlagHasAtmosphere()==false)) if (refMode==RefractionOff || skyDrawer==NULL || (refMode==Refractio nAuto && skyDrawer->getFlagHasAtmosphere()==false))
return StelProjector::ModelViewTranformP(new StelProjector:: Mat4dTransform(matAltAzModelView*matEquinoxEquToAltAz*matJ2000ToEquinoxEqu* matGalacticToJ2000)); return StelProjector::ModelViewTranformP(new StelProjector:: Mat4dTransform(matAltAzModelView*matEquinoxEquToAltAz*matJ2000ToEquinoxEqu* matGalacticToJ2000));
Refraction* refr = new Refraction(skyDrawer->getRefraction()); Refraction* refr = new Refraction(skyDrawer->getRefraction());
// The pretransform matrix will convert from input coordinates to Al tAz needed by the refraction function. // The pretransform matrix will convert from input coordinates to Al tAz needed by the refraction function.
refr->setPreTransfoMat(matEquinoxEquToAltAz*matJ2000ToEquinoxEqu*mat GalacticToJ2000); refr->setPreTransfoMat(matEquinoxEquToAltAz*matJ2000ToEquinoxEqu*mat GalacticToJ2000);
refr->setPostTransfoMat(matAltAzModelView); refr->setPostTransfoMat(matAltAzModelView);
return StelProjector::ModelViewTranformP(refr); return StelProjector::ModelViewTranformP(refr);
} }
// GZ: One of the most important functions, totally void of doc. :-(
// called in update() (for every frame)
void StelCore::updateTransformMatrices() void StelCore::updateTransformMatrices()
{ {
matAltAzToEquinoxEqu = position->getRotAltAzToEquatorial(JDay); matAltAzToEquinoxEqu = position->getRotAltAzToEquatorial(getJD(), ge tJDE());
matEquinoxEquToAltAz = matAltAzToEquinoxEqu.transpose(); matEquinoxEquToAltAz = matAltAzToEquinoxEqu.transpose();
// multiply static J2000 earth axis tilt (eclipticalJ2000<->equatori
alJ2000)
// in effect, this matrix transforms from VSOP87 ecliptical J2000 to
planet-based equatorial coordinates.
// For earth, matJ2000ToEquinoxEqu is the precession matrix.
// TODO: rename matEquinoxEquToJ2000 to matEquinoxEquDateToJ2000
matEquinoxEquToJ2000 = matVsop87ToJ2000 * position->getRotEquatorial ToVsop87(); matEquinoxEquToJ2000 = matVsop87ToJ2000 * position->getRotEquatorial ToVsop87();
matJ2000ToEquinoxEqu = matEquinoxEquToJ2000.transpose(); matJ2000ToEquinoxEqu = matEquinoxEquToJ2000.transpose();
matJ2000ToAltAz = matEquinoxEquToAltAz*matJ2000ToEquinoxEqu; matJ2000ToAltAz = matEquinoxEquToAltAz*matJ2000ToEquinoxEqu;
matHeliocentricEclipticToEquinoxEqu = matJ2000ToEquinoxEqu * matVsop 87ToJ2000 * Mat4d::translation(-position->getCenterVsop87Pos()); matHeliocentricEclipticToEquinoxEqu = matJ2000ToEquinoxEqu * matVsop 87ToJ2000 * Mat4d::translation(-position->getCenterVsop87Pos());
// These two next have to take into account the position of the obse // These two next have to take into account the position of the obse
rver on the earth rver on the earth/planet of observation.
// GZ tmp could be called matAltAzToVsop87
Mat4d tmp = matJ2000ToVsop87 * matEquinoxEquToJ2000 * matAltAzToEqui noxEqu; Mat4d tmp = matJ2000ToVsop87 * matEquinoxEquToJ2000 * matAltAzToEqui noxEqu;
matAltAzToHeliocentricEcliptic = Mat4d::translation(position->getCe // Before 0.14 getDistanceFromCenter assumed spherical planets. Now
nterVsop87Pos()) * tmp * uses rectangular coordinates for observer!
Mat4d::translation(Vec3d(0 if (flagUseTopocentricCoordinates)
.,0., position->getDistanceFromCenter())); {
matAltAzToHeliocentricEclipticJ2000 = Mat4d::translation(po
sition->getCenterVsop87Pos()) * tmp *
Mat4d::translation(Vec3d(0.,0., position->ge
tDistanceFromCenter()));
matHeliocentricEclipticJ2000ToAltAz = Mat4d::translation(Ve
c3d(0.,0.,-position->getDistanceFromCenter())) * tmp.transpose() *
Mat4d::translation(-position->getCenterVsop8
7Pos());
}
else
{
matAltAzToHeliocentricEclipticJ2000 = Mat4d::translation(po
sition->getCenterVsop87Pos()) * tmp;
matHeliocentricEclipticToAltAz = Mat4d::translation(Vec3d(0.,0.,-po matHeliocentricEclipticJ2000ToAltAz = tmp.transpose() *
sition->getDistanceFromCenter())) * tmp.transpose() * Mat4d::translation(-position->getCenterVsop8
Mat4d::translation(-positi 7Pos());
on->getCenterVsop87Pos()); }
} }
// Return the observer heliocentric position // Return the observer heliocentric position
Vec3d StelCore::getObserverHeliocentricEclipticPos() const Vec3d StelCore::getObserverHeliocentricEclipticPos() const
{ {
return Vec3d(matAltAzToHeliocentricEcliptic[12], matAltAzToHeliocent ricEcliptic[13], matAltAzToHeliocentricEcliptic[14]); return Vec3d(matAltAzToHeliocentricEclipticJ2000[12], matAltAzToHeli ocentricEclipticJ2000[13], matAltAzToHeliocentricEclipticJ2000[14]);
} }
// Set the location to use by default at startup // Set the location to use by default at startup
void StelCore::setDefaultLocationID(const QString& id) void StelCore::setDefaultLocationID(const QString& id)
{ {
StelLocation location = StelApp::getInstance().getLocationMgr().loca tionForString(id); StelLocation location = StelApp::getInstance().getLocationMgr().loca tionForString(id);
if (!location.isValid()) if (!location.isValid())
{ {
qWarning() << "Trying to set an invalid location" << id; qWarning() << "Trying to set an invalid location" << id;
return; return;
skipping to change at line 810 skipping to change at line 868
landscapeMgr->setFlagAtmosphere(p->hasAtmosphere() && conf->value("l andscape/flag_atmosphere", true).toBool()); landscapeMgr->setFlagAtmosphere(p->hasAtmosphere() && conf->value("l andscape/flag_atmosphere", true).toBool());
landscapeMgr->setFlagFog(p->hasAtmosphere() && conf->value("landscap e/flag_fog", true).toBool()); landscapeMgr->setFlagFog(p->hasAtmosphere() && conf->value("landscap e/flag_fog", true).toBool());
GETSTELMODULE(StelObjectMgr)->unSelect(); GETSTELMODULE(StelObjectMgr)->unSelect();
StelMovementMgr* smmgr = getMovementMgr(); StelMovementMgr* smmgr = getMovementMgr();
smmgr->setViewDirectionJ2000(altAzToJ2000(smmgr->getInitViewingDirec tion(), StelCore::RefractionOff)); smmgr->setViewDirectionJ2000(altAzToJ2000(smmgr->getInitViewingDirec tion(), StelCore::RefractionOff));
smmgr->zoomTo(smmgr->getInitFov(), 1.); smmgr->zoomTo(smmgr->getInitFov(), 1.);
} }
void StelCore::setJDay(double JD) void StelCore::setJD(double newJD)
{ {
JDay=JD; JD.first=newJD;
JD.second=computeDeltaT(newJD);
resetSync(); resetSync();
} }
double StelCore::getJDay() const double StelCore::getJD() const
{ {
return JDay; return JD.first;
} }
void StelCore::setMJDay(double MJD) void StelCore::setJDE(double newJDE)
{ {
JDay=MJD+2400000.5; // nitpickerish this is not exact, but as good as it gets...
JD.second=computeDeltaT(newJDE);
JD.first=newJDE-JD.second/86400.0;
resetSync(); resetSync();
} }
double StelCore::getJDE() const
{
return JD.first+JD.second/86400.0;
}
void StelCore::setMJDay(double MJD)
{
setJD(MJD+2400000.5);
}
double StelCore::getMJDay() const double StelCore::getMJDay() const
{ {
return JDay-2400000.5; return JD.first-2400000.5;
} }
double StelCore::getPresetSkyTime() const double StelCore::getPresetSkyTime() const
{ {
return presetSkyTime; return presetSkyTime;
} }
void StelCore::setPresetSkyTime(double d) void StelCore::setPresetSkyTime(double d)
{ {
presetSkyTime=d; presetSkyTime=d;
skipping to change at line 904 skipping to change at line 975
const StelLocation& StelCore::getCurrentLocation() const const StelLocation& StelCore::getCurrentLocation() const
{ {
return position->getCurrentLocation(); return position->getCurrentLocation();
} }
const QSharedPointer<Planet> StelCore::getCurrentPlanet() const const QSharedPointer<Planet> StelCore::getCurrentPlanet() const
{ {
return position->getHomePlanet(); return position->getHomePlanet();
} }
const StelObserver *StelCore::getCurrentObserver() const
{
return position;
}
// Smoothly move the observer to the given location // Smoothly move the observer to the given location
void StelCore::moveObserverTo(const StelLocation& target, double duration, double durationIfPlanetChange) void StelCore::moveObserverTo(const StelLocation& target, double duration, double durationIfPlanetChange)
{ {
emit(locationChanged(target)); emit(locationChanged(target));
double d = (getCurrentLocation().planetName==target.planetName) ? du ration : durationIfPlanetChange; double d = (getCurrentLocation().planetName==target.planetName) ? du ration : durationIfPlanetChange;
if (d>0.) if (d>0.)
{ {
StelLocation curLoc = getCurrentLocation(); StelLocation curLoc = getCurrentLocation();
if (position->isTraveling()) if (position->isTraveling())
{ {
skipping to change at line 932 skipping to change at line 1008
else else
{ {
delete position; delete position;
position = new StelObserver(target); position = new StelObserver(target);
} }
} }
//! Set stellarium time to current real world time //! Set stellarium time to current real world time
void StelCore::setTimeNow() void StelCore::setTimeNow()
{ {
double JD = StelUtils::getJDFromSystem(); setJD(StelUtils::getJDFromSystem());
// add Delta-T correction for actual time
setJDay(JD+getDeltaT(JD)/86400);
} }
void StelCore::setTodayTime(const QTime& target) void StelCore::setTodayTime(const QTime& target)
{ {
QDateTime dt = QDateTime::currentDateTime(); QDateTime dt = QDateTime::currentDateTime();
if (target.isValid()) if (target.isValid())
{ {
dt.setTime(target); dt.setTime(target);
// don't forget to adjust for timezone / daylight savings. // don't forget to adjust for timezone / daylight savings.
double JD = StelUtils::qDateTimeToJd(dt)-(StelUtils::getGMTS hiftFromQT(StelUtils::getJDFromSystem()) * JD_HOUR); double JD = StelUtils::qDateTimeToJd(dt)-(StelUtils::getGMTS hiftFromQT(StelUtils::getJDFromSystem()) * JD_HOUR);
setJDay(JD + getDeltaT(JD)/86400); setJD(JD);
} }
else else
{ {
qWarning() << "WARNING - time passed to StelCore::setTodayTi me is not valid. The system time will be used." << target; qWarning() << "WARNING - time passed to StelCore::setTodayTi me is not valid. The system time will be used." << target;
setTimeNow(); setTimeNow();
} }
} }
//! Get whether the current stellarium time is the real world time //! Get whether the current stellarium time is the real world time
bool StelCore::getIsTimeNow(void) const bool StelCore::getIsTimeNow(void) const
{ {
// cache last time to prevent to much slow system call // cache last time to prevent to much slow system call
static double lastJD = getJDay(); static double lastJD = getJD();
static bool previousResult = (fabs(getJDay()-(StelUtils::getJDFromSy static bool previousResult = (fabs(getJD()-(StelUtils::getJDFromSyst
stem()+getDeltaT(lastJD)/86400))<JD_SECOND); em()))<JD_SECOND);
if (fabs(lastJD-getJDay())>JD_SECOND/4) if (fabs(lastJD-getJD())>JD_SECOND/4)
{ {
lastJD = getJDay(); lastJD = getJD();
previousResult = (fabs(getJDay()-(StelUtils::getJDFromSystem previousResult = (fabs(getJD()-(StelUtils::getJDFromSystem()
()+getDeltaT(lastJD)/86400))<JD_SECOND); ))<JD_SECOND);
} }
return previousResult; return previousResult;
} }
QTime StelCore::getInitTodayTime(void) QTime StelCore::getInitTodayTime(void)
{ {
return initTodayTime; return initTodayTime;
} }
void StelCore::setInitTodayTime(const QTime& t) void StelCore::setInitTodayTime(const QTime& time)
{ {
initTodayTime=t; initTodayTime=time;
} }
void StelCore::setPresetSkyTime(QDateTime dt) void StelCore::setPresetSkyTime(QDateTime dateTime)
{ {
setPresetSkyTime(StelUtils::qDateTimeToJd(dt)); setPresetSkyTime(StelUtils::qDateTimeToJd(dateTime));
} }
void StelCore::addHour() void StelCore::addHour()
{ {
addSolarDays(JD_HOUR); addSolarDays(JD_HOUR);
} }
void StelCore::addDay() void StelCore::addDay()
{ {
addSolarDays(1.0); addSolarDays(1.0);
skipping to change at line 1003 skipping to change at line 1077
void StelCore::addWeek() void StelCore::addWeek()
{ {
addSolarDays(7.0); addSolarDays(7.0);
} }
void StelCore::addSiderealDay() void StelCore::addSiderealDay()
{ {
addSiderealDays(1.0); addSiderealDays(1.0);
} }
void StelCore::addSiderealWeek()
{
addSiderealDays(7.0);
}
void StelCore::addSiderealMonth()
{
double days = 27.321661;
const PlanetP& home = position->getHomePlanet();
if ((home->getEnglishName() != "Solar System Observer") && (home->ge
tSiderealPeriod()>0))
days = home->getSiderealPeriod()/12;
addSolarDays(days);
}
void StelCore::addSiderealYear() void StelCore::addSiderealYear()
{ {
double days = 365.256363004; double days = 365.256363004;
const PlanetP& home = position->getHomePlanet(); const PlanetP& home = position->getHomePlanet();
if ((home->getEnglishName() != "Solar System Observer") && (home->ge tSiderealPeriod()>0)) if ((home->getEnglishName() != "Solar System Observer") && (home->ge tSiderealPeriod()>0))
days = home->getSiderealPeriod(); days = home->getSiderealPeriod();
addSolarDays(days); addSolarDays(days);
} }
void StelCore::addSiderealCentury() void StelCore::addSiderealYears(float n)
{ {
double days = 36525.6363004; double days = 365.256363004;
const PlanetP& home = position->getHomePlanet(); const PlanetP& home = position->getHomePlanet();
if ((home->getEnglishName() != "Solar System Observer") && (home->ge tSiderealPeriod()>0)) if ((home->getEnglishName() != "Solar System Observer") && (home->ge tSiderealPeriod()>0))
days = home->getSiderealPeriod()*100; days = home->getSiderealPeriod();
addSolarDays(days); addSolarDays(days*n);
} }
void StelCore::addSynodicMonth() void StelCore::addSynodicMonth()
{ {
addSolarDays(29.530588853); addSolarDays(29.530588853);
} }
void StelCore::addDraconicMonth() void StelCore::addDraconicMonth()
{ {
addSolarDays(27.212220817); addSolarDays(27.212220817);
} }
void StelCore::addTropicalMonth() void StelCore::addMeanTropicalMonth()
{ {
addSolarDays(27.321582241); addSolarDays(27.321582241);
} }
void StelCore::addAnomalisticMonth() void StelCore::addAnomalisticMonth()
{ {
addSolarDays(27.554549878); addSolarDays(27.554549878);
} }
void StelCore::addAnomalisticYear()
{
addSolarDays(365.259636);
}
void StelCore::addAnomalisticYears(float n)
{
addSolarDays(365.259636*n);
}
void StelCore::addDraconicYear() void StelCore::addDraconicYear()
{ {
addSolarDays(346.620075883); addSolarDays(346.620075883);
} }
void StelCore::addTropicalYear() void StelCore::addMeanTropicalYear()
{ {
addSolarDays(365.242190419); addSolarDays(365.242190419);
} }
void StelCore::addTropicalCentury() void StelCore::addTropicalYear()
{
// Source: J. Meeus. More Mathematical Astronomy Morsels. 2002, p. 3
58.
float T = (getJD()-2451545.0)/365250.0;
addSolarDays(365.242189623 - T*(0.000061522 - T*(0.0000000609 + T*0.
00000026525)));
}
void StelCore::addMeanTropicalYears(float n)
{
addSolarDays(365.2421897*n);
}
void StelCore::addJulianYear()
{
addSolarDays(365.25);
}
void StelCore::addGaussianYear()
{ {
addSolarDays(36524.21897); addSolarDays(365.2568983);
}
void StelCore::addJulianYears(float n)
{
addSolarDays(365.25*n);
} }
void StelCore::subtractHour() void StelCore::subtractHour()
{ {
addSolarDays(-JD_HOUR); addSolarDays(-JD_HOUR);
} }
void StelCore::subtractDay() void StelCore::subtractDay()
{ {
addSolarDays(-1.0); addSolarDays(-1.0);
skipping to change at line 1093 skipping to change at line 1184
void StelCore::subtractWeek() void StelCore::subtractWeek()
{ {
addSolarDays(-7.0); addSolarDays(-7.0);
} }
void StelCore::subtractSiderealDay() void StelCore::subtractSiderealDay()
{ {
addSiderealDays(-1.0); addSiderealDays(-1.0);
} }
void StelCore::subtractSiderealWeek()
{
addSiderealDays(-7.0);
}
void StelCore::subtractSiderealMonth()
{
double days = -27.321661;
const PlanetP& home = position->getHomePlanet();
if ((home->getEnglishName() != "Solar System Observer") && (home->ge
tSiderealPeriod()>0))
days = -1*(home->getSiderealPeriod()/12);
addSolarDays(days);
}
void StelCore::subtractSiderealYear() void StelCore::subtractSiderealYear()
{ {
double days = 365.256363004; double days = 365.256363004;
const PlanetP& home = position->getHomePlanet(); const PlanetP& home = position->getHomePlanet();
if ((home->getEnglishName() != "Solar System Observer") && (home->ge tSiderealPeriod()>0)) if ((home->getEnglishName() != "Solar System Observer") && (home->ge tSiderealPeriod()>0))
days = home->getSiderealPeriod(); days = home->getSiderealPeriod();
addSolarDays(-days); addSolarDays(-days);
} }
void StelCore::subtractSiderealCentury() void StelCore::subtractSiderealYears(float n)
{ {
double days = 36525.6363004; double days = 365.256363004;
const PlanetP& home = position->getHomePlanet(); const PlanetP& home = position->getHomePlanet();
if ((home->getEnglishName() != "Solar System Observer") && (home->ge tSiderealPeriod()>0)) if ((home->getEnglishName() != "Solar System Observer") && (home->ge tSiderealPeriod()>0))
days = home->getSiderealPeriod()*100; days = home->getSiderealPeriod();
addSolarDays(-days); addSolarDays(-days*n);
} }
void StelCore::subtractSynodicMonth() void StelCore::subtractSynodicMonth()
{ {
addSolarDays(-29.530588853); addSolarDays(-29.530588853);
} }
void StelCore::subtractDraconicMonth() void StelCore::subtractDraconicMonth()
{ {
addSolarDays(-27.212220817); addSolarDays(-27.212220817);
} }
void StelCore::subtractTropicalMonth() void StelCore::subtractMeanTropicalMonth()
{ {
addSolarDays(-27.321582241); addSolarDays(-27.321582241);
} }
void StelCore::subtractAnomalisticMonth() void StelCore::subtractAnomalisticMonth()
{ {
addSolarDays(-27.554549878); addSolarDays(-27.554549878);
} }
void StelCore::subtractAnomalisticYear()
{
addSolarDays(-365.259636);
}
void StelCore::subtractAnomalisticYears(float n)
{
addSolarDays(-365.259636*n);
}
void StelCore::subtractDraconicYear() void StelCore::subtractDraconicYear()
{ {
addSolarDays(-346.620075883); addSolarDays(-346.620075883);
} }
void StelCore::subtractTropicalYear() void StelCore::subtractTropicalYear()
{ {
// Source: J. Meeus. More Mathematical Astronomy Morsels. 2002, p. 3
58.
float T = (getJD()-2451545.0)/365250.0;
addSolarDays(-(365.242189623 - T*(0.000061522 - T*(0.0000000609 + T*
0.00000026525))));
}
void StelCore::subtractMeanTropicalYear()
{
addSolarDays(-365.242190419); addSolarDays(-365.242190419);
} }
void StelCore::subtractTropicalCentury() void StelCore::subtractMeanTropicalYears(float n)
{ {
addSolarDays(-36524.21897); addSolarDays(-365.2421897*n);
}
void StelCore::subtractJulianYear()
{
addSolarDays(-365.25);
}
void StelCore::subtractGaussianYear()
{
addSolarDays(-365.2568983);
}
void StelCore::subtractJulianYears(float n)
{
addSolarDays(-365.25*n);
} }
void StelCore::addSolarDays(double d) void StelCore::addSolarDays(double d)
{ {
const PlanetP& home = position->getHomePlanet(); const PlanetP& home = position->getHomePlanet();
if (home->getEnglishName() != "Solar System Observer") if (home->getEnglishName() != "Solar System Observer")
d *= home->getMeanSolarDay(); d *= home->getMeanSolarDay();
setJDay(getJDay() + d); setJD(getJD() + d);
} }
void StelCore::addSiderealDays(double d) void StelCore::addSiderealDays(double d)
{ {
const PlanetP& home = position->getHomePlanet(); const PlanetP& home = position->getHomePlanet();
if (home->getEnglishName() != "Solar System Observer") if (home->getEnglishName() != "Solar System Observer")
d *= home->getSiderealDay(); d *= home->getSiderealDay();
setJDay(getJDay() + d); setJD(getJD() + d);
} }
// Get the sidereal time shifted by the observer longitude // Get the sidereal time shifted by the observer longitude
double StelCore::getLocalSiderealTime() const double StelCore::getLocalSiderealTime() const
{ {
return (position->getHomePlanet()->getSiderealTime(JDay)+position->g // On Earth, this requires UT deliberately with all its faults, on o
etCurrentLocation().longitude)*M_PI/180.; ther planets we use the more regular TT.
return (position->getHomePlanet()->getSiderealTime(getJD(), getJDE()
)+position->getCurrentLocation().longitude)*M_PI/180.;
} }
//! Get the duration of a sidereal day for the current observer in day. //! Get the duration of a sidereal day for the current observer in day.
double StelCore::getLocalSiderealDayLength() const double StelCore::getLocalSiderealDayLength() const
{ {
return position->getHomePlanet()->getSiderealDay(); return position->getHomePlanet()->getSiderealDay();
} }
//! Get the duration of a sidereal year for the current observer in days. //! Get the duration of a sidereal year for the current observer in days.
double StelCore::getLocalSiderealYearLength() const double StelCore::getLocalSiderealYearLength() const
skipping to change at line 1272 skipping to change at line 1381
return (fabs(timeSpeed-JD_SECOND)<0.0000001); return (fabs(timeSpeed-JD_SECOND)<0.0000001);
} }
/////////////////////////////////////////////////////////////////////////// ///// /////////////////////////////////////////////////////////////////////////// /////
// Increment time // Increment time
void StelCore::updateTime(double deltaTime) void StelCore::updateTime(double deltaTime)
{ {
if (getRealTimeSpeed()) if (getRealTimeSpeed())
{ {
// Get rid of the error from the 1 / // Get rid of the error from the 1 /
JDay = JDayOfLastJDayUpdate + (StelApp::getTotalRunTime() - // JDay = JDayOfLastJDayUpdate + (StelApp::getTotalRunTime()
secondsOfLastJDayUpdate) / ONE_OVER_JD_SECOND; - secondsOfLastJDayUpdate) / ONE_OVER_JD_SECOND;
// GZ I don't understand the comment. Is the constant wrong?
JD.first = jdOfLastJDUpdate + (StelApp::getTotalRunTime() -
secondsOfLastJDUpdate) * JD_SECOND;
} }
else else
{ {
JDay = JDayOfLastJDayUpdate + (StelApp::getTotalRunTime() - secondsOfLastJDayUpdate) * timeSpeed; JD.first = jdOfLastJDUpdate + (StelApp::getTotalRunTime() - secondsOfLastJDUpdate) * timeSpeed;
} }
// Fix time limits to -100000 to +100000 to prevent bugs // Fix time limits to -100000 to +100000 to prevent bugs
if (JDay>38245309.499988) JDay = 38245309.499988; if (JD.first>38245309.499988) JD.first = 38245309.499988;
if (JDay<-34803211.500012) JDay = -34803211.500012; if (JD.first<-34803211.500012) JD.first = -34803211.500012;
JD.second=computeDeltaT(JD.first);
if (position->isObserverLifeOver()) if (position->isObserverLifeOver())
{ {
// Unselect if the new home planet is the previously selecte d object // Unselect if the new home planet is the previously selecte d object
StelObjectMgr* objmgr = GETSTELMODULE(StelObjectMgr); StelObjectMgr* objmgr = GETSTELMODULE(StelObjectMgr);
Q_ASSERT(objmgr); Q_ASSERT(objmgr);
if (objmgr->getWasSelected() && objmgr->getSelectedObject()[ 0].data()==position->getHomePlanet()) if (objmgr->getWasSelected() && objmgr->getSelectedObject()[ 0].data()==position->getHomePlanet())
{ {
objmgr->unSelect(); objmgr->unSelect();
} }
StelObserver* newObs = position->getNextObserver(); StelObserver* newObs = position->getNextObserver();
delete position; delete position;
position = newObs; position = newObs;
} }
position->update(deltaTime); position->update(deltaTime);
// Position of sun and all the satellites (ie planets) // Position of sun and all the satellites (ie planets)
SolarSystem* solsystem = (SolarSystem*)StelApp::getInstance().getMod // GZ maybe setting this static can speedup a bit?
uleMgr().getModule("SolarSystem"); static SolarSystem* solsystem = (SolarSystem*)StelApp::getInstance()
solsystem->computePositions(getJDay(), position->getHomePlanet()->ge .getModuleMgr().getModule("SolarSystem");
tHeliocentricEclipticPos()); // Likely the most important location where we need JDE:
solsystem->computePositions(getJDE(), position->getHomePlanet()->get
HeliocentricEclipticPos());
} }
void StelCore::resetSync() void StelCore::resetSync()
{ {
JDayOfLastJDayUpdate = getJDay(); jdOfLastJDUpdate = getJD();
secondsOfLastJDayUpdate = StelApp::getTotalRunTime(); secondsOfLastJDUpdate = StelApp::getTotalRunTime();
} }
void StelCore::setStartupTimeMode(const QString& s) void StelCore::setStartupTimeMode(const QString& s)
{ {
startupTimeMode = s; startupTimeMode = s;
} }
double StelCore::getDeltaT(double jDay) const // return precomputed DeltaT in seconds. Public.
double StelCore::getDeltaT() const
{
return JD.second;
}
// compute and return DeltaT in seconds. Try not to call it directly, curre
nt DeltaT, JD, and JDE are available.
double StelCore::computeDeltaT(const double JD) const
{ {
double DeltaT = 0.; double DeltaT = 0.;
double ndot = 0.; double ndot = 0.;
bool dontUseMoon = false; bool dontUseMoon = false;
switch (getCurrentDeltaTAlgorithm()) switch (getCurrentDeltaTAlgorithm())
{ {
case WithoutCorrection: case WithoutCorrection:
// Without correction, DeltaT is disabled // Without correction, DeltaT is disabled
DeltaT = 0.; DeltaT = 0.;
dontUseMoon = true; dontUseMoon = true;
break; break;
case Schoch: case Schoch:
// Schoch (1931) algorithm for DeltaT // Schoch (1931) algorithm for DeltaT
ndot = -29.68; // n.dot = -29.68"/cy/cy ndot = -29.68; // n.dot = -29.68"/cy/cy
DeltaT = StelUtils::getDeltaTBySchoch(jDay); DeltaT = StelUtils::getDeltaTBySchoch(JD);
break; break;
case Clemence: case Clemence:
// Clemence (1948) algorithm for DeltaT // Clemence (1948) algorithm for DeltaT
ndot = -22.44; // n.dot = -22.44 "/cy/cy ndot = -22.44; // n.dot = -22.44 "/cy/cy
DeltaT = StelUtils::getDeltaTByClemence(jDay); DeltaT = StelUtils::getDeltaTByClemence(JD);
break; break;
case IAU: case IAU:
// IAU (1952) algorithm for DeltaT, based on observa tions by Spencer Jones (1939) // IAU (1952) algorithm for DeltaT, based on observa tions by Spencer Jones (1939)
ndot = -22.44; // n.dot = -22.44 "/cy/cy ndot = -22.44; // n.dot = -22.44 "/cy/cy
DeltaT = StelUtils::getDeltaTByIAU(jDay); DeltaT = StelUtils::getDeltaTByIAU(JD);
break; break;
case AstronomicalEphemeris: case AstronomicalEphemeris:
// Astronomical Ephemeris (1960) algorithm for Delta T // Astronomical Ephemeris (1960) algorithm for Delta T
ndot = -22.44; // n.dot = -22.44 "/cy/cy ndot = -22.44; // n.dot = -22.44 "/cy/cy
DeltaT = StelUtils::getDeltaTByAstronomicalEphemeris (jDay); DeltaT = StelUtils::getDeltaTByAstronomicalEphemeris (JD);
break; break;
case TuckermanGoldstine: case TuckermanGoldstine:
// Tuckerman (1962, 1964) & Goldstine (1973) algorit hm for DeltaT // Tuckerman (1962, 1964) & Goldstine (1973) algorit hm for DeltaT
//FIXME: n.dot //FIXME: n.dot
ndot = -22.44; // n.dot = -22.44 "/cy/cy ??? ndot = -22.44; // n.dot = -22.44 "/cy/cy ???
DeltaT = StelUtils::getDeltaTByTuckermanGoldstine(jD ay); DeltaT = StelUtils::getDeltaTByTuckermanGoldstine(JD );
break; break;
case MullerStephenson: case MullerStephenson:
// Muller & Stephenson (1975) algorithm for DeltaT // Muller & Stephenson (1975) algorithm for DeltaT
ndot = -37.5; // n.dot = -37.5 "/cy/cy ndot = -37.5; // n.dot = -37.5 "/cy/cy
DeltaT = StelUtils::getDeltaTByMullerStephenson(jDay ); DeltaT = StelUtils::getDeltaTByMullerStephenson(JD);
break; break;
case Stephenson1978: case Stephenson1978:
// Stephenson (1978) algorithm for DeltaT // Stephenson (1978) algorithm for DeltaT
ndot = -30.0; // n.dot = -30.0 "/cy/cy ndot = -30.0; // n.dot = -30.0 "/cy/cy
DeltaT = StelUtils::getDeltaTByStephenson1978(jDay); DeltaT = StelUtils::getDeltaTByStephenson1978(JD);
break; break;
case SchmadelZech1979: case SchmadelZech1979:
// Schmadel & Zech (1979) algorithm for DeltaT // Schmadel & Zech (1979) algorithm for DeltaT
ndot = -23.8946; // n.dot = -23.8946 "/cy/cy ndot = -23.8946; // n.dot = -23.8946 "/cy/cy
DeltaT = StelUtils::getDeltaTBySchmadelZech1979(jDay ); DeltaT = StelUtils::getDeltaTBySchmadelZech1979(JD);
break; break;
case MorrisonStephenson1982: case MorrisonStephenson1982:
// Morrison & Stephenson (1982) algorithm for DeltaT (used by RedShift) // Morrison & Stephenson (1982) algorithm for DeltaT (used by RedShift)
ndot = -26.0; // n.dot = -26.0 "/cy/cy ndot = -26.0; // n.dot = -26.0 "/cy/cy
DeltaT = StelUtils::getDeltaTByMorrisonStephenson198 2(jDay); DeltaT = StelUtils::getDeltaTByMorrisonStephenson198 2(JD);
break; break;
case StephensonMorrison1984: case StephensonMorrison1984:
// Stephenson & Morrison (1984) algorithm for DeltaT // Stephenson & Morrison (1984) algorithm for DeltaT
ndot = -26.0; // n.dot = -26.0 "/cy/cy ndot = -26.0; // n.dot = -26.0 "/cy/cy
DeltaT = StelUtils::getDeltaTByStephensonMorrison198 4(jDay); DeltaT = StelUtils::getDeltaTByStephensonMorrison198 4(JD);
break; break;
case StephensonHoulden: case StephensonHoulden:
// Stephenson & Houlden (1986) algorithm for DeltaT // Stephenson & Houlden (1986) algorithm for DeltaT
ndot = -26.0; // n.dot = -26.0 "/cy/cy ndot = -26.0; // n.dot = -26.0 "/cy/cy
DeltaT = StelUtils::getDeltaTByStephensonHoulden(jDa y); DeltaT = StelUtils::getDeltaTByStephensonHoulden(JD) ;
break; break;
case Espenak: case Espenak:
// Espenak (1987, 1989) algorithm for DeltaT // Espenak (1987, 1989) algorithm for DeltaT
//FIXME: n.dot //FIXME: n.dot
ndot = -23.8946; // n.dot = -23.8946 "/cy/cy ??? ndot = -23.8946; // n.dot = -23.8946 "/cy/cy ???
DeltaT = StelUtils::getDeltaTByEspenak(jDay); DeltaT = StelUtils::getDeltaTByEspenak(JD);
break; break;
case Borkowski: case Borkowski:
// Borkowski (1988) algorithm for DeltaT, relates to ELP2000-85! // Borkowski (1988) algorithm for DeltaT, relates to ELP2000-85!
ndot = -23.895; // GZ: I see -23.895 in the paper, n ot -23.859; (?) // n.dot = -23.859 "/cy/cy ndot = -23.895; // GZ: I see -23.895 in the paper, n ot -23.859; (?) // n.dot = -23.859 "/cy/cy
DeltaT = StelUtils::getDeltaTByBorkowski(jDay); DeltaT = StelUtils::getDeltaTByBorkowski(JD);
break; break;
case SchmadelZech1988: case SchmadelZech1988:
// Schmadel & Zech (1988) algorithm for DeltaT // Schmadel & Zech (1988) algorithm for DeltaT
//FIXME: n.dot //FIXME: n.dot
ndot = -26.0; // n.dot = -26.0 "/cy/cy ??? ndot = -26.0; // n.dot = -26.0 "/cy/cy ???
DeltaT = StelUtils::getDeltaTBySchmadelZech1988(jDay ); DeltaT = StelUtils::getDeltaTBySchmadelZech1988(JD);
break; break;
case ChaprontTouze: case ChaprontTouze:
// Chapront-Touzé & Chapront (1991) algorithm for De ltaT // Chapront-Touzé & Chapront (1991) algorithm for De ltaT
ndot = -23.8946; // n.dot = -23.8946 "/cy/cy ndot = -23.8946; // n.dot = -23.8946 "/cy/cy
DeltaT = StelUtils::getDeltaTByChaprontTouze(jDay); DeltaT = StelUtils::getDeltaTByChaprontTouze(JD);
break; break;
case StephensonMorrison1995: case StephensonMorrison1995:
// Stephenson & Morrison (1995) algorithm for DeltaT // Stephenson & Morrison (1995) algorithm for DeltaT
ndot = -26.0; // n.dot = -26.0 "/cy/cy ndot = -26.0; // n.dot = -26.0 "/cy/cy
DeltaT = StelUtils::getDeltaTByStephensonMorrison199 5(jDay); DeltaT = StelUtils::getDeltaTByStephensonMorrison199 5(JD);
break; break;
case Stephenson1997: case Stephenson1997:
// Stephenson (1997) algorithm for DeltaT // Stephenson (1997) algorithm for DeltaT
ndot = -26.0; // n.dot = -26.0 "/cy/cy ndot = -26.0; // n.dot = -26.0 "/cy/cy
DeltaT = StelUtils::getDeltaTByStephenson1997(jDay); DeltaT = StelUtils::getDeltaTByStephenson1997(JD);
break; break;
case ChaprontMeeus: case ChaprontMeeus:
// Chapront, Chapront-Touze & Francou (1997) & Meeus (1998) algorithm for DeltaT // Chapront, Chapront-Touze & Francou (1997) & Meeus (1998) algorithm for DeltaT
ndot = -25.7376; // n.dot = -25.7376 "/cy/cy ndot = -25.7376; // n.dot = -25.7376 "/cy/cy
DeltaT = StelUtils::getDeltaTByChaprontMeeus(jDay); DeltaT = StelUtils::getDeltaTByChaprontMeeus(JD);
break; break;
case JPLHorizons: case JPLHorizons:
// JPL Horizons algorithm for DeltaT // JPL Horizons algorithm for DeltaT
ndot = -25.7376; // n.dot = -25.7376 "/cy/cy ndot = -25.7376; // n.dot = -25.7376 "/cy/cy
DeltaT = StelUtils::getDeltaTByJPLHorizons(jDay); DeltaT = StelUtils::getDeltaTByJPLHorizons(JD);
break; break;
case MeeusSimons: case MeeusSimons:
// Meeus & Simons (2000) algorithm for DeltaT // Meeus & Simons (2000) algorithm for DeltaT
ndot = -25.7376; // n.dot = -25.7376 "/cy/cy ndot = -25.7376; // n.dot = -25.7376 "/cy/cy
DeltaT = StelUtils::getDeltaTByMeeusSimons(jDay); DeltaT = StelUtils::getDeltaTByMeeusSimons(JD);
break; break;
case ReingoldDershowitz: case ReingoldDershowitz:
// Reingold & Dershowitz (2002, 2007) algorithm for DeltaT // Reingold & Dershowitz (2002, 2007) algorithm for DeltaT
// FIXME: n.dot // FIXME: n.dot
ndot = -26.0; // n.dot = -26.0 "/cy/cy ??? ndot = -26.0; // n.dot = -26.0 "/cy/cy ???
DeltaT = StelUtils::getDeltaTByReingoldDershowitz(jD ay); DeltaT = StelUtils::getDeltaTByReingoldDershowitz(JD );
break; break;
case MontenbruckPfleger: case MontenbruckPfleger:
// Montenbruck & Pfleger (2000) algorithm for DeltaT // Montenbruck & Pfleger (2000) algorithm for DeltaT
// NOTE: book not contains n.dot value // NOTE: book not contains n.dot value
// FIXME: n.dot // FIXME: n.dot
ndot = -26.0; // n.dot = -26.0 "/cy/cy ??? ndot = -26.0; // n.dot = -26.0 "/cy/cy ???
DeltaT = StelUtils::getDeltaTByMontenbruckPfleger(jD ay); DeltaT = StelUtils::getDeltaTByMontenbruckPfleger(JD );
break; break;
case MorrisonStephenson2004: case MorrisonStephenson2004:
// Morrison & Stephenson (2004, 2005) algorithm for DeltaT // Morrison & Stephenson (2004, 2005) algorithm for DeltaT
ndot = -26.0; // n.dot = -26.0 "/cy/cy ndot = -26.0; // n.dot = -26.0 "/cy/cy
DeltaT = StelUtils::getDeltaTByMorrisonStephenson200 4(jDay); DeltaT = StelUtils::getDeltaTByMorrisonStephenson200 4(JD);
break; break;
case Reijs: case Reijs:
// Reijs (2006) algorithm for DeltaT // Reijs (2006) algorithm for DeltaT
ndot = -26.0; // n.dot = -26.0 "/cy/cy ndot = -26.0; // n.dot = -26.0 "/cy/cy
DeltaT = StelUtils::getDeltaTByReijs(jDay); DeltaT = StelUtils::getDeltaTByReijs(JD);
break; break;
case EspenakMeeus: case EspenakMeeus:
// Espenak & Meeus (2006) algorithm for DeltaT // Espenak & Meeus (2006) algorithm for DeltaT
ndot = -25.858; // n.dot = -25.858 "/cy/cy ndot = -25.858; // n.dot = -25.858 "/cy/cy
DeltaT = StelUtils::getDeltaTByEspenakMeeus(jDay); DeltaT = StelUtils::getDeltaTByEspenakMeeus(JD);
break;
case EspenakMeeusZeroMoonAccel:
// This is a trying area. Something is wrong with De
ltaT, maybe ndot is still not applied correctly.
// Espenak & Meeus (2006) algorithm for DeltaT
ndot = -25.858; // n.dot = -25.858 "/cy/cy
dontUseMoon = true;
DeltaT = StelUtils::getDeltaTByEspenakMeeus(JD);
break; break;
case Banjevic: case Banjevic:
// Banjevic (2006) algorithm for DeltaT // Banjevic (2006) algorithm for DeltaT
ndot = -26.0; // n.dot = -26.0 "/cy/cy ndot = -26.0; // n.dot = -26.0 "/cy/cy
DeltaT = StelUtils::getDeltaTByBanjevic(jDay); DeltaT = StelUtils::getDeltaTByBanjevic(JD);
break; break;
case IslamSadiqQureshi: case IslamSadiqQureshi:
// Islam, Sadiq & Qureshi (2008 + revisited 2013) al gorithm for DeltaT (6 polynomials) // Islam, Sadiq & Qureshi (2008 + revisited 2013) al gorithm for DeltaT (6 polynomials)
ndot = -26.0; // n.dot = -26.0 "/cy/cy ndot = -26.0; // n.dot = -26.0 "/cy/cy
DeltaT = StelUtils::getDeltaTByIslamSadiqQureshi(jDa y); DeltaT = StelUtils::getDeltaTByIslamSadiqQureshi(JD) ;
dontUseMoon = true; // Seems this solutions doesn't use value of secular acceleration of the Moon dontUseMoon = true; // Seems this solutions doesn't use value of secular acceleration of the Moon
break; break;
case KhalidSultanaZaidi: case KhalidSultanaZaidi:
// M. Khalid, Mariam Sultana and Faheem Zaidi polino mial approximation of time period 1620-2013 (2014) // M. Khalid, Mariam Sultana and Faheem Zaidi polino mial approximation of time period 1620-2013 (2014)
ndot = -26.0; // n.dot = -26.0 "/cy/cy ndot = -26.0; // n.dot = -26.0 "/cy/cy
DeltaT = StelUtils::getDeltaTByKhalidSultanaZaidi(jD ay); DeltaT = StelUtils::getDeltaTByKhalidSultanaZaidi(JD );
dontUseMoon = true; // Seems this solutions doesn't use value of secular acceleration of the Moon dontUseMoon = true; // Seems this solutions doesn't use value of secular acceleration of the Moon
break; break;
case Custom: case Custom:
// User defined coefficients for quadratic equation for DeltaT // User defined coefficients for quadratic equation for DeltaT
ndot = getDeltaTCustomNDot(); // n.dot = custom valu e "/cy/cy ndot = getDeltaTCustomNDot(); // n.dot = custom valu e "/cy/cy
int year, month, day; int year, month, day;
Vec3f coeff = getDeltaTCustomEquationCoefficients(); Vec3f coeff = getDeltaTCustomEquationCoefficients();
StelUtils::getDateFromJulianDay(jDay, &year, &month, &day); StelUtils::getDateFromJulianDay(JD, &year, &month, & day);
double u = (StelUtils::getDecYear(year,month,day)-ge tDeltaTCustomYear())/100; double u = (StelUtils::getDecYear(year,month,day)-ge tDeltaTCustomYear())/100;
DeltaT = coeff[0] + u*(coeff[1] + u*coeff[2]); DeltaT = coeff[0] + u*(coeff[1] + u*coeff[2]);
break; break;
} }
if (!dontUseMoon) if (!dontUseMoon)
DeltaT += StelUtils::getMoonSecularAcceleration(jDay, ndot); DeltaT += StelUtils::getMoonSecularAcceleration(JD, ndot);
return DeltaT; return DeltaT;
} }
//! Set the current algorithm for time correction to use //! Set the current algorithm for time correction to use
void StelCore::setCurrentDeltaTAlgorithmKey(QString key) void StelCore::setCurrentDeltaTAlgorithmKey(QString key)
{ {
const QMetaEnum& en = metaObject()->enumerator(metaObject()->indexOf Enumerator("DeltaTAlgorithm")); const QMetaEnum& en = metaObject()->enumerator(metaObject()->indexOf Enumerator("DeltaTAlgorithm"));
DeltaTAlgorithm algo = (DeltaTAlgorithm)en.keyToValue(key.toLatin1() .data()); DeltaTAlgorithm algo = (DeltaTAlgorithm)en.keyToValue(key.toLatin1() .data());
if (algo<0) if (algo<0)
skipping to change at line 1523 skipping to change at line 1651
// GZ remarked where more info would be desirable. Generally, a full citation and the math. term would be nice to have displayed if it's just o ne formula, and the range of valid dates. // GZ remarked where more info would be desirable. Generally, a full citation and the math. term would be nice to have displayed if it's just o ne formula, and the range of valid dates.
QString description; QString description;
double jd = 0; double jd = 0;
QString marker; QString marker;
switch (getCurrentDeltaTAlgorithm()) switch (getCurrentDeltaTAlgorithm())
{ {
case WithoutCorrection: case WithoutCorrection:
description = q_("Correction is disabled. Use only i f you know what you are doing!"); description = q_("Correction is disabled. Use only i f you know what you are doing!");
break; break;
case Schoch: // historical value. case Schoch: // historical value.
description = q_("This historical formula was obtain ed by C. Schoch in 1931 and was used by G. Henriksson in his article <em>Ei nstein's Theory of Relativity Confirmed by Ancient Solar Eclipses</em> (%1) . See for more info %2here%3.").arg("2009").arg("<a href='http://journalofc osmology.com/AncientAstronomy123.html'>").arg("</a>").append(getCurrentDelt aTAlgorithmValidRange(jd, &marker)); description = q_("This historical formula was obtain ed by C. Schoch in 1931 and was used by G. Henriksson in his article <em>Ei nstein's Theory of Relativity Confirmed by Ancient Solar Eclipses</em> (%1) . See for more info %2here%3.").arg("2009").arg("<a href='http://journalofc osmology.com/AncientAstronomy123.html'>").arg("</a>").append(getCurrentDelt aTAlgorithmValidRangeDescription(jd, &marker));
break; break;
case Clemence: // historical value. case Clemence: // historical value.
description = q_("This empirical equation was publis hed by G. M. Clemence in the article <em>On the system of astronomical cons tants</em> (%1).").arg("<a href='http://adsabs.harvard.edu/abs/1948AJ.....5 3..169C'>1948</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker) ); description = q_("This empirical equation was publis hed by G. M. Clemence in the article <em>On the system of astronomical cons tants</em> (%1).").arg("<a href='http://adsabs.harvard.edu/abs/1948AJ.....5 3..169C'>1948</a>").append(getCurrentDeltaTAlgorithmValidRangeDescription(j d, &marker));
break; break;
case IAU: // historical value. case IAU: // historical value.
description = q_("This formula is based on a study o f post-1650 observations of the Sun, the Moon and the planets by Spencer Jo nes (%1) and used by Jean Meeus in his <em>Astronomical Formulae for Calcul ators</em>. It was also adopted in the PC program SunTracker Pro.").arg("<a href='http://adsabs.harvard.edu/abs/1939MNRAS..99..541S'>1939</a>").append (getCurrentDeltaTAlgorithmValidRange(jd, &marker)); description = q_("This formula is based on a study o f post-1650 observations of the Sun, the Moon and the planets by Spencer Jo nes (%1) and used by Jean Meeus in his <em>Astronomical Formulae for Calcul ators</em>. It was also adopted in the PC program SunTracker Pro.").arg("<a href='http://adsabs.harvard.edu/abs/1939MNRAS..99..541S'>1939</a>").append (getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
// find year of publication of AFFC // find year of publication of AFFC
break; break;
case AstronomicalEphemeris: // historical value. case AstronomicalEphemeris: // historical value.
description = q_("This is a slightly modified versio n of the IAU (1952) formula which was adopted in the <em>Astronomical Ephem eris</em> and in the <em>Canon of Solar Eclipses</em> by Mucke & Meeus (198 3).").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker)); description = q_("This is a slightly modified versio n of the IAU (1952) formula which was adopted in the <em>Astronomical Ephem eris</em> and in the <em>Canon of Solar Eclipses</em> by Mucke & Meeus (198 3).").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
// TODO: expand the sentence: ... adopted ... from 1 9xx-19yy? // TODO: expand the sentence: ... adopted ... from 1 9xx-19yy?
break; break;
case TuckermanGoldstine: // historical value. case TuckermanGoldstine: // historical value.
description = q_("The tables of Tuckerman (1962, 196 4) list the positions of the Sun, the Moon and the planets at 5- and 10-day intervals from 601 BCE to 1649 CE. The same relation was also implicitly a dopted in the syzygy tables of Goldstine (1973).").append(getCurrentDeltaTA lgorithmValidRange(jd, &marker)); description = q_("The tables of Tuckerman (1962, 196 4) list the positions of the Sun, the Moon and the planets at 5- and 10-day intervals from 601 BCE to 1649 CE. The same relation was also implicitly a dopted in the syzygy tables of Goldstine (1973).").append(getCurrentDeltaTA lgorithmValidRangeDescription(jd, &marker));
// TODO: These tables are sometimes found cited, but I have no details. Maybe add "based on ... " ? // TODO: These tables are sometimes found cited, but I have no details. Maybe add "based on ... " ?
break; break;
case MullerStephenson: case MullerStephenson:
description = q_("This equation was published by P. M. Muller and F. R. Stephenson in the article <em>The accelerations of the earth and moon from early astronomical observations</em> (%1).").arg("<a hr ef='http://adsabs.harvard.edu/abs/1975grhe.conf..459M'>1975</a>").append(ge tCurrentDeltaTAlgorithmValidRange(jd, &marker)); description = q_("This equation was published by P. M. Muller and F. R. Stephenson in the article <em>The accelerations of the earth and moon from early astronomical observations</em> (%1).").arg("<a hr ef='http://adsabs.harvard.edu/abs/1975grhe.conf..459M'>1975</a>").append(ge tCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
break; break;
case Stephenson1978: case Stephenson1978:
description = q_("This equation was published by F. R. Stephenson in the article <em>Pre-Telescopic Astronomical Observations</ em> (%1).").arg("<a href='http://adsabs.harvard.edu/abs/1978tfer.conf....5S '>1978</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker)); description = q_("This equation was published by F. R. Stephenson in the article <em>Pre-Telescopic Astronomical Observations</ em> (%1).").arg("<a href='http://adsabs.harvard.edu/abs/1978tfer.conf....5S '>1978</a>").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &mar ker));
break; break;
case SchmadelZech1979: // outdated data fit, historical valu e? case SchmadelZech1979: // outdated data fit, historical valu e?
description = q_("This 12th-order polynomial equatio n (outdated and superseded by Schmadel & Zech (1988)) was published by L. D . Schmadel and G. Zech in the article <em>Polynomial approximations for the correction delta T E.T.-U.T. in the period 1800-1975</em> (%1) as fit thro ugh data published by Brouwer (1952).").arg("<a href='http://adsabs.harvard .edu/abs/1979AcA....29..101S'>1979</a>").append(getCurrentDeltaTAlgorithmVa lidRange(jd, &marker)); description = q_("This 12th-order polynomial equatio n (outdated and superseded by Schmadel & Zech (1988)) was published by L. D . Schmadel and G. Zech in the article <em>Polynomial approximations for the correction delta T E.T.-U.T. in the period 1800-1975</em> (%1) as fit thro ugh data published by Brouwer (1952).").arg("<a href='http://adsabs.harvard .edu/abs/1979AcA....29..101S'>1979</a>").append(getCurrentDeltaTAlgorithmVa lidRangeDescription(jd, &marker));
break; break;
case MorrisonStephenson1982: case MorrisonStephenson1982:
description = q_("This algorithm was adopted in P. B retagnon & L. Simon's <em>Planetary Programs and Tables from -4000 to +2800 </em> (1986) and in the PC planetarium program RedShift.").append(getCurren tDeltaTAlgorithmValidRange(jd, &marker)); description = q_("This algorithm was adopted in P. B retagnon & L. Simon's <em>Planetary Programs and Tables from -4000 to +2800 </em> (1986) and in the PC planetarium program RedShift.").append(getCurren tDeltaTAlgorithmValidRangeDescription(jd, &marker));
break; break;
case StephensonMorrison1984: // PRIMARY SOURCE case StephensonMorrison1984: // PRIMARY SOURCE
description = q_("This formula was published by F. R . Stephenson and L. V. Morrison in the article <em>Long-term changes in the rotation of the earth - 700 B.C. to A.D. 1980</em> (%1).").arg("<a href='h ttp://adsabs.harvard.edu/abs/1984RSPTA.313...47S'>1984</a>").append(getCurr entDeltaTAlgorithmValidRange(jd, &marker)); description = q_("This formula was published by F. R . Stephenson and L. V. Morrison in the article <em>Long-term changes in the rotation of the earth - 700 B.C. to A.D. 1980</em> (%1).").arg("<a href='h ttp://adsabs.harvard.edu/abs/1984RSPTA.313...47S'>1984</a>").append(getCurr entDeltaTAlgorithmValidRangeDescription(jd, &marker));
break; break;
case StephensonHoulden: case StephensonHoulden:
description = q_("This algorithm is used in the PC p lanetarium program Guide 7.").append(getCurrentDeltaTAlgorithmValidRange(jd , &marker)); description = q_("This algorithm is used in the PC p lanetarium program Guide 7.").append(getCurrentDeltaTAlgorithmValidRangeDes cription(jd, &marker));
break; break;
case Espenak: // limited range, but wide availability? case Espenak: // limited range, but wide availability?
description = q_("This algorithm was given by F. Esp enak in his <em>Fifty Year Canon of Solar Eclipses: 1986-2035</em> (1987) a nd in his <em>Fifty Year Canon of Lunar Eclipses: 1986-2035</em> (1989)."). append(getCurrentDeltaTAlgorithmValidRange(jd, &marker)); description = q_("This algorithm was given by F. Esp enak in his <em>Fifty Year Canon of Solar Eclipses: 1986-2035</em> (1987) a nd in his <em>Fifty Year Canon of Lunar Eclipses: 1986-2035</em> (1989)."). append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
break; break;
case Borkowski: // Linked to ELP2000-85, so it's important.. . case Borkowski: // Linked to ELP2000-85, so it's important.. .
description = q_("This formula was obtained by K.M. Borkowski (%1) from an analysis of 31 solar eclipse records dating between 2137 BCE and 1715 CE.").arg("<a href='http://adsabs.harvard.edu/abs/1988A&A ...205L...8B'>1988</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &ma rker)); description = q_("This formula was obtained by K.M. Borkowski (%1) from an analysis of 31 solar eclipse records dating between 2137 BCE and 1715 CE.").arg("<a href='http://adsabs.harvard.edu/abs/1988A&A ...205L...8B'>1988</a>").append(getCurrentDeltaTAlgorithmValidRangeDescript ion(jd, &marker));
break; break;
case SchmadelZech1988: // data fit through Stephenson&Morris on1984, which itself is important. Unclear who uses this version? case SchmadelZech1988: // data fit through Stephenson&Morris on1984, which itself is important. Unclear who uses this version?
description = q_("This 12th-order polynomial equatio n was published by L. D. Schmadel and G. Zech in the article <em>Empirical Transformations from U.T. to E.T. for the Period 1800-1988</em> (%1) as dat a fit through values given by Stephenson & Morrison (1984).").arg("<a href= 'http://adsabs.harvard.edu/abs/1988AN....309..219S'>1988</a>").append(getCu rrentDeltaTAlgorithmValidRange(jd, &marker)); description = q_("This 12th-order polynomial equatio n was published by L. D. Schmadel and G. Zech in the article <em>Empirical Transformations from U.T. to E.T. for the Period 1800-1988</em> (%1) as dat a fit through values given by Stephenson & Morrison (1984).").arg("<a href= 'http://adsabs.harvard.edu/abs/1988AN....309..219S'>1988</a>").append(getCu rrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
break; break;
case ChaprontTouze: case ChaprontTouze:
description = q_("This formula was adopted by M. Cha pront-Touze & J. Chapront in the shortened version of the ELP 2000-85 lunar theory in their <em>Lunar Tables and Programs from 4000 B.C. to A.D. 8000< /em> (1991).").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker)); description = q_("This formula was adopted by M. Cha pront-Touze & J. Chapront in the shortened version of the ELP 2000-85 lunar theory in their <em>Lunar Tables and Programs from 4000 B.C. to A.D. 8000< /em> (1991).").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &m arker));
break; break;
case StephensonMorrison1995: case StephensonMorrison1995:
description = q_("This equation was published by F. R. Stephenson and L. V. Morrison in the article <em>Long-Term Fluctuations in the Earth's Rotation: 700 BC to AD 1990</em> (%1).").arg("<a href='http: //adsabs.harvard.edu/abs/1995RSPTA.351..165S'>1995</a>").append(getCurrentD eltaTAlgorithmValidRange(jd, &marker)); description = q_("This equation was published by F. R. Stephenson and L. V. Morrison in the article <em>Long-Term Fluctuations in the Earth's Rotation: 700 BC to AD 1990</em> (%1).").arg("<a href='http: //adsabs.harvard.edu/abs/1995RSPTA.351..165S'>1995</a>").append(getCurrentD eltaTAlgorithmValidRangeDescription(jd, &marker));
break; break;
case Stephenson1997: case Stephenson1997:
description = q_("F. R. Stephenson published this fo rmula in his book <em>Historical Eclipses and Earth's Rotation</em> (%1).") .arg("<a href='http://ebooks.cambridge.org/ebook.jsf?bid=CBO9780511525186'> 1997</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker)); description = q_("F. R. Stephenson published this fo rmula in his book <em>Historical Eclipses and Earth's Rotation</em> (%1).") .arg("<a href='http://ebooks.cambridge.org/ebook.jsf?bid=CBO9780511525186'> 1997</a>").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marke r));
break; break;
case ChaprontMeeus: case ChaprontMeeus:
description = q_("From J. Meeus, <em>Astronomical Al gorithms</em> (2nd ed., 1998), and widely used. Table for 1620..2000, and i ncludes a variant of Chapront, Chapront-Touze & Francou (1997) for dates ou tside 1620..2000.").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker) ); description = q_("From J. Meeus, <em>Astronomical Al gorithms</em> (2nd ed., 1998), and widely used. Table for 1620..2000, and i ncludes a variant of Chapront, Chapront-Touze & Francou (1997) for dates ou tside 1620..2000.").append(getCurrentDeltaTAlgorithmValidRangeDescription(j d, &marker));
break; break;
case JPLHorizons: case JPLHorizons:
description = q_("The JPL Solar System Dynamics Grou p of the NASA Jet Propulsion Laboratory use this formula in their interacti ve website %1JPL Horizons%2.").arg("<a href='http://ssd.jpl.nasa.gov/?horiz ons'>").arg("</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker) ); description = q_("The JPL Solar System Dynamics Grou p of the NASA Jet Propulsion Laboratory use this formula in their interacti ve website %1JPL Horizons%2.").arg("<a href='http://ssd.jpl.nasa.gov/?horiz ons'>").arg("</a>").append(getCurrentDeltaTAlgorithmValidRangeDescription(j d, &marker));
break; break;
case MeeusSimons: case MeeusSimons:
description = q_("This polynome was published by J. Meeus and L. Simons in article <em>Polynomial approximations to Delta T, 16 20-2000 AD</em> (%1).").arg("<a href='http://adsabs.harvard.edu/abs/2000JBA A..110..323M'>2000</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &ma rker)); description = q_("This polynome was published by J. Meeus and L. Simons in article <em>Polynomial approximations to Delta T, 16 20-2000 AD</em> (%1).").arg("<a href='http://adsabs.harvard.edu/abs/2000JBA A..110..323M'>2000</a>").append(getCurrentDeltaTAlgorithmValidRangeDescript ion(jd, &marker));
break; break;
case MontenbruckPfleger: // uninspired case MontenbruckPfleger: // uninspired
description = q_("The fourth edition of O. Montenbru ck & T. Pfleger's <em>Astronomy on the Personal Computer</em> (2000) provid es simple 3rd-order polynomial data fits for the recent past.").append(getC urrentDeltaTAlgorithmValidRange(jd, &marker)); description = q_("The fourth edition of O. Montenbru ck & T. Pfleger's <em>Astronomy on the Personal Computer</em> (2000) provid es simple 3rd-order polynomial data fits for the recent past.").append(getC urrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
break; break;
case ReingoldDershowitz: // case ReingoldDershowitz: //
description = q_("E. M. Reingold & N. Dershowitz pre sent this polynomial data fit in <em>Calendrical Calculations</em> (3rd ed. 2007) and in their <em>Calendrical Tabulations</em> (2002). It is based on Jean Meeus' <em>Astronomical Algorithms</em> (1991).").append(getCurrentDe ltaTAlgorithmValidRange(jd, &marker)); description = q_("E. M. Reingold & N. Dershowitz pre sent this polynomial data fit in <em>Calendrical Calculations</em> (3rd ed. 2007) and in their <em>Calendrical Tabulations</em> (2002). It is based on Jean Meeus' <em>Astronomical Algorithms</em> (1991).").append(getCurrentDe ltaTAlgorithmValidRangeDescription(jd, &marker));
break; break;
case MorrisonStephenson2004: // PRIMARY SOURCE case MorrisonStephenson2004: // PRIMARY SOURCE
description = q_("This important solution was publis hed by L. V. Morrison and F. R. Stephenson in article <em>Historical values of the Earth's clock error %1T and the calculation of eclipses</em> (%2) w ith addendum in (%3).").arg(QChar(0x0394)).arg("<a href='http://adsabs.harv ard.edu/abs/2004JHA....35..327M'>2004</a>").arg("<a href='http://adsabs.har vard.edu/abs/2005JHA....36..339M'>2005</a>").append(getCurrentDeltaTAlgorit hmValidRange(jd, &marker)); description = q_("This important solution was publis hed by L. V. Morrison and F. R. Stephenson in article <em>Historical values of the Earth's clock error %1T and the calculation of eclipses</em> (%2) w ith addendum in (%3).").arg(QChar(0x0394)).arg("<a href='http://adsabs.harv ard.edu/abs/2004JHA....35..327M'>2004</a>").arg("<a href='http://adsabs.har vard.edu/abs/2005JHA....36..339M'>2005</a>").append(getCurrentDeltaTAlgorit hmValidRangeDescription(jd, &marker));
break; break;
case Reijs: case Reijs:
description = q_("From the Length of Day (LOD; as de termined by Stephenson & Morrison (%2)), Victor Reijs derived a %1T formula by using a Simplex optimisation with a cosine and square function. This is based on a possible periodicy described by Stephenson (%2). See for more i nfo %3here%4.").arg(QChar(0x0394)).arg("<a href='http://adsabs.harvard.edu/ abs/2004JHA....35..327M'>2004</a>").arg("<a href='http://www.iol.ie/~geniet /eng/DeltaTeval.htm'>").arg("</a>").append(getCurrentDeltaTAlgorithmValidRa nge(jd, &marker)); description = q_("From the Length of Day (LOD; as de termined by Stephenson & Morrison (%2)), Victor Reijs derived a %1T formula by using a Simplex optimisation with a cosine and square function. This is based on a possible periodicy described by Stephenson (%2). See for more i nfo %3here%4.").arg(QChar(0x0394)).arg("<a href='http://adsabs.harvard.edu/ abs/2004JHA....35..327M'>2004</a>").arg("<a href='http://www.iol.ie/~geniet /eng/DeltaTeval.htm'>").arg("</a>").append(getCurrentDeltaTAlgorithmValidRa ngeDescription(jd, &marker));
break; break;
case EspenakMeeus: // GENERAL SOLUTION case EspenakMeeus: // GENERAL SOLUTION
description = q_("This solution by F. Espenak and J. description = q_("This solution by F. Espenak and J.
Meeus, based on Morrison & Stephenson (2004) and a polynomial fit through Meeus, based on Morrison & Stephenson (2004) and a polynomial fit through
tabulated values for 1600-2000, is used for the %1NASA Eclipse Web Site%2 a tabulated values for 1600-2000, is used for the %1NASA Eclipse Web Site%2 a
nd in their <em>Five Millennium Canon of Solar Eclipses: -1900 to +3000</em nd in their <em>Five Millennium Canon of Solar Eclipses: -1900 to +3000</em
> (2006). This formula is also used in the solar, lunar and planetary ephem > (2006). This formula is also used in the solar, lunar and planetary ephem
eris program SOLEX.").arg("<a href='http://eclipse.gsfc.nasa.gov/eclipse.ht eris program SOLEX.").arg("<a href='http://eclipse.gsfc.nasa.gov/eclipse.ht
ml'>").arg("</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker)) ml'>").arg("</a>").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd
.append(" <em>").append(q_("Used by default.")).append("</em>"); , &marker)).append(" <em>").append(q_("Used by default.")).append("</em>");
break;
case EspenakMeeusZeroMoonAccel: // PATCHED SOLUTION
description = QString("%1 %2").arg(q_("PATCHED VERSI
ON WITHOUT ADDITIONAL LUNAR ACCELERATION.")).arg(q_("This solution by F. Es
penak and J. Meeus, based on Morrison & Stephenson (2004) and a polynomial
fit through tabulated values for 1600-2000, is used for the %1NASA Eclipse
Web Site%2 and in their <em>Five Millennium Canon of Solar Eclipses: -1900
to +3000</em> (2006). This formula is also used in the solar, lunar and pla
netary ephemeris program SOLEX.").arg("<a href='http://eclipse.gsfc.nasa.go
v/eclipse.html'>").arg("</a>").append(getCurrentDeltaTAlgorithmValidRangeDe
scription(jd, &marker)).append(" <em>").append("</em>"));
break; break;
case Banjevic: case Banjevic:
description = q_("This solution by B. Banjevic, base d on Stephenson & Morrison (1984), was published in article <em>Ancient ecl ipses and dating the fall of Babylon</em> (%1).").arg("<a href='http://adsa bs.harvard.edu/abs/2006POBeo..80..251B'>2006</a>").append(getCurrentDeltaTA lgorithmValidRange(jd, &marker)); description = q_("This solution by B. Banjevic, base d on Stephenson & Morrison (1984), was published in article <em>Ancient ecl ipses and dating the fall of Babylon</em> (%1).").arg("<a href='http://adsa bs.harvard.edu/abs/2006POBeo..80..251B'>2006</a>").append(getCurrentDeltaTA lgorithmValidRangeDescription(jd, &marker));
break; break;
case IslamSadiqQureshi: case IslamSadiqQureshi:
description = q_("This solution by S. Islam, M. Sadi q and M. S. Qureshi, based on Meeus & Simons (2000), was published in artic le <em>Error Minimization of Polynomial Approximation of DeltaT</em> (%1) a nd revisited by Sana Islam in 2013.").arg("<a href='http://www.ias.ac.in/ja a/dec2008/JAA610.pdf'>2008</a>").append(getCurrentDeltaTAlgorithmValidRange (jd, &marker)); description = q_("This solution by S. Islam, M. Sadi q and M. S. Qureshi, based on Meeus & Simons (2000), was published in artic le <em>Error Minimization of Polynomial Approximation of DeltaT</em> (%1) a nd revisited by Sana Islam in 2013.").arg("<a href='http://www.ias.ac.in/ja a/dec2008/JAA610.pdf'>2008</a>").append(getCurrentDeltaTAlgorithmValidRange Description(jd, &marker));
break; break;
case KhalidSultanaZaidi: case KhalidSultanaZaidi:
description = q_("This polynomial approximation with 0.6 seconds of accuracy by M. Khalid, Mariam Sultana and Faheem Zaidi was published in <em>Delta T: Polynomial Approximation of Time Period 1620-2013 </em> (%1).").arg("<a href='http://dx.doi.org/10.1155/2014/480964'>2014</a> ").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker)); description = q_("This polynomial approximation with 0.6 seconds of accuracy by M. Khalid, Mariam Sultana and Faheem Zaidi was published in <em>Delta T: Polynomial Approximation of Time Period 1620-2013 </em> (%1).").arg("<a href='http://dx.doi.org/10.1155/2014/480964'>2014</a> ").append(getCurrentDeltaTAlgorithmValidRangeDescription(jd, &marker));
break; break;
case Custom: case Custom:
description = q_("This is a quadratic formula for ca lculation of %1T with coefficients defined by the user.").arg(QChar(0x0394) ); description = q_("This is a quadratic formula for ca lculation of %1T with coefficients defined by the user.").arg(QChar(0x0394) );
break; break;
default: default:
description = q_("Error"); description = q_("Error");
} }
return description; return description;
} }
QString StelCore::getCurrentDeltaTAlgorithmValidRange(double jDay, QString *marker) const QString StelCore::getCurrentDeltaTAlgorithmValidRangeDescription(const doub le JD, QString *marker) const
{ {
QString validRange = ""; QString validRange = "";
QString validRangeAppendix = ""; QString validRangeAppendix = "";
*marker = ""; *marker = "";
int year, month, day; int year, month, day;
int start = 0; int start = 0;
int finish = 0; int finish = 0;
StelUtils::getDateFromJulianDay(jDay, &year, &month, &day); StelUtils::getDateFromJulianDay(JD, &year, &month, &day);
switch (getCurrentDeltaTAlgorithm()) switch (getCurrentDeltaTAlgorithm())
{ {
case WithoutCorrection: case WithoutCorrection:
// say nothing // say nothing
break; break;
case Schoch: case Schoch:
// Valid range unknown // Valid range unknown
break; break;
case Clemence: case Clemence:
start = 1681; start = 1681;
skipping to change at line 1737 skipping to change at line 1868
break; break;
case MorrisonStephenson2004: case MorrisonStephenson2004:
start = -1000; start = -1000;
finish = 2000; finish = 2000;
break; break;
case Reijs: case Reijs:
start = -1500; // -500; // GZ: It models long-term variability, so we should reflect this. Not sure on the begin, though. start = -1500; // -500; // GZ: It models long-term variability, so we should reflect this. Not sure on the begin, though.
finish = 1100; // not 1620; // GZ: Not applicable f or telescopic era, and better not after 1100 (pers.comm.) finish = 1100; // not 1620; // GZ: Not applicable f or telescopic era, and better not after 1100 (pers.comm.)
break; break;
case EspenakMeeus: // the default, range stated in the Canon , p. 14. case EspenakMeeus: // the default, range stated in the Canon , p. 14.
case EspenakMeeusZeroMoonAccel:
start = -1999; start = -1999;
finish = 3000; finish = 3000;
break; break;
case Banjevic: case Banjevic:
start = -2020; start = -2020;
finish = 1620; finish = 1620;
validRangeAppendix = q_("with zero values outside th is range"); validRangeAppendix = q_("with zero values outside th is range");
break; break;
case IslamSadiqQureshi: case IslamSadiqQureshi:
start = 1620; start = 1620;
skipping to change at line 1766 skipping to change at line 1898
// Valid range unknown // Valid range unknown
break; break;
} }
if (start!=finish) if (start!=finish)
{ {
if (validRangeAppendix!="") if (validRangeAppendix!="")
validRange = q_("Valid range of usage: between years %1 and %2, %3.").arg(start).arg(finish).arg(validRangeAppendix); validRange = q_("Valid range of usage: between years %1 and %2, %3.").arg(start).arg(finish).arg(validRangeAppendix);
else else
validRange = q_("Valid range of usage: between years %1 and %2.").arg(start).arg(finish); validRange = q_("Valid range of usage: between years %1 and %2.").arg(start).arg(finish);
if (start > year || year > finish) if ((year < start) || (finish < year))
*marker = "*"; *marker = "*";
} }
else else
*marker = "?"; *marker = "?";
return QString(" %1").arg(validRange); return QString(" %1").arg(validRange);
} }
bool StelCore::isDay() const // return if sky plus atmosphere is bright enough from sunlight so that e.g
. screen labels should be rendered dark.
bool StelCore::isBrightDaylight() const
{ {
const Vec3d& sunPos = GETSTELMODULE(SolarSystem)->getSun()->getAltAz bool r = false;
PosGeometric(this); SolarSystem* ssys = GETSTELMODULE(SolarSystem);
return sunPos[2] > -0.12; // Nautical twilight const Vec3d& sunPos = ssys->getSun()->getAltAzPosGeometric(this);
if (sunPos[2] > -0.10452846326) // Nautical twilight (sin (6 deg))
r = true;
if (ssys->getEclipseFactor(this)<=0.01) // Total solar eclipse
r = false;
return r;
} }
double StelCore::getCurrentEpoch() const double StelCore::getCurrentEpoch() const
{ {
int year, month, day; return 2000.0 + (getJD() - 2451545.0)/365.25;
StelUtils::getDateFromJulianDay(getJDay(), &year, &month, &day);
QDate date = QDate::fromString(QString("%1.%2.%3").arg(year, 4, 10,
QLatin1Char('0')).arg(month).arg(day), "yyyy.M.d");
return double(year) + double(date.dayOfYear())/double(date.daysInYea
r());
} }
 End of changes. 153 change blocks. 
226 lines changed or deleted 404 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/