• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Stellarium / stellarium / 13260145531

11 Feb 2025 09:41AM UTC coverage: 12.127% (+0.03%) from 12.101%
13260145531

Pull #3751

github

10110111
Restore deleted additional SC files
Pull Request #3751: Switch skycultures to the new format

14613 of 120497 relevant lines covered (12.13%)

18620.19 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

2.27
/src/core/StelCore.hpp
1
/*
2
 * Copyright (C) 2003 Fabien Chereau
3
 * Copyright (C) 2012 Matthew Gates
4
 * Copyright (C) 2015 Georg Zotti (Precession fixes)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.
19
 */
20

21
#ifndef STELCORE_HPP
22
#define STELCORE_HPP
23

24
#include "StelProjector.hpp"
25
#include "StelProjectorType.hpp"
26
#include "StelLocation.hpp"
27
#include "StelSkyDrawer.hpp"
28
#include "StelPropertyMgr.hpp"
29
#include "SolarSystem.hpp"
30
#include "Dithering.hpp"
31
#include <QString>
32
#include <QStringList>
33
#include <QTime>
34
#include <QPair>
35

36
class StelToneReproducer;
37
class StelSkyDrawer;
38
class StelGeodesicGrid;
39
class StelMovementMgr;
40
class StelObserver;
41

