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

Stellarium / stellarium / 17068063291

19 Aug 2025 11:22AM UTC coverage: 11.766%. Remained the same
17068063291

push

github

alex-w
Reformatting

14706 of 124990 relevant lines covered (11.77%)

18303.49 hits per line

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

4.0
/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 7-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_Byname_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
        //! - byname, an explanatory description. Note that this came in late and is encoded in bit 0x40, while the name particle is always in front of "Modern"
98
        //! - Modern name (useful for stars and planets only). Helpful to see the modern name in context.
99
        enum class CulturalDisplayStyle
100
        {
101
                NONE                                                   = 0x00,
102
                Modern                                                 = 0x01,
103
                IPA                                                    = 0x02,
104
                IPA_Modern                                             = 0x03,
105
                Translated                                             = 0x04,
106
                Translated_Modern                                      = 0x05,
107
                Translated_IPA                                         = 0x06,
108
                Translated_IPA_Modern                                  = 0x07,
109
                Translit                                               = 0x08,
110
                Translit_Modern                                        = 0x09,
111
                Translit_IPA                                           = 0x0A,
112
                Translit_IPA_Modern                                    = 0x0B,
113
                Translit_Translated                                    = 0x0C,
114
                Translit_Translated_Modern                             = 0x0D,
115
                Translit_Translated_IPA                                = 0x0E,
116
                Translit_Translated_IPA_Modern                         = 0x0F,
117
                Pronounce                                              = 0x10,
118
                Pronounce_Modern                                       = 0x11,
119
                Pronounce_IPA                                          = 0x12,
120
                Pronounce_IPA_Modern                                   = 0x13,
121
                Pronounce_Translated                                   = 0x14,
122
                Pronounce_Translated_Modern                            = 0x15,
123
                Pronounce_Translated_IPA                               = 0x16,
124
                Pronounce_Translated_IPA_Modern                        = 0x17,
125
                Pronounce_Translit                                     = 0x18,
126
                Pronounce_Translit_Modern                              = 0x19,
127
                Pronounce_Translit_IPA                                 = 0x1A,
128
                Pronounce_Translit_IPA_Modern                          = 0x1B,
129
                Pronounce_Translit_Translated                          = 0x1C,
130
                Pronounce_Translit_Translated_Modern                   = 0x1D,
131
                Pronounce_Translit_Translated_IPA                      = 0x1E,
132
                Pronounce_Translit_Translated_IPA_Modern               = 0x1F,
133
                Native                                                 = 0x20,
134
                Native_Modern                                          = 0x21,
135
                Native_IPA                                             = 0x22,
136
                Native_IPA_Modern                                      = 0x23,
137
                Native_Translated                                      = 0x24,
138
                Native_Translated_Modern                               = 0x25,
139
                Native_Translated_IPA                                  = 0x26,
140
                Native_Translated_IPA_Modern                           = 0x27,
141
                Native_Translit                                        = 0x28,
142
                Native_Translit_Modern                                 = 0x29,
143
                Native_Translit_IPA                                    = 0x2A,
144
                Native_Translit_IPA_Modern                             = 0x2B,
145
                Native_Translit_Translated                             = 0x2C,
146
                Native_Translit_Translated_Modern                      = 0x2D,
147
                Native_Translit_Translated_IPA                         = 0x2E,
148
                Native_Translit_Translated_IPA_Modern                  = 0x2F,
149
                Native_Pronounce                                       = 0x30,
150
                Native_Pronounce_Modern                                = 0x31,
151
                Native_Pronounce_IPA                                   = 0x32,
152
                Native_Pronounce_IPA_Modern                            = 0x33,
153
                Native_Pronounce_Translated                            = 0x34,
154
                Native_Pronounce_Translated_Modern                     = 0x35,
155
                Native_Pronounce_Translated_IPA                        = 0x36,
156
                Native_Pronounce_Translated_IPA_Modern                 = 0x37,
157
                Native_Pronounce_Translit                              = 0x38,
158
                Native_Pronounce_Translit_Modern                       = 0x39,
159
                Native_Pronounce_Translit_IPA                          = 0x3A,
160
                Native_Pronounce_Translit_IPA_Modern                   = 0x3B,
161
                Native_Pronounce_Translit_Translated                   = 0x3C,
162
                Native_Pronounce_Translit_Translated_Modern            = 0x3D,
163
                Native_Pronounce_Translit_Translated_IPA               = 0x3E,
164
                Native_Pronounce_Translit_Translated_IPA_Modern        = 0x3F,
165
                Byname                                                 = 0x40,
166
                Byname_Modern                                          = 0x41,
167
                IPA_Byname                                             = 0x42,
168
                IPA_Byname_Modern                                      = 0x43,
169
                Translated_Byname                                      = 0x44,
170
                Translated_Byname_Modern                               = 0x45,
171
                Translated_IPA_Byname                                  = 0x46,
172
                Translated_IPA_Byname_Modern                           = 0x47,
173
                Translit_Byname                                        = 0x48,
174
                Translit_Byname_Modern                                 = 0x49,
175
                Translit_IPA_Byname                                    = 0x4A,
176
                Translit_IPA_Byname_Modern                             = 0x4B,
177
                Translit_Translated_Byname                             = 0x4C,
178
                Translit_Translated_Byname_Modern                      = 0x4D,
179
                Translit_Translated_IPA_Byname                         = 0x4E,
180
                Translit_Translated_IPA_Byname_Modern                  = 0x4F,
181
                Pronounce_Byname                                       = 0x50,
182
                Pronounce_Byname_Modern                                = 0x51,
183
                Pronounce_IPA_Byname                                   = 0x52,
184
                Pronounce_IPA_Byname_Modern                            = 0x53,
185
                Pronounce_Translated_Byname                            = 0x54,
186
                Pronounce_Translated_Byname_Modern                     = 0x55,
187
                Pronounce_Translated_IPA_Byname                        = 0x56,
188
                Pronounce_Translated_IPA_Byname_Modern                 = 0x57,
189
                Pronounce_Translit_Byname                              = 0x58,
190
                Pronounce_Translit_Byname_Modern                       = 0x59,
191
                Pronounce_Translit_IPA_Byname                          = 0x5A,
192
                Pronounce_Translit_IPA_Byname_Modern                   = 0x5B,
193
                Pronounce_Translit_Translated_Byname                   = 0x5C,
194
                Pronounce_Translit_Translated_Byname_Modern            = 0x5D,
195
                Pronounce_Translit_Translated_IPA_Byname               = 0x5E,
196
                Pronounce_Translit_Translated_IPA_Byname_Modern        = 0x5F,
197
                Native_Byname                                          = 0x60,
198
                Native_Byname_Modern                                   = 0x61,
199
                Native_IPA_Byname                                      = 0x62,
200
                Native_IPA_Byname_Modern                               = 0x63,
201
                Native_Translated_Byname                               = 0x64,
202
                Native_Translated_Byname_Modern                        = 0x65,
203
                Native_Translated_IPA_Byname                           = 0x66,
204
                Native_Translated_IPA_Byname_Modern                    = 0x67,
205
                Native_Translit_Byname                                 = 0x68,
206
                Native_Translit_Byname_Modern                          = 0x69,
207
                Native_Translit_IPA_Byname                             = 0x6A,
208
                Native_Translit_IPA_Byname_Modern                      = 0x6B,
209
                Native_Translit_Translated_Byname                      = 0x6C,
210
                Native_Translit_Translated_Byname_Modern               = 0x6D,
211
                Native_Translit_Translated_IPA_Byname                  = 0x6E,
212
                Native_Translit_Translated_IPA_Byname_Modern           = 0x6F,
213
                Native_Pronounce_Byname                                = 0x70,
214
                Native_Pronounce_Byname_Modern                         = 0x71,
215
                Native_Pronounce_IPA_Byname                            = 0x72,
216
                Native_Pronounce_IPA_Byname_Modern                     = 0x73,
217
                Native_Pronounce_Translated_Byname                     = 0x74,
218
                Native_Pronounce_Translated_Byname_Modern              = 0x75,
219
                Native_Pronounce_Translated_IPA_Byname                 = 0x76,
220
                Native_Pronounce_Translated_IPA_Byname_Modern          = 0x77,
221
                Native_Pronounce_Translit_Byname                       = 0x78,
222
                Native_Pronounce_Translit_Byname_Modern                = 0x79,
223
                Native_Pronounce_Translit_IPA_Byname                   = 0x7A,
224
                Native_Pronounce_Translit_IPA_Byname_Modern            = 0x7B,
225
                Native_Pronounce_Translit_Translated_Byname            = 0x7C,
226
                Native_Pronounce_Translit_Translated_Byname_Modern     = 0x7D,
227
                Native_Pronounce_Translit_Translated_IPA_Byname        = 0x7E,
228
                Native_Pronounce_Translit_Translated_IPA_Byname_Modern = 0x7F
229
        };
