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

Stellarium / stellarium / 15670918640

16 Jun 2025 02:08AM UTC coverage: 11.775% (-0.2%) from 11.931%
15670918640

push

github

alex-w
Updated data

14700 of 124846 relevant lines covered (11.77%)

18324.52 hits per line

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

3.13
/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
                ProjectionMollweide,        //!< Mollweide projection
105
                ProjectionSinusoidal,                //!< Sinusoidal projection
106
                ProjectionMercator,                //!< Mercator projection
107
                ProjectionMiller,                //!< Miller cylindrical projection
108
                ProjectionCylinder,                //!< Cylinder projection
109
                ProjectionCylinderFill                //!< Cylinder projection, no zoom or movement allowed
110
        };
111
        Q_ENUM(ProjectionType)
×
112

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

339
        SphericalCap getVisibleSkyArea() const;
340

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

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

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

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

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

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

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

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

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

381
        Vec3d getMouseJ2000Pos(void) const;
382

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

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

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

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

405
        QString getCurrentProjectionNameI18n() const;
406

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

529
        //! Compute DeltaT estimation for a given date [seconds].
530
        //! DeltaT is the accumulated effect of earth's rotation slowly getting slower, mostly caused by tidal braking by the Moon.
531
        //! For accurate positioning of objects in the sky, we must compute earth-based clock-dependent things like earth rotation, hour angles etc.
532
        //! using plain UT, but all orbital motions or rotation of the other planets must be computed in TT, which is a regular time frame.
533
        //! Also satellites are computed in the UT frame because (1) they are short-lived and (2) must follow paths over earth ground.
534
        //! (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.)
535
        //! @param JD the date and time expressed as a Julian Day
536
        //! @return DeltaT in seconds
537
        //! @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
538
        //! @note Use this only if needed, prefer calling getDeltaT() for access to the current value.
539
        //! @note Up to V0.15.1, if the requested year was outside validity range, we returned zero or some useless value.
540
        //!       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.
541
        //!       Limits can be queried with getCurrentDeltaTAlgorithmValidRangeDescription()
542

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

547
        //! @return whether nutation is currently used.
548
        bool getUseNutation() const;
549
        //! Set whether you want computation and simulation of nutation (a slight wobble of Earth's axis, just a few arcseconds).
550
        void setUseNutation(bool use);
551

552
        //! @return whether aberration is currently used.
553
        bool getUseAberration() const;
554
        //! 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).
555
        void setUseAberration(bool use);
556

557
        //! @return aberration factor. 1 is realistic simulation, but higher values may be useful for didactic purposes.
558
        double getAberrationFactor() const;
559
        //! Set aberration factor. Values are clamped to 0...5. (Values above 5 cause graphical problems.)
560
        void setAberrationFactor(double factor);
561

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

565
        //! @return whether parallax effect is currently used.
566
        bool getUseParallax() const;
567
        //! Set whether you want computation and simulation of parallax effect.
568
        void setUseParallax(bool use);
569

570
        //! @return parallax factor. 1 is realistic simulation, but higher values may be useful for didactic purposes.
571
        double getParallaxFactor() const;
572
        //! Set aberration factor. Values are clamped to 0...5. (Values above 5 cause graphical problems.)
573
        void setParallaxFactor(double factor);
574

575
        //! @return whether topocentric coordinates are currently used.
576
        bool getUseTopocentricCoordinates() const;
577
        //! Set whether you want topocentric or planetocentric data
578
        void setUseTopocentricCoordinates(bool use);
579

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

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

590
        void revertTimeDirection(void);
591

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

718
        //! 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.
719
        //! 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.
720
        void addGaussianYear();
721

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

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

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

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

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

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

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

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

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

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

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

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

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

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

805
        bool de430IsAvailable();            //!< true if DE430 ephemeris file has been found
806
        bool de431IsAvailable();            //!< true if DE431 ephemeris file has been found
807
        bool de430IsActive();               //!< true if DE430 ephemeris is in use
808
        bool de431IsActive();               //!< true if DE431 ephemeris is in use
809
        void setDe430Active(bool status);   //!< switch DE430 use to @param status (if de430IsAvailable()). DE430 is only used if date is within range of DE430.
810
        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.
811

812
        bool de440IsAvailable();            //!< true if DE440 ephemeris file has been found
813
        bool de441IsAvailable();            //!< true if DE441 ephemeris file has been found
814
        bool de440IsActive();               //!< true if DE440 ephemeris is in use
815
        bool de441IsActive();               //!< true if DE441 ephemeris is in use
816
        void setDe440Active(bool status);   //!< switch DE440 use to @param status (if de440IsAvailable()). DE440 is only used if date is within range of DE440.
817
        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.
818

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

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

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

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

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

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

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

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

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

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

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

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

940
        void registerMathMetaTypes();
941

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

954
        Mat4d matJ2000ToAltAz;
955
        Mat4d matAltAzToJ2000;
956

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

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

965
        // flag to indicate we want to use nutation (the small-scale wobble of earth's axis)
966
        bool flagUseNutation;
967
        // 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.)
968
        bool flagUseAberration;
969
        // value to allow exaggerating aberration effects. 1 is natural value, stretching to e.g. 1000 may be useful for explanations.
970
        double aberrationFactor;
971
        // flag to indicate we want to include parallax effect
972
        bool flagUseParallax;
973
        // value to allow exaggerating parallax effects. 1 is natural value, stretching to e.g. 1000 may be useful for explanations.
974
        double parallaxFactor;
975
        // flag to indicate that we show topocentrically corrected coordinates. (Switching to false for planetocentric coordinates is new for 0.14)
976
        bool flagUseTopocentricCoordinates;
977

978
        // Time variables
979
        double timeSpeed;           // Positive : forward, Negative : Backward, 1 = 1sec/sec
980
        //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.
981
        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()
982
                                    // Use is best with calls getJD()/setJD() and getJDE()/setJDE() to explicitly state which flavour of JD you need.
983
        double presetSkyTime;
984
        QTime initTodayTime;
985
        QString startupTimeMode;
986
        qint64 milliSecondsOfLastJDUpdate;    // Time in milliseconds when the time rate or time last changed
987
        double jdOfLastJDUpdate;         // JD when the time rate or time last changed
988

989
        DitheringMode ditheringMode = DitheringMode::Color888;
990

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

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

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

1023
        // Variables for caching the aberration effect
1024
        static Vec3d cachedAberrationVec;
1025
        static double cachedAberrationJD;
1026
        static PlanetP cachedAberrationPlanet;
1027
        Vec3d calculateAberrationVec(double JD) const; // Actual calculation
1028
};
1029
#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