• 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

4.17
/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, ...), and Zodiacal sign and Lunar station/mansion where defined
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
        };
165
        Q_ENUM(CulturalDisplayStyle)
×
166

167
        //! @struct CulturalName
168
        //! Contains name components belonging to an object.
169
        //!
170
        enum class CulturalNameSpecial
171
        {
172
                None = 0,        //!< Nothing special
173
                Morning = 1,     //!< This name is used for Mercury or Venus in Western elongation, i.e., "morning star"
174
                Evening = 2      //!< This name is used for Mercury or Venus in Eastern elongation, i.e., "evening star"
175
        };
176
        Q_ENUM(CulturalNameSpecial)
177
        struct CulturalName
178
        {
179
                QString native;           //!< native name in native glyphs
180
                QString pronounce;        //!< native name in a Latin-based transliteration usable as pronunciation aid for English
181
                QString pronounceI18n;    //!< native name in a transliteration scheme in user-language usable as pronunciation aid
182
                QString transliteration;  //!< native name in a science-based transliteration scheme not geared at pronunciation (e.g. Tibetan Wylie; rarely used).
183
                QString translated;       //!< Native name translated to English. NOT the same as the usual object's englishName!
184
                QString translatedI18n;   //!< Translated name (user language)
185
                QString IPA;              //!< native name expressed in International Phonetic Alphabet
186
                StelObject::CulturalNameSpecial special;          //!< any particular extra application?
187
                CulturalName(): special(StelObject::CulturalNameSpecial::None){};
×
188
                CulturalName(QString nat, QString pr, QString prI18n, QString trl,
×
189
                             QString tra, QString traI18n, QString ipa, StelObject::CulturalNameSpecial sp=StelObject::CulturalNameSpecial::None):
×
190
                        native(nat), pronounce(pr), pronounceI18n(prI18n), transliteration(trl),
×
191
                        translated(tra), translatedI18n(traI18n), IPA(ipa),
×
192
                        special(sp){};
×
193
        };
194

195
        //! A pre-defined "all available" set of specifiers for the getInfoString flags argument to getInfoString
196
        static constexpr InfoStringGroup AllInfo = static_cast<InfoStringGroup>(Name|CatalogNumber|Magnitude|RaDecJ2000|RaDecOfDate|AltAzi|
197
                                                                           Distance|Elongation|Size|Velocity|ProperMotion|Extra|HourAngle|AbsoluteMagnitude|
198
                                                                           GalacticCoord|SupergalacticCoord|OtherCoord|ObjectType|EclipticCoordJ2000|
199
                                                                           EclipticCoordOfDate|IAUConstellation|SiderealTime|RTSTime|SolarLunarPosition);
200
        //! A pre-defined "default" set of specifiers for the getInfoString flags argument to getInfoString
201
        //! It appears useful to propose this set as post-install settings and let users configure more on demand.
202
        static constexpr InfoStringGroup DefaultInfo = static_cast<InfoStringGroup>(Name|CatalogNumber|Magnitude|RaDecOfDate|HourAngle|AltAzi|OtherCoord|
203
                                                                                          Distance|Elongation|Size|Velocity|Extra|IAUConstellation|SiderealTime|RTSTime);
204
        //! A pre-defined "shortest useful" set of specifiers for the getInfoString flags argument to getInfoString
205
        static constexpr InfoStringGroup ShortInfo = static_cast<InfoStringGroup>(Name|CatalogNumber|Magnitude|RaDecJ2000);
206

207
        ~StelObject() override {}
1✔
208

209
        //! Default implementation of the getRegion method.
210
        //! Return the spatial region of the object.
211
        SphericalRegionP getRegion() const override {return SphericalRegionP(new SphericalPoint(getJ2000EquatorialPos(Q_NULLPTR)));}
×
212

213
        //! Default implementation of the getPointInRegion method.
214
        //! Return the J2000 Equatorial Position of the object.
215
        Vec3d getPointInRegion() const override {return getJ2000EquatorialPos(Q_NULLPTR);}
×
216
        
217
        //! Write I18n information about the object in QString.
218
        //! @param core the StelCore object to use
219
        //! @param flags a set of InfoStringGroup flags which are used to
220
        //! filter the return value - including specified types of information
221
        //! and altering the output format.
222
        //! @return an HTML string containing information about the StelObject.
223
        virtual QString getInfoString(const StelCore *core, const InfoStringGroup& flags=StelObject::AllInfo) const = 0;
224

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

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

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

286
        //! Returns a unique identifier for this object.
287
        //! The ID should be unique for all objects of the same type,
288
        //! but may freely conflict with IDs of other types, so getType() must also be tested.
289
        //!
290
        //! With this it should be possible to at least identify the same object
291
        //! in a different instance of Stellarium running the same version, but
292
        //! it would even be better if the ID provides some degree of forward-compatibility.
293
        //! For some object types (e.g. planets) this may simply return getEnglishName(),
294
        //! but better candidates may be official designations or at least (stable) internal IDs.