230
        Q_ENUM(CulturalDisplayStyle)
×
231

232
        //! @struct CulturalName
233
        //! Contains name components belonging to an object.
234
        //!
235
        enum class CulturalNameSpecial
236
        {
237
                None = 0,        //!< Nothing special
238
                Morning = 1,     //!< This name is used for Mercury or Venus in Western elongation, i.e., "morning star"
239
                Evening = 2      //!< This name is used for Mercury or Venus in Eastern elongation, i.e., "evening star"
240
        };
241
        Q_ENUM(CulturalNameSpecial)
242
        struct CulturalName
243
        {
244
                QString native;           //!< native name in native glyphs
245
                QString pronounce;        //!< native name in a Latin-based transliteration usable as pronunciation aid for English
246
                QString pronounceI18n;    //!< native name in a transliteration scheme in user-language usable as pronunciation aid
247
                QString transliteration;  //!< native name in a science-based transliteration scheme not geared at pronunciation (e.g. Tibetan Wylie; rarely used).
248
                QString translated;       //!< Native name translated to English. NOT the same as the usual object's englishName!
249
                QString translatedI18n;   //!< Translated name (user language)
250
                QString IPA;              //!< native name expressed in International Phonetic Alphabet
251
                QString byname;           //!< explanatory byname. In tradition of al-Sufi (Andromeda=Chained Woman), but useful for other SCs as well. Currently only ever used for constellations.
252
                QString bynameI18n;       //!< explanatory byname translated to user language.
253
                StelObject::CulturalNameSpecial special;          //!< any particular extra application?
254
                CulturalName(): special(StelObject::CulturalNameSpecial::None){};
×
255
                CulturalName(const QString &nat, const QString &pr, const QString &prI18n, const QString &trl,
×
256
                             const QString &tra, const QString &traI18n, const QString &ipa, const QString &by = "", const QString &byI18n = "", StelObject::CulturalNameSpecial sp = StelObject::CulturalNameSpecial::None):
×
257
                        native(nat), pronounce(pr), pronounceI18n(prI18n), transliteration(trl),
×
258
                        translated(tra), translatedI18n(traI18n), IPA(ipa), byname(by), bynameI18n(byI18n),
×
259
                        special(sp){};
×
260
        };
