diff --git a/src/gui/AstroCalcDialog.cpp b/src/gui/AstroCalcDialog.cpp index 438c90bfc994a..8e824cb148060 100644 --- a/src/gui/AstroCalcDialog.cpp +++ b/src/gui/AstroCalcDialog.cpp @@ -3159,18 +3159,27 @@ void AstroCalcDialog::generateSolarEclipses() // Source: Astronomical Algorithms (1991), Jean Meeus if (abs(gamma) <= (1.5433 + L2)) { + bool add = false; if (abs(gamma) > 0.9972 && abs(gamma) < (1.5433 + L2)) { if (abs(gamma) < 0.9972 + abs(L2) && dRatio > 1.) { eclipseTypeStr = qc_("Total", "eclipse type"); // Non-central total eclipse + if (ui->seFilterTotal->isChecked()) + add = true; } else if (abs(gamma) < 0.9972 + abs(L2) && dRatio < 1.) { eclipseTypeStr = qc_("Annular", "eclipse type"); // Non-central annular eclipse + if (ui->seFilterAnnular->isChecked()) + add = true; } else + { eclipseTypeStr = qc_("Partial", "eclipse type"); + if (ui->seFilterPartial->isChecked()) + add = true; + } noncentraleclipse = true; } else @@ -3178,105 +3187,116 @@ void AstroCalcDialog::generateSolarEclipses() if (L2 < 0.) { eclipseTypeStr = qc_("Total", "eclipse type"); + if (ui->seFilterTotal->isChecked()) + add = true; } else if (L2 > 0.0047) { eclipseTypeStr = qc_("Annular", "eclipse type"); + if (ui->seFilterAnnular->isChecked()) + add = true; } else if (L2 > 0. && L2 < 0.0047) { if (L2 < (0.00464 * sqrt(1. - gamma * gamma))) { eclipseTypeStr = qc_("Hybrid", "eclipse type"); + if (ui->seFilterHybrid->isChecked()) + add = true; } else { eclipseTypeStr = qc_("Annular", "eclipse type"); + if (ui->seFilterAnnular->isChecked()) + add = true; } } } - // Saros series calculations - useful to search for eclipses in the same Saros - // Adapted from Saros calculations for solar eclipses in Sky & Telescope (October 1985) - // Saros numbers calculated here are matching well with NASA's Five Millennium Catalog of Solar Eclipses - - // ln = Brown Lunation number : = 1 at the first New Moon of 1923 - const double q = round ((JD-2423436.40347)/29.530588); - const int ln = int(q) + 1 - 953; - const int nd = ln + 105; - const int s = 136 + 38 * nd; - const int nx = -61 * nd; - const int nc = qFloor(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)); - double eclipseLatitude = 0.; - double eclipseLongitude = 0.; - double eclipseAltitude = 0.; - - if (noncentraleclipse) + if (add) { - magStr = QString("%1").arg(QString::number(magnitude, 'f', 3)); - eclipseLatitude = latDeg; - eclipseLongitude = lngDeg; - altitudeStr = "0°"; - durationStr = dash; - pathWidthStr = dash; - } - else - { - magStr = QString("%1").arg(QString::number(dRatio, 'f', 3)); - eclipseAltitude = altitude; - altitudeStr = QString("%1°").arg(QString::number(round(eclipseAltitude))); - pathWidthStr = QString("%1 %2").arg(QString::number(round(pathWidth)), km); - eclipseLatitude = latDeg; - eclipseLongitude = lngDeg; - double centralDuration = abs(duration); - int durationMinute = int(centralDuration); - int durationSecond = qRound((centralDuration - durationMinute) * 60.); - if (durationSecond>59) + // Saros series calculations - useful to search for eclipses in the same Saros + // Adapted from Saros calculations for solar eclipses in Sky & Telescope (October 1985) + // Saros numbers calculated here are matching well with NASA's Five Millennium Catalog of Solar Eclipses + + // ln = Brown Lunation number : = 1 at the first New Moon of 1923 + const double q = round ((JD-2423436.40347)/29.530588); + const int ln = int(q) + 1 - 953; + const int nd = ln + 105; + const int s = 136 + 38 * nd; + const int nx = -61 * nd; + const int nc = qFloor(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)); + double eclipseLatitude = 0.; + double eclipseLongitude = 0.; + double eclipseAltitude = 0.; + + if (noncentraleclipse) { - durationMinute += 1; - durationSecond = 0; + magStr = QString("%1").arg(QString::number(magnitude, 'f', 3)); + eclipseLatitude = latDeg; + eclipseLongitude = lngDeg; + altitudeStr = "0°"; + durationStr = dash; + pathWidthStr = dash; } - if (durationSecond>9) - durationStr = QString("%1m %2s").arg(QString::number(durationMinute), QString::number(durationSecond)); else - durationStr = QString("%1m 0%2s").arg(QString::number(durationMinute), QString::number(durationSecond)); - } - - latitudeStr = StelUtils::decDegToLatitudeStr(eclipseLatitude, !withDecimalDegree); - longitudeStr = StelUtils::decDegToLongitudeStr(eclipseLongitude, true, false, !withDecimalDegree); + { + magStr = QString("%1").arg(QString::number(dRatio, 'f', 3)); + eclipseAltitude = altitude; + altitudeStr = QString("%1°").arg(QString::number(round(eclipseAltitude))); + pathWidthStr = QString("%1 %2").arg(QString::number(round(pathWidth)), km); + eclipseLatitude = latDeg; + eclipseLongitude = lngDeg; + double centralDuration = abs(duration); + int durationMinute = int(centralDuration); + int durationSecond = qRound((centralDuration - durationMinute) * 60.); + if (durationSecond>59) + { + durationMinute += 1; + durationSecond = 0; + } + if (durationSecond>9) + durationStr = QString("%1m %2s").arg(QString::number(durationMinute), QString::number(durationSecond)); + else + durationStr = QString("%1m 0%2s").arg(QString::number(durationMinute), QString::number(durationSecond)); + } - ACSolarEclipseTreeWidgetItem* treeItem = new ACSolarEclipseTreeWidgetItem(ui->solareclipseTreeWidget); - const double utcOffsetHrs = core->getUTCOffset(JD); - treeItem->setText(SolarEclipseDate, QString("%1 %2").arg(localeMgr->getPrintableDateLocal(JD, utcOffsetHrs), localeMgr->getPrintableTimeLocal(JD, utcOffsetHrs))); // local date and time - treeItem->setData(SolarEclipseDate, Qt::UserRole, JD); - treeItem->setText(SolarEclipseSaros, sarosStr); - treeItem->setToolTip(SolarEclipseSaros, q_("Saros series number of eclipse (each eclipse in a Saros is separated by an interval of 18 years 11.3 days)")); - treeItem->setText(SolarEclipseType, eclipseTypeStr); - treeItem->setText(SolarEclipseGamma, gammaStr); - treeItem->setText(SolarEclipseMag, magStr); - treeItem->setToolTip(SolarEclipseMag, q_("Eclipse magnitude is the fraction of the Sun's diameter obscured by the Moon")); - treeItem->setText(SolarEclipseLatitude, latitudeStr); - treeItem->setData(SolarEclipseLatitude, Qt::UserRole, eclipseLatitude); - treeItem->setText(SolarEclipseLongitude, longitudeStr); - treeItem->setData(SolarEclipseLongitude, Qt::UserRole, eclipseLongitude); - treeItem->setText(SolarEclipseAltitude, altitudeStr); - treeItem->setData(SolarEclipseAltitude, Qt::UserRole, eclipseAltitude); - treeItem->setToolTip(SolarEclipseAltitude, q_("Sun's altitude at greatest eclipse")); - treeItem->setText(SolarEclipsePathwidth, pathWidthStr); - treeItem->setData(SolarEclipsePathwidth, Qt::UserRole, pathWidth); - treeItem->setToolTip(SolarEclipsePathwidth, q_("Width of the path of totality or annularity at greatest eclipse")); - treeItem->setText(SolarEclipseDuration, durationStr); - treeItem->setData(SolarEclipseDuration, Qt::UserRole, abs(duration)); - treeItem->setToolTip(SolarEclipseDuration, q_("Duration of total or annular phase at greatest eclipse")); - for (auto column: {SolarEclipseDate, SolarEclipseSaros, SolarEclipseGamma, SolarEclipseMag, SolarEclipseLatitude, - SolarEclipseLongitude, SolarEclipseAltitude, SolarEclipsePathwidth, SolarEclipseDuration}) - treeItem->setTextAlignment(column, Qt::AlignRight); + latitudeStr = StelUtils::decDegToLatitudeStr(eclipseLatitude, !withDecimalDegree); + longitudeStr = StelUtils::decDegToLongitudeStr(eclipseLongitude, true, false, !withDecimalDegree); + + ACSolarEclipseTreeWidgetItem* treeItem = new ACSolarEclipseTreeWidgetItem(ui->solareclipseTreeWidget); + const double utcOffsetHrs = core->getUTCOffset(JD); + treeItem->setText(SolarEclipseDate, QString("%1 %2").arg(localeMgr->getPrintableDateLocal(JD, utcOffsetHrs), localeMgr->getPrintableTimeLocal(JD, utcOffsetHrs))); // local date and time + treeItem->setData(SolarEclipseDate, Qt::UserRole, JD); + treeItem->setText(SolarEclipseSaros, sarosStr); + treeItem->setToolTip(SolarEclipseSaros, q_("Saros series number of eclipse (each eclipse in a Saros is separated by an interval of 18 years 11.3 days)")); + treeItem->setText(SolarEclipseType, eclipseTypeStr); + treeItem->setText(SolarEclipseGamma, gammaStr); + treeItem->setText(SolarEclipseMag, magStr); + treeItem->setToolTip(SolarEclipseMag, q_("Eclipse magnitude is the fraction of the Sun's diameter obscured by the Moon")); + treeItem->setText(SolarEclipseLatitude, latitudeStr); + treeItem->setData(SolarEclipseLatitude, Qt::UserRole, eclipseLatitude); + treeItem->setText(SolarEclipseLongitude, longitudeStr); + treeItem->setData(SolarEclipseLongitude, Qt::UserRole, eclipseLongitude); + treeItem->setText(SolarEclipseAltitude, altitudeStr); + treeItem->setData(SolarEclipseAltitude, Qt::UserRole, eclipseAltitude); + treeItem->setToolTip(SolarEclipseAltitude, q_("Sun's altitude at greatest eclipse")); + treeItem->setText(SolarEclipsePathwidth, pathWidthStr); + treeItem->setData(SolarEclipsePathwidth, Qt::UserRole, pathWidth); + treeItem->setToolTip(SolarEclipsePathwidth, q_("Width of the path of totality or annularity at greatest eclipse")); + treeItem->setText(SolarEclipseDuration, durationStr); + treeItem->setData(SolarEclipseDuration, Qt::UserRole, abs(duration)); + treeItem->setToolTip(SolarEclipseDuration, q_("Duration of total or annular phase at greatest eclipse")); + for (auto column: {SolarEclipseDate, SolarEclipseSaros, SolarEclipseGamma, SolarEclipseMag, SolarEclipseLatitude, + SolarEclipseLongitude, SolarEclipseAltitude, SolarEclipsePathwidth, SolarEclipseDuration}) + treeItem->setTextAlignment(column, Qt::AlignRight); + } } } } diff --git a/src/gui/astroCalcDialog.ui b/src/gui/astroCalcDialog.ui index 0cc19d3623f12..cdaf8c237df2b 100644 --- a/src/gui/astroCalcDialog.ui +++ b/src/gui/astroCalcDialog.ui @@ -2987,6 +2987,78 @@ + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + + + Include total eclipses + + + Total + + + true + + + + + + + Include partial eclipses + + + Partial + + + true + + + + + + + Include annular eclipses + + + Annular + + + true + + + + + + + Include hybrid eclipses + + + Hybrid + + + true + + + + +