7#include "skymapcomposite.h"
9#include "artificialhorizoncomponent.h"
10#include "catalogsdb.h"
11#include "constellationartcomponent.h"
12#include "constellationboundarylines.h"
13#include "constellationlines.h"
14#include "constellationnamescomponent.h"
15#include "culturelist.h"
16#include "deepstarcomponent.h"
17#include "catalogscomponent.h"
20#include "equatorialcoordinategrid.h"
21#include "horizoncomponent.h"
22#include "horizontalcoordinategrid.h"
23#include "localmeridiancomponent.h"
24#include "ksasteroid.h"
26#include <kmessagebox.h>
30#include "kstarsdata.h"
32#include "satellitescomponent.h"
33#include "skylabeler.h"
34#include "skypainter.h"
35#include "solarsystemcomposite.h"
36#include "starcomponent.h"
37#include "supernovaecomponent.h"
38#include "targetlistcomponent.h"
39#include "projections/projector.h"
40#include "skyobjects/ksplanet.h"
41#include "skyobjects/constellationsart.h"
44#include "flagcomponent.h"
46#include "observinglist.h"
48#include "hipscomponent.h"
49#include "terraincomponent.h"
50#include "imageoverlaycomponent.h"
51#include "mosaiccomponent.h"
54#include <QApplication>
56#include <kstars_debug.h>
61 m_skyLabeler.reset(SkyLabeler::Instance());
79 addComponent(m_CBoundLines =
new ConstellationBoundaryLines(
this), 80);
89 addComponent(m_ArtificialHorizon =
new ArtificialHorizonComponent(
this), 110);
91 QStringList allcatalogs = Options::showCatalogNames();
93 Options::setShowCatalogNames(allcatalogs);
102 SkyMapLite::Instance()->loadingFinished();
111 addComponent(m_CBoundLines =
new ConstellationBoundaryLines(
this), 80);
119 const auto &path = CatalogsDB::dso_db_path();
130 const auto &backup_path =
135 i18n(
"Do you want to start over with an empty database?\n"
136 "This will move the current DSO database \"%1\"\n"
167 addComponent(m_ArtificialHorizon =
new ArtificialHorizonComponent(
this), 110);
174 &Options::obsListSymbol,
175 &Options::obsListText),
182 connect(
this, SIGNAL(progressText(
QString)), KStarsData::Instance(),
183 SIGNAL(progressText(
QString)));
193 m_HorizontalCoordinateGrid->update(num);
195 m_LocalMeridianComponent->update(num);
203 m_CNames->update(num);
215 m_SolarSystem->update(num);
217 m_Satellites->update(num);
219 m_Supernovae->update(num);
221 m_Horizon->update(num);
224 m_Flags->update(num);
230 m_SolarSystem->updateSolarSystemBodies(num);
235 m_SolarSystem->updateMoons(num);
248 SkyMap *map = SkyMap::Instance();
254 m_CLines->reindex(&m_reindexNum);
260 data->syncUpdateIDs();
265 float radius = map->projector()->fov();
266 if (radius > 180.0 && SkyMap::Instance()->projector()->type() != Projector::Stereographic)
269 if (m_skyMesh->inDraw())
271 printf(
"Warning: aborting concurrent SkyMapComposite::draw()\n");
275 m_skyMesh->inDraw(
true);
277 m_skyMesh->aperture(focus, radius + 1.0, DRAW_BUF);
280 if (Options::showEquatorialGrid() || Options::showHorizontalGrid() ||
281 Options::showEquator())
283 m_skyMesh->index(focus, radius + 1.0, NO_PRECESS_BUF);
287 m_skyLabeler->reset(map);
288 m_skyLabeler->useStdFont();
297 auto &obsList = KStarsData::Instance()->observingList()->sessionList();
299 if (Options::obsListText())
300 for (
auto &obj_clone : obsList)
311 m_MilkyWay->draw(skyp);
316 if (Options::showImageOverlaysBelowCatalogs())
318 m_ImageOverlay->draw(skyp);
320 m_EquatorialCoordinateGrid->draw(skyp);
321 m_HorizontalCoordinateGrid->draw(skyp);
322 m_LocalMeridianComponent->draw(skyp);
325 if (m_Cultures->current() ==
"Western")
327 m_CBoundLines->draw(skyp);
328 m_ConstellationArt->draw(skyp);
330 else if (m_Cultures->current() ==
"Inuit")
332 m_ConstellationArt->draw(skyp);
335 m_CLines->draw(skyp);
337 m_Equator->draw(skyp);
339 m_Ecliptic->draw(skyp);
341 m_Catalogs->draw(skyp);
345 m_SolarSystem->drawTrails(skyp);
346 m_SolarSystem->draw(skyp);
348 m_Satellites->draw(skyp);
350 m_Supernovae->draw(skyp);
352 map->drawObjectLabels(labelObjects());
354 m_skyLabeler->drawQueuedLabels();
355 m_CNames->draw(skyp);
356 m_Stars->drawLabels();
358 m_ObservingList->pen =
360 m_ObservingList->list2 = KStarsData::Instance()->observingList()->sessionList();
361 m_ObservingList->draw(skyp);
365 m_StarHopRouteList->pen =
367 m_StarHopRouteList->draw(skyp);
369 if (!Options::showImageOverlaysBelowCatalogs())
371 m_ImageOverlay->draw(skyp);
374 m_Mosaic->draw(skyp);
377 m_ArtificialHorizon->draw(skyp);
379 m_Horizon->draw(skyp);
381 m_skyMesh->inDraw(
false);
384 m_Terrain->draw(skyp);
420 double rTry = maxrad;
421 double rBest = maxrad;
426 m_skyMesh->aperture(p, maxrad + 1.0, OBJ_NEAREST_BUF);
428 oBest = m_Stars->objectNearest(p, rBest);
430 if (oBest && oBest->
mag() < 4.0)
433 else if (oBest && oBest->
mag() > 12.0)
439 oTry = m_Satellites->objectNearest(p, rTry);
446 for (
auto &star : m_DeepStars)
449 oTry = star->objectNearest(p, rTry);
458 oTry = m_Catalogs->objectNearest(p, rTry);
459 if (oTry && rTry < rBest)
466 oTry = m_Supernovae->objectNearest(p, rTry);
475 oTry = m_SolarSystem->objectNearest(p, rTry);
476 if (!
dynamic_cast<KSComet *
>(oTry) &&
485 if (std::isfinite(oTry->
mag()) && oTry->
mag() < 12.0)
504 double rtry = maxrad;
507 m_skyMesh->aperture(p, maxrad + 1.0, OBJ_NEAREST_BUF);
509 star = m_Stars->objectNearest(p, rtry);
511 if (star && star->
mag() < 4.0)
520bool SkyMapComposite::addNameLabel(
SkyObject *o)
528bool SkyMapComposite::removeNameLabel(
SkyObject *o)
532 int index = labelObjects().indexOf(o);
535 labelObjects().removeAt(index);
541 return m_ObjectNames;
546 return m_ObjectLists;
552 const SkyRegion ®ion = m_skyMesh->skyRegion(p1, p2);
556 if (m_Stars->selected())
557 m_Stars->objectsInArea(list, region);
558 if (m_Catalogs->selected())
559 m_Catalogs->objectsInArea(list, region);
575 if ((o = m_SolarSystem->findByName(name, exact)))
577 if ((o = m_Catalogs->findByName(name, exact)))
579 if ((o = m_CNames->findByName(name, exact)))
581 if ((o = m_Stars->findByName(name, exact)))
583 if ((o = m_Supernovae->findByName(name, exact)))
585 if ((o = m_Satellites->findByName(name, exact)))
593 return m_Stars->findStarByGenetiveName(name);
598 if (n == KSPlanetBase::SUN)
599 return dynamic_cast<KSPlanetBase *
>((m_SolarSystem->findByName(
i18n(
"Sun"))));
600 if (n == KSPlanetBase::MERCURY)
601 return dynamic_cast<KSPlanetBase *
>((m_SolarSystem->findByName(
i18n(
"Mercury"))));
602 if (n == KSPlanetBase::VENUS)
603 return dynamic_cast<KSPlanetBase *
>((m_SolarSystem->findByName(
i18n(
"Venus"))));
604 if (n == KSPlanetBase::MOON)
605 return dynamic_cast<KSPlanetBase *
>((m_SolarSystem->findByName(
i18n(
"Moon"))));
606 if (n == KSPlanetBase::MARS)
607 return dynamic_cast<KSPlanetBase *
>((m_SolarSystem->findByName(
i18n(
"Mars"))));
608 if (n == KSPlanetBase::JUPITER)
609 return dynamic_cast<KSPlanetBase *
>((m_SolarSystem->findByName(
i18n(
"Jupiter"))));
610 if (n == KSPlanetBase::SATURN)
611 return dynamic_cast<KSPlanetBase *
>((m_SolarSystem->findByName(
i18n(
"Saturn"))));
612 if (n == KSPlanetBase::URANUS)
613 return dynamic_cast<KSPlanetBase *
>((m_SolarSystem->findByName(
i18n(
"Uranus"))));
614 if (n == KSPlanetBase::NEPTUNE)
615 return dynamic_cast<KSPlanetBase *
>((m_SolarSystem->findByName(
i18n(
"Neptune"))));
621void SkyMapComposite::reloadCLines()
629 addComponent(m_CLines =
new ConstellationLines(
this, m_Cultures.get()));
634void SkyMapComposite::reloadCNames()
643 objectNames(SkyObject::CONSTELLATION).clear();
644 objectLists(SkyObject::CONSTELLATION).clear();
647 addComponent(m_CNames =
new ConstellationNamesComponent(
this, m_Cultures.get()));
650void SkyMapComposite::reloadConstellationArt()
656 delete m_ConstellationArt;
658 new ConstellationArtComponent(
this, m_Cultures.get()));
663void SkyMapComposite::reloadDeepSky()
674 double maxrad = 30.0;
675 SkyPoint center_point = current_map->getCenterPoint();
692 m_Catalogs->dropCache();
697bool SkyMapComposite::isLocalCNames()
699 return m_CNames->isLocalCNames();
704 emit progressText(message);
707 qApp->processEvents();
714 return m_CNames->objectList();
720 return m_Stars->objectList();
725 return m_SolarSystem->asteroids();
730 return m_SolarSystem->comets();
735 return m_Supernovae->objectList();
740 return solarSystemComposite()->planetObjects();
762 case SkyObject::STAR:
763 return &m_Stars->objectList();
764 case SkyObject::CATALOG_STAR:
766 case SkyObject::PLANET:
767 return &m_SolarSystem->planetObjects();
768 case SkyObject::COMET:
770 case SkyObject::ASTEROID:
772 case SkyObject::MOON:
773 return &m_SolarSystem->moons();
774 case SkyObject::GALAXY:
775 case SkyObject::PLANETARY_NEBULA:
776 case SkyObject::GASEOUS_NEBULA:
777 case SkyObject::GLOBULAR_CLUSTER:
778 case SkyObject::OPEN_CLUSTER:
780 case SkyObject::CONSTELLATION:
781 return &constellationNames();
782 case SkyObject::SUPERNOVA:
783 return &supernovae();
792 return m_SolarSystem->earth();
797 return m_Cultures->getNames();
800QString SkyMapComposite::getCultureName(
int index)
802 return m_Cultures->getName(index);
805void SkyMapComposite::setCurrentCulture(
QString culture)
807 m_Cultures->setCurrent(culture);
810QString SkyMapComposite::currentCulture()
812 return m_Cultures->current();
831ArtificialHorizonComponent *SkyMapComposite::artificialHorizon()
833 return m_ArtificialHorizon;
838 return m_ImageOverlay;
Represents objects loaded from an sqlite backed, trixel indexed catalog.
Database related error, thrown when database access fails or an action does not succeed.
QColor colorNamed(const QString &name) const
Retrieve a color by name.
Represents the ConstellationsArt objects.
Collection of lines making the 88 constellations.
Represents the constellation names on the sky map.
A list of all cultures FIXME: Why not use a QStringList?
Represents the ecliptic on the sky map.
Represents the equator on the sky map.
Collection of all the circles in the equatorial coordinate grid.
Represents a flag on the sky map.
Represents the HIPS progress survey overlay.
Represents the horizon on the sky map.
Collection of all the circles in the horizontal coordinate grid.
Represents the ImageOverlay overlay.
A subclass of KSPlanetBase that implements asteroids.
A subclass of KSPlanetBase that implements comets.
There are several time-dependent values used in position calculations, that are not specific to an ob...
long double julianDay() const
A subclass of TrailObject that provides additional information needed for most solar system objects.
A subclass of KSPlanetBase for seven of the major planets in the solar system (Earth and Pluto have t...
KStarsData is the backbone of KStars.
ColorScheme * colorScheme()
static KStars * Instance()
static bool Closing
Set to true when the application is being closed.
Single local meridian line.
Class that handles drawing of MilkyWay (both filled and non-filled)
Renders Mosaic Panel on Sky Map in either of two modes depending on scheduler.
Represents artificial satellites on the sky map.
void addComponent(SkyComponent *comp, int priority=1024)
Add a new sub component to the composite comp Pointer to the SkyComponent to be added priority A prio...
void removeComponent(SkyComponent *const comp)
Remove a sub component from the composite comp Pointer to the SkyComponent to be removed.
SkyComposite(SkyComposite *parent=nullptr)
Constructor parent pointer to the parent SkyComponent.
static void AddLabel(SkyObject *obj, label_t type)
static version of addLabel() below.
SkyObject * findByName(const QString &name, bool exact=true) override
Search the children of this SkyMapComposite for a SkyObject whose name matches the argument.
SkyObject * starNearest(SkyPoint *p, double &maxrad)
void updateSolarSystemBodies(KSNumbers *num) override
Delegate planet position updates to the SolarSystemComposite.
void update(KSNumbers *num=nullptr) override
Delegate update-position requests to all sub components.
SkyMapComposite(SkyComposite *parent=nullptr)
Constructor parent pointer to the parent SkyComponent.
QList< SkyObject * > findObjectsInArea(const SkyPoint &p1, const SkyPoint &p2)
void draw(SkyPainter *skyp) override
Delegate draw requests to all sub components psky Reference to the QPainter on which to paint.
void emitProgressText(const QString &message) override
Emit signal about progress.
void updateMoons(KSNumbers *num) override
Delegate moon position updates to the SolarSystemComposite.
SkyObject * objectNearest(SkyPoint *p, double &maxrad) override
static void setDrawLock(bool state)
Acquire / release a draw lock.
This is the canvas on which the sky is painted.
void setClickedPoint(const SkyPoint *f)
Set the ClickedPoint to the skypoint given as an argument.
void setClickedObject(SkyObject *o)
Set the ClickedObject pointer to the argument.
SkyObject * clickedObject() const
Retrieve the object nearest to a mouse click event.
void slotCenter()
Center the display at the point ClickedPoint.
static SkyMesh * Create(int level)
creates the single instance of SkyMesh.
Provides all necessary information about an object in the sky: its coordinates, name(s),...
TYPE
The type classification of the SkyObject.
Draws things on the sky, without regard to backend.
The sky coordinates of a point in the sky.
The solar system composite manages all planets, asteroids and comets.
static StarComponent * Create(SkyComposite *)
Create an instance of StarComponent.
This class encapsulates Supernovae.
Highlights objects present in certain lists by drawing "target" symbols around them.
Represents the terrain overlay.
QString i18n(const char *text, const TYPE &arg...)
ButtonCode warningContinueCancel(QWidget *parent, const QString &text, const QString &title=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
void detailedError(QWidget *parent, const QString &text, const QString &details, const QString &title, const KGuiItem &buttonOk, Options options=Notify)
QDateTime currentDateTime()
bool exists(const QString &fileName)
bool rename(const QString &newName)
void append(QList< T > &&value)
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QObject * parent() const const
QString arg(Args &&... args) const const