StelCore.cpp   StelCore.cpp 
skipping to change at line 31 skipping to change at line 31
#include "StelProjector.hpp" #include "StelProjector.hpp"
#include "StelProjectorClasses.hpp" #include "StelProjectorClasses.hpp"
#include "StelToneReproducer.hpp" #include "StelToneReproducer.hpp"
#include "StelSkyDrawer.hpp" #include "StelSkyDrawer.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "StelGeodesicGrid.hpp" #include "StelGeodesicGrid.hpp"
#include "StelMovementMgr.hpp" #include "StelMovementMgr.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.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 "renderer/GenericVertexTypes.hpp"
#include "renderer/StelRenderer.hpp"
#include "LandscapeMgr.hpp" #include "LandscapeMgr.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include "StelActionMgr.hpp"
#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;
const double StelCore::JD_MINUTE=0.00069444444444444444444; const double StelCore::JD_MINUTE=0.00069444444444444444444;
const double StelCore::JD_HOUR =0.041666666666666666666; const double StelCore::JD_HOUR =0.041666666666666666666;
const double StelCore::JD_DAY =1.; const double StelCore::JD_DAY =1.;
const double StelCore::ONE_OVER_JD_SECOND = 24 * 60 * 60;
StelCore::StelCore() : movementMgr(NULL), geodesicGrid(NULL), currentProjec StelCore::StelCore()
tionType(ProjectionStereographic), position(NULL), timeSpeed(JD_SECOND), JD : skyDrawer(NULL)
ay(0.) , movementMgr(NULL)
, geodesicGrid(NULL)
, currentProjectionType(ProjectionStereographic)
, currentDeltaTAlgorithm(EspenakMeeus)
, position(NULL)
, timeSpeed(JD_SECOND)
, JDay(0.)
, presetSkyTime(0.)
, secondsOfLastJDayUpdate(0.)
, JDayOfLastJDayUpdate(0.)
, deltaTCustomNDot(-26.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 ();
skipping to change at line 79 skipping to change at line 93
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);
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();
} }
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;
} }
/************************************************************************* /*************************************************************************
Load core data and initialize with default values Load core data and initialize with default values
*************************************************************************/ *************************************************************************/
void StelCore::init(class StelRenderer* renderer) void StelCore::init()
{ {
QSettings* conf = StelApp::getInstance().getSettings(); QSettings* conf = StelApp::getInstance().getSettings();
defaultLocationID = conf->value("init_location/location","error").to String(); defaultLocationID = conf->value("init_location/location","error").to String();
bool ok; bool ok;
StelLocation location = StelApp::getInstance().getLocationMgr().loca StelLocationMgr* locationMgr = &StelApp::getInstance().getLocationMg
tionForString(defaultLocationID, &ok); r();
if (!ok) StelLocation location = locationMgr->locationForString(defaultLocati
onID);
if (!location.isValid())
{ {
qWarning() << "Warning: location" << defaultLocationID << "i s unknown."; qWarning() << "Warning: location" << defaultLocationID << "i s unknown.";
location = locationMgr->getLastResortLocation();
} }
position = new StelObserver(location); position = new StelObserver(location);
// Delta-T stuff // Delta-T stuff
// Define default algorithm for time correction (Delta T) // Define default algorithm for time correction (Delta T)
QString tmpDT = conf->value("navigation/time_correction_algorithm", "EspenakMeeus").toString(); QString tmpDT = conf->value("navigation/time_correction_algorithm", "EspenakMeeus").toString();
setCurrentDeltaTAlgorithmKey(tmpDT); setCurrentDeltaTAlgorithmKey(tmpDT);
// Define variables of custom equation for calculation of Delta T // Define variables of custom equation for calculation of Delta T
// Default: ndot = -26.0 "/cy/cy; year = 1820; DeltaT = -20 + 32*u^2 , where u = (currentYear-1820)/100 // Default: ndot = -26.0 "/cy/cy; year = 1820; DeltaT = -20 + 32*u^2 , where u = (currentYear-1820)/100
setCustomYear(conf->value("custom_time_correction/year", 1820.0).toF setDeltaTCustomYear(conf->value("custom_time_correction/year", 1820.
loat()); 0).toFloat());
setCustomNDot(conf->value("custom_time_correction/ndot", -26.0).toFl setDeltaTCustomNDot(conf->value("custom_time_correction/ndot", -26.0
oat()); ).toFloat());
setCustomEquationCoefficients(StelUtils::strToVec3f(conf->value("cus setDeltaTCustomEquationCoefficients(StelUtils::strToVec3f(conf->valu
tom_time_correction/coefficients", "-20,0,32").toString())); e("custom_time_correction/coefficients", "-20,0,32").toString()));
// 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)
{ {
skipping to change at line 147 skipping to change at line 165
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);
skyDrawer = new StelSkyDrawer(this, renderer); skyDrawer = new StelSkyDrawer(this);
skyDrawer->init(); skyDrawer->init();
QString tmpstr = conf->value("projection/type", "ProjectionStereogra phic").toString(); QString tmpstr = conf->value("projection/type", "ProjectionStereogra phic").toString();
setCurrentProjectionTypeKey(tmpstr); setCurrentProjectionTypeKey(tmpstr);
// Register all the core actions.
QString timeGroup = N_("Date and Time");
QString movementGroup = N_("Movement and Selection");
QString displayGroup = N_("Display Options");
StelActionMgr* actionsMgr = StelApp::getInstance().getStelActionMana
ger();
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("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("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("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_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("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_Week", timeGroup, N_("Su
btract 1 solar week"), this, "subtractWeek()", "[");
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_Century", timeGroup, N_("A
dd 1 sidereal century"), this, "addSiderealCentury()");
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_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_Tropical_Month", timeGroup, N_("Add
1 mean tropical month"), this, "addTropicalMonth()");
actionsMgr->addAction("actionAdd_Tropical_Year", timeGroup, N_("Add
1 mean tropical year"), this, "addTropicalYear()");
actionsMgr->addAction("actionAdd_Tropical_Century", timeGroup, N_("A
dd 1 mean tropical century"), this, "addTropicalCentury()");
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_Century", timeGroup,
N_("Subtract 1 sidereal century"), this, "subtractSiderealCentury()");
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_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_Tropical_Month", timeGroup, N_
("Subtract 1 mean tropical month"), this, "subtractTropicalMonth()");
actionsMgr->addAction("actionSubtract_Tropical_Year", timeGroup, N_(
"Subtract 1 mean tropical year"), this, "subtractTropicalYear()");
actionsMgr->addAction("actionSubtract_Tropical_Century", timeGroup,
N_("Subtract 1 mean tropical century"), this, "subtractTropicalCentury()");
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("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);
} }
// Get the shared instance of StelGeodesicGrid. // Get the shared instance of StelGeodesicGrid.
// The returned instance is garanteed to allow for at least maxLevel levels // The returned instance is garanteed to allow for at least maxLevel levels
const StelGeodesicGrid* StelCore::getGeodesicGrid(int maxLevel) const const StelGeodesicGrid* StelCore::getGeodesicGrid(int maxLevel) const
{ {
if (geodesicGrid==NULL) if (geodesicGrid==NULL)
{ {
geodesicGrid = new StelGeodesicGrid(maxLevel); geodesicGrid = new StelGeodesicGrid(maxLevel);
} }
skipping to change at line 272 skipping to change at line 339
StelMovementMgr* StelCore::getMovementMgr() StelMovementMgr* StelCore::getMovementMgr()
{ {
return movementMgr; return movementMgr;
} }
const StelMovementMgr* StelCore::getMovementMgr() const const StelMovementMgr* StelCore::getMovementMgr() const
{ {
return movementMgr; return movementMgr;
} }
SphericalCap StelCore::getVisibleSkyArea() const
{
const LandscapeMgr* landscapeMgr = GETSTELMODULE(LandscapeMgr);
Vec3d up(0, 0, 1);
up = altAzToJ2000(up, RefractionOff);
if (landscapeMgr->getIsLandscapeFullyVisible())
{
return SphericalCap(up, -0.035f);
}
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;
} }
skipping to change at line 316 skipping to change at line 396
currentProjectorParams.fov = movementMgr->getCurrentFov(); currentProjectorParams.fov = movementMgr->getCurrentFov();
skyDrawer->update(deltaTime); skyDrawer->update(deltaTime);
} }
/************************************************************************* /*************************************************************************
Execute all the pre-drawing functions Execute all the pre-drawing functions
*************************************************************************/ *************************************************************************/
void StelCore::preDraw() void StelCore::preDraw()
{ {
// Init openGL viewing with fov, screen size and clip planes
currentProjectorParams.zNear = 0.000001; currentProjectorParams.zNear = 0.000001;
currentProjectorParams.zFar = 50.; currentProjectorParams.zFar = 50.;
skyDrawer->preDraw();
}
//! Fill with black around viewport disc shape.
static void drawViewportShape(StelRenderer* renderer, StelProjectorP projec
tor)
{
if (projector->getMaskType() != StelProjector::MaskDisk)
{
return;
}
renderer->setBlendMode(BlendMode_None);
renderer->setGlobalColor(0.0f, 0.0f, 0.0f);
const float innerRadius = 0.5 * projector->getViewportFovDiameter(); skyDrawer->preDraw();
const float outerRadius = projector->getViewportWidth() + projector-
>getViewportHeight();
Q_ASSERT_X(innerRadius >= 0.0f && outerRadius > innerRadius,
Q_FUNC_INFO, "Inner radius must be at least zero and oute
r radius must be greater");
const float sweepAngle = 360.0f;
static const int resolution = 192;
float sinCache[resolution];
float cosCache[resolution];
const float deltaRadius = outerRadius - innerRadius;
const int slices = resolution - 1;
// Cache is the vertex locations cache
for (int s = 0; s <= slices; s++)
{
const float angle = (M_PI * sweepAngle) / 180.0f * s / slice
s;
sinCache[s] = std::sin(angle);
cosCache[s] = std::cos(angle);
}
sinCache[slices] = sinCache[0];
cosCache[slices] = cosCache[0];
const float radiusHigh = outerRadius - deltaRadius;
StelVertexBuffer<VertexP2>* vertices =
renderer->createVertexBuffer<VertexP2>(PrimitiveType_Triangl
eStrip);
const Vec2f center = projector->getViewportCenterAbsolute();
for (int i = 0; i <= slices; i++)
{
vertices->addVertex(VertexP2(center[0] + outerRadius * sinCa
che[i],
center[1] + outerRadius * cosCa
che[i]));
vertices->addVertex(VertexP2(center[0] + radiusHigh * sinCac
he[i],
center[1] + radiusHigh * cosCac
he[i]));
}
vertices->lock(); // Clear areas not redrawn by main viewport (i.e. fisheye square vie
renderer->setCulledFaces(CullFace_None); wport)
renderer->drawVertexBuffer(vertices); glClearColor(0,0,0,0);
delete vertices; glClear(GL_COLOR_BUFFER_BIT);
} }
/************************************************************************* /*************************************************************************
Update core state after drawing modules Update core state after drawing modules
*************************************************************************/ *************************************************************************/
void StelCore::postDraw(StelRenderer* renderer) void StelCore::postDraw()
{ {
drawViewportShape(renderer, getProjection(StelCore::FrameJ2000)); StelPainter sPainter(getProjection(StelCore::FrameJ2000));
sPainter.drawViewportShape();
} }
void StelCore::setCurrentProjectionType(ProjectionType type) void StelCore::setCurrentProjectionType(ProjectionType type)
{ {
currentProjectionType=type; currentProjectionType=type;
const double savedFov = currentProjectorParams.fov; const double savedFov = currentProjectorParams.fov;
currentProjectorParams.fov = 0.0001; // Avoid crash currentProjectorParams.fov = 0.0001; // Avoid crash
double newMaxFov = getProjection(StelProjector::ModelViewTranformP(n ew StelProjector::Mat4dTransform(Mat4d::identity())))->getMaxFov(); double newMaxFov = getProjection(StelProjector::ModelViewTranformP(n ew StelProjector::Mat4dTransform(Mat4d::identity())))->getMaxFov();
movementMgr->setMaxFov(newMaxFov); movementMgr->setMaxFov(newMaxFov);
currentProjectorParams.fov = qMin(newMaxFov, savedFov); currentProjectorParams.fov = qMin(newMaxFov, savedFov);
skipping to change at line 403 skipping to change at line 435
StelCore::ProjectionType StelCore::getCurrentProjectionType() const StelCore::ProjectionType StelCore::getCurrentProjectionType() const
{ {
return currentProjectionType; return currentProjectionType;
} }
//! Set the current projection type to use //! Set the current projection type to use
void StelCore::setCurrentProjectionTypeKey(QString key) void StelCore::setCurrentProjectionTypeKey(QString key)
{ {
const QMetaEnum& en = metaObject()->enumerator(metaObject()->indexOf Enumerator("ProjectionType")); const QMetaEnum& en = metaObject()->enumerator(metaObject()->indexOf Enumerator("ProjectionType"));
ProjectionType newType = (ProjectionType)en.keyToValue(key.toAscii() .data()); ProjectionType newType = (ProjectionType)en.keyToValue(key.toLatin1( ).data());
if (newType<0) if (newType<0)
{ {
qWarning() << "Unknown projection type: " << key << "setting \"ProjectionStereographic\" instead"; qWarning() << "Unknown projection type: " << key << "setting \"ProjectionStereographic\" instead";
newType = ProjectionStereographic; newType = ProjectionStereographic;
} }
setCurrentProjectionType(newType); setCurrentProjectionType(newType);
} }
//! Get the current Mapping used by the Projection //! Get the current Mapping used by the Projection
QString StelCore::getCurrentProjectionTypeKey(void) const QString StelCore::getCurrentProjectionTypeKey(void) const
skipping to change at line 471 skipping to change at line 503
} }
QString StelCore::getDefaultLocationID() const QString StelCore::getDefaultLocationID() const
{ {
return defaultLocationID; return defaultLocationID;
} }
QString StelCore::projectionTypeKeyToNameI18n(const QString& key) const QString StelCore::projectionTypeKeyToNameI18n(const QString& key) const
{ {
const QMetaEnum& en = metaObject()->enumerator(metaObject()->indexOf Enumerator("ProjectionType")); const QMetaEnum& en = metaObject()->enumerator(metaObject()->indexOf Enumerator("ProjectionType"));
QString s(getProjection(StelProjector::ModelViewTranformP(new StelPr ojector::Mat4dTransform(Mat4d::identity())), (ProjectionType)en.keyToValue( key.toAscii()))->getNameI18()); QString s(getProjection(StelProjector::ModelViewTranformP(new StelPr ojector::Mat4dTransform(Mat4d::identity())), (ProjectionType)en.keyToValue( key.toLatin1()))->getNameI18());
return s; return s;
} }
QString StelCore::projectionNameI18nToTypeKey(const QString& nameI18n) cons t QString StelCore::projectionNameI18nToTypeKey(const QString& nameI18n) cons t
{ {
const QMetaEnum& en = metaObject()->enumerator(metaObject()->indexOf Enumerator("ProjectionType")); const QMetaEnum& en = metaObject()->enumerator(metaObject()->indexOf Enumerator("ProjectionType"));
for (int i=0;i<en.keyCount();++i) for (int i=0;i<en.keyCount();++i)
{ {
if (getProjection(StelProjector::ModelViewTranformP(new Stel Projector::Mat4dTransform(Mat4d::identity())), (ProjectionType)i)->getNameI 18()==nameI18n) if (getProjection(StelProjector::ModelViewTranformP(new Stel Projector::Mat4dTransform(Mat4d::identity())), (ProjectionType)i)->getNameI 18()==nameI18n)
return en.valueToKey(i); return en.valueToKey(i);
skipping to change at line 705 skipping to change at line 737
// 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(matAltAzToHeliocentricEcliptic[12], matAltAzToHeliocent ricEcliptic[13], matAltAzToHeliocentricEcliptic[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)
{ {
bool ok = false; StelLocation location = StelApp::getInstance().getLocationMgr().loca
StelApp::getInstance().getLocationMgr().locationForSmallString(id, & tionForString(id);
ok); if (!location.isValid())
if (!ok) {
qWarning() << "Trying to set an invalid location" << id;
return; return;
}
defaultLocationID = id; defaultLocationID = id;
QSettings* conf = StelApp::getInstance().getSettings(); QSettings* conf = StelApp::getInstance().getSettings();
Q_ASSERT(conf); Q_ASSERT(conf);
conf->setValue("init_location/location", id); conf->setValue("init_location/location", id);
} }
void StelCore::returnToDefaultLocation() void StelCore::returnToDefaultLocation()
{ {
StelLocationMgr& locationMgr = StelApp::getInstance().getLocationMgr (); StelLocationMgr& locationMgr = StelApp::getInstance().getLocationMgr ();
bool ok = false; StelLocation loc = locationMgr.locationForString(defaultLocationID);
StelLocation loc = locationMgr.locationForString(defaultLocationID, if (loc.isValid())
&ok);
if (ok)
moveObserverTo(loc, 0.); moveObserverTo(loc, 0.);
} }
void StelCore::returnToHome() void StelCore::returnToHome()
{ {
// Using returnToDefaultLocation() and getCurrentLocation() introduc e issue, because for flying // Using returnToDefaultLocation() and getCurrentLocation() introduc e issue, because for flying
// between planets using SpaceShip and second method give does not e xist data // between planets using SpaceShip and second method give does not e xist data
StelLocationMgr& locationMgr = StelApp::getInstance().getLocationMgr (); StelLocationMgr& locationMgr = StelApp::getInstance().getLocationMgr ();
bool ok = false; StelLocation loc = locationMgr.locationForString(defaultLocationID);
StelLocation loc = locationMgr.locationForString(defaultLocationID, if (loc.isValid())
&ok);
if (ok)
moveObserverTo(loc, 0.); moveObserverTo(loc, 0.);
PlanetP p = GETSTELMODULE(SolarSystem)->searchByEnglishName(loc.plan etName); PlanetP p = GETSTELMODULE(SolarSystem)->searchByEnglishName(loc.plan etName);
LandscapeMgr* landscapeMgr = GETSTELMODULE(LandscapeMgr); LandscapeMgr* landscapeMgr = GETSTELMODULE(LandscapeMgr);
landscapeMgr->setCurrentLandscapeID(landscapeMgr->getDefaultLandscap eID()); landscapeMgr->setCurrentLandscapeID(landscapeMgr->getDefaultLandscap eID());
landscapeMgr->setFlagAtmosphere(p->hasAtmosphere()); landscapeMgr->setFlagAtmosphere(p->hasAtmosphere());
landscapeMgr->setFlagFog(p->hasAtmosphere()); landscapeMgr->setFlagFog(p->hasAtmosphere());
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.);
} }
void StelCore::setJDay(double JD) void StelCore::setJDay(double JD)
{ {
JDay=JD; JDay=JD;
resetSync();
} }
double StelCore::getJDay() const double StelCore::getJDay() const
{ {
return JDay; return JDay;
} }
void StelCore::setMJDay(double MJD) void StelCore::setMJDay(double MJD)
{ {
JDay=MJD+2400000.5; JDay=MJD+2400000.5;
resetSync();
} }
double StelCore::getMJDay() const double StelCore::getMJDay() const
{ {
return JDay-2400000.5; return JDay-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;
} }
void StelCore::setTimeRate(double ts) void StelCore::setTimeRate(double ts)
{ {
timeSpeed=ts; emit timeRateChanged(timeSpeed); timeSpeed=ts;
resetSync();
emit timeRateChanged(timeSpeed);
} }
double StelCore::getTimeRate() const double StelCore::getTimeRate() const
{ {
return timeSpeed; return timeSpeed;
} }
void StelCore::moveObserverToSelected() void StelCore::moveObserverToSelected()
{ {
StelObjectMgr* objmgr = GETSTELMODULE(StelObjectMgr); StelObjectMgr* objmgr = GETSTELMODULE(StelObjectMgr);
skipping to change at line 1113 skipping to change at line 1150
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); setJDay(getJDay() + d);
} }
// Get the sidereal time shifted by the observer longitude // Get the sidereal time shifted by the observer longitude
double StelCore::getLocalSideralTime() const double StelCore::getLocalSiderealTime() const
{ {
return (position->getHomePlanet()->getSiderealTime(JDay)+position->g etCurrentLocation().longitude)*M_PI/180.; return (position->getHomePlanet()->getSiderealTime(JDay)+position->g etCurrentLocation().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::getLocalSideralDayLength() 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::getLocalSideralYearLength() const double StelCore::getLocalSiderealYearLength() const
{ {
return position->getHomePlanet()->getSiderealPeriod(); return position->getHomePlanet()->getSiderealPeriod();
} }
QString StelCore::getStartupTimeMode() QString StelCore::getStartupTimeMode()
{ {
return startupTimeMode; return startupTimeMode;
} }
//! Increase the time speed //! Increase the time speed
skipping to change at line 1201 skipping to change at line 1238
bool StelCore::getRealTimeSpeed() const bool StelCore::getRealTimeSpeed() const
{ {
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)
{ {
JDay+=timeSpeed*deltaTime; if (getRealTimeSpeed())
{
// Get rid of the error from the 1 /
JDay = JDayOfLastJDayUpdate + (StelApp::getTotalRunTime() -
secondsOfLastJDayUpdate) / ONE_OVER_JD_SECOND;
}
else
{
JDay = JDayOfLastJDayUpdate + (StelApp::getTotalRunTime() -
secondsOfLastJDayUpdate) * 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 (JDay>38245309.499988) JDay = 38245309.499988;
if (JDay<-34803211.500012) JDay = -34803211.500012; if (JDay<-34803211.500012) JDay = -34803211.500012;
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);
skipping to change at line 1227 skipping to change at line 1272
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 uleMgr().getModule("SolarSystem"); SolarSystem* solsystem = (SolarSystem*)StelApp::getInstance().getMod uleMgr().getModule("SolarSystem");
solsystem->computePositions(getJDay(), position->getHomePlanet()->ge tHeliocentricEclipticPos()); solsystem->computePositions(getJDay(), position->getHomePlanet()->ge tHeliocentricEclipticPos());
} }
void StelCore::resetSync()
{
JDayOfLastJDayUpdate = getJDay();
secondsOfLastJDayUpdate = StelApp::getTotalRunTime();
}
void StelCore::setStartupTimeMode(const QString& s) void StelCore::setStartupTimeMode(const QString& s)
{ {
startupTimeMode = s; startupTimeMode = s;
} }
double StelCore::getDeltaT(double jDay) const double StelCore::getDeltaT(double jDay) 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: {
// Without correction, DeltaT is disabled case WithoutCorrection:
DeltaT = 0.; // Without correction, DeltaT is disabled
dontUseMoon = true; DeltaT = 0.;
break; dontUseMoon = true;
case Schoch: break;
// Schoch (1931) algorithm for DeltaT case Schoch:
ndot = -29.68; // n.dot = -29.68"/cy/cy // Schoch (1931) algorithm for DeltaT
DeltaT = StelUtils::getDeltaTBySchoch(jDay); ndot = -29.68; // n.dot = -29.68"/cy/cy
break; DeltaT = StelUtils::getDeltaTBySchoch(jDay);
case Clemence: break;
// Clemence (1948) algorithm for DeltaT case Clemence:
ndot = -22.44; // n.dot = -22.44 "/cy/cy // Clemence (1948) algorithm for DeltaT
DeltaT = StelUtils::getDeltaTByClemence(jDay); ndot = -22.44; // n.dot = -22.44 "/cy/cy
break; DeltaT = StelUtils::getDeltaTByClemence(jDay);
case IAU: break;
// IAU (1952) algorithm for DeltaT, based on observations by case IAU:
Spencer Jones (1939) // IAU (1952) algorithm for DeltaT, based on observa
ndot = -22.44; // n.dot = -22.44 "/cy/cy tions by Spencer Jones (1939)
DeltaT = StelUtils::getDeltaTByIAU(jDay); ndot = -22.44; // n.dot = -22.44 "/cy/cy
break; DeltaT = StelUtils::getDeltaTByIAU(jDay);
case AstronomicalEphemeris: break;
// Astronomical Ephemeris (1960) algorithm for DeltaT case AstronomicalEphemeris:
ndot = -22.44; // n.dot = -22.44 "/cy/cy // Astronomical Ephemeris (1960) algorithm for Delta
DeltaT = StelUtils::getDeltaTByAstronomicalEphemeris(jDay); T
break; ndot = -22.44; // n.dot = -22.44 "/cy/cy
case TuckermanGoldstine: DeltaT = StelUtils::getDeltaTByAstronomicalEphemeris
// Tuckerman (1962, 1964) & Goldstine (1973) algorithm for D (jDay);
eltaT break;
//FIXME: n.dot case TuckermanGoldstine:
ndot = -22.44; // n.dot = -22.44 "/cy/cy ??? // Tuckerman (1962, 1964) & Goldstine (1973) algorit
DeltaT = StelUtils::getDeltaTByTuckermanGoldstine(jDay); hm for DeltaT
break; //FIXME: n.dot
case MullerStephenson: ndot = -22.44; // n.dot = -22.44 "/cy/cy ???
// Muller & Stephenson (1975) algorithm for DeltaT DeltaT = StelUtils::getDeltaTByTuckermanGoldstine(jD
ndot = -37.5; // n.dot = -37.5 "/cy/cy ay);
DeltaT = StelUtils::getDeltaTByMullerStephenson(jDay); break;
break; case MullerStephenson:
case Stephenson1978: // Muller & Stephenson (1975) algorithm for DeltaT
// Stephenson (1978) algorithm for DeltaT ndot = -37.5; // n.dot = -37.5 "/cy/cy
ndot = -30.0; // n.dot = -30.0 "/cy/cy DeltaT = StelUtils::getDeltaTByMullerStephenson(jDay
DeltaT = StelUtils::getDeltaTByStephenson1978(jDay); );
break; break;
case SchmadelZech1979: case Stephenson1978:
// Schmadel & Zech (1979) algorithm for DeltaT // Stephenson (1978) algorithm for DeltaT
ndot = -23.8946; // n.dot = -23.8946 "/cy/cy ndot = -30.0; // n.dot = -30.0 "/cy/cy
DeltaT = StelUtils::getDeltaTBySchmadelZech1979(jDay); DeltaT = StelUtils::getDeltaTByStephenson1978(jDay);
break; break;
case MorrisonStephenson1982: case SchmadelZech1979:
// Morrison & Stephenson (1982) algorithm for DeltaT (used b // Schmadel & Zech (1979) algorithm for DeltaT
y RedShift) ndot = -23.8946; // n.dot = -23.8946 "/cy/cy
ndot = -26.0; // n.dot = -26.0 "/cy/cy DeltaT = StelUtils::getDeltaTBySchmadelZech1979(jDay
DeltaT = StelUtils::getDeltaTByMorrisonStephenson1982(jDay); );
break; break;
case StephensonMorrison1984: case MorrisonStephenson1982:
// Stephenson & Morrison (1984) algorithm for DeltaT // Morrison & Stephenson (1982) algorithm for DeltaT
ndot = -26.0; // n.dot = -26.0 "/cy/cy (used by RedShift)
DeltaT = StelUtils::getDeltaTByStephensonMorrison1984(jDay); ndot = -26.0; // n.dot = -26.0 "/cy/cy
break; DeltaT = StelUtils::getDeltaTByMorrisonStephenson198
case StephensonHoulden: 2(jDay);
// Stephenson & Houlden (1986) algorithm for DeltaT break;
ndot = -26.0; // n.dot = -26.0 "/cy/cy case StephensonMorrison1984:
DeltaT = StelUtils::getDeltaTByStephensonHoulden(jDay); // Stephenson & Morrison (1984) algorithm for DeltaT
break; ndot = -26.0; // n.dot = -26.0 "/cy/cy
case Espenak: DeltaT = StelUtils::getDeltaTByStephensonMorrison198
// Espenak (1987, 1989) algorithm for DeltaT 4(jDay);
//FIXME: n.dot break;
ndot = -23.8946; // n.dot = -23.8946 "/cy/cy ??? case StephensonHoulden:
DeltaT = StelUtils::getDeltaTByEspenak(jDay); // Stephenson & Houlden (1986) algorithm for DeltaT
break; ndot = -26.0; // n.dot = -26.0 "/cy/cy
case Borkowski: DeltaT = StelUtils::getDeltaTByStephensonHoulden(jDa
// Borkowski (1988) algorithm for DeltaT, relates to ELP2000 y);
-85! break;
ndot = -23.895; // GZ: I see -23.895 in the paper, not -23.8 case Espenak:
59; (?) // n.dot = -23.859 "/cy/cy // Espenak (1987, 1989) algorithm for DeltaT
DeltaT = StelUtils::getDeltaTByBorkowski(jDay); //FIXME: n.dot
break; ndot = -23.8946; // n.dot = -23.8946 "/cy/cy ???
case SchmadelZech1988: DeltaT = StelUtils::getDeltaTByEspenak(jDay);
// Schmadel & Zech (1988) algorithm for DeltaT break;
//FIXME: n.dot case Borkowski:
ndot = -26.0; // n.dot = -26.0 "/cy/cy ??? // Borkowski (1988) algorithm for DeltaT, relates to
DeltaT = StelUtils::getDeltaTBySchmadelZech1988(jDay); ELP2000-85!
break; ndot = -23.895; // GZ: I see -23.895 in the paper, n
case ChaprontTouze: ot -23.859; (?) // n.dot = -23.859 "/cy/cy
// Chapront-Touzé & Chapront (1991) algorithm for DeltaT DeltaT = StelUtils::getDeltaTByBorkowski(jDay);
ndot = -23.8946; // n.dot = -23.8946 "/cy/cy break;
DeltaT = StelUtils::getDeltaTByChaprontTouze(jDay); case SchmadelZech1988:
break; // Schmadel & Zech (1988) algorithm for DeltaT
case StephensonMorrison1995: //FIXME: n.dot
// 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::getDeltaTBySchmadelZech1988(jDay
DeltaT = StelUtils::getDeltaTByStephensonMorrison1995(jDay); );
break; break;
case Stephenson1997: case ChaprontTouze:
// Stephenson (1997) algorithm for DeltaT // Chapront-Touzé & Chapront (1991) algorithm for De
ndot = -26.0; // n.dot = -26.0 "/cy/cy ltaT
DeltaT = StelUtils::getDeltaTByStephenson1997(jDay); ndot = -23.8946; // n.dot = -23.8946 "/cy/cy
break; DeltaT = StelUtils::getDeltaTByChaprontTouze(jDay);
case ChaprontMeeus: break;
// Chapront, Chapront-Touze & Francou (1997) & Meeus (1998) case StephensonMorrison1995:
algorithm for DeltaT // Stephenson & Morrison (1995) algorithm for DeltaT
ndot = -25.7376; // n.dot = -25.7376 "/cy/cy ndot = -26.0; // n.dot = -26.0 "/cy/cy
DeltaT = StelUtils::getDeltaTByChaprontMeeus(jDay); DeltaT = StelUtils::getDeltaTByStephensonMorrison199
break; 5(jDay);
case JPLHorizons: break;
// JPL Horizons algorithm for DeltaT case Stephenson1997:
ndot = -25.7376; // n.dot = -25.7376 "/cy/cy // Stephenson (1997) algorithm for DeltaT
DeltaT = StelUtils::getDeltaTByJPLHorizons(jDay); ndot = -26.0; // n.dot = -26.0 "/cy/cy
break; DeltaT = StelUtils::getDeltaTByStephenson1997(jDay);
case MeeusSimons: break;
// Meeus & Simons (2000) algorithm for DeltaT case ChaprontMeeus:
ndot = -25.7376; // n.dot = -25.7376 "/cy/cy // Chapront, Chapront-Touze & Francou (1997) & Meeus
DeltaT = StelUtils::getDeltaTByMeeusSimons(jDay); (1998) algorithm for DeltaT
break; ndot = -25.7376; // n.dot = -25.7376 "/cy/cy
case ReingoldDershowitz: DeltaT = StelUtils::getDeltaTByChaprontMeeus(jDay);
// Reingold & Dershowitz (2002, 2007) algorithm for DeltaT break;
// FIXME: n.dot case JPLHorizons:
ndot = -26.0; // n.dot = -26.0 "/cy/cy ??? // JPL Horizons algorithm for DeltaT
DeltaT = StelUtils::getDeltaTByReingoldDershowitz(jDay); ndot = -25.7376; // n.dot = -25.7376 "/cy/cy
break; DeltaT = StelUtils::getDeltaTByJPLHorizons(jDay);
case MontenbruckPfleger: break;
// Montenbruck & Pfleger (2000) algorithm for DeltaT case MeeusSimons:
// NOTE: book not contains n.dot value // Meeus & Simons (2000) algorithm for DeltaT
// FIXME: n.dot ndot = -25.7376; // n.dot = -25.7376 "/cy/cy
ndot = -26.0; // n.dot = -26.0 "/cy/cy ??? DeltaT = StelUtils::getDeltaTByMeeusSimons(jDay);
DeltaT = StelUtils::getDeltaTByMontenbruckPfleger(jDay); break;
break; case ReingoldDershowitz:
case MorrisonStephenson2004: // Reingold & Dershowitz (2002, 2007) algorithm for
// Morrison & Stephenson (2004, 2005) algorithm for DeltaT DeltaT
ndot = -26.0; // n.dot = -26.0 "/cy/cy // FIXME: n.dot
DeltaT = StelUtils::getDeltaTByMorrisonStephenson2004(jDay); ndot = -26.0; // n.dot = -26.0 "/cy/cy ???
break; DeltaT = StelUtils::getDeltaTByReingoldDershowitz(jD
case Reijs: ay);
// Reijs (2006) algorithm for DeltaT break;
ndot = -26.0; // n.dot = -26.0 "/cy/cy case MontenbruckPfleger:
DeltaT = StelUtils::getDeltaTByReijs(jDay); // Montenbruck & Pfleger (2000) algorithm for DeltaT
break; // NOTE: book not contains n.dot value
case EspenakMeeus: // FIXME: n.dot
// Espenak & Meeus (2006) algorithm for DeltaT ndot = -26.0; // n.dot = -26.0 "/cy/cy ???
ndot = -25.858; // n.dot = -25.858 "/cy/cy DeltaT = StelUtils::getDeltaTByMontenbruckPfleger(jD
DeltaT = StelUtils::getDeltaTByEspenakMeeus(jDay); ay);
break; break;
case Banjevic: case MorrisonStephenson2004:
// Banjevic (2006) algorithm for DeltaT // Morrison & Stephenson (2004, 2005) algorithm for
ndot = -26.0; // n.dot = -26.0 "/cy/cy DeltaT
DeltaT = StelUtils::getDeltaTByBanjevic(jDay); ndot = -26.0; // n.dot = -26.0 "/cy/cy
break; DeltaT = StelUtils::getDeltaTByMorrisonStephenson200
case IslamSadiqQureshi: 4(jDay);
// Islam, Sadiq & Qureshi (2008 + revisited 2013) algorithm break;
for DeltaT (6 polynomials) case Reijs:
ndot = -26.0; // n.dot = -26.0 "/cy/cy // Reijs (2006) algorithm for DeltaT
DeltaT = StelUtils::getDeltaTByIslamSadiqQureshi(jDay); ndot = -26.0; // n.dot = -26.0 "/cy/cy
break; DeltaT = StelUtils::getDeltaTByReijs(jDay);
case Custom: break;
// User defined coefficients for quadratic equation for Delt case EspenakMeeus:
aT // Espenak & Meeus (2006) algorithm for DeltaT
ndot = getCustomNDot(); // n.dot = custom value "/cy/cy ndot = -25.858; // n.dot = -25.858 "/cy/cy
int year, month, day; DeltaT = StelUtils::getDeltaTByEspenakMeeus(jDay);
Vec3f coeff = getCustomEquationCoefficients(); break;
StelUtils::getDateFromJulianDay(jDay, &year, &month, &day); case Banjevic:
double yeardec=year+((month-1)*30.5+day/31*30.5)/366; // Banjevic (2006) algorithm for DeltaT
double u = (yeardec-getCustomYear())/100; ndot = -26.0; // n.dot = -26.0 "/cy/cy
DeltaT = coeff[0] + coeff[1]*u + coeff[2]*std::pow(u,2); DeltaT = StelUtils::getDeltaTByBanjevic(jDay);
break; break;
case IslamSadiqQureshi:
// Islam, Sadiq & Qureshi (2008 + revisited 2013) al
gorithm for DeltaT (6 polynomials)
ndot = -26.0; // n.dot = -26.0 "/cy/cy
DeltaT = StelUtils::getDeltaTByIslamSadiqQureshi(jDa
y);
break;
case Custom:
// User defined coefficients for quadratic equation
for DeltaT
ndot = getDeltaTCustomNDot(); // n.dot = custom valu
e "/cy/cy
int year, month, day;
Vec3f coeff = getDeltaTCustomEquationCoefficients();
StelUtils::getDateFromJulianDay(jDay, &year, &month,
&day);
double yeardec=year+((month-1)*30.5+day/31*30.5)/366
;
double u = (yeardec-getDeltaTCustomYear())/100;
DeltaT = coeff[0] + coeff[1]*u + coeff[2]*std::pow(u
,2);
break;
} }
if (!dontUseMoon) if (!dontUseMoon)
DeltaT += StelUtils::getMoonSecularAcceleration(jDay, ndot); DeltaT += StelUtils::getMoonSecularAcceleration(jDay, 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.toAscii(). data()); DeltaTAlgorithm algo = (DeltaTAlgorithm)en.keyToValue(key.toLatin1() .data());
if (algo<0) if (algo<0)
{ {
qWarning() << "Unknown DeltaT algorithm: " << key << "settin g \"WithoutCorrection\" instead"; qWarning() << "Unknown DeltaT algorithm: " << key << "settin g \"WithoutCorrection\" instead";
algo = WithoutCorrection; algo = WithoutCorrection;
} }
setCurrentDeltaTAlgorithm(algo); setCurrentDeltaTAlgorithm(algo);
} }
//! Get the current algorithm used by the DeltaT //! Get the current algorithm used by the DeltaT
QString StelCore::getCurrentDeltaTAlgorithmKey(void) const QString StelCore::getCurrentDeltaTAlgorithmKey(void) const
skipping to change at line 1428 skipping to change at line 1480
return metaObject()->enumerator(metaObject()->indexOfEnumerator("Del taTAlgorithm")).key(currentDeltaTAlgorithm); return metaObject()->enumerator(metaObject()->indexOfEnumerator("Del taTAlgorithm")).key(currentDeltaTAlgorithm);
} }
//! Get description of the current algorithm for time correction //! Get description of the current algorithm for time correction
QString StelCore::getCurrentDeltaTAlgorithmDescription(void) const QString StelCore::getCurrentDeltaTAlgorithmDescription(void) const
{ {
// 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: {
description = q_("Correction is disabled. Use only if you kn case WithoutCorrection:
ow what you are doing!"); description = q_("Correction is disabled. Use only i
break; f you know what you are doing!");
case Schoch: // historical value. break;
description = q_("This historical formula was obtained by C. case Schoch: // historical value.
Schoch in 1931 and was used by G. Henriksson in his article <em>Einstein's description = q_("This historical formula was obtain
Theory of Relativity Confirmed by Ancient Solar Eclipses</em> (%1). See fo ed by C. Schoch in 1931 and was used by G. Henriksson in his article <em>Ei
r more info %2here%3.").arg("2009").arg("<a href='http://journalofcosmology nstein's Theory of Relativity Confirmed by Ancient Solar Eclipses</em> (%1)
.com/AncientAstronomy123.html'>").arg("</a>").append(getCurrentDeltaTAlgori . See for more info %2here%3.").arg("2009").arg("<a href='http://journalofc
thmValidRange(jd, &marker)); osmology.com/AncientAstronomy123.html'>").arg("</a>").append(getCurrentDelt
break; aTAlgorithmValidRange(jd, &marker));
case Clemence: // historical value. break;
description = q_("This empirical equation was published by G case Clemence: // historical value.
. M. Clemence in the article <em>On the system of astronomical constants</e description = q_("This empirical equation was publis
m> (%1).").arg("<a href='http://adsabs.harvard.edu/abs/1948AJ.....53..169C' hed by G. M. Clemence in the article <em>On the system of astronomical cons
>1948</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker)); tants</em> (%1).").arg("<a href='http://adsabs.harvard.edu/abs/1948AJ.....5
break; 3..169C'>1948</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker)
case IAU: // historical value. );
description = q_("This formula is based on a study of post-1 break;
650 observations of the Sun, the Moon and the planets by Spencer Jones (%1) case IAU: // historical value.
and used by Jean Meeus in his <em>Astronomical Formulae for Calculators</e description = q_("This formula is based on a study o
m>. It was also adopted in the PC program SunTracker Pro.").arg("<a href='h f post-1650 observations of the Sun, the Moon and the planets by Spencer Jo
ttp://adsabs.harvard.edu/abs/1939MNRAS..99..541S'>1939</a>").append(getCurr nes (%1) and used by Jean Meeus in his <em>Astronomical Formulae for Calcul
entDeltaTAlgorithmValidRange(jd, &marker)); ators</em>. It was also adopted in the PC program SunTracker Pro.").arg("<a
// find year of publication of AFFC href='http://adsabs.harvard.edu/abs/1939MNRAS..99..541S'>1939</a>").append
break; (getCurrentDeltaTAlgorithmValidRange(jd, &marker));
case AstronomicalEphemeris: // historical value. // find year of publication of AFFC
description = q_("This is a slightly modified version of the break;
IAU (1952) formula which was adopted in the <em>Astronomical Ephemeris</em case AstronomicalEphemeris: // historical value.
> and in the <em>Canon of Solar Eclipses</em> by Mucke & Meeus (1983).").ap description = q_("This is a slightly modified versio
pend(getCurrentDeltaTAlgorithmValidRange(jd, &marker)); n of the IAU (1952) formula which was adopted in the <em>Astronomical Ephem
// TODO: expand the sentence: ... adopted ... from 19xx-19yy eris</em> and in the <em>Canon of Solar Eclipses</em> by Mucke & Meeus (198
? 3).").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
break; // TODO: expand the sentence: ... adopted ... from 1
case TuckermanGoldstine: // historical value. 9xx-19yy?
description = q_("The tables of Tuckerman (1962, 1964) list break;
the positions of the Sun, the Moon and the planets at 5- and 10-day interva case TuckermanGoldstine: // historical value.
ls from 601 BCE to 1649 CE. The same relation was also implicitly adopted i description = q_("The tables of Tuckerman (1962, 196
n the syzygy tables of Goldstine (1973).").append(getCurrentDeltaTAlgorithm 4) list the positions of the Sun, the Moon and the planets at 5- and 10-day
ValidRange(jd, &marker)); intervals from 601 BCE to 1649 CE. The same relation was also implicitly a
// TODO: These tables are sometimes found cited, but I have dopted in the syzygy tables of Goldstine (1973).").append(getCurrentDeltaTA
no details. Maybe add "based on ... " ? lgorithmValidRange(jd, &marker));
break; // TODO: These tables are sometimes found cited, but
case MullerStephenson: I have no details. Maybe add "based on ... " ?
description = q_("This equation was published by P. M. Mulle break;
r and F. R. Stephenson in the article <em>The accelerations of the earth an case MullerStephenson:
d moon from early astronomical observations</em> (%1).").arg("<a href='http description = q_("This equation was published by P.
://adsabs.harvard.edu/abs/1975grhe.conf..459M'>1975</a>").append(getCurrent M. Muller and F. R. Stephenson in the article <em>The accelerations of the
DeltaTAlgorithmValidRange(jd, &marker)); earth and moon from early astronomical observations</em> (%1).").arg("<a hr
break; ef='http://adsabs.harvard.edu/abs/1975grhe.conf..459M'>1975</a>").append(ge
case Stephenson1978: tCurrentDeltaTAlgorithmValidRange(jd, &marker));
description = q_("This equation was published by F. R. Steph break;
enson in the article <em>Pre-Telescopic Astronomical Observations</em> (%1) case Stephenson1978:
.").arg("<a href='http://adsabs.harvard.edu/abs/1978tfer.conf....5S'>1978</ description = q_("This equation was published by F.
a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker)); R. Stephenson in the article <em>Pre-Telescopic Astronomical Observations</
break; em> (%1).").arg("<a href='http://adsabs.harvard.edu/abs/1978tfer.conf....5S
case SchmadelZech1979: // outdated data fit, historical value? '>1978</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
description = q_("This 12th-order polynomial equation (outda break;
ted and superseded by Schmadel & Zech (1988)) was published by L. D. Schmad case SchmadelZech1979: // outdated data fit, historical valu
el and G. Zech in the article <em>Polynomial approximations for the correct e?
ion delta T E.T.-U.T. in the period 1800-1975</em> (%1) as fit through data description = q_("This 12th-order polynomial equatio
published by Brouwer (1952).").arg("<a href='http://adsabs.harvard.edu/abs n (outdated and superseded by Schmadel & Zech (1988)) was published by L. D
/1979AcA....29..101S'>1979</a>").append(getCurrentDeltaTAlgorithmValidRange . Schmadel and G. Zech in the article <em>Polynomial approximations for the
(jd, &marker)); correction delta T E.T.-U.T. in the period 1800-1975</em> (%1) as fit thro
break; ugh data published by Brouwer (1952).").arg("<a href='http://adsabs.harvard
case MorrisonStephenson1982: .edu/abs/1979AcA....29..101S'>1979</a>").append(getCurrentDeltaTAlgorithmVa
description = q_("This algorithm was adopted in P. Bretagnon lidRange(jd, &marker));
& L. Simon's <em>Planetary Programs and Tables from -4000 to +2800</em> (1 break;
986) and in the PC planetarium program RedShift.").append(getCurrentDeltaTA case MorrisonStephenson1982:
lgorithmValidRange(jd, &marker)); description = q_("This algorithm was adopted in P. B
break; retagnon & L. Simon's <em>Planetary Programs and Tables from -4000 to +2800
case StephensonMorrison1984: // PRIMARY SOURCE </em> (1986) and in the PC planetarium program RedShift.").append(getCurren
description = q_("This formula was published by F. R. Stephe tDeltaTAlgorithmValidRange(jd, &marker));
nson and L. V. Morrison in the article <em>Long-term changes in the rotatio break;
n of the earth - 700 B.C. to A.D. 1980</em> (%1).").arg("<a href='http://ad case StephensonMorrison1984: // PRIMARY SOURCE
sabs.harvard.edu/abs/1984RSPTA.313...47S'>1984</a>").append(getCurrentDelta description = q_("This formula was published by F. R
TAlgorithmValidRange(jd, &marker)); . Stephenson and L. V. Morrison in the article <em>Long-term changes in the
break; rotation of the earth - 700 B.C. to A.D. 1980</em> (%1).").arg("<a href='h
case StephensonHoulden: ttp://adsabs.harvard.edu/abs/1984RSPTA.313...47S'>1984</a>").append(getCurr
description = q_("This algorithm is used in the PC planetari entDeltaTAlgorithmValidRange(jd, &marker));
um program Guide 7.").append(getCurrentDeltaTAlgorithmValidRange(jd, &marke break;
r)); case StephensonHoulden:
break; description = q_("This algorithm is used in the PC p
case Espenak: // limited range, but wide availability? lanetarium program Guide 7.").append(getCurrentDeltaTAlgorithmValidRange(jd
description = q_("This algorithm was given by F. Espenak in , &marker));
his <em>Fifty Year Canon of Solar Eclipses: 1986-2035</em> (1987) and in hi break;
s <em>Fifty Year Canon of Lunar Eclipses: 1986-2035</em> (1989).").append(g case Espenak: // limited range, but wide availability?
etCurrentDeltaTAlgorithmValidRange(jd, &marker)); description = q_("This algorithm was given by F. Esp
break; enak in his <em>Fifty Year Canon of Solar Eclipses: 1986-2035</em> (1987) a
case Borkowski: // Linked to ELP2000-85, so it's important... nd in his <em>Fifty Year Canon of Lunar Eclipses: 1986-2035</em> (1989).").
description = q_("This formula was obtained by K.M. Borkowsk append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
i (%1) from an analysis of 31 solar eclipse records dating between 2137 BCE break;
and 1715 CE.").arg("<a href='http://adsabs.harvard.edu/abs/1988A&A...205L. case Borkowski: // Linked to ELP2000-85, so it's important..
..8B'>1988</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker)); .
break; description = q_("This formula was obtained by K.M.
case SchmadelZech1988: // data fit through Stephenson&Morrison1984, Borkowski (%1) from an analysis of 31 solar eclipse records dating between
which itself is important. Unclear who uses this version? 2137 BCE and 1715 CE.").arg("<a href='http://adsabs.harvard.edu/abs/1988A&A
description = q_("This 12th-order polynomial equation was pu ...205L...8B'>1988</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &ma
blished by L. D. Schmadel and G. Zech in the article <em>Empirical Transfor rker));
mations from U.T. to E.T. for the Period 1800-1988</em> (%1) as data fit th break;
rough values given by Stephenson & Morrison (1984).").arg("<a href='http:// case SchmadelZech1988: // data fit through Stephenson&Morris
adsabs.harvard.edu/abs/1988AN....309..219S'>1988</a>").append(getCurrentDel on1984, which itself is important. Unclear who uses this version?
taTAlgorithmValidRange(jd, &marker)); description = q_("This 12th-order polynomial equatio
break; n was published by L. D. Schmadel and G. Zech in the article <em>Empirical
case ChaprontTouze: Transformations from U.T. to E.T. for the Period 1800-1988</em> (%1) as dat
description = q_("This formula was adopted by M. Chapront-To a fit through values given by Stephenson & Morrison (1984).").arg("<a href=
uze & J. Chapront in the shortened version of the ELP 2000-85 lunar theory 'http://adsabs.harvard.edu/abs/1988AN....309..219S'>1988</a>").append(getCu
in their <em>Lunar Tables and Programs from 4000 B.C. to A.D. 8000</em> (19 rrentDeltaTAlgorithmValidRange(jd, &marker));
91).").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker)); break;
break; case ChaprontTouze:
case StephensonMorrison1995: description = q_("This formula was adopted by M. Cha
description = q_("This equation was published by F. R. Steph pront-Touze & J. Chapront in the shortened version of the ELP 2000-85 lunar
enson and L. V. Morrison in the article <em>Long-Term Fluctuations in the E theory in their <em>Lunar Tables and Programs from 4000 B.C. to A.D. 8000<
arth's Rotation: 700 BC to AD 1990</em> (%1).").arg("<a href='http://adsabs /em> (1991).").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
.harvard.edu/abs/1995RSPTA.351..165S'>1995</a>").append(getCurrentDeltaTAlg break;
orithmValidRange(jd, &marker)); case StephensonMorrison1995:
break; description = q_("This equation was published by F.
case Stephenson1997: R. Stephenson and L. V. Morrison in the article <em>Long-Term Fluctuations
description = q_("F. R. Stephenson published this formula in in the Earth's Rotation: 700 BC to AD 1990</em> (%1).").arg("<a href='http:
his book <em>Historical Eclipses and Earth's Rotation</em> (%1).").arg("<a //adsabs.harvard.edu/abs/1995RSPTA.351..165S'>1995</a>").append(getCurrentD
href='http://ebooks.cambridge.org/ebook.jsf?bid=CBO9780511525186'>1997</a> eltaTAlgorithmValidRange(jd, &marker));
").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker)); break;
break; case Stephenson1997:
case ChaprontMeeus: description = q_("F. R. Stephenson published this fo
description = q_("From J. Meeus, <em>Astronomical Algorithms rmula in his book <em>Historical Eclipses and Earth's Rotation</em> (%1).")
</em> (2nd ed., 1998), and widely used. Table for 1620..2000, and includes .arg("<a href='http://ebooks.cambridge.org/ebook.jsf?bid=CBO9780511525186'>
a variant of Chapront, Chapront-Touze & Francou (1997) for dates outside 16 1997</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker));
20..2000.").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker)); break;
break; case ChaprontMeeus:
case JPLHorizons: description = q_("From J. Meeus, <em>Astronomical Al
description = q_("The JPL Solar System Dynamics Group of the gorithms</em> (2nd ed., 1998), and widely used. Table for 1620..2000, and i
NASA Jet Propulsion Laboratory use this formula in their interactive websi ncludes a variant of Chapront, Chapront-Touze & Francou (1997) for dates ou
te %1JPL Horizons%2.").arg("<a href='http://ssd.jpl.nasa.gov/?horizons'>"). tside 1620..2000.").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker)
arg("</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker)); );
break; break;
case MeeusSimons: case JPLHorizons:
description = q_("This polynome was published by J. Meeus an description = q_("The JPL Solar System Dynamics Grou
d L. Simons in article <em>Polynomial approximations to Delta T, 1620-2000 p of the NASA Jet Propulsion Laboratory use this formula in their interacti
AD</em> (%1).").arg("<a href='http://adsabs.harvard.edu/abs/2000JBAA..110.. ve website %1JPL Horizons%2.").arg("<a href='http://ssd.jpl.nasa.gov/?horiz
323M'>2000</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker)); ons'>").arg("</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker)
break; );
case MontenbruckPfleger: // uninspired break;
description = q_("The fourth edition of O. Montenbruck & T. case MeeusSimons:
Pfleger's <em>Astronomy on the Personal Computer</em> (2000) provides simpl description = q_("This polynome was published by J.
e 3rd-order polynomial data fits for the recent past.").append(getCurrentDe Meeus and L. Simons in article <em>Polynomial approximations to Delta T, 16
ltaTAlgorithmValidRange(jd, &marker)); 20-2000 AD</em> (%1).").arg("<a href='http://adsabs.harvard.edu/abs/2000JBA
break; A..110..323M'>2000</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &ma
case ReingoldDershowitz: // rker));
description = q_("E. M. Reingold & N. Dershowitz present thi break;
s polynomial data fit in <em>Calendrical Calculations</em> (3rd ed. 2007) a case MontenbruckPfleger: // uninspired
nd in their <em>Calendrical Tabulations</em> (2002). It is based on Jean Me description = q_("The fourth edition of O. Montenbru
eus' <em>Astronomical Algorithms</em> (1991).").append(getCurrentDeltaTAlgo ck & T. Pfleger's <em>Astronomy on the Personal Computer</em> (2000) provid
rithmValidRange(jd, &marker)); es simple 3rd-order polynomial data fits for the recent past.").append(getC
break; urrentDeltaTAlgorithmValidRange(jd, &marker));
case MorrisonStephenson2004: // PRIMARY SOURCE break;
description = q_("This important solution was published by L case ReingoldDershowitz: //
. V. Morrison and F. R. Stephenson in article <em>Historical values of the description = q_("E. M. Reingold & N. Dershowitz pre
Earth's clock error %1T and the calculation of eclipses</em> (%2) with adde sent this polynomial data fit in <em>Calendrical Calculations</em> (3rd ed.
ndum in (%3).").arg(QChar(0x0394)).arg("<a href='http://adsabs.harvard.edu/ 2007) and in their <em>Calendrical Tabulations</em> (2002). It is based on
abs/2004JHA....35..327M'>2004</a>").arg("<a href='http://adsabs.harvard.edu Jean Meeus' <em>Astronomical Algorithms</em> (1991).").append(getCurrentDe
/abs/2005JHA....36..339M'>2005</a>").append(getCurrentDeltaTAlgorithmValidR ltaTAlgorithmValidRange(jd, &marker));
ange(jd, &marker)); break;
break; case MorrisonStephenson2004: // PRIMARY SOURCE
case Reijs: description = q_("This important solution was publis
description = q_("From the Length of Day (LOD; as determined hed by L. V. Morrison and F. R. Stephenson in article <em>Historical values
by Stephenson & Morrison (%2)), Victor Reijs derived a %1T formula by usin of the Earth's clock error %1T and the calculation of eclipses</em> (%2) w
g a Simplex optimisation with a cosine and square function. This is based o ith addendum in (%3).").arg(QChar(0x0394)).arg("<a href='http://adsabs.harv
n a possible periodicy described by Stephenson (%2). See for more info %3he ard.edu/abs/2004JHA....35..327M'>2004</a>").arg("<a href='http://adsabs.har
re%4.").arg(QChar(0x0394)).arg("<a href='http://adsabs.harvard.edu/abs/2004 vard.edu/abs/2005JHA....36..339M'>2005</a>").append(getCurrentDeltaTAlgorit
JHA....35..327M'>2004</a>").arg("<a href='http://www.iol.ie/~geniet/eng/Del hmValidRange(jd, &marker));
taTeval.htm'>").arg("</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, break;
&marker)); case Reijs:
break; description = q_("From the Length of Day (LOD; as de
case EspenakMeeus: // GENERAL SOLUTION termined by Stephenson & Morrison (%2)), Victor Reijs derived a %1T formula
description = q_("This solution by F. Espenak and J. Meeus, by using a Simplex optimisation with a cosine and square function. This is
based on Morrison & Stephenson (2004) and a polynomial fit through tabulate based on a possible periodicy described by Stephenson (%2). See for more i
d values for 1600-2000, is used for the %1NASA Eclipse Web Site%2 and in th nfo %3here%4.").arg(QChar(0x0394)).arg("<a href='http://adsabs.harvard.edu/
eir <em>Five Millennium Canon of Solar Eclipses: -1900 to +3000</em> (2006) abs/2004JHA....35..327M'>2004</a>").arg("<a href='http://www.iol.ie/~geniet
. This formula is also used in the solar, lunar and planetary ephemeris pro /eng/DeltaTeval.htm'>").arg("</a>").append(getCurrentDeltaTAlgorithmValidRa
gram SOLEX.").arg("<a href='http://eclipse.gsfc.nasa.gov/eclipse.html'>").a nge(jd, &marker));
rg("</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker)).append( break;
" <em>").append(q_("Used by default.")).append("</em>"); case EspenakMeeus: // GENERAL SOLUTION
break; description = q_("This solution by F. Espenak and J.
case Banjevic: Meeus, based on Morrison & Stephenson (2004) and a polynomial fit through
description = q_("This solution by B. Banjevic, based on Ste tabulated values for 1600-2000, is used for the %1NASA Eclipse Web Site%2 a
phenson & Morrison (1984), was published in article <em>Ancient eclipses an nd in their <em>Five Millennium Canon of Solar Eclipses: -1900 to +3000</em
d dating the fall of Babylon</em> (%1).").arg("<a href='http://adsabs.harva > (2006). This formula is also used in the solar, lunar and planetary ephem
rd.edu/abs/2006POBeo..80..251B'>2006</a>").append(getCurrentDeltaTAlgorithm eris program SOLEX.").arg("<a href='http://eclipse.gsfc.nasa.gov/eclipse.ht
ValidRange(jd, &marker)); ml'>").arg("</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &marker))
break; .append(" <em>").append(q_("Used by default.")).append("</em>");
case IslamSadiqQureshi: break;
description = q_("This solution by S. Islam, M. Sadiq and M. case Banjevic:
S. Qureshi, based on Meeus & Simons (2000), was published in article <em>E description = q_("This solution by B. Banjevic, base
rror Minimization of Polynomial Approximation of DeltaT</em> (%1) and revis d on Stephenson & Morrison (1984), was published in article <em>Ancient ecl
ited by Sana Islam in 2013.").arg("<a href='http://www.ias.ac.in/jaa/dec200 ipses and dating the fall of Babylon</em> (%1).").arg("<a href='http://adsa
8/JAA610.pdf'>2008</a>").append(getCurrentDeltaTAlgorithmValidRange(jd, &ma bs.harvard.edu/abs/2006POBeo..80..251B'>2006</a>").append(getCurrentDeltaTA
rker)); lgorithmValidRange(jd, &marker));
break; break;
case Custom: case IslamSadiqQureshi:
description = q_("This is a quadratic formula for calculatio description = q_("This solution by S. Islam, M. Sadi
n of %1T with coefficients defined by the user.").arg(QChar(0x0394)); q and M. S. Qureshi, based on Meeus & Simons (2000), was published in artic
break; le <em>Error Minimization of Polynomial Approximation of DeltaT</em> (%1) a
default: nd revisited by Sana Islam in 2013.").arg("<a href='http://www.ias.ac.in/ja
description = q_("Error"); a/dec2008/JAA610.pdf'>2008</a>").append(getCurrentDeltaTAlgorithmValidRange
(jd, &marker));
break;
case Custom:
description = q_("This is a quadratic formula for ca
lculation of %1T with coefficients defined by the user.").arg(QChar(0x0394)
);
break;
default:
description = q_("Error");
} }
return description; return description;
} }
QString StelCore::getCurrentDeltaTAlgorithmValidRange(double jDay, QString *marker) const QString StelCore::getCurrentDeltaTAlgorithmValidRange(double jDay, 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(jDay, &year, &month, &day);
switch (getCurrentDeltaTAlgorithm()) { switch (getCurrentDeltaTAlgorithm())
case WithoutCorrection: {
// say nothing case WithoutCorrection:
break; // say nothing
case Schoch: break;
// Valid range unknown case Schoch:
break; // Valid range unknown
case Clemence: break;
start = 1681; case Clemence:
finish = 1900; start = 1681;
break; finish = 1900;
case IAU: break;
start = 1681; case IAU:
finish = 1900; start = 1681;
break; finish = 1900;
case AstronomicalEphemeris: break;
// GZ: What is the source of "1681..1900"? Expl.Suppl.AE 196 case AstronomicalEphemeris:
1-p87 says "...over periods extending back to ancient times" // GZ: What is the source of "1681..1900"? Expl.Supp
// I changed to what I estimate. l.AE 1961-p87 says "...over periods extending back to ancient times"
start = -500; // 1681; // I changed to what I estimate.
finish = 2000; // 1900; start = -500; // 1681;
break; finish = 2000; // 1900;
case TuckermanGoldstine: break;
start = -600; case TuckermanGoldstine:
finish = 1649; start = -600;
break; finish = 1649;
case MullerStephenson: break;
start = -1375; case MullerStephenson:
finish = 1975; start = -1375;
break; finish = 1975;
case Stephenson1978: break;
// Valid range unknown case Stephenson1978:
break; // Valid range unknown
case SchmadelZech1979: break;
start = 1800; case SchmadelZech1979:
finish = 1975; start = 1800;
validRangeAppendix = q_("with meaningless values outside thi finish = 1975;
s range"); validRangeAppendix = q_("with meaningless values out
break; side this range");
case MorrisonStephenson1982: break;
// FIXME: This is correct valid range? case MorrisonStephenson1982:
start = -4000; // FIXME: This is correct valid range?
finish = 2800; start = -4000;
break; finish = 2800;
case StephensonMorrison1984: break;
start = -391; case StephensonMorrison1984:
finish = 1600; start = -391;
break; finish = 1600;
case StephensonHoulden: break;
start = -600; case StephensonHoulden:
finish = 1600; start = -600;
break; finish = 1600;
case Espenak: break;
start = 1950; case Espenak:
finish = 2100; start = 1950;
break; finish = 2100;
case Borkowski: break;
start = -2136; case Borkowski:
finish = 1715; start = -2136;
break; finish = 1715;
case SchmadelZech1988: break;
start = 1800; case SchmadelZech1988:
finish = 1988; start = 1800;
validRangeAppendix = q_("with a mean error of less than one finish = 1988;
second, max. error 1.9s, and meaningless values outside this range"); validRangeAppendix = q_("with a mean error of less t
break; han one second, max. error 1.9s, and meaningless values outside this range"
case ChaprontTouze: );
// FIXME: It's valid range? break;
start = -4000; case ChaprontTouze:
finish = 8000; // FIXME: It's valid range?
break; start = -4000;
case StephensonMorrison1995: finish = 8000;
start = -700; break;
finish = 1600; case StephensonMorrison1995:
break; start = -700;
case Stephenson1997: finish = 1600;
start = -500; break;
finish = 1600; case Stephenson1997:
break; start = -500;
case ChaprontMeeus: finish = 1600;
start = -400; // 1800; // not explicitly given, but guess break;
based on his using ChaprontFrancou which is cited elsewhere in a similar te case ChaprontMeeus:
rm with -391. start = -400; // 1800; // not explicitly given, bu
finish = 2150; // 1997; t guess based on his using ChaprontFrancou which is cited elsewhere in a si
break; milar term with -391.
case JPLHorizons: finish = 2150; // 1997;
start = -2999; break;
finish = 1620; case JPLHorizons:
validRangeAppendix = q_("with zero values outside this range start = -2999;
"); finish = 1620;
break; validRangeAppendix = q_("with zero values outside th
case MeeusSimons: is range");
start = 1620; break;
finish = 2000; case MeeusSimons:
validRangeAppendix = q_("with zero values outside this range start = 1620;
"); finish = 2000;
break; validRangeAppendix = q_("with zero values outside th
case MontenbruckPfleger: is range");
start = 1825; break;
finish = 2005; case MontenbruckPfleger:
validRangeAppendix = q_("with a typical 1-second accuracy an start = 1825;
d zero values outside this range"); finish = 2005;
break; validRangeAppendix = q_("with a typical 1-second acc
case ReingoldDershowitz: uracy and zero values outside this range");
// GZ: while not original work, it's based on Meeus and ther break;
efore the full implementation covers likewise approximately: case ReingoldDershowitz:
start = -400; //1620; // GZ: while not original work, it's based on Meeus
finish = 2100; //2019; and therefore the full implementation covers likewise approximately:
break; start = -400; //1620;
case MorrisonStephenson2004: finish = 2100; //2019;
start = -1000; break;
finish = 2000; case MorrisonStephenson2004:
break; start = -1000;
case Reijs: finish = 2000;
start = -1500; // -500; // GZ: It models long-term variabi break;
lity, so we should reflect this. Not sure on the begin, though. case Reijs:
finish = 1100; // not 1620; // GZ: Not applicable for teles start = -1500; // -500; // GZ: It models long-term
copic era, and better not after 1100 (pers.comm.) variability, so we should reflect this. Not sure on the begin, though.
break; finish = 1100; // not 1620; // GZ: Not applicable f
case EspenakMeeus: // the default, range stated in the Canon, p. 14. or telescopic era, and better not after 1100 (pers.comm.)
start = -1999; break;
finish = 3000; case EspenakMeeus: // the default, range stated in the Canon
break; , p. 14.
case Banjevic: start = -1999;
start = -2020; finish = 3000;
finish = 1620; break;
validRangeAppendix = q_("with zero values outside this range case Banjevic:
"); start = -2020;
break; finish = 1620;
case IslamSadiqQureshi: validRangeAppendix = q_("with zero values outside th
start = 1620; is range");
finish = 2007; break;
validRangeAppendix = q_("with zero values outside this range case IslamSadiqQureshi:
"); start = 1620;
break; finish = 2007;
case Custom: validRangeAppendix = q_("with zero values outside th
// Valid range unknown is range");
break; break;
case Custom:
// Valid range unknown
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 (start > year || year > finish)
*marker = "*"; *marker = "*";
 End of changes. 38 change blocks. 
610 lines changed or deleted 734 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/