Kstars

skymapcomposite.h
1/*
2 SPDX-FileCopyrightText: 2005 Thomas Kabelmann <thomas.kabelmann@gmx.de>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "culturelist.h"
10#include "ksnumbers.h"
11#include "skycomposite.h"
12#include "skylabeler.h"
13#include "skymesh.h"
14#include "skyobject.h"
15#include "config-kstars.h"
16#include <QList>
17
18#include <memory>
19
20class QPolygonF;
21
22class ArtificialHorizonComponent;
24class ConstellationBoundaryLines;
30class Ecliptic;
31class Equator;
33class FlagComponent;
37class KSPlanet;
38class KSPlanetBase;
39class MilkyWay;
41class SkyMap;
42class SkyObject;
44class StarComponent;
47class HIPSComponent;
50class MosaicComponent;
51
52/**
53 * @class SkyMapComposite
54 *
55 * SkyMapComposite is the root object in the object hierarchy of the sky map.
56 * All requests to update, init, draw etc. will be done with this class.
57 * The requests will be delegated to it's children.
58 * The object hierarchy will created by adding new objects via addComponent().
59 *
60 * @author Thomas Kabelmann
61 * @version 0.1
62 */
63class SkyMapComposite : public QObject, public SkyComposite
64{
66
67 public:
68 /**
69 * Constructor
70 * @p parent pointer to the parent SkyComponent
71 */
72 explicit SkyMapComposite(SkyComposite *parent = nullptr);
73
74 virtual ~SkyMapComposite() override = default;
75
76 void update(KSNumbers *num = nullptr) override;
77
78 /**
79 * @short Delegate planet position updates to the SolarSystemComposite
80 *
81 * Planet positions change over time, so they need to be recomputed
82 * periodically, but not on every call to update(). This function
83 * will recompute the positions of all solar system bodies except the
84 * Earth's Moon, Jupiter's Moons AND Saturn Moons (because these objects' positions
85 * change on a much more rapid timescale).
86 * @p num Pointer to the KSNumbers object
87 * @sa update()
88 * @sa updateMoons()
89 * @sa SolarSystemComposite::updatePlanets()
90 */
91 void updateSolarSystemBodies(KSNumbers *num) override;
92
93 /**
94 * @short Delegate moon position updates to the SolarSystemComposite
95 *
96 * Planet positions change over time, so they need to be recomputed
97 * periodically, but not on every call to update(). This function
98 * will recompute the positions of the Earth's Moon and Jupiter's four
99 * Galilean moons. These objects are done separately from the other
100 * solar system bodies, because their positions change more rapidly,
101 * and so updateMoons() must be called more often than updatePlanets().
102 * @p num Pointer to the KSNumbers object
103 * @sa update()
104 * @sa updatePlanets()
105 * @sa SolarSystemComposite::updateMoons()
106 */
107 void updateMoons(KSNumbers *num) override;
108
109 /**
110 * @short Delegate draw requests to all sub components
111 * @p psky Reference to the QPainter on which to paint
112 */
113 void draw(SkyPainter *skyp) override;
114
115 /**
116 * @return the object nearest a given point in the sky.
117 * @param p The point to find an object near
118 * @param maxrad The maximum search radius, in Degrees
119 * @note the angular separation to the matched object is returned
120 * through the maxrad variable.
121 */
122 SkyObject *objectNearest(SkyPoint *p, double &maxrad) override;
123
124 /**
125 * @return the star nearest a given point in the sky.
126 * @param p The point to find a star near
127 * @param maxrad The maximum search radius, in Degrees
128 * @note the angular separation to the matched star is returned
129 * through the maxrad variable.
130 */
131 SkyObject *starNearest(SkyPoint *p, double &maxrad);
132
133 /**
134 * @short Search the children of this SkyMapComposite for
135 * a SkyObject whose name matches the argument.
136 *
137 * The objects' primary, secondary and long-form names will
138 * all be checked for a match.
139 * @note Overloaded from SkyComposite. In this version, we search
140 * the most likely object classes first to be more efficient.
141 * @p name the name to be matched
142 * @p exact If true, it will return an exact match (default), otherwise it can return
143 * a partial match.
144 * @return a pointer to the SkyObject whose name matches
145 * the argument, or a nullptr pointer if no match was found.
146 */
147 SkyObject *findByName(const QString &name, bool exact = true) override;
148
149 /**
150 * @return the list of objects in the region defined by skypoints
151 * @param p1 first sky point (top-left vertex of rectangular region)
152 * @param p2 second sky point (bottom-right vertex of rectangular region)
153 */
155
156 bool addNameLabel(SkyObject *o);
157 bool removeNameLabel(SkyObject *o);
158
159 void reloadDeepSky();
160 void reloadAsteroids();
161 void reloadComets();
162 void reloadCLines();
163 void reloadCNames();
164 void reloadConstellationArt();
165#ifndef KSTARS_LITE
166 FlagComponent *flags();
167#endif
168 SatellitesComponent *satellites();
169 SupernovaeComponent *supernovaeComponent();
170 ArtificialHorizonComponent *artificialHorizon();
171 ImageOverlayComponent *imageOverlay();
172
173 /** Getters for SkyComponents **/
175 {
176 return m_Horizon;
177 }
178
179 inline ConstellationBoundaryLines *constellationBoundary()
180 {
181 return m_CBoundLines;
182 }
183 inline ConstellationLines *constellationLines()
184 {
185 return m_CLines;
186 }
187
188 inline Ecliptic *ecliptic()
189 {
190 return m_Ecliptic;
191 }
192 inline Equator *equator()
193 {
194 return m_Equator;
195 }
196
197 inline EquatorialCoordinateGrid *equatorialCoordGrid()
198 {
199 return m_EquatorialCoordinateGrid;
200 }
201 inline HorizontalCoordinateGrid *horizontalCoordGrid()
202 {
203 return m_HorizontalCoordinateGrid;
204 }
205 inline LocalMeridianComponent *localMeridianComponent()
206 {
207 return m_LocalMeridianComponent;
208 }
209
210 inline ConstellationArtComponent *constellationArt()
211 {
212 return m_ConstellationArt;
213 }
214
215 inline SolarSystemComposite *solarSystemComposite()
216 {
217 return m_SolarSystem;
218 }
219
220 inline ConstellationNamesComponent *constellationNamesComponent()
221 {
222 return m_CNames;
223 }
224
225 inline CatalogsComponent *catalogsComponent()
226 {
227 return m_Catalogs;
228 }
229
230 inline MilkyWay *milkyWay()
231 {
232 return m_MilkyWay;
233 }
234
235#ifdef HAVE_INDI
237 {
238 return m_Mosaic;
239 }
240#endif
241
242 //Accessors for StarComponent
243 SkyObject *findStarByGenetiveName(const QString name);
244 void emitProgressText(const QString &message) override;
245 QList<SkyObject *> &labelObjects()
246 {
247 return m_LabeledObjects;
248 }
249
250 const QList<SkyObject *> &constellationNames() const;
251 const QList<SkyObject *> &stars() const;
252 const QList<SkyObject *> &asteroids() const;
253 const QList<SkyObject *> &comets() const;
254 const QList<SkyObject *> &supernovae() const;
255 QList<SkyObject *> planets();
256 // QList<SkyObject*> moons();
257
258 const QList<SkyObject *> *getSkyObjectsList(SkyObject::TYPE t);
259
260 KSPlanet *earth();
261 KSPlanetBase *planet(int n);
262 QStringList getCultureNames();
263 QString getCultureName(int index);
264 QString currentCulture();
265 void setCurrentCulture(QString culture);
266 bool isLocalCNames();
267
268 inline TargetListComponent *getStarHopRouteList()
269 {
270 return m_StarHopRouteList;
271 }
272 signals:
273 void progressText(const QString &message);
274
275 private:
276 QHash<int, QStringList> &getObjectNames() override;
277 QHash<int, QVector<QPair<QString, const SkyObject *>>> &getObjectLists() override;
278
279 std::unique_ptr<CultureList> m_Cultures;
280 ConstellationBoundaryLines *m_CBoundLines{ nullptr };
281 ConstellationNamesComponent *m_CNames{ nullptr };
282 ConstellationLines *m_CLines{ nullptr };
283 ConstellationArtComponent *m_ConstellationArt{ nullptr };
284 EquatorialCoordinateGrid *m_EquatorialCoordinateGrid{ nullptr };
285 HorizontalCoordinateGrid *m_HorizontalCoordinateGrid{ nullptr };
286 LocalMeridianComponent *m_LocalMeridianComponent{ nullptr };
287 CatalogsComponent *m_Catalogs{ nullptr };
288 Equator *m_Equator{ nullptr };
289 ArtificialHorizonComponent *m_ArtificialHorizon{ nullptr };
290 Ecliptic *m_Ecliptic{ nullptr };
291 HorizonComponent *m_Horizon{ nullptr };
292 MilkyWay *m_MilkyWay{ nullptr };
293 SolarSystemComposite *m_SolarSystem{ nullptr };
294 StarComponent *m_Stars{ nullptr };
295#ifndef KSTARS_LITE
296 FlagComponent *m_Flags { nullptr };
297 HIPSComponent *m_HiPS{ nullptr };
298 TerrainComponent *m_Terrain{ nullptr };
299 ImageOverlayComponent *m_ImageOverlay{ nullptr };
300#ifdef HAVE_INDI
301 MosaicComponent *m_Mosaic { nullptr };
302#endif
303#endif
304 TargetListComponent *m_ObservingList { nullptr };
305 TargetListComponent *m_StarHopRouteList{ nullptr };
306 SatellitesComponent *m_Satellites{ nullptr };
307 SupernovaeComponent *m_Supernovae{ nullptr };
308
309 SkyMesh *m_skyMesh;
310 std::unique_ptr<SkyLabeler> m_skyLabeler;
311
312 KSNumbers m_reindexNum;
313
314 QList<DeepStarComponent *> m_DeepStars;
315
316 QList<SkyObject *> m_LabeledObjects;
317 QHash<int, QStringList> m_ObjectNames;
319 QHash<QString, QString> m_ConstellationNames;
320};
Represents objects loaded from an sqlite backed, trixel indexed catalog.
Represents the ConstellationsArt objects.
Collection of lines making the 88 constellations.
Represents the constellation names on the sky map.
Information about a ConstellationsArt object.
Stores and manages unnamed stars, most of which are dynamically loaded into memory.
Represents the ecliptic on the sky map.
Definition ecliptic.h:20
Represents the equator on the sky map.
Definition equator.h:20
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.
There are several time-dependent values used in position calculations, that are not specific to an ob...
Definition ksnumbers.h:43
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...
Definition ksplanet.h:33
Single local meridian line.
Class that handles drawing of MilkyWay (both filled and non-filled)
Definition milkyway.h:25
Renders Mosaic Panel on Sky Map in either of two modes depending on scheduler.
Represents artificial satellites on the sky map.
SkyComposite is a kind of container class for SkyComponent objects.
SkyMapComposite is the root object in the object hierarchy of the sky map.
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)
HorizonComponent * horizon()
Getters for SkyComponents.
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
This is the canvas on which the sky is painted.
Definition skymap.h:54
Provides an interface to the Hierarchical Triangular Mesh (HTM) library written by A.
Definition skymesh.h:74
Provides all necessary information about an object in the sky: its coordinates, name(s),...
Definition skyobject.h:42
TYPE
The type classification of the SkyObject.
Definition skyobject.h:112
Draws things on the sky, without regard to backend.
Definition skypainter.h:40
The sky coordinates of a point in the sky.
Definition skypoint.h:45
The solar system composite manages all planets, asteroids and comets.
Represents the stars on the sky map.
This class encapsulates Supernovae.
Highlights objects present in certain lists by drawing "target" symbols around them.
Represents the terrain overlay.
Q_OBJECTQ_OBJECT
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:19:04 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.