261

262
        //! A pre-defined "all available" set of specifiers for the getInfoString flags argument to getInfoString
263
        static constexpr InfoStringGroup AllInfo = static_cast<InfoStringGroup>(Name|CatalogNumber|Magnitude|RaDecJ2000|RaDecOfDate|AltAzi|
264
                                                                           Distance|Elongation|Size|Velocity|ProperMotion|Extra|HourAngle|AbsoluteMagnitude|
265
                                                                           GalacticCoord|SupergalacticCoord|OtherCoord|ObjectType|EclipticCoordJ2000|
266
                                                                           EclipticCoordOfDate|IAUConstellation|SiderealTime|RTSTime|SolarLunarPosition);
267
        //! A pre-defined "default" set of specifiers for the getInfoString flags argument to getInfoString
268
        //! It appears useful to propose this set as post-install settings and let users configure more on demand.
269
        static constexpr InfoStringGroup DefaultInfo = static_cast<InfoStringGroup>(Name|CatalogNumber|Magnitude|RaDecOfDate|HourAngle|AltAzi|OtherCoord|
270
                                                                                          Distance|Elongation|Size|Velocity|Extra|IAUConstellation|SiderealTime|RTSTime);
271
        //! A pre-defined "shortest useful" set of specifiers for the getInfoString flags argument to getInfoString