42
//! @class StelCore
43
//! Main class for Stellarium core processing.
44
//! This class provides services like management of sky projections,
45
//! tone conversion, or reference frame conversion. It is used by the
46
//! various StelModules to update and display themselves.
47
//! There is currently only one StelCore instance in Stellarium, but
48
//! in the future they may be more, allowing for example to display
49
//! several independent views of the sky at the same time.
50
//! @author Fabien Chereau, Matthew Gates, Georg Zotti
51
class StelCore : public QObject
52
{
53
        Q_OBJECT
54
        Q_PROPERTY(bool flipHorz READ getFlipHorz WRITE setFlipHorz NOTIFY flipHorzChanged)
55
        Q_PROPERTY(bool flipVert READ getFlipVert WRITE setFlipVert NOTIFY flipVertChanged)
56
        Q_PROPERTY(bool flagUseNutation READ getUseNutation WRITE setUseNutation NOTIFY flagUseNutationChanged)
57
        Q_PROPERTY(bool flagUseAberration READ getUseAberration WRITE setUseAberration NOTIFY flagUseAberrationChanged)
58
        Q_PROPERTY(double aberrationFactor READ getAberrationFactor WRITE setAberrationFactor NOTIFY aberrationFactorChanged)
59
        Q_PROPERTY(bool flagUseParallax READ getUseParallax WRITE setUseParallax NOTIFY flagUseParallaxChanged)
60
        Q_PROPERTY(double parallaxFactor READ getParallaxFactor WRITE setParallaxFactor NOTIFY parallaxFactorChanged)
61
        Q_PROPERTY(bool flagUseTopocentricCoordinates READ getUseTopocentricCoordinates WRITE setUseTopocentricCoordinates NOTIFY flagUseTopocentricCoordinatesChanged)
62
        Q_PROPERTY(ProjectionType currentProjectionType READ getCurrentProjectionType WRITE setCurrentProjectionType NOTIFY currentProjectionTypeChanged)
63
        //! This is just another way to access the projection type, by string instead of enum
64
        Q_PROPERTY(QString currentProjectionTypeKey READ getCurrentProjectionTypeKey WRITE setCurrentProjectionTypeKey NOTIFY currentProjectionTypeKeyChanged STORED false)
65
        //! Read-only property returning the localized projection name
66
        Q_PROPERTY(QString currentProjectionNameI18n READ getCurrentProjectionNameI18n NOTIFY currentProjectionNameI18nChanged STORED false)
67
        Q_PROPERTY(bool flagGravityLabels READ getFlagGravityLabels WRITE setFlagGravityLabels NOTIFY flagGravityLabelsChanged)
68
        Q_PROPERTY(QString currentTimeZone READ getCurrentTimeZone WRITE setCurrentTimeZone NOTIFY currentTimeZoneChanged)
69
        Q_PROPERTY(bool flagUseCTZ READ getUseCustomTimeZone WRITE setUseCustomTimeZone NOTIFY useCustomTimeZoneChanged)
70
        Q_PROPERTY(bool flagUseDST READ getUseDST WRITE setUseDST NOTIFY flagUseDSTChanged)
71
        Q_PROPERTY(bool startupTimeStop READ getStartupTimeStop WRITE setStartupTimeStop NOTIFY startupTimeStopChanged)
72
        Q_PROPERTY(DitheringMode ditheringMode READ getDitheringMode WRITE setDitheringMode NOTIFY ditheringModeChanged)
73

74
public:
75
        //! @enum FrameType
76
        //! Supported reference frame types
77
        enum FrameType
78
        {
79
                FrameUninitialized,                        //!< Reference frame is not set (FMajerech: Added to avoid condition on uninitialized value in StelSkyLayerMgr::draw())
80
                FrameAltAz,                                //!< Altazimuthal reference frame centered on observer: +x=south, +y=east, +z=zenith.
81
                FrameHeliocentricEclipticJ2000,                //!< Fixed-ecliptic reference frame centered on the Sun. This is J2000 ecliptical / almost VSOP87.
82
                FrameObservercentricEclipticJ2000,        //!< Fixed-ecliptic reference frame centered on the Observer. Was ObservercentricEcliptic, but renamed because it is Ecliptic of J2000!
83
                FrameObservercentricEclipticOfDate,        //!< Moving ecliptic reference frame centered on the Observer. Ecliptic of date, i.e. includes the precession of the ecliptic.
84
                FrameEquinoxEqu,                        //!< Equatorial reference frame at the current equinox centered on the observer.
85
                                                        //!< The north pole follows the precession of the planet on which the observer is located.
86
                                                        //!< On Earth, this may include nutation if so configured. Models ecliptical motion and precession (Vondrak 2011 model) and nutation.
87
                FrameJ2000,                                //!< Equatorial reference frame at the J2000 equinox centered on the observer. This is also the ICRS reference frame.
88
                FrameFixedEquatorial,                        //!< Fixed equatorial frame (hour angle/declination). Note that hour angle is counted backwards here and must be treated specially for user I/O.
89
                FrameGalactic,                                //!< Galactic reference frame centered on observer.
90
                FrameSupergalactic                        //!< Supergalactic reference frame centered on observer.
91
        };
92
        Q_ENUM(FrameType)
×
93

94
        //! @enum ProjectionType
95
        //! Available projection types. A value of 1000 indicates the default projection
96
        enum ProjectionType
97
        {
98
                ProjectionPerspective,                //!< Perspective projection
99
                ProjectionStereographic,        //!< Stereographic projection
100
                ProjectionFisheye,                //!< Fisheye projection
101
                ProjectionOrthographic,                //!< Orthographic projection
102
                ProjectionEqualArea,                //!< Equal Area projection
103
                ProjectionHammer,                //!< Hammer-Aitoff projection
104
                ProjectionSinusoidal,                //!< Sinusoidal projection
105
                ProjectionMercator,                //!< Mercator projection
106
                ProjectionMiller,                //!< Miller cylindrical projection
107
                ProjectionCylinder,                //!< Cylinder projection
108
                ProjectionCylinderFill                //!< Cylinder projection, no zoom or movement allowed
109
        };
110
        Q_ENUM(ProjectionType)
×
111

112
        //! @enum RefractionMode
113
        //! Available refraction mode.
114
        enum RefractionMode
115
        {
116
                RefractionAuto,                //!< Automatically decide to add refraction if atmosphere is activated
117
                RefractionOn,                //!< Always add refraction (i.e. apparent coordinates)
118
                RefractionOff                //!< Never add refraction (i.e. geometric coordinates)
119
        };
120
        Q_ENUM(RefractionMode)
121

122
        //! @enum DeltaTAlgorithm
123
        //! Available DeltaT algorithms
124
        enum DeltaTAlgorithm
125
        {
126
                WithoutCorrection,               //!< Without correction, DeltaT is Zero. Like Stellarium versions before 0.12.
127
                Schoch,                          //!< Schoch (1931) algorithm for DeltaT
128
                Clemence,                        //!< Clemence (1948) algorithm for DeltaT
129
                IAU,                             //!< IAU (1952) algorithm for DeltaT (based on observations by Spencer Jones (1939))
130
                AstronomicalEphemeris,           //!< Astronomical Ephemeris (1960) algorithm for DeltaT
131
                TuckermanGoldstine,              //!< Tuckerman (1962, 1964) & Goldstine (1973) algorithm for DeltaT
132
                MullerStephenson,                //!< Muller & Stephenson (1975) algorithm for DeltaT
133
                Stephenson1978,                  //!< Stephenson (1978) algorithm for DeltaT
134
                SchmadelZech1979,                //!< Schmadel & Zech (1979) algorithm for DeltaT
135
                MorrisonStephenson1982,          //!< Morrison & Stephenson (1982) algorithm for DeltaT (used by RedShift)
136
                StephensonMorrison1984,          //!< Stephenson & Morrison (1984) algorithm for DeltaT
137
                StephensonHoulden,               //!< Stephenson & Houlden (1986) algorithm for DeltaT
138
                Espenak,                         //!< Espenak (1987, 1989) algorithm for DeltaT
139
                Borkowski,                       //!< Borkowski (1988) algorithm for DeltaT
140
                SchmadelZech1988,                //!< Schmadel & Zech (1988) algorithm for DeltaT
141
                ChaprontTouze,                   //!< Chapront-Touzé & Chapront (1991) algorithm for DeltaT
142
                StephensonMorrison1995,          //!< Stephenson & Morrison (1995) algorithm for DeltaT
143
                Stephenson1997,                  //!< Stephenson (1997) algorithm for DeltaT
144
                ChaprontMeeus,                   //!< Chapront, Chapront-Touze & Francou (1997) & Meeus (1998) algorithm for DeltaT
145
                JPLHorizons,                     //!< JPL Horizons algorithm for DeltaT
146
                MeeusSimons,                     //!< Meeus & Simons (2000) algorithm for DeltaT
147
                MontenbruckPfleger,              //!< Montenbruck & Pfleger (2000) algorithm for DeltaT
148
                ReingoldDershowitz,              //!< Reingold & Dershowitz (2002, 2007) algorithm for DeltaT
149
                MorrisonStephenson2004,          //!< Morrison & Stephenson (2004, 2005) algorithm for DeltaT
150
                Reijs,                           //!< Reijs (2006) algorithm for DeltaT
151
                EspenakMeeus,                    //!< Espenak & Meeus (2006) algorithm for DeltaT
152
                EspenakMeeusModified,            //!< Espenak & Meeus (2006) algorithm with modified formulae for DeltaT (Recommended, default)
153
                EspenakMeeusZeroMoonAccel,       //!< Espenak & Meeus (2006) algorithm for DeltaT (but without additional Lunar acceleration. FOR TESTING ONLY, NONPUBLIC)
154
                Banjevic,                        //!< Banjevic (2006) algorithm for DeltaT
155
                IslamSadiqQureshi,               //!< Islam, Sadiq & Qureshi (2008 + revisited 2013) algorithm for DeltaT (6 polynomials)
156
                KhalidSultanaZaidi,              //!< M. Khalid, Mariam Sultana and Faheem Zaidi polynomial approximation of time period 1620-2013 (2014)
157
                StephensonMorrisonHohenkerk2016, //!< Stephenson, Morrison, Hohenkerk (2016) RSPA paper provides spline fit to observations for -720..2019 and else parabolic fit.
158
                Henriksson2017,                  //!< Henriksson (2017) algorithm for DeltaT (The solution for Schoch formula for DeltaT (1931), but with ndot=-30.128"/cy^2)
159
                Custom                           //!< User defined coefficients for quadratic equation for DeltaT
160
        };
161
        Q_ENUM(DeltaTAlgorithm)
×
162

163
        StelCore();
164
        ~StelCore() override;
165

166
        //! Init and load all main core components.
167
        void init();
168

169
        //! Update all the objects with respect to the time.
170
        //! @param deltaTime the time increment in sec.
171
        void update(double deltaTime);
172

173
        //! Handle the resizing of the window
174
        void windowHasBeenResized(qreal x, qreal y, qreal width, qreal height);
175

176
        //! Update core state before drawing modules.
177
        void preDraw();
178

179
        //! Update core state after drawing modules.
180
        void postDraw();
181

182
        //! Get a new instance of a simple 2d projection. This projection cannot be used to project or unproject but
183
        //! only for 2d painting
184
        StelProjectorP getProjection2d() const;
185

186
        //! Get a new instance of projector using a modelview transformation corresponding to the given frame.
187
        //! If not specified the refraction effect is included if atmosphere is on.
188
        StelProjectorP getProjection(FrameType frameType, RefractionMode refractionMode=RefractionAuto) const;
189

190
        //! Get a new instance of projector using the given modelview transformation.
191
        //! If not specified the projection used is the one currently used as default.
192
        StelProjectorP getProjection(StelProjector::ModelViewTranformP modelViewTransform, ProjectionType projType=static_cast<ProjectionType>(1000)) const;
193

194
        //! Get the current tone reproducer used in the core.
195
        StelToneReproducer* getToneReproducer(){return toneReproducer;}
×
196
        //! Get the current tone reproducer used in the core.
197
        const StelToneReproducer* getToneReproducer() const{return toneReproducer;}
198

199
        //! Get the current StelSkyDrawer used in the core.
200
        StelSkyDrawer* getSkyDrawer(){return skyDrawer;}
×
201
        //! Get the current StelSkyDrawer used in the core.
202
        const StelSkyDrawer* getSkyDrawer() const{return skyDrawer;}
×
203

204
        //! Get an instance of StelGeodesicGrid which is guaranteed to allow for at least maxLevel levels
205
        const StelGeodesicGrid* getGeodesicGrid(int maxLevel) const;
206

207
        //! Get the instance of movement manager.
208
        StelMovementMgr* getMovementMgr(){return movementMgr;}
×
209
        //! Get the const instance of movement manager.
210
        const StelMovementMgr* getMovementMgr() const{return movementMgr;}
×
211

212
        //! Set the near and far clipping planes.
213
        void setClippingPlanes(double znear, double zfar){
×
214
                currentProjectorParams.zNear=znear;currentProjectorParams.zFar=zfar;
×
215
        }
×
216
        //! Get the near and far clipping planes.
217
        void getClippingPlanes(double* zn, double* zf) const{
×
218
                *zn = currentProjectorParams.zNear;
×
219
                *zf = currentProjectorParams.zFar;
×
220
        }
×
221

222
        //! Get the translated projection name from its TypeKey for the current locale.
223
        QString projectionTypeKeyToNameI18n(const QString& key) const;
224

225
        //! Get the projection TypeKey from its translated name for the current locale.
226
        QString projectionNameI18nToTypeKey(const QString& nameI18n) const;
227

228
        //! Get the current set of parameters.
229
        StelProjector::StelProjectorParams getCurrentStelProjectorParams() const;
230
        //! Set the set of parameters to use when creating a new StelProjector.
231
        void setCurrentStelProjectorParams(const StelProjector::StelProjectorParams& newParams);
232

233
        //! Set vision direction
234
        void lookAtJ2000(const Vec3d& pos, const Vec3d& up);
235
        // Unused as of 24.1
236
        //void setMatAltAzModelView(const Mat4d& mat);
237

238
        Vec3d altAzToEquinoxEqu(const Vec3d& v, RefractionMode refMode=RefractionAuto) const;
239
        Vec3d equinoxEquToAltAz(const Vec3d& v, RefractionMode refMode=RefractionAuto) const;
240
        Vec3d altAzToJ2000(const Vec3d& v, RefractionMode refMode=RefractionAuto) const;
241
        Vec3d j2000ToAltAz(const Vec3d& v, RefractionMode refMode=RefractionAuto) const;
242
        void j2000ToAltAzInPlaceNoRefraction(Vec3f* v) const {v->transfo4d(matJ2000ToAltAz);}
×
243
        void j2000ToAltAzInPlaceNoRefraction(Vec3d* v) const {v->transfo4d(matJ2000ToAltAz);}
×
244
        Vec3d galacticToJ2000(const Vec3d& v) const;
245
        Vec3d supergalacticToJ2000(const Vec3d& v) const;
246
        //! Transform position vector v from equatorial coordinates of date (which may also include atmospheric refraction) to those of J2000.
247
        //! Use refMode=StelCore::RefractionOff if you don't want any atmosphere correction.
248
        //! Use refMode=StelCore::RefractionOn to create observed (apparent) coordinates (which are subject to refraction).
249
        //! Use refMode=StelCore::RefractionAuto to correct coordinates for refraction only when atmosphere is active.
250
        Vec3d equinoxEquToJ2000(const Vec3d& v, RefractionMode refMode=RefractionAuto) const;
251
        //! Use fixed matrix to allow fast transformation of positions related to the IAU constellation borders.
252
        Vec3d j2000ToJ1875(const Vec3d& v) const;
253
        //! Use fixed matrix to allow fast transformation of positions related to the IAU constellation borders.
254
        Vec3d j1875ToJ2000(const Vec3d& v) const;
255
        //! Transform position vector v from equatorial coordinates J2000 to those of date (optionally corrected by refraction).
256
        //! Use refMode=StelCore::RefractionOff if you don't want any atmosphere correction.
257
        //! Use refMode=StelCore::RefractionOn to correct observed (apparent) coordinates (which are subject to refraction).
258
        //! Use refMode=StelCore::RefractionAuto to correct coordinates for refraction only when atmosphere is active.
259
        Vec3d j2000ToEquinoxEqu(const Vec3d& v, RefractionMode refMode=RefractionAuto) const;
260
        Vec3d j2000ToGalactic(const Vec3d& v) const;
261
        Vec3d j2000ToSupergalactic(const Vec3d& v) const;
262

263
        //! Transform vector from heliocentric ecliptic coordinate to altazimuthal
264
        Vec3d heliocentricEclipticToAltAz(const Vec3d& v, RefractionMode refMode=RefractionAuto) const;
265

266
        //! Transform from heliocentric coordinate to equatorial at current equinox (for the planet where the observer stands)
267
        Vec3d heliocentricEclipticToEquinoxEqu(const Vec3d& v) const;
268
//        //! Transform vector from heliocentric coordinate to false equatorial : equatorial
269
//        //! coordinate but centered on the observer position (useful for objects close to earth)
270
//        //! Unused as of V0.13
271
//        Vec3d heliocentricEclipticToEarthPosEquinoxEqu(const Vec3d& v) const;
272

273
        //! Get the modelview matrix for heliocentric ecliptic (Vsop87) drawing.
274
        StelProjector::ModelViewTranformP getHeliocentricEclipticModelViewTransform(RefractionMode refMode=RefractionAuto) const;
275

276
        //! Get the modelview matrix for observer-centric ecliptic (Vsop87) drawing.
277
        StelProjector::ModelViewTranformP getObservercentricEclipticJ2000ModelViewTransform(RefractionMode refMode=RefractionAuto) const;
278

279
        //! Get the modelview matrix for observer-centric ecliptic of Date drawing.
280
        StelProjector::ModelViewTranformP getObservercentricEclipticOfDateModelViewTransform(RefractionMode refMode=RefractionAuto) const;
281

282
        //! Get the modelview matrix for observer-centric equatorial at equinox drawing.
283
        StelProjector::ModelViewTranformP getEquinoxEquModelViewTransform(RefractionMode refMode=RefractionAuto) const;
284

285
        //! Get the modelview matrix for observer-centric fixed equatorial drawing.
286
        StelProjector::ModelViewTranformP getFixedEquatorialModelViewTransform(RefractionMode refMode) const;
287

288
        //! Get the modelview matrix for observer-centric altazimuthal drawing.
289
        StelProjector::ModelViewTranformP getAltAzModelViewTransform(RefractionMode refMode=RefractionAuto) const;
290

291
        //! Get the modelview matrix for observer-centric J2000 equatorial drawing.
292
        StelProjector::ModelViewTranformP getJ2000ModelViewTransform(RefractionMode refMode=RefractionAuto) const;
293

294
        //! Get the modelview matrix for observer-centric Galactic equatorial drawing.
295
        StelProjector::ModelViewTranformP getGalacticModelViewTransform(RefractionMode refMode=RefractionAuto) const;
296

297
        //! Get the modelview matrix for observer-centric Supergalactic equatorial drawing.
298
        StelProjector::ModelViewTranformP getSupergalacticModelViewTransform(RefractionMode refMode=RefractionAuto) const;
299

300
        //! Rotation matrix from equatorial J2000 to ecliptic (VSOP87A).
301
        static const Mat4d matJ2000ToVsop87;
302
        //! Rotation matrix from ecliptic (VSOP87A) to equatorial J2000.
303
        static const Mat4d matVsop87ToJ2000;
304
        //! Rotation matrix from J2000 to Galactic reference frame, using FITS convention.
305
        static const Mat4d matJ2000ToGalactic;
306
        //! Rotation matrix from Galactic to J2000 reference frame, using FITS convention.
307
        static const Mat4d matGalacticToJ2000;
308
        //! Rotation matrix from J2000 to Supergalactic reference frame.
309
        static const Mat4d matJ2000ToSupergalactic;
310
        //! Rotation matrix from Supergalactic to J2000 reference frame.
311
        static const Mat4d matSupergalacticToJ2000;
312

313
        //! Return the observer heliocentric ecliptic position (GZ: presumably J2000)
314
        Vec3d getObserverHeliocentricEclipticPos() const;
315
        //! Return the observer heliocentric ecliptic velocity. This includes orbital and diurnal motion;
316
        // diurnal motion is omitted if planetocentric coordinates are in use.
317
        Vec3d getObserverHeliocentricEclipticVelocity() const;
318

319
        //! Get the information on the current location
320
        const StelLocation& getCurrentLocation() const;
321
        //! Get the UTC offset on the current location (in hours)
322
        //! N.B. This is a rather costly operation. Re-use where possible!
323
        double getUTCOffset(const double JD) const;
324

325
        QString getCurrentTimeZone() const;
326
        void setCurrentTimeZone(const QString& tz);
327

328
        const QSharedPointer<class Planet> getCurrentPlanet() const;
329

330
        //! Unfortunately we also need this.
331
        //! Returns the current observer.
332
        //! Note that the observer object may be deleted at any time when control returns to StelCore.
333
        const StelObserver* getCurrentObserver() const;
334

335
        //! Replaces the current observer. StelCore assumes ownership of the observer.
336
        void setObserver(StelObserver* obs);
337

338
        SphericalCap getVisibleSkyArea() const;
339

340
        // Conversion in standard Julian time format
341
        static const double JD_SECOND;
342
        static const double JD_MINUTE;
343
        static const double JD_HOUR;
344
        static const double JD_DAY;
345
        static const double ONE_OVER_JD_SECOND;
346
        static const double TZ_ERA_BEGINNING;
347

348
        //! Get the sidereal time shifted by the observer longitude
349
        //! @return the local sidereal time in radian
350
        double getLocalSiderealTime() const;
351

352
        //! Get the duration of a sidereal day for the current observer in day.
353
        double getLocalSiderealDayLength() const;
354

355
        //! Get the duration of a sidereal year for the current observer in days.
356
        double getLocalSiderealYearLength() const;
357

358
        //! Return the startup mode, can be "actual" (i.e. take current time from system),
359
        //! "today" (take some time e.g. on the evening of today) or "preset" (completely preconfigured).
360
        QString getStartupTimeMode() const;
361
        void setStartupTimeMode(const QString& s);
362

363
        //! Get info about valid range for current algorithm for calculation of Delta-T
364
        //! @param JD the Julian Day number to test.
365
        //! @param marker receives a string: "*" if jDay is outside valid range, or "?" if range unknown, else an empty string.
366
        //! @return valid range as explanatory string.
367
        QString getCurrentDeltaTAlgorithmValidRangeDescription(const double JD, QString* marker) const;
368

369
        //! Checks for altitude of the Sun - is it night or day?
370
        //! @return true if sun higher than about -6 degrees, i.e. "day" includes civil twilight.
371
        //! @note Useful mostly for brightness-controlled GUI decisions like font colors.
372
        bool isBrightDaylight() const;
373

374
        //! Get value of the current Julian epoch (i.e. current year with decimal fraction, e.g. 2012.34567)
375
        double getCurrentEpoch() const;
376

377
        //! Get the default Mapping used by the Projection
378
        QString getDefaultProjectionTypeKey(void) const;
379

380
        Vec3d getMouseJ2000Pos(void) const;
381

382
        //! get vector used to compute parallax effect
383
        Vec3d getParallaxDiff(double JD) const;
384
        //! get vector used to compute aberration effect
385
        Vec3d getAberrationVec(double JD) const;
386

387
public slots:
388
        //! Smoothly move the observer to the given location
389
        //! @param target the target location
390
        //! @param duration direction of view move duration in s
391
        //! @param durationIfPlanetChange direction of view + planet travel move duration in s.
392
        //! This is used only if the destination planet is different from the starting one.
393
        void moveObserverTo(const StelLocation& target, double duration=1., double durationIfPlanetChange=1., const QString& landscapeID=QString());
394

395
        //! Set the current ProjectionType to use
396
        void setCurrentProjectionType(StelCore::ProjectionType type);
397
        StelCore::ProjectionType getCurrentProjectionType() const;
398

399
        //! Get the current Mapping used by the Projection
400
        QString getCurrentProjectionTypeKey(void) const;
401
        //! Set the current ProjectionType to use from its key
402
        void setCurrentProjectionTypeKey(QString type);
403

404
        QString getCurrentProjectionNameI18n() const;
405

406
        //! Get the list of all the available projections
407
        QStringList getAllProjectionTypeKeys() const;
408

409
        //! Set the current algorithm and nDot used therein for time correction (DeltaT)
410
        void setCurrentDeltaTAlgorithm(StelCore::DeltaTAlgorithm algorithm);
411
        //! Get the current algorithm for time correction (DeltaT)
412
        StelCore::DeltaTAlgorithm getCurrentDeltaTAlgorithm() const { return currentDeltaTAlgorithm; }
×
413
        //! Get description of the current algorithm for time correction
414
        QString getCurrentDeltaTAlgorithmDescription(void) const;
415
        //! Get the current algorithm used by the DeltaT
416
        QString getCurrentDeltaTAlgorithmKey(void) const;
417
        //! Set the current algorithm to use from its key
418
        void setCurrentDeltaTAlgorithmKey(QString type);
419

420
        //! Set the mask type.
421
        void setMaskType(StelProjector::StelProjectorMaskType m);
422

423
        //! Set the flag with decides whether to arrange labels so that
424
        //! they are aligned with the bottom of a 2d screen, or a 3d dome.
425
        void setFlagGravityLabels(bool gravity);
426
        //! return whether dome-aligned labels are in use
427
        bool getFlagGravityLabels() const;
428
        //! Set the offset rotation angle in degree to apply to gravity text (only if gravityLabels is set to false).
429
        void setDefaultAngleForGravityText(float a);
430
        //! Set the horizontal flip status.
431
        //! @param flip The new value (true = flipped, false = unflipped).
432
        void setFlipHorz(bool flip);
433
        //! Set the vertical flip status.
434
        //! @param flip The new value (true = flipped, false = unflipped).
435
        void setFlipVert(bool flip);
436
        //! Get the state of the horizontal flip.
437
        //! @return True if flipped horizontally, else false.
438
        bool getFlipHorz(void) const;
439
        //! Get the state of the vertical flip.
440
        //! @return True if flipped vertically, else false.
441
        bool getFlipVert(void) const;
442

443
        // Vertical offset should even be available for animation, so at last with property mechanism.
444
        //! Get current value for horizontal viewport offset [-50...50]
445
        //! An offset of 50 percent means projective image center is on the right screen border
446
        double getViewportHorizontalOffset(void) const;
447
        //! Set horizontal viewport offset. Argument will be clamped to be inside [-50...50]
448
        //! An offset of 50 percent means projective image center is on the right screen border
449
        //! Animation is available via StelMovementMgr::moveViewport()
450
        void setViewportHorizontalOffset(double newOffsetPct);
451
        //! Get current value for vertical viewport offset [-50...50]
452
        //! An offset of 50 percent means projective image center is on the upper screen border
453
        double getViewportVerticalOffset(void) const;
454
        //! Set vertical viewport offset. Argument will be clamped to be inside [-50...50]
455
        //! An offset of 50 percent means projective image center is on the upper screen border
456
        //! Setting to a negative value will move the visible horizon down, this may be desired esp. in cylindrical projection.
457
        //! Animation is available via StelMovementMgr::moveViewport()
458
        void setViewportVerticalOffset(double newOffsetPct);
459
        // Set both viewport offsets. Arguments will be clamped to be inside [-50...50].
460
        void setViewportOffset(double newHorizontalOffsetPct, double newVerticalOffsetPct);
461

462
        //! Can be used in specialized setups, intended e.g. for multi-projector installations with edge blending.
463
        //! @param stretch [default 1] enlarge to stretch image to non-square pixels. A minimum value of 0.001 is enforced.
464
        //! @note This only influences the projected content. Things like ScreenImages keep square pixels.
465
        void setViewportStretch(float stretch);
466

467
        //! Get the location used by default at startup
468
        QString getDefaultLocationID() const;
469
        //! Set the location to use by default at startup
470
        void setDefaultLocationID(const QString& id);
471
        //! Return to the default location.
472
        void returnToDefaultLocation();
473
        //! Return to the default location and set default landscape with atmosphere and fog effects
474
        void returnToHome();
475

476
        //! Returns the JD of the last time resetSync() was called
477
        double getJDOfLastJDUpdate() const;
478
        //! Sets the system date which corresponds to the jdOfLastJDUpdate.
479
        //! Usually, you do NOT want to call this method.
480
        //! This method is used by the RemoteSync plugin.
481
        void setMilliSecondsOfLastJDUpdate(qint64 millis);
482
        //! Returns the system date of the last time resetSync() was called
483
        qint64 getMilliSecondsOfLastJDUpdate() const;
484

485
        //! Set the current date in Julian Day (UT)
486
        void setJD(double newJD);
487
        //! Set the current date in Julian Day (TT).
488
        //! The name is derived from the classical name "Ephemeris Time", of which TT is the successor.
489
        //! It is still frequently used in the literature.
490
        void setJDE(double newJDE);
491
        //! Get the current date in Julian Day (UT).
492
        double getJD() const;
493
        //! Get the current date in Julian Day (TT).
494
        //! The name is derived from the classical name "Ephemeris Time", of which TT is the successor.
495
        //! It is still frequently used in the literature.
496
        double getJDE() const;
497

498
        //! Get solution of equation of time [minutes].
499
        //! Source: J. Meeus "Astronomical Algorithms" (2nd ed., 1998) 28.3.
500
        //! @param JDE JD in Dynamical Time (previously called Ephemeris Time)
501
        //! @return time in minutes
502
        double getSolutionEquationOfTime(const double JDE) const;
503
        //! Get solution of equation of time [minutes] for the current time.
504
        //! Source: J. Meeus "Astronomical Algorithms" (2nd ed., with corrections as of August 10, 2009) p.183-187.
505
        //! @return time in minutes
506
        double getSolutionEquationOfTime() const;
507

508
        bool getUseDST() const;
509
        void setUseDST(const bool b);
510

511
        bool getStartupTimeStop() const;
512
        void setStartupTimeStop(const bool b);
513

514
        DitheringMode getDitheringMode() const { return ditheringMode; }
×
515
        void setDitheringMode(DitheringMode mode);
516
        void setDitheringMode(const QString& modeName);
517

518
        bool getUseCustomTimeZone(void) const;
519
        void setUseCustomTimeZone(const bool b);
520

521
        //! Set the current date in Modified Julian Day (UT).
522
        //! MJD is simply JD-2400000.5, getting rid of large numbers and starting days at midnight.
523
        //! It is mostly used in satellite contexts.
524
        void setMJDay(double MJD);
525
        //! Get the current date in Modified Julian Day (UT)
526
        double getMJDay() const;
527

528
        //! Compute DeltaT estimation for a given date [seconds].
529
        //! DeltaT is the accumulated effect of earth's rotation slowly getting slower, mostly caused by tidal braking by the Moon.
530
        //! For accurate positioning of objects in the sky, we must compute earth-based clock-dependent things like earth rotation, hour angles etc.
531
        //! using plain UT, but all orbital motions or rotation of the other planets must be computed in TT, which is a regular time frame.
532
        //! Also satellites are computed in the UT frame because (1) they are short-lived and (2) must follow paths over earth ground.
533
        //! (Note that we make no further difference between TT and DT, those might differ by milliseconds at best but are regarded equivalent for our purpose.)
534
        //! @param JD the date and time expressed as a Julian Day
535
        //! @return DeltaT in seconds
536
        //! @note Thanks to Rob van Gent who created a collection from many formulas for calculation of DeltaT: http://www.staff.science.uu.nl/~gent0113/deltat/deltat.htm
537
        //! @note Use this only if needed, prefer calling getDeltaT() for access to the current value.
538
        //! @note Up to V0.15.1, if the requested year was outside validity range, we returned zero or some useless value.
539
        //!       Starting with V0.15.2 the value from the edge of the defined range is returned instead if not explicitly zero is given in the source.
540
        //!       Limits can be queried with getCurrentDeltaTAlgorithmValidRangeDescription()
541

542
        double computeDeltaT(const double JD);
543
        //! Get current DeltaT in seconds.
544
        double getDeltaT() const;
545

546
        //! @return whether nutation is currently used.
547
        bool getUseNutation() const {return flagUseNutation;}
×
548
        //! Set whether you want computation and simulation of nutation (a slight wobble of Earth's axis, just a few arcseconds).
549
        void setUseNutation(bool use) { if (flagUseNutation != use) { flagUseNutation=use; StelApp::immediateSave("astro/flag_nutation", use); emit flagUseNutationChanged(use); }}
×
550

551
        //! @return whether aberration is currently used.
552
        bool getUseAberration() const {return flagUseAberration;}
×
553
        //! Set whether you want computation and simulation of aberration (a slight wobble of stellar positions due to finite speed of light, about 20 arcseconds when observing from earth).
554
        void setUseAberration(bool use) { if (flagUseAberration != use) { flagUseAberration=use; StelApp::immediateSave("astro/flag_aberration", use); emit flagUseAberrationChanged(use); }}
×
555

556
        //! @return aberration factor. 1 is realistic simulation, but higher values may be useful for didactic purposes.
557
        double getAberrationFactor() const {return aberrationFactor;}
×
558
        //! Set aberration factor. Values are clamped to 0...5. (Values above 5 cause graphical problems.)
559
        void setAberrationFactor(double factor) { if (!fuzzyEquals(aberrationFactor, factor)) { aberrationFactor=qBound(0.,factor, 5.); StelApp::immediateSave("astro/aberration_factor", aberrationFactor); emit aberrationFactorChanged(factor); }}
×
560

561
        QByteArray getAberrationShader() const;
562
        void setAberrationUniforms(QOpenGLShaderProgram& program) const;
563

564
        //! @return whether parallax effect is currently used.
565
        bool getUseParallax() const {return flagUseParallax;}
×
566
        //! Set whether you want computation and simulation of parallax effect.
567
        void setUseParallax(bool use) { if (flagUseParallax != use) { flagUseParallax=use; StelApp::immediateSave("astro/flag_parallax", use); emit flagUseParallaxChanged(use); }}
×
568

569
        //! @return parallax factor. 1 is realistic simulation, but higher values may be useful for didactic purposes.
570
        double getParallaxFactor() const {return parallaxFactor;}
×
571
        //! Set aberration factor. Values are clamped to 0...5. (Values above 5 cause graphical problems.)
572
        void setParallaxFactor(double factor) { if (!fuzzyEquals(parallaxFactor, factor)) { parallaxFactor=qBound(0.,factor, 10000.); StelApp::immediateSave("astro/parallax_factor", parallaxFactor); emit parallaxFactorChanged(factor); }}
×
573

574
        //! @return whether topocentric coordinates are currently used.
575
        bool getUseTopocentricCoordinates() const {return flagUseTopocentricCoordinates;}
×
576
        //! Set whether you want topocentric or planetocentric data
577
        void setUseTopocentricCoordinates(bool use) { if (flagUseTopocentricCoordinates!= use) { flagUseTopocentricCoordinates=use; StelApp::immediateSave("astro/flag_topocentric_coordinates", use); emit flagUseTopocentricCoordinatesChanged(use); }}
×
578

579
        //! Return the preset sky time in JD
580
        double getPresetSkyTime() const;
581
        //! Set the preset sky time from a JD
582
        void setPresetSkyTime(double d);
583

584
        //! Set time speed in JDay/sec
585
        void setTimeRate(double ts);
586
        //! Get time speed in JDay/sec
587
        double getTimeRate() const;
588

589
        void revertTimeDirection(void);
590

591
        //! Increase the time speed
592
        void increaseTimeSpeed();
593
        //! Decrease the time speed
594
        void decreaseTimeSpeed();
595
        //! Increase the time speed, but not as much as with increaseTimeSpeed()
596
        void increaseTimeSpeedLess();
597
        //! Decrease the time speed but not as much as with decreaseTimeSpeed()
598
        void decreaseTimeSpeedLess();
599

600
        //! Set time speed to 0, i.e. freeze the passage of simulation time
601
        void setZeroTimeSpeed();
602
        //! Set real time speed, i.e. 1 sec/sec
603
        void setRealTimeSpeed();
604
        //! Set real time speed or pause simulation if we are already in realtime speed.
605
        void toggleRealTimeSpeed();
606
        //! Get whether it is real time speed, i.e. 1 sec/sec
607
        bool getRealTimeSpeed() const;
608

609
        //! Set stellarium time to current real world time
610
        void setTimeNow();
611
        //! Set the time to some value, leaving the day the same.
612
        void setTodayTime(const QTime& target);
613
        //! Get whether the current stellarium time is the real world time
614
        bool getIsTimeNow() const;
615

616
        //! get the initial "today time" from the config file
617
        QTime getInitTodayTime(void) const;
618
        //! set the initial "today time" from the config file
619
        void setInitTodayTime(const QTime& time);
620
        //! Set the preset sky time from a QDateTime
621
        void setPresetSkyTime(QDateTime dateTime);
622

623
        //! Add one [Earth, solar] minute to the current simulation time.
624
        void addMinute();
625
        //! Add one [Earth, solar] hour to the current simulation time.
626
        void addHour();
627
        //! Add one [Earth, solar] day to the current simulation time.
628
        void addDay();
629
        //! Add one [Earth, solar] week to the current simulation time.
630
        void addWeek();
631

632
        //! Add one sidereal day to the simulation time. The length of time depends
633
        //! on the current planetary body on which the observer is located.
634
        void addSiderealDay();
635
        //! Add seven sidereal days to the simulation time. The length of time depends
636
        //! on the current planetary body on which the observer is located.
637
        void addSiderealWeek();
638
        //! Add one sidereal year to the simulation time. The length of time depends
639
        //! on the current planetary body on which the observer is located. Sidereal year
640
        //! connected to orbital period of planets.
641
        void addSiderealYear();
642
        //! Add n sidereal years to the simulation time. The length of time depends
643
        //! on the current planetary body on which the observer is located. Sidereal year
644
        //! connected to orbital period of planets.
645
        void addSiderealYears(double n=100.);
646

647
        //! Subtract one [Earth, solar] minute to the current simulation time.
648
        void subtractMinute();
649
        //! Subtract one [Earth, solar] hour to the current simulation time.
650
        void subtractHour();
651
        //! Subtract one [Earth, solar] day to the current simulation time.
652
        void subtractDay();
653
        //! Subtract one [Earth, solar] week to the current simulation time.
654
        void subtractWeek();
655

656
        //! Subtract one sidereal day to the simulation time. The length of time depends
657
        //! on the current planetary body on which the observer is located.
658
        void subtractSiderealDay();
659
        //! Subtract seven sidereal days to the simulation time. The length of time depends
660
        //! on the current planetary body on which the observer is located.
661
        void subtractSiderealWeek();
662
        //! Subtract one sidereal year to the simulation time. The length of time depends
663
        //! on the current planetary body on which the observer is located. Sidereal year
664
        //! connected to orbital period of planets.
665
        void subtractSiderealYear();
666
        //! Subtract n sidereal years to the simulation time. The length of time depends
667
        //! on the current planetary body on which the observer is located. Sidereal year
668
        //! connected to orbital period of planets.
669
        void subtractSiderealYears(double n=100.);
670

671
        //! Add one synodic month to the simulation time.
672
        void addSynodicMonth();
673

674
        //! Add one saros (223 synodic months) to the simulation time.
675
        void addSaros();
676

677
        //! Add one draconic year to the simulation time.
678
        void addDraconicYear();
679
        //! Add one draconic month to the simulation time.
680
        void addDraconicMonth();
681

682
        //! Add one anomalistic month to the simulation time.
683
        void addAnomalisticMonth();
684
        //! Add one anomalistic year to the simulation time.
685
        void addAnomalisticYear();
686
        //! Add n anomalistic years to the simulation time.
687
        void addAnomalisticYears(double n=100.);
688

689
        //! Add one mean tropical month to the simulation time.
690
        void addMeanTropicalMonth();
691
        //! Add one mean tropical year to the simulation time.
692
        void addMeanTropicalYear();
693
        //! Add n mean tropical years to the simulation time.
694
        void addMeanTropicalYears(double n=100.);
695
        //! Add one tropical year to the simulation time.
696
        void addTropicalYear();
697

698
        //! Add one great year
699
        //! Great Year [NASA SP-7, 1965] - the period of one complete cycle of the equinoxes around the ecliptic, about 25,800 years.
700
        //! https://web.archive.org/web/20050421192849/http://www.hq.nasa.gov/office/hqlibrary/aerospacedictionary/aerodictall/g.html
701
        void addGreatYear();
702

703
        //! Add one calendar month to the simulation time.
704
        void addCalendarMonth();
705
        //! Add one calendar year to the simulation time.
706
        void addCalendarYear();
707
        //! Add one calendar decade to the simulation time.
708
        void addCalendarDecade();
709
        //! Add one calendar century to the simulation time.
710
        void addCalendarCentury();
711

712
        //! Add one Julian year to the simulation time.
713
        void addJulianYear();
714
        //! Add n Julian years to the simulation time.
715
        void addJulianYears(double n=100.);
716

717
        //! Add one Gaussian year to the simulation time. The Gaussian Year is 365.2568983 days, and is C.F.Gauss's value for the Sidereal Year.
718
        //! Note that 1 GaussY=2 &pi;/k where k is the Gaussian gravitational constant. A massless body orbits one solar mass in 1AU distance in a Gaussian Year.
719
        void addGaussianYear();
720

721
        //! Subtract one synodic month from the simulation time.
722
        void subtractSynodicMonth();
723

724
        //! Subtract one saros (223 synodic months) from the simulation time.
725
        void subtractSaros();
726

727
        //! Subtract one draconic year from the simulation time.
728
        void subtractDraconicYear();
729
        //! Subtract one draconic month from the simulation time.
730
        void subtractDraconicMonth();
731

732
        //! Subtract one anomalistic month from the simulation time.
733
        void subtractAnomalisticMonth();
734
        //! Subtract one anomalistic year from the simulation time.
735
        void subtractAnomalisticYear();
736
        //! Subtract n anomalistic years from the simulation time.
737
        void subtractAnomalisticYears(double n=100.);
738

739
        //! Subtract one mean tropical month from the simulation time.
740
        void subtractMeanTropicalMonth();
741
        //! Subtract one mean tropical year from the simulation time.
742
        void subtractMeanTropicalYear();
743
        //! Subtract n mean tropical years from the simulation time.
744
        void subtractMeanTropicalYears(double n=100.);
745
        //! Subtract one tropical year from the simulation time.
746
        void subtractTropicalYear();
747

748
        //! Subtract one great year
749
        //! Great Year [NASA SP-7, 1965] - the period of one complete cycle of the equinoxes around the ecliptic, about 25,800 years.
750
        //! https://web.archive.org/web/20050421192849/http://www.hq.nasa.gov/office/hqlibrary/aerospacedictionary/aerodictall/g.html
751
        void subtractGreatYear();
752

753
        //! Subtract one calendar month from the simulation time.
754
        void subtractCalendarMonth();
755
        //! Subtract one calendar year from the simulation time.
756
        void subtractCalendarYear();
757
        //! Subtract one calendar decade from the simulation time.
758
        void subtractCalendarDecade();
759
        //! Subtract one calendar century from the simulation time.
760
        void subtractCalendarCentury();
761

762
        //! Subtract one Julian year from the simulation time.
763
        void subtractJulianYear();
764
        //! Subtract n Julian years from the simulation time.
765
        void subtractJulianYears(double n=100.);
766

767
        //! Subtract one Gaussian year from the simulation time.
768
        void subtractGaussianYear();
769

770
        //! Add a number of Earth Solar days to the current simulation time
771
        //! @param d the decimal number of days to add (use negative values to subtract)
772
        void addSolarDays(double d);
773
        //! Add a number of sidereal days to the current simulation time,
774
        //! based on the observer body's rotational period.
775
        //! @param d the decimal number of sidereal days to add (use negative values to subtract)
776
        void addSiderealDays(double d);
777

778
        //! Move the observer to the selected object. This will only do something if
779
        //! the selected object is of the correct type - i.e. a planet.
780
        void moveObserverToSelected();
781

782
        //! Set central year for custom equation for calculation of DeltaT
783
        //! @param y the year, e.g. 1820
784
        void setDeltaTCustomYear(double y) { deltaTCustomYear=y; }
×
785
        //! Set n-dot for custom equation for calculation of DeltaT
786
        //! @param v the n-dot value, e.g. -26.0
787
        void setDeltaTCustomNDot(double v) { deltaTCustomNDot=v; }
×
788
        //! Set coefficients for custom equation for calculation of DeltaT
789
        //! @param c the coefficients, e.g. -20,0,32
790
        void setDeltaTCustomEquationCoefficients(const Vec3d &c) { deltaTCustomEquationCoeff=c; }
×
791

792
        //! Get central year for custom equation for calculation of DeltaT
793
        double getDeltaTCustomYear() const { return deltaTCustomYear; }
×
794
        //! Get n-dot for custom equation for calculation of DeltaT
795
        double getDeltaTCustomNDot() const { return deltaTCustomNDot; }
×
796
        //! Get n-dot for current DeltaT algorithm
797
        double getDeltaTnDot() const { return deltaTnDot; }
×
798
        //! Get coefficients for custom equation for calculation of DeltaT
799
        Vec3d getDeltaTCustomEquationCoefficients() const { return deltaTCustomEquationCoeff; }
×
800

801
        //! initialize ephemerides calculation functions
802
        void initEphemeridesFunctions();
803

804
        bool de430IsAvailable();            //!< true if DE430 ephemeris file has been found
805
        bool de431IsAvailable();            //!< true if DE431 ephemeris file has been found
806
        bool de430IsActive();               //!< true if DE430 ephemeris is in use
807
        bool de431IsActive();               //!< true if DE431 ephemeris is in use
808
        void setDe430Active(bool status);   //!< switch DE430 use to @param status (if de430IsAvailable()). DE430 is only used if date is within range of DE430.
809
        void setDe431Active(bool status);   //!< switch DE431 use to @param status (if de431IsAvailable()). DE431 is only used if DE430 is not used and the date is within range of DE431.
810

811
        bool de440IsAvailable();            //!< true if DE440 ephemeris file has been found
812
        bool de441IsAvailable();            //!< true if DE441 ephemeris file has been found
813
        bool de440IsActive();               //!< true if DE440 ephemeris is in use
814
        bool de441IsActive();               //!< true if DE441 ephemeris is in use
815
        void setDe440Active(bool status);   //!< switch DE440 use to @param status (if de440IsAvailable()). DE440 is only used if date is within range of DE440.
816
        void setDe441Active(bool status);   //!< switch DE441 use to @param status (if de441IsAvailable()). DE441 is only used if DE440 is not used and the date is within range of DE441.
817

818
        //! Set min and max range of dates for ephemeris
819
        void setMinMaxEphemRange(QPair<int, int> mm) { minMaxEphemRange = mm; }
×
820
        //! Get min and max range of dates for ephemeris
821
        QPair<int, int> getMinMaxEphemRange(void) { return minMaxEphemRange; }
×
822

823
        //! Return 3-letter abbreviation of IAU constellation name for position in equatorial coordinates on the current epoch.
824
        //! Follows 1987PASP...99..695R: Nancy Roman: Identification of a Constellation from a Position
825
        //! Data file from ADC catalog VI/42 with its amendment from 1999-12-30.
826
        //! @param positionEqJnow position vector in rectangular equatorial coordinates of current epoch&equinox.
827
        QString getIAUConstellation(const Vec3d &positionEqJnow) const;
828

829
        //! Returns naked-eye limiting magnitude corresponding to the given sky luminance in cd/m².
830
        static float luminanceToNELM(float luminance);
831
        //! Returns sky luminance in cd/m² corresponding to the given naked-eye limiting magnitude.
832
        static float nelmToLuminance(float nelm);
833
        //! Returns some representative naked-eye limiting magnitude for the given Bortle scale index.
834
        static float bortleScaleIndexToNELM(int index);
835
        //! Returns some representative value of zenith luminance in cd/m² for the given Bortle scale index.
836
        static float bortleScaleIndexToLuminance(const int index) { return nelmToLuminance(bortleScaleIndexToNELM(index)); }
247✔
837
        //! Classifies the sky using the Bortle scale using zenith naked-eye limiting magnitude as input.
838
        static int nelmToBortleScaleIndex(float nelm);
839
        //! Classifies the sky using the Bortle scale using zenith luminance in cd/m² as input.
840
        static int luminanceToBortleScaleIndex(const float luminance) { return nelmToBortleScaleIndex(luminanceToNELM(luminance)); }
×
841
        //! Converts luminance in cd/m² to magnitude/arcsec².
842
        static float luminanceToMPSAS(const float cdm2) { return std::log10(cdm2/10.8e4f) / -0.4f; }
×
843
        //! Converts magnitude/arcsec² to luminance in cd/m².
844
        static float mpsasToLuminance(const float mag) { return 10.8e4f*std::pow(10.f, -0.4f*mag); }
×
845

846
signals:
847
        //! This signal is emitted when the observer location has changed.
848
        void locationChanged(const StelLocation&);
849
        //! This signal is emitted whenever the targeted location changes, i.e., at the onset of location transitions.
850
        //! The second parameter can transmit a landscapeID or should be QString().
851
        void targetLocationChanged(const StelLocation& loc, const QString& id);
852
        //! This signal is emitted when the current timezone name is changed.
853
        void currentTimeZoneChanged(const QString& tz);
854
        //! This signal is emitted when custom timezone use is activated (true) or deactivated (false).
855
        void useCustomTimeZoneChanged(const bool b);
856
        //! This signal is emitted when daylight saving time is enabled or disabled.
857
        void flagUseDSTChanged(const bool b);
858
        //! This signal is emitted when stop clock at startup is enabled or disabled.
859
        void startupTimeStopChanged(const bool b);
860
        //! This signal is emitted when the time rate has changed
861
        void timeRateChanged(double rate);
862
        //! This signal is emitted whenever the time is re-synced.
863
        //! This happens whenever the internal jDay is changed through setJDay/setMJDay and similar,
864
        //! and whenever the time rate changes.
865
        void timeSyncOccurred(double jDay);
866
        //! This signal is emitted when the date has changed.
867
        void dateChanged();
868
        //! This signal can be emitted when e.g. the date has changed in a way that planet trails or similar things should better be reset.
869
        //! TODO: Currently the signal is not used. Think of the proper way to apply it.
870
        void dateChangedForTrails();
871
        //! This signal is emitted when the date has changed for a month.
872
        void dateChangedForMonth();
873
        //! This signal is emitted when the date has changed by one year.
874
        void dateChangedByYear(const int year);
875
        //! This signal indicates a horizontal display flip
876
        void flipHorzChanged(bool b);
877
        //! This signal indicates a vertical display flip
878
        void flipVertChanged(bool b);
879
        //! This signal indicates a switch in use of nutation
880
        void flagUseNutationChanged(bool b);
881
        //! This signal indicates a switch in use of aberration
882
        void flagUseAberrationChanged(bool b);
883
        //! This signal indicates a change in aberration exaggeration factor
884
        void aberrationFactorChanged(double val);
885
        //! This signal indicates a switch in use of parallax
886
        void flagUseParallaxChanged(bool b);
887
        //! This signal indicates a change in parallax exaggeration factor
888
        void parallaxFactorChanged(double val);
889
        //! This signal indicates a switch in use of topocentric coordinates
890
        void flagUseTopocentricCoordinatesChanged(bool b);
891
        //! Emitted whenever the projection type changes
892
        void currentProjectionTypeChanged(StelCore::ProjectionType newType);
893
        //! Emitted whenever the projection type changes
894
        void currentProjectionTypeKeyChanged(const QString& newValue);
895
        //! Emitted whenever the projection type changes
896
        void currentProjectionNameI18nChanged(const QString& newValue);
897
        //! Emitted when gravity label use is changed
898
        void flagGravityLabelsChanged(bool gravity);
899
        //! Emitted when button "Save settings" is pushed
900
        void configurationDataSaved();
901
        void updateSearchLists();
902
        void ditheringModeChanged(DitheringMode mode);
903

904
        //! Called just after algorithm/theory for ephemeris is changed in the GUI
905
        void ephemAlgorithmChanged();
906

907
private slots:
908
        //! Call this whenever latitude changes. I.e., just connect it to the locationChanged() signal.
909
        void updateFixedEquatorialTransformMatrices();
910
private:
911
        DitheringMode parseDitheringMode(const QString& s);
912
        static const QMap<QString, DitheringMode>ditheringMap;
913

914
private:
915
        StelToneReproducer* toneReproducer;                // Tones conversion between stellarium world and display device
916
        StelSkyDrawer* skyDrawer;
917
        StelMovementMgr* movementMgr;                // Manage vision movements
918
        StelPropertyMgr* propMgr;
919

920
        // Manage geodesic grid
921
        mutable StelGeodesicGrid* geodesicGrid;
922

923
        // The currently used projection type
924
        ProjectionType currentProjectionType;
925

926
        // The currentrly used time correction (DeltaT)
927
        DeltaTAlgorithm currentDeltaTAlgorithm;
928

929
        // Parameters to use when creating new instances of StelProjector
930
        StelProjector::StelProjectorParams currentProjectorParams;
931

932
        //! This is called in every frame to set rotation matrices for the various movable projection frames.
933
        //! The rarely updated frame transform between AltAz and Fixed Equatorial is set in updateFixedEquatorialTransformMatrices() instead.
934
        void updateTransformMatrices();
935
        void updateTime(double deltaTime);
936
        void updateMaximumFov();
937
        void resetSync();
938

939
        void registerMathMetaTypes();
940

941
        // Matrices used for every coordinate transfo
942
        Mat4d matHeliocentricEclipticJ2000ToAltAz; // Transform from heliocentric ecliptic Cartesian (VSOP87A) to topocentric (StelObserver) altazimuthal coordinate
943
        Mat4d matAltAzToHeliocentricEclipticJ2000; // Transform from topocentric (StelObserver) altazimuthal coordinate to heliocentric ecliptic Cartesian (VSOP87A)
944
        Mat4d matAltAzToEquinoxEqu;                // Transform from topocentric altazimuthal coordinate to Earth Equatorial
945
        Mat4d matEquinoxEquToAltAz;                // Transform from Earth Equatorial to topocentric (StelObserver) altazimuthal coordinate
946
        Mat4d matAltAzToFixedEquatorial;           // Transform from topocentric altazimuthal coordinate to Fixed Equatorial system (hour angle/decl)
947
        Mat4d matFixedEquatorialToAltAz;           // Transform from Fixed Equatorial (hour angle/decl) to topocentric (StelObserver) altazimuthal coordinate
948
        Mat4d matHeliocentricEclipticToEquinoxEqu; // Transform from heliocentric ecliptic Cartesian (VSOP87A) to earth equatorial coordinate
949
        Mat4d matEquinoxEquDateToJ2000;            // For Earth, this is almost the inverse precession matrix, =Rz(VSOPbias)Rx(eps0)Rz(-psiA)Rx(-omA)Rz(chiA)
950
        Mat4d matJ2000ToEquinoxEqu;                // precession matrix
951
        static Mat4d matJ2000ToJ1875;              // Precession matrix for IAU constellation lookup.
952

953
        Mat4d matJ2000ToAltAz;
954
        Mat4d matAltAzToJ2000;
955

956
        Mat4d matAltAzModelView;           // Modelview matrix for observer-centric altazimuthal drawing
957
        Mat4d invertMatAltAzModelView;     // Inverted modelview matrix for observer-centric altazimuthal drawing
958

959
        // Position variables
960
        StelObserver* position;
961
        // The ID of the default startup location
962
        QString defaultLocationID;
963

964
        // flag to indicate we want to use nutation (the small-scale wobble of earth's axis)
965
        bool flagUseNutation;
966
        // flag to indicate we want to use aberration (a small-scale wobble of stellar positions (~20 arceconds on earth) due to finite speed of light and observer in motion on a planet.)
967
        bool flagUseAberration;
968
        // value to allow exaggerating aberration effects. 1 is natural value, stretching to e.g. 1000 may be useful for explanations.
969
        double aberrationFactor;
970
        // flag to indicate we want to include parallax effect
971
        bool flagUseParallax;
972
        // value to allow exaggerating parallax effects. 1 is natural value, stretching to e.g. 1000 may be useful for explanations.
973
        double parallaxFactor;
974
        // flag to indicate that we show topocentrically corrected coordinates. (Switching to false for planetocentric coordinates is new for 0.14)
975
        bool flagUseTopocentricCoordinates;
976

977
        // Time variables
978
        double timeSpeed;           // Positive : forward, Negative : Backward, 1 = 1sec/sec
979
        //double JDay;              // Current time in Julian day. IN V0.12 TO V0.14, this was JD in TT, and all places where UT was required had to subtract getDeltaT() explicitly.
980
        QPair<double,double> JD;    // From 0.14 on: JD.first=JD_UT, JD.second=DeltaT[seconds]=(TT-UT)*86400. To gain JD_TT, compute JDE=JD.first+JD.second/86400 or better just call getJDE()
981
                                    // Use is best with calls getJD()/setJD() and getJDE()/setJDE() to explicitly state which flavour of JD you need.
982
        double presetSkyTime;
983
        QTime initTodayTime;
984
        QString startupTimeMode;
985
        qint64 milliSecondsOfLastJDUpdate;    // Time in milliseconds when the time rate or time last changed
986
        double jdOfLastJDUpdate;         // JD when the time rate or time last changed
987

988
        DitheringMode ditheringMode = DitheringMode::Color888;
989

990
        QString currentTimeZone;        
991
        bool flagUseDST;
992
        bool flagUseCTZ; // custom time zone
993
        bool startupTimeStop;
994

995
        // Variables for equations of DeltaT
996
        Vec3d deltaTCustomEquationCoeff;
997
        double deltaTCustomNDot;
998
        double deltaTCustomYear;
999
        double deltaTnDot; // The currently applied nDot correction. (different per algorithm, and displayed in status line.)
1000
        bool  deltaTdontUseMoon; // true if the currently selected algorithm does not do a lunar correction (?????)
1001
        double (*deltaTfunc)(const double JD); // This is a function pointer which must be set to a function which computes DeltaT(JD).
1002
        int deltaTstart;   // begin year of validity range for the selected DeltaT algorithm. (SET INT_MIN to mark infinite)
1003
        int deltaTfinish;  // end   year of validity range for the selected DeltaT algorithm. (Set INT_MAX to mark infinite)
1004

1005
        // Variables for DE430/431/440/441 ephem calculation
1006
        bool de430Available; // ephem file found
1007
        bool de431Available; // ephem file found
1008
        bool de430Active;    // available and user-activated.
1009
        bool de431Active;    // available and user-activated.
1010
        bool de440Available; // ephem file found
1011
        bool de441Available; // ephem file found
1012
        bool de440Active;    // available and user-activated.
1013
        bool de441Active;    // available and user-activated.
1014
        QPair<int, int> minMaxEphemRange;
1015
        
1016
        // Variables for caching the observer position relative to the star catalog reference frame
1017
        static Vec3d cachedParallaxDiff;
1018
    static double cachedParallaxJD; // Cached Julian Date
1019
        static PlanetP cachedParallaxPlanet;
1020
        Vec3d calculateParallaxDiff(double JD) const; // Actual calculation
1021

1022
        // Variables for caching the aberration effect
1023
        static Vec3d cachedAberrationVec;
1024
        static double cachedAberrationJD;
1025
        static PlanetP cachedAberrationPlanet;
1026
        Vec3d calculateAberrationVec(double JD) const; // Actual calculation
1027
};
1028
#endif // STELCORE_HPP
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc