EquationOfTime.cpp   EquationOfTime.cpp 
skipping to change at line 36 skipping to change at line 36
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
#include "StelGui.hpp" #include "StelGui.hpp"
#include "StelGuiItems.hpp" #include "StelGuiItems.hpp"
#include "StelObjectMgr.hpp" #include "StelObjectMgr.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "Planet.hpp" #include "Planet.hpp"
#include "EquationOfTime.hpp" #include "EquationOfTime.hpp"
#include "EquationOfTimeWindow.hpp" #include "EquationOfTimeWindow.hpp"
//#include "sidereal_time.h"
#include "precession.h"
#include <QFontMetrics> #include <QFontMetrics>
#include <QSettings> #include <QSettings>
#include <QPixmap> #include <QPixmap>
#include <cmath> #include <cmath>
StelModule* EquationOfTimeStelPluginInterface::getStelModule() const StelModule* EquationOfTimeStelPluginInterface::getStelModule() const
{ {
return new EquationOfTime(); return new EquationOfTime();
} }
skipping to change at line 126 skipping to change at line 123
return; return;
if (core->getCurrentPlanet()->getEnglishName()!="Earth") if (core->getCurrentPlanet()->getEnglishName()!="Earth")
return; return;
StelPainter sPainter(core->getProjection2d()); StelPainter sPainter(core->getProjection2d());
sPainter.setColor(textColor[0], textColor[1], textColor[2], 1.f); sPainter.setColor(textColor[0], textColor[1], textColor[2], 1.f);
font.setPixelSize(getFontSize()); font.setPixelSize(getFontSize());
sPainter.setFont(font); sPainter.setFont(font);
QString timeText; QString timeText;
double eqTime = getSolutionEquationOfTime(core->getJDE()); double eqTime = core->getSolutionEquationOfTime(core->getJDE());
if (getFlagInvertedValue()) if (getFlagInvertedValue())
eqTime *= -1; eqTime *= -1;
if (getFlagMsFormat()) if (getFlagMsFormat())
{ {
int seconds = qRound((eqTime - (int)eqTime)*60); int seconds = qRound((eqTime - (int)eqTime)*60);
QString messageSecondsValue = QString("%1").arg(qAbs(seconds ), 2, 10, QLatin1Char('0')); QString messageSecondsValue = QString("%1").arg(qAbs(seconds ), 2, 10, QLatin1Char('0'));
timeText = QString("%1: %2%3%4%5%6").arg(messageEquation, (e qTime<0? QString(QLatin1Char('-')):QString()), QString::number((int)qAbs(eq Time)), messageEquationMinutes, messageSecondsValue, messageEquationSeconds ); timeText = QString("%1: %2%3%4%5%6").arg(messageEquation, (e qTime<0? QString(QLatin1Char('-')):QString()), QString::number((int)qAbs(eq Time)), messageEquationMinutes, messageSecondsValue, messageEquationSeconds );
skipping to change at line 217 skipping to change at line 214
conf->setValue("enable_at_startup", getFlagEnableAtStartup()); conf->setValue("enable_at_startup", getFlagEnableAtStartup());
conf->setValue("flag_use_ms_format", getFlagMsFormat()); conf->setValue("flag_use_ms_format", getFlagMsFormat());
conf->setValue("flag_use_inverted_value", getFlagInvertedValue()); conf->setValue("flag_use_inverted_value", getFlagInvertedValue());
conf->setValue("flag_show_button", getFlagShowEOTButton()); conf->setValue("flag_show_button", getFlagShowEOTButton());
//conf->setValue("text_color", "0,0.5,1"); //conf->setValue("text_color", "0,0.5,1");
conf->setValue("font_size", getFontSize()); conf->setValue("font_size", getFontSize());
conf->endGroup(); conf->endGroup();
} }
double EquationOfTime::getSolutionEquationOfTime(const double JDE) const
{
StelCore* core = StelApp::getInstance().getCore();
double tau = (JDE - 2451545.0)/365250.0;
double sunMeanLongitude = 280.4664567 + tau*(360007.6892779 + tau*(0
.03032028 + tau*(1./49931. - tau*(1./15300. - tau/2000000.))));
// reduce the angle
sunMeanLongitude = std::fmod(sunMeanLongitude, 360.);
// force it to be the positive remainder, so that 0 <= angle < 360
sunMeanLongitude = std::fmod(sunMeanLongitude + 360., 360.);
Vec3d pos = GETSTELMODULE(StelObjectMgr)->searchByName("Sun")->getEq
uinoxEquatorialPos(core);
double ra, dec;
StelUtils::rectToSphe(&ra, &dec, pos);
// covert radians to degrees and reduce the angle
double alpha = std::fmod(ra*180./M_PI, 360.);
// force it to be the positive remainder, so that 0 <= angle < 360
alpha = std::fmod(alpha + 360., 360.);
double deltaPsi, deltaEps;
getNutationAngles(JDE, &deltaPsi, &deltaEps); // these are radians!
//double equation = 4*(sunMeanLongitude - 0.0057183 - alpha + get_nu
tation_longitude(JDE)*cos(get_mean_ecliptical_obliquity(JDE)));
double equation = 4*(sunMeanLongitude - 0.0057183 - alpha + deltaPsi
*180./M_PI*cos(getPrecessionAngleVondrakEpsilon(JDE)));
// The equation of time is always smaller 20 minutes in absolute val
ue
if (qAbs(equation)>20)
{
// If absolute value of the equation of time appears to be t
oo large, add 24 hours (1440 minutes) to or subtract it from our result
if (equation>0.)
equation -= 1440.;
else
equation += 1440.;
}
return equation;
}
void EquationOfTime::updateMessageText() void EquationOfTime::updateMessageText()
{ {
messageEquation = q_("Equation of Time"); messageEquation = q_("Equation of Time");
// TRANSLATORS: minutes. // TRANSLATORS: minutes.
messageEquationMinutes = qc_("m", "time"); messageEquationMinutes = qc_("m", "time");
// TRANSLATORS: seconds. // TRANSLATORS: seconds.
messageEquationSeconds = qc_("s", "time"); messageEquationSeconds = qc_("s", "time");
} }
void EquationOfTime::setFlagShowEOTButton(bool b) void EquationOfTime::setFlagShowEOTButton(bool b)
 End of changes. 3 change blocks. 
48 lines changed or deleted 1 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/