summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWorachate Boonplod <41257965+worachate001@users.noreply.github.com>2022-02-01 08:31:59 +0700
committerGitHub <noreply@github.com>2022-02-01 08:31:59 +0700
commita99649983725ef75e600dd4b60752860c0edadb2 (patch)
tree7c6dbe063faca2f0139ecb1ba88a62ab74dd9b46
parent9b1c8a9f868925ba1429b26fd060abca23f6004c (diff)
Allow years before 1582 in AstroCalc/Eclipses (#2224)
-rw-r--r--src/gui/AstroCalcDialog.cpp56
-rw-r--r--src/gui/astroCalcDialog.ui142
2 files changed, 101 insertions, 97 deletions
diff --git a/src/gui/AstroCalcDialog.cpp b/src/gui/AstroCalcDialog.cpp
index d4d9ee5291..49ac89360d 100644
--- a/src/gui/AstroCalcDialog.cpp
+++ b/src/gui/AstroCalcDialog.cpp
@@ -199,12 +199,6 @@ void AstroCalcDialog::retranslate()
ui->phenomenToDateEdit->setToolTip(validDates);
ui->transitFromDateEdit->setToolTip(validDates);
ui->transitToDateEdit->setToolTip(validDates);
- ui->lunareclipseFromDateEdit->setToolTip(validDates);
- ui->lunareclipseToDateEdit->setToolTip(validDates);
- ui->solareclipseFromDateEdit->setToolTip(validDates);
- ui->solareclipseToDateEdit->setToolTip(validDates);
- ui->solareclipselocalFromDateEdit->setToolTip(validDates);
- ui->solareclipselocalToDateEdit->setToolTip(validDates);
}
}
@@ -272,12 +266,6 @@ void AstroCalcDialog::createDialogContent()
ui->phenomenToDateEdit->setDateTime(currentDT.addMonths(1));
ui->transitFromDateEdit->setDateTime(currentDT);
ui->transitToDateEdit->setDateTime(currentDT.addMonths(1));
- ui->lunareclipseFromDateEdit->setDateTime(firstDayOfYear);
- ui->lunareclipseToDateEdit->setDateTime(lastDayOfYear);
- ui->solareclipseFromDateEdit->setDateTime(firstDayOfYear);
- ui->solareclipseToDateEdit->setDateTime(lastDayOfYear);
- ui->solareclipselocalFromDateEdit->setDateTime(firstDayOfYear);
- ui->solareclipselocalToDateEdit->setDateTime(lastDayOfYear);
ui->monthlyElevationTimeInfo->setStyleSheet("font-size: 18pt; color: rgb(238, 238, 238);");
// TODO: Replace QDateTimeEdit by a new StelDateTimeEdit widget to apply full range of dates
@@ -296,18 +284,6 @@ void AstroCalcDialog::createDialogContent()
ui->transitFromDateEdit->setToolTip(validDates);
ui->transitToDateEdit->setMinimumDate(minDate);
ui->transitToDateEdit->setToolTip(validDates);
- ui->lunareclipseFromDateEdit->setMinimumDate(minDate);
- ui->lunareclipseFromDateEdit->setToolTip(validDates);
- ui->lunareclipseToDateEdit->setMinimumDate(minDate);
- ui->lunareclipseToDateEdit->setToolTip(validDates);
- ui->solareclipseFromDateEdit->setMinimumDate(minDate);
- ui->solareclipseFromDateEdit->setToolTip(validDates);
- ui->solareclipseToDateEdit->setMinimumDate(minDate);
- ui->solareclipseToDateEdit->setToolTip(validDates);
- ui->solareclipselocalFromDateEdit->setMinimumDate(minDate);
- ui->solareclipselocalFromDateEdit->setToolTip(validDates);
- ui->solareclipselocalToDateEdit->setMinimumDate(minDate);
- ui->solareclipselocalToDateEdit->setToolTip(validDates);
ui->pushButtonExtraEphemerisDialog->setFixedSize(QSize(20, 20));
ui->pushButtonCustomStepsDialog->setFixedSize(QSize(26, 26));
@@ -594,6 +570,7 @@ void AstroCalcDialog::createDialogContent()
ui->transitNotificationLabel->setStyleSheet(style);
ui->gammaNoteLabel->setStyleSheet(style);
ui->gammaNoteSolarEclipseLabel->setStyleSheet(style);
+ ui->UncertaintiesNoteLabel->setStyleSheet(style);
style = "QCheckBox { color: rgb(238, 238, 238); }";
ui->sunAltitudeCheckBox->setStyleSheet(style);
ui->moonAltitudeCheckBox->setStyleSheet(style);
@@ -2292,8 +2269,11 @@ void AstroCalcDialog::generateLunarEclipses()
initListLunarEclipse();
const double currentJD = core->getJD(); // save current JD
- double startJD = StelUtils::qDateTimeToJd(QDateTime(ui->lunareclipseFromDateEdit->date()));
- double stopJD = StelUtils::qDateTimeToJd(QDateTime(ui->lunareclipseToDateEdit->date()));
+ double startyear = ui->lunareclipseFromYearSpinBox->value();
+ double years = ui->lunareclipseYearsSpinBox->value();
+ double startJD, stopJD;
+ StelUtils::getJDFromDate(&startJD, startyear, 1, 1, 0, 0, 0);
+ StelUtils::getJDFromDate(&stopJD, startyear+years, 1, 1, 0, 0, 0);
startJD = startJD - core->getUTCOffset(startJD) / 24.;
stopJD = stopJD - core->getUTCOffset(stopJD) / 24.;
int elements = static_cast<int>((stopJD - startJD) / 29.530588853);
@@ -2442,6 +2422,7 @@ void AstroCalcDialog::generateLunarEclipses()
int nc = floor(nx / 358. + 0.5 - nd / (12. * 358 * 358));
int saros = 1 + ((s + nc * 223 - 1) % 223);
if ((s + nc * 223 - 1) < 0) saros -= 223;
+ if (saros < -223) saros += 223;
// gamma = minimum distance from the center of the Moon to the axis of Earth’s umbral shadow cone
// in units of Earth’s equatorial radius. Positive when the Moon passes north of the shadow cone axis.
@@ -2587,6 +2568,8 @@ void AstroCalcDialog::saveLunarEclipses()
}
}
+ xlsx.write(count+3, 1, q_("Note: Local circumstances for eclipses during thousands of years in the past and future are not reliable due to uncertainty in ΔT which is caused by fluctuations in Earth's rotation."));
+
for (int i = 0; i < columns; i++)
{
xlsx.setColumnWidth(i+1, width[i]+2);
@@ -3050,8 +3033,11 @@ void AstroCalcDialog::generateSolarEclipses()
initListSolarEclipse();
const double currentJD = core->getJD(); // save current JD
- double startJD = StelUtils::qDateTimeToJd(QDateTime(ui->solareclipseFromDateEdit->date()));
- double stopJD = StelUtils::qDateTimeToJd(QDateTime(ui->solareclipseToDateEdit->date()));
+ double startyear = ui->solareclipseFromYearSpinBox->value();
+ double years = ui->solareclipseYearsSpinBox->value();
+ double startJD, stopJD;
+ StelUtils::getJDFromDate(&startJD, startyear, 1, 1, 0, 0, 0);
+ StelUtils::getJDFromDate(&stopJD, startyear+years, 1, 1, 0, 0, 0);
startJD = startJD - core->getUTCOffset(startJD) / 24.;
stopJD = stopJD - core->getUTCOffset(stopJD) / 24.;
QString sarosStr, eclipseTypeStr, gammaStr, magStr, latitudeStr, longitudeStr, altitudeStr, pathWidthStr, durationStr;
@@ -3070,7 +3056,7 @@ void AstroCalcDialog::generateSolarEclipses()
double InitJD = approxJD + int(tmp) * synodicMonth;
// Search for solar eclipses at each New Moon
- for (int i = 0; i <= elements+1; i++)
+ for (int i = 0; i <= elements+2; i++)
{
double JD = InitJD + synodicMonth * i;
if (JD > startJD)
@@ -3180,6 +3166,7 @@ void AstroCalcDialog::generateSolarEclipses()
int nc = floor(nx / 358. + 0.5 - nd / (12. * 358 * 358));
int saros = 1 + ((s + nc * 223 - 1) % 223);
if ((s + nc * 223 - 1) < 0) saros -= 223;
+ if (saros < -223) saros += 223;
sarosStr = QString("%1").arg(QString::number(saros));
gammaStr = QString("%1").arg(QString::number(gamma, 'f', 3));
@@ -3327,8 +3314,11 @@ void AstroCalcDialog::generateSolarEclipsesLocal()
initListSolarEclipseLocal();
const double currentJD = core->getJD(); // save current JD
- double startJD = StelUtils::qDateTimeToJd(QDateTime(ui->solareclipselocalFromDateEdit->date()));
- double stopJD = StelUtils::qDateTimeToJd(QDateTime(ui->solareclipselocalToDateEdit->date()));
+ double startyear = ui->solareclipselocalFromYearSpinBox->value();
+ double years = ui->solareclipselocalYearsSpinBox->value();
+ double startJD, stopJD;
+ StelUtils::getJDFromDate(&startJD, startyear, 1, 1, 0, 0, 0);
+ StelUtils::getJDFromDate(&stopJD, startyear+years, 1, 1, 0, 0, 0);
startJD = startJD - core->getUTCOffset(startJD) / 24.;
stopJD = stopJD - core->getUTCOffset(stopJD) / 24.;
QString eclipseTypeStr, magStr, altitudeStr, durationStr;
@@ -3730,6 +3720,8 @@ void AstroCalcDialog::saveSolarEclipses()
}
}
+ xlsx.write(count+3, 1, q_("Note: Path of eclipses during thousands of years in the past and future are not reliable due to uncertainty in ΔT which is caused by fluctuations in Earth's rotation."));
+
for (int i = 0; i < columns; i++)
{
xlsx.setColumnWidth(i+1, width[i]+2);
@@ -3829,6 +3821,8 @@ void AstroCalcDialog::saveSolarEclipsesLocal()
}
}
+ xlsx.write(count+3, 1, q_("Note: Local circumstances for eclipses during thousands of years in the past and future are not reliable due to uncertainty in ΔT which is caused by fluctuations in Earth's rotation."));
+
for (int i = 0; i < columns; i++)
{
xlsx.setColumnWidth(i+1, width[i]+2);
diff --git a/src/gui/astroCalcDialog.ui b/src/gui/astroCalcDialog.ui
index 00403801bc..4305b9158b 100644
--- a/src/gui/astroCalcDialog.ui
+++ b/src/gui/astroCalcDialog.ui
@@ -2526,39 +2526,39 @@
</widget>
</item>
<item>
- <widget class="QDateEdit" name="solareclipseFromDateEdit">
- <property name="wrapping">
- <bool>true</bool>
- </property>
- <property name="displayFormat">
- <string notr="true">yyyy.MM.dd</string>
- </property>
- <property name="calendarPopup">
- <bool>true</bool>
- </property>
- </widget>
- </item>
+ <widget class="QSpinBox" name="solareclipseFromYearSpinBox">
+ <property name="maximum">
+ <number>9999</number>
+ </property>
+ <property name="minimum">
+ <number>-9999</number>
+ </property>
+ <property name="value">
+ <number>2022</number>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_42">
<item>
- <widget class="QLabel" name="solareclipseToLabel">
+ <widget class="QLabel" name="solareclipseYearsLabel">
<property name="text">
- <string>To:</string>
+ <string>to the next</string>
</property>
</widget>
</item>
<item>
- <widget class="QDateEdit" name="solareclipseToDateEdit">
- <property name="wrapping">
- <bool>true</bool>
+ <widget class="QSpinBox" name="solareclipseYearsSpinBox">
+ <property name="maximum">
+ <number>500</number>
</property>
- <property name="displayFormat">
- <string notr="true">yyyy.MM.dd</string>
+ <property name="minimum">
+ <number>2</number>
</property>
- <property name="calendarPopup">
- <bool>true</bool>
+ <property name="value">
+ <number>10</number>
</property>
</widget>
</item>
@@ -2569,7 +2569,7 @@
<item row="3" column="0">
<widget class="QLabel" name="gammaNoteSolarEclipseLabel">
<property name="text">
- <string>Notes: The quantity gamma is the minimum distance from the axis of lunar shadow cone to the center of Earth, in units of Earth’s equatorial radius. This distance is positive or negative, depending on whether the axis of the shadow cone passes north or south of the Earth's center. Double click will change current location to the place of greatest eclipse.</string>
+ <string>Notes: The quantity gamma is the minimum distance from the axis of lunar shadow cone to the center of Earth, in units of Earth’s equatorial radius. This distance is positive or negative, depending on whether the axis of the shadow cone passes north or south of the Earth's center. Path of solar eclipses during thousands of years in the past and future are not reliable due to uncertainty in ΔT which is caused by fluctuations in Earth's rotation.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
@@ -2666,15 +2666,15 @@
</widget>
</item>
<item>
- <widget class="QDateEdit" name="solareclipselocalFromDateEdit">
- <property name="wrapping">
- <bool>true</bool>
+ <widget class="QSpinBox" name="solareclipselocalFromYearSpinBox">
+ <property name="maximum">
+ <number>9999</number>
</property>
- <property name="displayFormat">
- <string notr="true">yyyy.MM.dd</string>
+ <property name="minimum">
+ <number>-9999</number>
</property>
- <property name="calendarPopup">
- <bool>true</bool>
+ <property name="value">
+ <number>2022</number>
</property>
</widget>
</item>
@@ -2683,22 +2683,22 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_47">
<item>
- <widget class="QLabel" name="solareclipselocalToLabel">
+ <widget class="QLabel" name="solareclipselocalYearsLabel">
<property name="text">
- <string>To:</string>
+ <string>to the next</string>
</property>
</widget>
</item>
<item>
- <widget class="QDateEdit" name="solareclipselocalToDateEdit">
- <property name="wrapping">
- <bool>true</bool>
+ <widget class="QSpinBox" name="solareclipselocalYearsSpinBox">
+ <property name="maximum">
+ <number>500</number>
</property>
- <property name="displayFormat">
- <string notr="true">yyyy.MM.dd</string>
+ <property name="minimum">
+ <number>2</number>
</property>
- <property name="calendarPopup">
- <bool>true</bool>
+ <property name="value">
+ <number>10</number>
</property>
</widget>
</item>
@@ -2706,6 +2706,16 @@
</item>
</layout>
</item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="UncertaintiesNoteLabel">
+ <property name="text">
+ <string>Note: Local circumstances for eclipses during thousands of years in the past and future are not reliable due to uncertainty in ΔT which is caused by fluctuations in Earth's rotation.</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<widget class="QWidget" name="tabLunarEclipse">
@@ -2796,42 +2806,42 @@
</widget>
</item>
<item>
- <widget class="QDateEdit" name="lunareclipseFromDateEdit">
- <property name="wrapping">
- <bool>true</bool>
- </property>
- <property name="displayFormat">
- <string notr="true">yyyy.MM.dd</string>
- </property>
- <property name="calendarPopup">
- <bool>true</bool>
- </property>
- </widget>
- </item>
+ <widget class="QSpinBox" name="lunareclipseFromYearSpinBox">
+ <property name="maximum">
+ <number>9999</number>
+ </property>
+ <property name="minimum">
+ <number>-9999</number>
+ </property>
+ <property name="value">
+ <number>2022</number>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_38">
<item>
- <widget class="QLabel" name="lunareclipseToLabel">
+ <widget class="QLabel" name="lunareclipseYearsLabel">
<property name="text">
- <string>To:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QDateEdit" name="lunareclipseToDateEdit">
- <property name="wrapping">
- <bool>true</bool>
- </property>
- <property name="displayFormat">
- <string notr="true">yyyy.MM.dd</string>
- </property>
- <property name="calendarPopup">
- <bool>true</bool>
+ <string>to the next</string>
</property>
</widget>
</item>
+ <item>
+ <widget class="QSpinBox" name="lunareclipseYearsSpinBox">
+ <property name="maximum">
+ <number>500</number>
+ </property>
+ <property name="minimum">
+ <number>2</number>
+ </property>
+ <property name="value">
+ <number>10</number>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
</layout>
@@ -2839,7 +2849,7 @@
<item row="3" column="0">
<widget class="QLabel" name="gammaNoteLabel">
<property name="text">
- <string>Note: The quantity gamma is the minimum distance from the center of the Moon to the axis of Earth’s umbral shadow cone, in units of Earth’s equatorial radius. This distance is positive or negative, depending on whether the Moon passes north or south of the shadow cone axis.</string>
+ <string>Notes: The quantity gamma is the minimum distance from the center of the Moon to the axis of Earth’s umbral shadow cone, in units of Earth’s equatorial radius. This distance is positive or negative, depending on whether the Moon passes north or south of the shadow cone axis. Local circumstances for eclipses during thousands of years in the past and future are not reliable due to uncertainty in ΔT which is caused by fluctuations in Earth's rotation.</string>
</property>
<property name="wordWrap">
<bool>true</bool>