272
        static constexpr InfoStringGroup ShortInfo = static_cast<InfoStringGroup>(Name|CatalogNumber|Magnitude|RaDecJ2000);
273

274
        ~StelObject() override {}
1✔
275

276
        //! Default implementation of the getRegion method.
277
        //! Return the spatial region of the object.
278
        SphericalRegionP getRegion() const override {return SphericalRegionP(new SphericalPoint(getJ2000EquatorialPos(Q_NULLPTR)));}
×
279

280
        //! Default implementation of the getPointInRegion method.
281
        //! Return the J2000 Equatorial Position of the object.
282
        Vec3d getPointInRegion() const override {return getJ2000EquatorialPos(Q_NULLPTR);}
×
283
        
284
        //! Write I18n information about the object in QString.
285
        //! @param core the StelCore object to use
286
        //! @param flags a set of InfoStringGroup flags which are used to
287
        //! filter the return value - including specified types of information
288
        //! and altering the output format.
289
        //! @return an HTML string containing information about the StelObject.
290
        virtual QString getInfoString(const StelCore *core, const InfoStringGroup& flags=StelObject::AllInfo) const = 0;
291

292
        //! Return a key/value map with data about an object's position, magnitude and so on. Useful in a context like scripting.
293
        //! Derived objects can add their own special information tags.
294
        //! @param core the current StelCore
295
        //! @return a map of object data.  Keys:
296
        //! - above-horizon : true, if celestial body is above horizon
297
        //! - altitude : apparent altitude angle in decimal degrees
298
        //! - azimuth : apparent azimuth angle in decimal degrees
299
        //! - altitude-geometric : geometric altitude angle in decimal degrees
300
        //! - azimuth-geometric : geometric azimuth angle in decimal degrees
301
        //! - airmass : number of airmasses the object's light had to pass through the atmosphere. For negative altitudes this number may be meaningless.
302
        //! - ra : right ascension angle (current date frame) in decimal degrees
303
        //! - dec : declination angle (current date frame) in decimal degrees
304
        //! - raJ2000 : right ascension angle (J2000 frame) in decimal degrees
305
        //! - decJ2000 : declination angle (J2000 frame) in decimal degrees
306
        //! - parallacticAngle : parallactic angle in decimal degrees (for non-star objects only)
307
        //! - hourAngle-dd : hour angle in decimal degrees
308
        //! - hourAngle-hms : hour angle in HMS format (formatted string)
309
        //! - iauConstellation : 3-letter abbreviation of IAU constellation (string)
310
        //! - meanSidTm : mean sidereal time, as time string (on Earth only!)
311
        //! - meanSidTm-dd : mean sidereal time, in decimal degrees (on Earth only!)
312
        //! - appSidTm : mean sidereal time, as time string (on Earth only!)
313
        //! - appSidTm-dd : mean sidereal time, in decimal degrees (on Earth only!)
314
        //! - glong : galactic longitude in decimal degrees
315
        //! - glat : galactic latitude in decimal degrees
316
        //! - sglong : supergalactic longitude in decimal degrees
317
        //! - sglat : supergalactic latitude in decimal degrees
318
        //! - ecliptic-obliquity : mean ecliptic obliquity of date in decimal degrees
319
        //! - elong : ecliptic longitude in decimal degrees (on Earth only!)
320
        //! - elat : ecliptic latitude in decimal degrees (on Earth only!)
321
        //! - elongJ2000 : ecliptic longitude (Earth's J2000 frame) in decimal degrees
322
        //! - elatJ2000 : ecliptic latitude (Earth's J2000 frame) in decimal degrees
323
        //! - vmag : visual magnitude
324
        //! - vmage : visual magnitude (after atmospheric extinction)
325
        //! - size: angular size (diameter) in radians
326
        //! - size-dd : angular size (diameter) in decimal degrees
