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

Stellarium / stellarium / 15291801018

28 May 2025 04:52AM UTC coverage: 11.931% (-0.02%) from 11.951%
15291801018

push

github

alex-w
Added new set of navigational stars (XIX century)

0 of 6 new or added lines in 2 files covered. (0.0%)

14124 existing lines in 74 files now uncovered.

14635 of 122664 relevant lines covered (11.93%)

18291.42 hits per line

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

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

20
#ifndef STELOBJECT_HPP
21
#define STELOBJECT_HPP
22

23
#include "VecMath.hpp"
24
// Ignore clangd warning! Inclusion is OK.
25
#include "StelObjectType.hpp"
26
#include "StelRegionObject.hpp"
27

28
#include <QFlags>
29
#include <QString>
30

31
class StelCore;
32

33
//! The base abstract class for sky objects used in Stellarium like Stars, Planets, Constellations etc...
34
//! Normally you should use StelObjectP instead of StelObject* which have by default the same behaviour,
35
//! but which can be added reference counting if needed.
36
//! @sa StelObjectP
37
class StelObject : public StelRegionObject
38
{
39
        //Required for Q_FLAG macro, this requires this header to be MOC'ed
40
        Q_GADGET
41
public:
42
        //! Used as named bitfield flags as specifiers to
43
        //! filter results of getInfoString. The precise definition of these should
44
        //! be documented in the getInfoString documentation for the derived classes
45
        //! for all specifiers which are defined in that derivative.
46
        //! Use InfoStringGroup instead.
47
        enum InfoStringGroupFlags
48
        {
49
                None                        = 0x00000000, //!< Show Nothing
50
                Name                        = 0x00000001, //!< An object's name as further defined by CulturalDisplayStyle found in SkyCultureMgr.
51
                CatalogNumber                = 0x00000002, //!< Catalog numbers
52
                Magnitude                = 0x00000004, //!< Magnitude related data
53
                RaDecJ2000                = 0x00000008, //!< The equatorial position (J2000 ref)
54
                RaDecOfDate                = 0x00000010, //!< The equatorial position (of date)
55
                AltAzi                        = 0x00000020, //!< The position (Altitude/Azimuth)
56
                Distance                = 0x00000040, //!< Info about an object's distance
57
                Elongation                = 0x00000080, //!< Info about elongation, phase angle etc. Most useful for Planets, but possible for all objects.
58
                Size                        = 0x00000100, //!< Info about an object's size
59
                Velocity                = 0x00000200, //!< Info about object's velocity
60
                ProperMotion                = 0x00000400, //!< Annual proper motion (for stars) or hourly motion (for Planets)
61
                Extra                        = 0x00000800, //!< Derived class-specific extra fields
62
                HourAngle                = 0x00001000, //!< The hour angle + DE (of date)
63
                AbsoluteMagnitude        = 0x00002000, //!< The absolute magnitude
64
                GalacticCoord                = 0x00004000, //!< The galactic position
65
                SupergalacticCoord        = 0x00008000, //!< The supergalactic position
66
                OtherCoord                = 0x00010000, //!< Unspecified additional coordinates. These can be "injected" into the extraInfoStrings by plugins.
67
                ObjectType                = 0x00020000, //!< The type of the object (star, planet, etc.)
68
                EclipticCoordJ2000        = 0x00040000, //!< The ecliptic position (J2000.0 ref) [+ XYZ of VSOP87A (used mainly for debugging, not public)]
69
                EclipticCoordOfDate        = 0x00080000, //!< The ecliptic position (of date)
70
                IAUConstellation        = 0x00100000, //!< Three-letter constellation code (And, Boo, Cas, ...)
71
                SiderealTime                = 0x00200000, //!< Mean and Apparent Sidereal Time
72
                RTSTime                        = 0x00400000, //!< Time of rise, transit and set of celestial object
73
                SolarLunarPosition      = 0x00800000, //!< Show Solar and Lunar horizontal position (on Earth location only)
74
                Script                  = 0x01000000, //!< Should be used by Scripts only which can inject extraInfoStrings.
75
                DebugAid                = 0x02000000, //!< Can be used for development only, place messages into extraInfoStrings. Comment them away or delete for releases.
76
                NoFont                        = 0x04000000,
77
                PlainText                = 0x08000000  //!< Strip HTML tags from output
78
        };
79
        Q_DECLARE_FLAGS(InfoStringGroup, InfoStringGroupFlags)
80
        Q_FLAG(InfoStringGroup)
×
81

82

83
        //! A 6-bit code with all options for displaying relevant CulturalName parts.
84
        //! Describes how to display culture aware labels for constellation, planets, star names, ....
85
        //! The viewDialog GUI has checkboxes which corresponds to these values.
86
        //! It is necessary to have different settings for screen labels (usually shorter) and InfoString labels (may be set to more complete)
87

88
        //! This setting is handled by methods getScreenLabel() and getInfoLabel() in StelObject and descendants.
89

90
        //! The names are explicitly long and descriptive, usable in config.ini.
91
        //! Example: Native_Pronounce_Translit_Translated_IPA_Modern shows everything:
92
        //! - native name,
93
        //! - simple translatable pronunciation
94
        //! - non-translatable scientific transliteration (in rare cases only)
95
        //! - translated meaning
96
        //! - IPA reading/pronunciation aid in International Phonetic Alphabet
97
        //! - Modern name (useful for stars and planets only). Helpful to see the modern name in context.
98
        enum class CulturalDisplayStyle
99
        {
100
                NONE                                            = 0x00,
101
                Modern                                          = 0x01,
102
                IPA                                             = 0x02,
103
                IPA_Modern                                      = 0x03,
104
                Translated                                      = 0x04,
105
                Translated_Modern                               = 0x05,
106
                Translated_IPA                                  = 0x06,
107
                Translated_IPA_Modern                           = 0x07,
108
                Translit                                        = 0x08,
109
                Translit_Modern                                 = 0x09,
110
                Translit_IPA                                    = 0x0A,
111
                Translit_IPA_Modern                             = 0x0B,
112
                Translit_Translated                             = 0x0C,
113
                Translit_Translated_Modern                      = 0x0D,
114
                Translit_Translated_IPA                         = 0x0E,
115
                Translit_Translated_IPA_Modern                  = 0x0F,
116
                Pronounce                                       = 0x10,
117
                Pronounce_Modern                                = 0x11,
118
                Pronounce_IPA                                   = 0x12,
119
                Pronounce_IPA_Modern                            = 0x13,
120
                Pronounce_Translated                            = 0x14,
121
                Pronounce_Translated_Modern                     = 0x15,
122
                Pronounce_Translated_IPA                        = 0x16,
123
                Pronounce_Translated_IPA_Modern                 = 0x17,
124
                Pronounce_Translit                              = 0x18,
125
                Pronounce_Translit_Modern                       = 0x19,
126
                Pronounce_Translit_IPA                          = 0x1A,
127
                Pronounce_Translit_IPA_Modern                   = 0x1B,
128
                Pronounce_Translit_Translated                   = 0x1C,
129
                Pronounce_Translit_Translated_Modern            = 0x1D,
130
                Pronounce_Translit_Translated_IPA               = 0x1E,
131
                Pronounce_Translit_Translated_IPA_Modern        = 0x1F,
132
                Native                                          = 0x20,
133
                Native_Modern                                   = 0x21,
134
                Native_IPA                                      = 0x22,
135
                Native_IPA_Modern                               = 0x23,
136
                Native_Translated                               = 0x24,
137
                Native_Translated_Modern                        = 0x25,
138
                Native_Translated_IPA                           = 0x26,
139
                Native_Translated_IPA_Modern                    = 0x27,
140
                Native_Translit                                 = 0x28,
141
                Native_Translit_Modern                          = 0x29,
142
                Native_Translit_IPA                             = 0x2A,
143
                Native_Translit_IPA_Modern                      = 0x2B,
144
                Native_Translit_Translated                      = 0x2C,
145
                Native_Translit_Translated_Modern               = 0x2D,
146
                Native_Translit_Translated_IPA                  = 0x2E,
147
                Native_Translit_Translated_IPA_Modern           = 0x2F,
148
                Native_Pronounce                                = 0x30,
149
                Native_Pronounce_Modern                         = 0x31,
150
                Native_Pronounce_IPA                            = 0x32,
151
                Native_Pronounce_IPA_Modern                     = 0x33,
152
                Native_Pronounce_Translated                     = 0x34,
153
                Native_Pronounce_Translated_Modern              = 0x35,
154
                Native_Pronounce_Translated_IPA                 = 0x36,
155
                Native_Pronounce_Translated_IPA_Modern          = 0x37,
156
                Native_Pronounce_Translit                       = 0x38,
157
                Native_Pronounce_Translit_Modern                = 0x39,
158
                Native_Pronounce_Translit_IPA                   = 0x3A,
159
                Native_Pronounce_Translit_IPA_Modern            = 0x3B,
160
                Native_Pronounce_Translit_Translated            = 0x3C,
161
                Native_Pronounce_Translit_Translated_Modern     = 0x3D,
162
                Native_Pronounce_Translit_Translated_IPA        = 0x3E,
163
                Native_Pronounce_Translit_Translated_IPA_Modern = 0x3F
164
        };
UNCOV
165
        Q_ENUM(CulturalDisplayStyle)
×
166

167
        //! @struct CulturalName
168
        //! Contains name components belonging to an object.
169
        //!
170
        struct CulturalName
171
        {
172
                QString native;           //!< native name in native glyphs
173
                QString pronounce;        //!< native name in a Latin-based transliteration usable as pronunciation aid for English
174
                QString pronounceI18n;    //!< native name in a transliteration scheme in user-language usable as pronunciation aid
175
                QString transliteration;  //!< native name in a science-based transliteration scheme not geared at pronunciation (e.g. Tibetan Wylie; rarely used).
176
                QString translated;       //!< Native name translated to English. NOT the same as the usual object's englishName!
177
                QString translatedI18n;   //!< Translated name (user language)
178
                QString IPA;              //!< native name expressed in International Phonetic Alphabet
179
        };
180

181
        //! A pre-defined "all available" set of specifiers for the getInfoString flags argument to getInfoString
182
        static constexpr InfoStringGroup AllInfo = static_cast<InfoStringGroup>(Name|CatalogNumber|Magnitude|RaDecJ2000|RaDecOfDate|AltAzi|
183
                                                                           Distance|Elongation|Size|Velocity|ProperMotion|Extra|HourAngle|AbsoluteMagnitude|
184
                                                                           GalacticCoord|SupergalacticCoord|OtherCoord|ObjectType|EclipticCoordJ2000|
185
                                                                           EclipticCoordOfDate|IAUConstellation|SiderealTime|RTSTime|SolarLunarPosition);
186
        //! A pre-defined "default" set of specifiers for the getInfoString flags argument to getInfoString
187
        //! It appears useful to propose this set as post-install settings and let users configure more on demand.
188
        static constexpr InfoStringGroup DefaultInfo = static_cast<InfoStringGroup>(Name|CatalogNumber|Magnitude|RaDecOfDate|HourAngle|AltAzi|OtherCoord|
189
                                                                                          Distance|Elongation|Size|Velocity|Extra|IAUConstellation|SiderealTime|RTSTime);
190
        //! A pre-defined "shortest useful" set of specifiers for the getInfoString flags argument to getInfoString
191
        static constexpr InfoStringGroup ShortInfo = static_cast<InfoStringGroup>(Name|CatalogNumber|Magnitude|RaDecJ2000);
192

193
        ~StelObject() override {}
1✔
194

195
        //! Default implementation of the getRegion method.
196
        //! Return the spatial region of the object.
UNCOV
197
        SphericalRegionP getRegion() const override {return SphericalRegionP(new SphericalPoint(getJ2000EquatorialPos(Q_NULLPTR)));}
×
198

199
        //! Default implementation of the getPointInRegion method.
200
        //! Return the J2000 Equatorial Position of the object.
UNCOV
201
        Vec3d getPointInRegion() const override {return getJ2000EquatorialPos(Q_NULLPTR);}
×
202
        
203
        //! Write I18n information about the object in QString.
204
        //! @param core the StelCore object to use
205
        //! @param flags a set of InfoStringGroup flags which are used to
206
        //! filter the return value - including specified types of information
207
        //! and altering the output format.
208
        //! @return an HTML string containing information about the StelObject.
209
        virtual QString getInfoString(const StelCore *core, const InfoStringGroup& flags=StelObject::AllInfo) const = 0;
210

211
        //! Return a key/value map with data about an object's position, magnitude and so on. Useful in a context like scripting.
212
        //! Derived objects can add their own special information tags.
213
        //! @param core the current StelCore
214
        //! @return a map of object data.  Keys:
215
        //! - above-horizon : true, if celestial body is above horizon
216
        //! - altitude : apparent altitude angle in decimal degrees
217
        //! - azimuth : apparent azimuth angle in decimal degrees
218
        //! - altitude-geometric : geometric altitude angle in decimal degrees
219
        //! - azimuth-geometric : geometric azimuth angle in decimal degrees
220
        //! - airmass : number of airmasses the object's light had to pass through the atmosphere. For negative altitudes this number may be meaningless.
221
        //! - ra : right ascension angle (current date frame) in decimal degrees
222
        //! - dec : declination angle (current date frame) in decimal degrees
223
        //! - raJ2000 : right ascension angle (J2000 frame) in decimal degrees
224
        //! - decJ2000 : declination angle (J2000 frame) in decimal degrees
225
        //! - parallacticAngle : parallactic angle in decimal degrees (for non-star objects only)
226
        //! - hourAngle-dd : hour angle in decimal degrees
227
        //! - hourAngle-hms : hour angle in HMS format (formatted string)
228
        //! - iauConstellation : 3-letter abbreviation of IAU constellation (string)
229
        //! - meanSidTm : mean sidereal time, as time string (on Earth only!)
230
        //! - meanSidTm-dd : mean sidereal time, in decimal degrees (on Earth only!)
231
        //! - appSidTm : mean sidereal time, as time string (on Earth only!)
232
        //! - appSidTm-dd : mean sidereal time, in decimal degrees (on Earth only!)
233
        //! - glong : galactic longitude in decimal degrees
234
        //! - glat : galactic latitude in decimal degrees
235
        //! - sglong : supergalactic longitude in decimal degrees
236
        //! - sglat : supergalactic latitude in decimal degrees
237
        //! - ecliptic-obliquity : mean ecliptic obliquity of date in decimal degrees
238
        //! - elong : ecliptic longitude in decimal degrees (on Earth only!)
239
        //! - elat : ecliptic latitude in decimal degrees (on Earth only!)
240
        //! - elongJ2000 : ecliptic longitude (Earth's J2000 frame) in decimal degrees
241
        //! - elatJ2000 : ecliptic latitude (Earth's J2000 frame) in decimal degrees
242
        //! - vmag : visual magnitude
243
        //! - vmage : visual magnitude (after atmospheric extinction)
244
        //! - size: angular size (diameter) in radians
245
        //! - size-dd : angular size (diameter) in decimal degrees
246
        //! - size-deg : angular size (diameter) in decimal degrees (formatted string)
247
        //! - size-dms : angular size (diameter) in DMS format
248
        //! - rise : time of rise in HM format
249
        //! - rise-dhr : time of rise in decimal hours
250
        //! - transit : time of transit in HM format
251
        //! - transit-dhr : time of transit in decimal hours
252
        //! - set : time of set in HM format
253
        //! - set-dhr : time of set in decimal hours
254
        //! - name : english name of the object
255
        //! - localized-name : localized name
256
        //! - type: type of object' class
257
        //! - object-type: English lowercase name of the type of the object
258
        //! @note Coordinate values may need modulo operation to bring them into ranges [0..360].
259
        virtual QVariantMap getInfoMap(const StelCore *core) const;
260

261
        //! Return object's type. It should be the name of the class.
262
        virtual QString getType() const = 0;
263

264
        //! Return object's type. It should be English lowercase name of the astronomical type of the object.
265
        //! The purpose of this string is a distinction or further refinement over object class name retrieved with getType():
266
        //! Planet objects can be planets, moons, or even the Sun. The Sun should however return "star".
267
        //! Nebula objects should return their actual type like "open cluster", "galaxy", "nebula", ...
268
        virtual QString getObjectType() const = 0;
269
        //! Return object's type. It should be translated lowercase name of the type of the object.
270
        virtual QString getObjectTypeI18n() const = 0;
271

272
        //! Returns a unique identifier for this object.
273
        //! The ID should be unique for all objects of the same type,
274
        //! but may freely conflict with IDs of other types, so getType() must also be tested.
275
        //!
276
        //! With this it should be possible to at least identify the same object
277
        //! in a different instance of Stellarium running the same version, but
278
        //! it would even be better if the ID provides some degree of forward-compatibility.
279
        //! For some object types (e.g. planets) this may simply return getEnglishName(),
280
        //! but better candidates may be official designations or at least (stable) internal IDs.
281
        //!
282
        //! An object may have multiple IDs (different catalog numbers, etc). StelObjectMgr::searchByID()
283
        //! should search through all ID variants, but this method only returns one of them.
284
        virtual QString getID() const = 0;
285

286
        //! Return object's name in english.
287
        //! For non-default skycultures, this is the english translation of the native name.
288
        virtual QString getEnglishName() const = 0;
289

290
        //! Return translated object's name
291
        //! For non-default skycultures, this is the user language translation of the english name (which should be native translated to english).
292
        virtual QString getNameI18n() const = 0;
293

294
        //! Return object's native name in the glyphs as written in skyculture descriptions (index.json).
295
        //! For non-default skycultures, this is as close to the original as possible.
UNCOV
296
        virtual QString getNameNative() const {return QString();}
×
297

298
        //! Return a Latin-letter based transliteration geared at english pronounciation of the native name.
299
        //! This is optional but essential for all skycultures in languages which use non-Latin glyphs.
300
        //! When user language is English, this is the string from index.json.
301
        //! TBD: When user language is different, this may appear adapted to user language.
UNCOV
302
        virtual QString getNamePronounce() const {return QString();}
×
303

304
        //! Return a secondary scientific transliteration of the native name.
305
        //! This is optional and in fact rarely used. An example would be Wylie-transliteration of Tibetan.
UNCOV
306
        virtual QString getNameTransliteration() const {return QString();}
×
307

308
        //! Return native name in International Phonetic Alphabet. Optional.
UNCOV
309
        virtual QString getNameIPA() const {return QString();}
×
310

311
        //! Return screen label (to be used in the sky display. Most users will use some short label)
UNCOV
312
        virtual QString getScreenLabel() const {return QString();}
×
313

314
        //! Return InfoString label (to be used in the InfoString).
315
        //! When dealing with foreign skycultures, many users will want this to be longer, with more name components.
UNCOV
316
        virtual QString getInfoLabel() const {return QString();}
×
317

318
        //! Get observer-centered equatorial coordinates at equinox J2000, including aberration
319
        virtual Vec3d getJ2000EquatorialPos(const StelCore* core) const = 0;
320

321
        //! Get observer-centered equatorial coordinate at the current equinox
322
        //! The frame has its Z axis at the planet's current rotation axis
323
        //! At time 2000-01-01 this frame is almost the same as J2000, but ONLY if the observer is on earth
324
        Vec3d getEquinoxEquatorialPos(const StelCore* core) const;
325
        //! Like getEquinoxEquatorialPos(core), but always adds refraction correction to the position.
326
        Vec3d getEquinoxEquatorialPosApparent(const StelCore* core) const;
327
        //! Like getEquinoxEquatorialPos(core), but adds refraction correction to the position if atmosphere is active.
328
        Vec3d getEquinoxEquatorialPosAuto(const StelCore* core) const;
329

330
        //! Get observer-centered galactic coordinates
331
        Vec3d getGalacticPos(const StelCore* core) const;
332

333
        //! Get observer-centered supergalactic coordinates
334
        Vec3d getSupergalacticPos(const StelCore* core) const;
335

336
        //! Get observer-centered hour angle + declination (at current equinox)
337
        //! It is the geometric position, i.e. without taking refraction effect into account.
338
        //! The frame has its Z axis at the planet's current rotation axis
339
        Vec3d getSiderealPosGeometric(const StelCore* core) const;
340

341
        //! Get observer-centered hour angle + declination (at current equinox)
342
        //! It is the apparent position, i.e. taking the refraction effect into account.
343
        //! The frame has its Z axis at the planet's current rotation axis
344
        Vec3d getSiderealPosApparent(const StelCore* core) const;
345

346
        //! Get observer-centered alt/az position
347
        //! It is the geometric position, i.e. without taking refraction effect into account.
348
        //! The frame has its Z axis at the zenith
349
        Vec3d getAltAzPosGeometric(const StelCore* core) const;
350

351
        //! Get observer-centered alt/az position
352
        //! It is the apparent position, i.e. taking the refraction effect into account.
353
        //! The frame has its Z axis at the zenith
354
        Vec3d getAltAzPosApparent(const StelCore* core) const;
355

356
        //! Get observer-centered alt/az position
357
        //! It is the automatic position, i.e. taking the refraction effect into account if atmosphere is on.
358
        //! The frame has its Z axis at the zenith
359
        Vec3d getAltAzPosAuto(const StelCore* core) const;
360

361
        //! Get parallactic angle, which is the deviation between zenith angle and north angle. [radians]
362
        float getParallacticAngle(const StelCore* core) const;
363

364
        //! Checking position an object above mathematical horizon for current location.
365
        //! @return true if object an above mathematical horizon
366
        bool isAboveHorizon(const StelCore* core) const;
367

368
        //! Checking position an object above real horizon for current location.
369
        //! @return true if object an above real horizon (uses test for landscapes)
370
        bool isAboveRealHorizon(const StelCore* core) const;
371

372
        //! Compute time of rise, transit and set for celestial object for current location.
373
        //! @param core the currently active StelCore object
374
        //! @param altitude (optional; default=0) altitude of the object, degrees.
375
        //!        Setting this to -6. for the Sun will find begin and end for civil twilight.
376
        //! @return Vec4d - time of rise, transit and set closest to current time; JD.
377
        //! @note The fourth element flags particular conditions:
378
        //!       *  +100. for circumpolar objects. Rise and set give lower culmination times.
379
        //!       *  -100. for objects never rising. Rise and set give transit times.
380
        //!       * -1000. is used as "invalid" value. The result should then not be used.
381
        //!       *   +20. (Planet objects only) no transit time on current date.
382
        //!       *   +30. (Planet objects only) no rise time on current date.
383
        //!       *   +40. (Planet objects only) no set time on current date.
384
        //! @note This is an abbreviated version of the method implemented in the Planet class.
385

386
        virtual Vec4d getRTSTime(const StelCore* core, const double altitude=0.) const;
387

388
        //! Return object's apparent V magnitude as seen from observer, without including extinction.
389
        virtual float getVMagnitude(const StelCore* core) const;
390
        
391
        //! Return object's apparent V magnitude as seen from observer including extinction.
392
        //! Extinction obviously only if atmosphere=on.
393
        //! If you already know vMag, it is wise to provide it in the optional @param knownVMag.
394
        //! Else it is called from getVMagnitude() which may be costly.
UNCOV
395
        float getVMagnitudeWithExtinction(const StelCore* core, const float knownVMag=-1000.f, const float& magOffset=0.f) const;
×
396

397
        //! Return a priority value which is used to discriminate objects by priority
398
        //! As for magnitudes, the lower is the higher priority
399
        virtual float getSelectPriority(const StelCore*) const;
400

401
        //! Get a color used to display info about the object
UNCOV
402
        virtual Vec3f getInfoColor() const {return Vec3f(1.f,1.f,1.f);}
×
403

404
        //! Return the best FOV in degree to use for a close view of the object
UNCOV
405
        virtual double getCloseViewFov(const StelCore*) const {return 10.;}
×
406

407
        //! Return the best FOV in degree to use for a global view of the object satellite system (if there are satellites)
UNCOV
408
        virtual double getSatellitesFov(const StelCore*) const {return -1.;}
×
UNCOV
409
        virtual double getParentSatellitesFov(const StelCore*) const {return -1.;}
×
410

411
        //! Return the angular radius of a circle containing the object as seen from the observer
412
        //! with the circle center assumed to be at getJ2000EquatorialPos().
413
        //! @return radius in degree. This value is the apparent angular size of the object, and is independent of the current FOV.
414
        //! @note The default implementation just returns zero.
UNCOV
415
        virtual double getAngularRadius(const StelCore* core) const { Q_UNUSED(core) return 0.; }
×
416

417
        //! Return airmass value for the object (for atmosphere-dependent calculations)
418
        //! @param core
419
        //! @return airmass value or -1.f if calculations are not applicable or meaningless
420
        virtual float getAirmass(const StelCore *core) const;
421

422
public slots:
423
        //! Allow additions to the Info String. Can be used by plugins to show extra info for the selected object, or for debugging.
424
        //! Hard-set this string group to a single str, or delete all messages when str==""
425
        //! @note This should be used with caution. Usually you want to use addToExtraInfoString().
426
        //! @note: If this breaks some const declaration, you can use StelObjectMgr::setExtraInfoString() instead.
427
        virtual void setExtraInfoString(const InfoStringGroup& flags, const QString &str);
428
        //! Add str to the extra string. This should be preferable over hard setting.
429
        //! Can be used by plugins to show extra info for the selected object, or for debugging.
430
        //! The strings will be shown in the InfoString for the selected object, below the default fields per-flag.
431
        //! Additional coordinates not fitting into one of the predefined coordinate sets should be flagged with OtherCoords,
432
        //! and must be adapted to table or non-table layout as required.
433
        //! The line ending must be given explicitly, usually just end a line with "<br/>", except when it may end up in a Table or appended to a line.
434
        //! See getCommonInfoString() or the respective getInfoString() in the subclasses for details of use.
435
        //! @note: If this breaks some const declaration, you can use StelObjectMgr::addToExtraInfoString() instead.
436
        virtual void addToExtraInfoString(const StelObject::InfoStringGroup& flags, const QString &str);
437
        //! Retrieve an (unsorted) QStringList of all extra info strings that match flags.
438
        //! Normally the order matches the order of addition, but this cannot be guaranteed.
439
        //! @note: Usually objects should keep their extraInfoStrings to themselves. But there are cases where StelObjectMgr::setExtraInfoString() has been set.
440
        QStringList getExtraInfoStrings(const InfoStringGroup& flags) const;
441
        //! Remove the extraInfoStrings with the given flags.
442
        //! This is a finer-grained removal than just extraInfoStrings.remove(flags), as it allows a combination of flags.
443
        //! After display, InfoPanel::setTextFromObjects() auto-clears the strings of the selected object using the AllInfo constant.
444
        //! extraInfoStrings having been set with the DebugAid and Script flags have to be removed by separate calls of this method.
445
        //! Those which have been set by scripts have to persist at least as long as the selection remains active.
446
        //! The behaviour of DebugAid texts depends on the use case.
447
        //! @note: Usually objects should keep their extraInfoStrings to themselves. But there are cases where StelObjectMgr::setExtraInfoString() has been set.
448
        void removeExtraInfoStrings(const InfoStringGroup& flags);
449

450
protected:
451
        //! Format the positional info string containing J2000/of date/altaz/hour angle positions and constellation, sidereal time, etc. for the object
452
        //! FIXME: We should split this and provide shorter virtual methods for various parts of the InfoString.
453
        //! The ExtraInfoStrings should be placed per flag, where they best fit.
454
        QString getCommonInfoString(const StelCore *core, const InfoStringGroup& flags) const;
455

456
        //! Format the magnitude info string for the object
457
        //! @param core
458
        //! @param flags
459
        //! @param decimals significant digits after the comma.
460
        //! @param magOffset magnitude offset to apply to display final apparent magnitude, are used if a star distance has changed in the past/future
UNCOV
461
        virtual QString getMagnitudeInfoString(const StelCore *core, const InfoStringGroup& flags, const int decimals=1, const float& magOffset=0.f) const;
×
462

463
        //! Add a section to the InfoString with just horizontal data for the Sun and Moon, when observed from Earth.
464
        //! The application of this is to have quick info while observing other objects.
465
        QString getSolarLunarInfoString(const StelCore *core, const InfoStringGroup& flags) const;
466

467
        //! Apply post processing on the info string.
468
        //! This also removes all extraInfoStrings possibly injected by modules (plugins) etc., except for Script and DebugAid types.
469
        void postProcessInfoString(QString& str, const InfoStringGroup& flags) const;
470

471
private:
472
        //! Location for additional object info that can be set for special purposes (at least for debugging, but maybe others), even via scripting.
473
        //! Modules are allowed to add new strings to be displayed in the various getInfoString() methods of subclasses.
474
        //! This helps avoiding screen collisions if a plugin wants to display some additional object information.
475
        //! This string map gets cleared by InfoPanel::setTextFromObjects(), with the exception of strings with Script or DebugAid flags,
476
        //! which have been injected by scripts or for debugging (take care of those yourself!).
477
        QMultiMap<InfoStringGroup, QString> extraInfoStrings;
478

479
        static int stelObjectPMetaTypeID;
480
};
481

482
Q_DECLARE_OPERATORS_FOR_FLAGS(StelObject::InfoStringGroup)
483

484
#endif // STELOBJECT_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