11#include "dialogs/detaildialog.h"
12#include "dialogs/locationdialog.h"
13#include "dialogs/timedialog.h"
14#include "skyobjects/kssun.h"
15#include "skyobjects/ksmoon.h"
16#include "skycomponents/skymapcomposite.h"
17#include "tools/observinglist.h"
18#include "catalogsdb.h"
33 WUT =
new WUTDialogUI(
this);
54 UT0 = geo->LTtoUT(T0);
57 Tomorrow = T0.
addSecs(12 * 3600);
58 TomorrowUT = geo->LTtoUT(Tomorrow);
61 Evening = T0.
addSecs(-6 * 3600);
62 EveningUT = geo->LTtoUT(Evening);
68 WUT->LocationLabel->setText(
i18n(
"at %1",
sGeo));
69 WUT->DateLabel->setText(
72 WUT->MagnitudeEdit->setValue(m_Mag);
74 WUT->MagnitudeEdit->setSingleStep(0.100);
80void WUTDialog::makeConnections()
92 SLOT(slotEveningMorning(
int)));
94 SLOT(slotChangeMagnitude()));
97void WUTDialog::initCategories()
99 m_Categories <<
i18n(
"Planets") <<
i18n(
"Stars") <<
i18n(
"Nebulae")
100 <<
i18n(
"Galaxies") <<
i18n(
"Star Clusters") <<
i18n(
"Constellations")
101 <<
i18n(
"Asteroids") <<
i18n(
"Comets");
103 foreach (
const QString &c, m_Categories)
104 WUT->CategoryListWidget->addItem(c);
106 WUT->CategoryListWidget->setCurrentRow(0);
116 foreach (
const QString &c, m_Categories)
119 visibleObjects(c).clear();
123 m_CategoryInitialized[c] =
false;
131 sunRiseTomorrow =
oSun->riseSetTime(TomorrowUT, geo,
true);
132 sunSetToday =
oSun->riseSetTime(EveningUT, geo,
false);
133 sunRiseToday =
oSun->riseSetTime(EveningUT, geo,
true);
140 oSun->updateCoords(num,
true, geo->
lat(), &LST,
true);
141 if (
oSun->checkCircumpolar(geo->
lat()))
143 if (
oSun->alt().Degrees() > 0.0)
165 Dur = 24.0 + (float)sunRiseTomorrow.
hour() +
166 (float)sunRiseTomorrow.
minute() / 60.0 +
167 (float)sunRiseTomorrow.
second() / 3600.0 - (float)sunSetToday.
hour() -
168 (float)sunSetToday.
minute() / 60.0 - (float)sunSetToday.
second() / 3600.0;
177 WUT->SunSetLabel->setText(
178 i18nc(
"Sunset at time %1 on date %2",
"Sunset: %1 on %2",
sSet,
180 WUT->SunRiseLabel->setText(
181 i18nc(
"Sunrise at time %1 on date %2",
"Sunrise: %1 on %2",
sRise,
184 WUT->NightDurationLabel->setText(
i18n(
"Night duration: %1",
sDuration));
186 WUT->NightDurationLabel->setText(
i18n(
"Night duration: %1 hours",
sDuration));
188 WUT->NightDurationLabel->setText(
i18n(
"Night duration: %1 hour",
sDuration));
190 WUT->NightDurationLabel->setText(
i18n(
"Night duration: %1 minutes",
sDuration));
192 WUT->NightDurationLabel->setText(
i18n(
"Night duration: %1 minute",
sDuration));
196 moonRise =
oMoon->riseSetTime(UT0, geo,
true);
197 moonSet =
oMoon->riseSetTime(UT0, geo,
false);
200 oMoon->updateCoords(num,
true, geo->
lat(), &LST,
true);
201 if (
oMoon->checkCircumpolar(geo->
lat()))
203 if (
oMoon->alt().Degrees() > 0.0)
221 WUT->MoonRiseLabel->setText(
228 if (moonSet > moonRise)
229 WUT->MoonSetLabel->setText(
230 i18n(
"Moon sets at: %1 on %2",
sSet,
233 WUT->MoonSetLabel->setText(
234 i18n(
"Moon sets at: %1 on %2",
sSet,
236 oMoon->findPhase(
nullptr);
237 WUT->MoonIllumLabel->setText(
oMoon->phaseName() +
243 oMoon->findPhase(
nullptr);
245 if (WUT->CategoryListWidget->currentItem())
246 slotLoadList(WUT->CategoryListWidget->currentItem()->text());
254 return m_VisibleList[category];
259 for (
const auto &
oneList : m_VisibleList)
271bool WUTDialog::isCategoryInitialized(
const QString &category)
273 return m_CategoryInitialized[
category];
277 const std::vector<SkyObject::TYPE> &types)
282 auto &lst = m_CatalogObjects[
category];
285 for (
const auto type : types)
287 lst.splice(lst.end(), db.get_objects(type, m_Mag));
290 objects.reserve(lst.size());
291 for (
const auto &obj : lst)
293 objects.push_back({ obj.name(), &obj });
299void WUTDialog::slotLoadList(
const QString &c)
305 WUT->ObjectListWidget->clear();
308 const bool isDSO = c == m_Categories[2] || c == m_Categories[3] || c == m_Categories[4];
310 if (!isCategoryInitialized(c))
312 if (c == m_Categories[0])
320 visibleObjects(c).insert(o);
323 m_CategoryInitialized[c] =
true;
326 else if (c == m_Categories[1])
331 data->
skyComposite()->objectLists(SkyObject::CATALOG_STAR));
332 starObjects.append(load_dso(c, { SkyObject::STAR, SkyObject::CATALOG_STAR }));
340 visibleObjects(c).insert(o);
343 m_CategoryInitialized[c] =
true;
346 else if (c == m_Categories[5])
350 visibleObjects(c).insert(o);
352 m_CategoryInitialized[c] =
true;
355 else if (c == m_Categories[6])
358 if (o->
mag() <= m_Mag &&
359 o->
name() !=
i18nc(
"Asteroid name (optional)",
"Pluto") &&
361 visibleObjects(c).insert(o);
363 m_CategoryInitialized[c] =
true;
366 else if (c == m_Categories[7])
370 visibleObjects(c).insert(o);
372 m_CategoryInitialized[c] =
true;
377 auto dsos{ load_dso(c,
379 SkyObject::OPEN_CLUSTER, SkyObject::GLOBULAR_CLUSTER,
380 SkyObject::GASEOUS_NEBULA, SkyObject::PLANETARY_NEBULA,
381 SkyObject::SUPERNOVA_REMNANT, SkyObject::SUPERNOVA,
392 case SkyObject::OPEN_CLUSTER:
393 case SkyObject::GLOBULAR_CLUSTER:
394 visibleObjects(m_Categories[4]).insert(o);
396 case SkyObject::GASEOUS_NEBULA:
397 case SkyObject::PLANETARY_NEBULA:
398 case SkyObject::SUPERNOVA:
399 case SkyObject::SUPERNOVA_REMNANT:
400 visibleObjects(m_Categories[2]).insert(o);
402 case SkyObject::GALAXY:
403 visibleObjects(m_Categories[3]).insert(o);
409 m_CategoryInitialized[m_Categories[2]] =
true;
410 m_CategoryInitialized[m_Categories[3]] =
true;
411 m_CategoryInitialized[m_Categories[4]] =
true;
418 for (
const auto &
oneObject : visibleObjects(c))
423 for (
const auto &
oneObject : visibleObjects(c))
430 if (WUT->ObjectListWidget->count())
432 WUT->ObjectListWidget->setCurrentRow(0);
449 T1.setTime(sunSetToday);
451 T2.setTime(sunRiseTomorrow);
454 if (EveningFlag == 0)
458 else if (EveningFlag == 1)
467 dms LST = geo->GSTtoLST(ut.
gst());
473 if (sp.
alt().Degrees() > minAlt)
483void WUTDialog::slotDisplayObject(
const QString &name)
497 WUT->ObjectBox->setTitle(
i18n(
"No Object Selected"));
502 o = KStarsData::Instance()->objectNamed(name);
506 WUT->ObjectBox->setTitle(
i18n(
"Object Not Found"));
511 WUT->ObjectBox->setTitle(o->
name());
515 if (o->
alt().Degrees() > 0.0)
541 WUT->ObjectRiseLabel->setText(
i18n(
"Rises at: %1",
sRise));
542 WUT->ObjectTransitLabel->setText(
i18n(
"Transits at: %1",
sTransit));
543 WUT->ObjectSetLabel->setText(
i18n(
"Sets at: %1",
sSet));
546void WUTDialog::slotCenter()
551 if (WUT->ObjectListWidget->currentItem() !=
nullptr)
553 o =
kstars->data()->objectNamed(WUT->ObjectListWidget->currentItem()->text());
557 kstars->map()->setFocusPoint(o);
558 kstars->map()->setFocusObject(o);
559 kstars->map()->setDestination(*
kstars->map()->focusPoint());
563void WUTDialog::slotDetails()
568 if (WUT->ObjectListWidget->currentItem() !=
nullptr)
570 o =
kstars->data()->objectNamed(WUT->ObjectListWidget->currentItem()->text());
580void WUTDialog::slotObslist()
584 if (WUT->ObjectListWidget->currentItem() !=
nullptr)
586 o = KStarsData::Instance()->objectNamed(
587 WUT->ObjectListWidget->currentItem()->text());
591 KStarsData::Instance()->observingList()->slotAddObject(o, session);
595void WUTDialog::slotChangeDate()
604 T0 =
td->selectedDateTime();
617 UT0 = geo->LTtoUT(T0);
620 Tomorrow = T0.
addSecs(12 * 3600);
621 TomorrowUT = geo->LTtoUT(Tomorrow);
624 Evening = T0.
addSecs(-6 * 3600);
625 EveningUT = geo->LTtoUT(Evening);
627 WUT->DateLabel->setText(
i18n(
631 slotLoadList(WUT->CategoryListWidget->currentItem()->text());
636void WUTDialog::slotChangeLocation()
645 UT0 = geo->LTtoUT(T0);
646 TomorrowUT = geo->LTtoUT(Tomorrow);
647 EveningUT = geo->LTtoUT(Evening);
649 WUT->LocationLabel->setText(
i18n(
"at %1", geo->
fullName()));
652 slotLoadList(WUT->CategoryListWidget->currentItem()->text());
658void WUTDialog::slotEveningMorning(
int index)
660 if (EveningFlag != index)
664 slotLoadList(WUT->CategoryListWidget->currentItem()->text());
668void WUTDialog::updateMag()
670 m_Mag = WUT->MagnitudeEdit->value();
672 slotLoadList(WUT->CategoryListWidget->currentItem()->text());
675void WUTDialog::slotChangeMagnitude()
684 timer->setSingleShot(
true);
a dms subclass that caches its sine and cosine values every time the angle is changed.
Manages the catalog database and provides an interface to provide an interface to query and modify th...
DetailDialog is a window showing detailed information for a selected object.
Contains all relevant information for specifying a location on Earth: City Name, State/Province name,...
const CachingDms * lat() const
QString translatedCountry() const
QString translatedName() const
QString translatedProvince() const
Provides necessary information about the Moon.
There are several time-dependent values used in position calculations, that are not specific to an ob...
Child class of KSPlanetBase; encapsulates information about the Sun.
KStarsData is the backbone of KStars.
SkyObject * objectNamed(const QString &name)
Find object by name.
const KStarsDateTime & ut() const
SkyMapComposite * skyComposite()
Extension of QDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day,...
KStarsDateTime addDays(int nd) const
Modify the Date/Time by adding a number of days.
KStarsDateTime addSecs(double s) const
void setTime(const QTime &t)
Assign the Time according to a QTime object.
This is the main window for KStars.
static KStars * Instance()
Dialog for changing the geographic location of the observer.
SkyObject * findByName(const QString &name, bool exact=true) override
Search the children of this SkyMapComposite for a SkyObject whose name matches the argument.
Provides all necessary information about an object in the sky: its coordinates, name(s),...
virtual QString name(void) const
QTime transitTime(const KStarsDateTime &dt, const GeoLocation *geo) const
The same iteration technique described in riseSetTime() is used here.
QTime riseSetTime(const KStarsDateTime &dt, const GeoLocation *geo, bool rst, bool exact=true) const
Determine the time at which the point will rise or set.
SkyPoint recomputeCoords(const KStarsDateTime &dt, const GeoLocation *geo=nullptr) const
The equatorial coordinates for the object on date dt are computed and returned, but the object's inte...
The sky coordinates of a point in the sky.
bool checkCircumpolar(const dms *gLat) const
Check if this point is circumpolar at the given geographic latitude.
void EquatorialToHorizontal(const CachingDms *LST, const CachingDms *lat)
Determine the (Altitude, Azimuth) coordinates of the SkyPoint from its (RA, Dec) coordinates,...
WUTDialog(QWidget *ks, bool session=false, GeoLocation *geo=KStarsData::Instance() ->geo(), KStarsDateTime lt=KStarsData::Instance() ->lt())
Constructor.
void init()
Determine which objects are visible, and store them in an array of lists, classified by object type.
bool checkVisibility(const SkyObject *o)
Check visibility of object o the object to check.
An angle, stored as degrees, but expressible in many ways.
QString i18nc(const char *context, const char *text, const TYPE &arg...)
QString i18n(const char *text, const TYPE &arg...)
char * toString(const EngineQuery &query)
Category category(StandardShortcut id)
QString name(StandardShortcut id)
void setModal(bool modal)
bool contains(const Key &key) const const
QString toString(QDate date, FormatType format) const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QString arg(Args &&... args) const const
bool isEmpty() const const
QTime addSecs(int s) const const