327
        //! - size-deg : angular size (diameter) in decimal degrees (formatted string)
328
        //! - size-dms : angular size (diameter) in DMS format
329
        //! - rise : time of rise in HM format
330
        //! - rise-dhr : time of rise in decimal hours
331
        //! - transit : time of transit in HM format
332
        //! - transit-dhr : time of transit in decimal hours
333
        //! - set : time of set in HM format
334
        //! - set-dhr : time of set in decimal hours
335
        //! - name : english name of the object
336
        //! - localized-name : localized name
337
        //! - type: type of object' class
338
        //! - object-type: English lowercase name of the type of the object
339
        //! @note Coordinate values may need modulo operation to bring them into ranges [0..360].
340
        virtual QVariantMap getInfoMap(const StelCore *core) const;
341

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

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

353
        //! Returns a unique identifier for this object.
354
        //! The ID should be unique for all objects of the same type,
355
        //! but may freely conflict with IDs of other types, so getType() must also be tested.
356
        //!
357
        //! With this it should be possible to at least identify the same object
358
        //! in a different instance of Stellarium running the same version, but
359
        //! it would even be better if the ID provides some degree of forward-compatibility.
360
        //! For some object types (e.g. planets) this may simply return getEnglishName(),
361
        //! but better candidates may be official designations or at least (stable) internal IDs.
362
        //!
363
        //! An object may have multiple IDs (different catalog numbers, etc). StelObjectMgr::searchByID()
364
        //! should search through all ID variants, but this method only returns one of them.
365
        virtual QString getID() const = 0;
366

367
        //! Return object's name in english.
368
        //! For non-default skycultures, this is the english translation of the native name.
369
        virtual QString getEnglishName() const = 0;
370

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

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

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

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

389
        //! Return native name in International Phonetic Alphabet. Optional.
390
        virtual QString getNameIPA() const {return QString();}
×
391

392
        //! Return byname. Optional.
393
        virtual QString getByname() const {return QString();}
×
394

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

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

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

405
        //! Get observer-centered equatorial coordinate at the current equinox
406
        //! The frame has its Z axis at the planet's current rotation axis
407
        //! At time 2000-01-01 this frame is almost the same as J2000, but ONLY if the observer is on earth
408
        Vec3d getEquinoxEquatorialPos(const StelCore* core) const;
409
        //! Like getEquinoxEquatorialPos(core), but always adds refraction correction to the position.
410
        Vec3d getEquinoxEquatorialPosApparent(const StelCore* core) const;
411
        //! Like getEquinoxEquatorialPos(core), but adds refraction correction to the position if atmosphere is active.
412
        Vec3d getEquinoxEquatorialPosAuto(const StelCore* core) const;
413

414
        //! Get observer-centered galactic coordinates
415
        Vec3d getGalacticPos(const StelCore* core) const;
416

417
        //! Get observer-centered supergalactic coordinates
418
        Vec3d getSupergalacticPos(const StelCore* core) const;
419

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

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

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

435
        //! Get observer-centered alt/az position
436
        //! It is the apparent position, i.e. taking the refraction effect into account.
437
        //! The frame has its Z axis at the zenith
438
        Vec3d getAltAzPosApparent(const StelCore* core) const;
439

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

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

448
        //! Checking position an object above mathematical horizon for current location.
449
        //! @return true if object an above mathematical horizon
450
        bool isAboveHorizon(const StelCore* core) const;
451

452
        //! Checking position an object above real horizon for current location.
453
        //! @return true if object an above real horizon (uses test for landscapes)
454
        bool isAboveRealHorizon(const StelCore* core) const;
455

456
        //! Compute time of rise, transit and set for celestial object for current location.
457
        //! @param core the currently active StelCore object
458
        //! @param altitude (optional; default=0) altitude of the object, degrees.
459
        //!        Setting this to -6. for the Sun will find begin and end for civil twilight.
460
        //! @return Vec4d - time of rise, transit and set closest to current time; JD.
461
        //! @note The fourth element flags particular conditions:
462
        //!       *  +100. for circumpolar objects. Rise and set give lower culmination times.