295
        //!
296
        //! An object may have multiple IDs (different catalog numbers, etc). StelObjectMgr::searchByID()
297
        //! should search through all ID variants, but this method only returns one of them.
298
        virtual QString getID() const = 0;
299

300
        //! Return object's name in english.
301
        //! For non-default skycultures, this is the english translation of the native name.
302
        virtual QString getEnglishName() const = 0;
303

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

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

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

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

322
        //! Return native name in International Phonetic Alphabet. Optional.
323
        virtual QString getNameIPA() const {return QString();}
×
324

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

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

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

335
        //! Get observer-centered equatorial coordinate at the current equinox
336
        //! The frame has its Z axis at the planet's current rotation axis
337
        //! At time 2000-01-01 this frame is almost the same as J2000, but ONLY if the observer is on earth
338
        Vec3d getEquinoxEquatorialPos(const StelCore* core) const;
339
        //! Like getEquinoxEquatorialPos(core), but always adds refraction correction to the position.
340
        Vec3d getEquinoxEquatorialPosApparent(const StelCore* core) const;
341
        //! Like getEquinoxEquatorialPos(core), but adds refraction correction to the position if atmosphere is active.
342
        Vec3d getEquinoxEquatorialPosAuto(const StelCore* core) const;
343

344
        //! Get observer-centered galactic coordinates
345
        Vec3d getGalacticPos(const StelCore* core) const;
346

347
        //! Get observer-centered supergalactic coordinates
348
        Vec3d getSupergalacticPos(const StelCore* core) const;
349

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

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

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

365
        //! Get observer-centered alt/az position
366
        //! It is the apparent position, i.e. taking the refraction effect into account.
367
        //! The frame has its Z axis at the zenith
368
        Vec3d getAltAzPosApparent(const StelCore* core) const;
369

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

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

378
        //! Checking position an object above mathematical horizon for current location.
379
        //! @return true if object an above mathematical horizon
380
        bool isAboveHorizon(const StelCore* core) const;
381

382
        //! Checking position an object above real horizon for current location.
383
        //! @return true if object an above real horizon (uses test for landscapes)
384
        bool isAboveRealHorizon(const StelCore* core) const;
385

386
        //! Compute time of rise, transit and set for celestial object for current location.
387
        //! @param core the currently active StelCore object
388
        //! @param altitude (optional; default=0) altitude of the object, degrees.
389
        //!        Setting this to -6. for the Sun will find begin and end for civil twilight.
390
        //! @return Vec4d - time of rise, transit and set closest to current time; JD.
391
        //! @note The fourth element flags particular conditions:
392
        //!       *  +100. for circumpolar objects. Rise and set give lower culmination times.
393
        //!       *  -100. for objects never rising. Rise and set give transit times.
394
        //!       * -1000. is used as "invalid" value. The result should then not be used.
395
        //!       *   +20. (Planet objects only) no transit time on current date.
396
        //!       *   +30. (Planet objects only) no rise time on current date.
397
        //!       *   +40. (Planet objects only) no set time on current date.
398
        //! @note This is an abbreviated version of the method implemented in the Planet class.
399

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

402
        //! Return object's apparent V magnitude as seen from observer, without including extinction.
403
        virtual float getVMagnitude(const StelCore* core) const;
404
        
405
        //! Return object's apparent V magnitude as seen from observer including extinction.
406
        //! Extinction obviously only if atmosphere=on.
407
        //! If you already know vMag, it is wise to provide it in the optional @param knownVMag.
408
        //! Else it is called from getVMagnitude() which may be costly.
409
        float getVMagnitudeWithExtinction(const StelCore* core, const float knownVMag=-1000.f, const float& magOffset=0.f) const;
×
410

411
        //! Return a priority value which is used to discriminate objects by priority
412
        //! As for magnitudes, the lower is the higher priority
413
        virtual float getSelectPriority(const StelCore*) const;
414

415
        //! Get a color used to display info about the object
416
        virtual Vec3f getInfoColor() const {return Vec3f(1.f,1.f,1.f);}
×
417

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

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

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

431
        //! Return airmass value for the object (for atmosphere-dependent calculations)
432
        //! @param core
433
        //! @return airmass value or -1.f if calculations are not applicable or meaningless
434
        virtual float getAirmass(const StelCore *core) const;
435

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

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

470
        //! Format the magnitude info string for the object
471
        //! @param core
472
        //! @param flags
473
        //! @param decimals significant digits after the comma.
474
        //! @param magOffset magnitude offset to apply to display final apparent magnitude, are used if a star distance has changed in the past/future
475
        virtual QString getMagnitudeInfoString(const StelCore *core, const InfoStringGroup& flags, const int decimals=1, const float& magOffset=0.f) const;
×
476

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

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

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

493
        static int stelObjectPMetaTypeID;
494
};
495

496
Q_DECLARE_OPERATORS_FOR_FLAGS(StelObject::InfoStringGroup)
497

498
#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