463
        //!       *  -100. for objects never rising. Rise and set give transit times.
464
        //!       * -1000. is used as "invalid" value. The result should then not be used.
465
        //!       *   +20. (Planet objects only) no transit time on current date.
466
        //!       *   +30. (Planet objects only) no rise time on current date.
467
        //!       *   +40. (Planet objects only) no set time on current date.
468
        //! @note This is an abbreviated version of the method implemented in the Planet class.
469

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

472
        //! Return object's apparent V magnitude as seen from observer, without including extinction.
473
        virtual float getVMagnitude(const StelCore* core) const;
474
        
475
        //! Return object's apparent V magnitude as seen from observer including extinction.
476
        //! Extinction obviously only if atmosphere=on.
477
        //! If you already know vMag, it is wise to provide it in the optional @param knownVMag.
478
        //! Else it is called from getVMagnitude() which may be costly.
479
        float getVMagnitudeWithExtinction(const StelCore* core, const float knownVMag=-1000.f, const float& magOffset=0.f) const;
×
480

481
        //! Return a priority value which is used to discriminate objects by priority
482
        //! As for magnitudes, the lower is the higher priority
483
        virtual float getSelectPriority(const StelCore*) const;
484

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

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

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

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

501
        //! Return airmass value for the object (for atmosphere-dependent calculations)
502
        //! @param core
503
        //! @return airmass value or -1.f if calculations are not applicable or meaningless
504
        virtual float getAirmass(const StelCore *core) const;
505

506
public slots:
507
        //! Allow additions to the Info String. Can be used by plugins to show extra info for the selected object, or for debugging.
508
        //! Hard-set this string group to a single str, or delete all messages when str==""
509
        //! @note This should be used with caution. Usually you want to use addToExtraInfoString().
510
        //! @note: If this breaks some const declaration, you can use StelObjectMgr::setExtraInfoString() instead.
511
        virtual void setExtraInfoString(const InfoStringGroup& flags, const QString &str);
512
        //! Add str to the extra string. This should be preferable over hard setting.
513
        //! Can be used by plugins to show extra info for the selected object, or for debugging.
514
        //! The strings will be shown in the InfoString for the selected object, below the default fields per-flag.
515
        //! Additional coordinates not fitting into one of the predefined coordinate sets should be flagged with OtherCoords,
516
        //! and must be adapted to table or non-table layout as required.
517
        //! 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.
518
        //! See getCommonInfoString() or the respective getInfoString() in the subclasses for details of use.
519
        //! @note: If this breaks some const declaration, you can use StelObjectMgr::addToExtraInfoString() instead.
520
        virtual void addToExtraInfoString(const StelObject::InfoStringGroup& flags, const QString &str);
521
        //! Retrieve an (unsorted) QStringList of all extra info strings that match flags.
522
        //! Normally the order matches the order of addition, but this cannot be guaranteed.
523
        //! @note: Usually objects should keep their extraInfoStrings to themselves. But there are cases where StelObjectMgr::setExtraInfoString() has been set.
524
        QStringList getExtraInfoStrings(const InfoStringGroup& flags) const;
525
        //! Remove the extraInfoStrings with the given flags.
526
        //! This is a finer-grained removal than just extraInfoStrings.remove(flags), as it allows a combination of flags.
527
        //! After display, InfoPanel::setTextFromObjects() auto-clears the strings of the selected object using the AllInfo constant.
528
        //! extraInfoStrings having been set with the DebugAid and Script flags have to be removed by separate calls of this method.
529
        //! Those which have been set by scripts have to persist at least as long as the selection remains active.
530
        //! The behaviour of DebugAid texts depends on the use case.
531
        //! @note: Usually objects should keep their extraInfoStrings to themselves. But there are cases where StelObjectMgr::setExtraInfoString() has been set.
532
        void removeExtraInfoStrings(const InfoStringGroup& flags);
533

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

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

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

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

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

563
        static int stelObjectPMetaTypeID;
564
};
565

566
Q_DECLARE_OPERATORS_FOR_FLAGS(StelObject::InfoStringGroup)
567

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