Stellarium  1.0
Public Types | Public Slots | Public Member Functions | Static Public Attributes | Protected Member Functions
StelObject Class Referenceabstract

The base abstract class for sky objects used in Stellarium like Stars, Planets, Constellations etc... More...

#include <StelObject.hpp>

Public Types

enum  InfoStringGroupFlags {
  None = 0x00000000, Name = 0x00000001, CatalogNumber = 0x00000002, Magnitude = 0x00000004,
  RaDecJ2000 = 0x00000008, RaDecOfDate = 0x00000010, AltAzi = 0x00000020, Distance = 0x00000040,
  Elongation = 0x00000080, Size = 0x00000100, Velocity = 0x00000200, ProperMotion = 0x00000400,
  Extra = 0x00000800, HourAngle = 0x00001000, AbsoluteMagnitude = 0x00002000, GalacticCoord = 0x00004000,
  SupergalacticCoord = 0x00008000, OtherCoord = 0x00010000, ObjectType = 0x00020000, EclipticCoordJ2000 = 0x00040000,
  EclipticCoordOfDate = 0x00080000, IAUConstellation = 0x00100000, SiderealTime = 0x00200000, RTSTime = 0x00400000,
  SolarLunarPosition = 0x00800000, Script = 0x01000000, DebugAid = 0x02000000, NoFont = 0x04000000,
  PlainText = 0x08000000
}
 Used as named bitfield flags as specifiers to filter results of getInfoString. More...
 

Public Slots

virtual void setExtraInfoString (const InfoStringGroup &flags, const QString &str)
 Allow additions to the Info String. More...
 
virtual void addToExtraInfoString (const StelObject::InfoStringGroup &flags, const QString &str)
 Add str to the extra string. More...
 
QStringList getExtraInfoStrings (const InfoStringGroup &flags) const
 Retrieve an (unsorted) QStringList of all extra info strings that match flags. More...
 
void removeExtraInfoStrings (const InfoStringGroup &flags)
 Remove the extraInfoStrings with the given flags. More...
 

Public Member Functions

virtual SphericalRegionP getRegion () const Q_DECL_OVERRIDE
 Default implementation of the getRegion method. More...
 
virtual Vec3d getPointInRegion () const Q_DECL_OVERRIDE
 Default implementation of the getPointInRegion method. More...
 
virtual QString getInfoString (const StelCore *core, const InfoStringGroup &flags=StelObject::AllInfo) const =0
 Write I18n information about the object in QString. More...
 
virtual QVariantMap getInfoMap (const StelCore *core) const
 Return a key/value map with data about an object's position, magnitude and so on. More...
 
virtual QString getType () const =0
 Return object's type. It should be the name of the class.
 
virtual QString getObjectType () const =0
 Return object's type. It should be English lowercase name of the type of the object.
 
virtual QString getObjectTypeI18n () const =0
 Return object's type. It should be translated lowercase name of the type of the object.
 
virtual QString getID () const =0
 Returns a unique identifier for this object. More...
 
virtual QString getEnglishName () const =0
 Return object's name in english.
 
virtual QString getNameI18n () const =0
 Return translated object's name.
 
virtual Vec3d getJ2000EquatorialPos (const StelCore *core) const =0
 Get observer-centered equatorial coordinates at equinox J2000.
 
Vec3d getEquinoxEquatorialPos (const StelCore *core) const
 Get observer-centered equatorial coordinate at the current equinox The frame has its Z axis at the planet's current rotation axis At time 2000-01-01 this frame is almost the same as J2000, but ONLY if the observer is on earth.
 
Vec3d getEquinoxEquatorialPosApparent (const StelCore *core) const
 Like getEquinoxEquatorialPos(core), but always adds refraction correction to the position.
 
Vec3d getEquinoxEquatorialPosAuto (const StelCore *core) const
 Like getEquinoxEquatorialPos(core), but adds refraction correction to the position if atmosphere is active.
 
Vec3d getGalacticPos (const StelCore *core) const
 Get observer-centered galactic coordinates.
 
Vec3d getSupergalacticPos (const StelCore *core) const
 Get observer-centered supergalactic coordinates.
 
Vec3d getSiderealPosGeometric (const StelCore *core) const
 Get observer-centered hour angle + declination (at current equinox) It is the geometric position, i.e. More...
 
Vec3d getSiderealPosApparent (const StelCore *core) const
 Get observer-centered hour angle + declination (at current equinox) It is the apparent position, i.e. More...
 
Vec3d getAltAzPosGeometric (const StelCore *core) const
 Get observer-centered alt/az position It is the geometric position, i.e. More...
 
Vec3d getAltAzPosApparent (const StelCore *core) const
 Get observer-centered alt/az position It is the apparent position, i.e. More...
 
Vec3d getAltAzPosAuto (const StelCore *core) const
 Get observer-centered alt/az position It is the automatic position, i.e. More...
 
float getParallacticAngle (const StelCore *core) const
 Get parallactic angle, which is the deviation between zenith angle and north angle. [radians].
 
bool isAboveHorizon (const StelCore *core) const
 Checking position an object above mathematical horizon for current location. More...
 
bool isAboveRealHorizon (const StelCore *core) const
 Checking position an object above real horizon for current location. More...
 
virtual Vec4d getRTSTime (const StelCore *core, const double altitude=0.) const
 Compute time of rise, transit and set for celestial object for current location. More...
 
virtual float getVMagnitude (const StelCore *core) const
 Return object's apparent V magnitude as seen from observer, without including extinction.
 
float getVMagnitudeWithExtinction (const StelCore *core) const
 Return object's apparent V magnitude as seen from observer including extinction. More...
 
virtual float getSelectPriority (const StelCore *) const
 Return a priority value which is used to discriminate objects by priority As for magnitudes, the lower is the higher priority.
 
virtual Vec3f getInfoColor () const
 Get a color used to display info about the object.
 
virtual double getCloseViewFov (const StelCore *) const
 Return the best FOV in degree to use for a close view of the object.
 
virtual double getSatellitesFov (const StelCore *) const
 Return the best FOV in degree to use for a global view of the object satellite system (if there are satellites)
 
virtual double getParentSatellitesFov (const StelCore *) const
 
virtual double getAngularRadius (const StelCore *core) const
 Return the angular radius of a circle containing the object as seen from the observer with the circle center assumed to be at getJ2000EquatorialPos(). More...
 
virtual float getAirmass (const StelCore *core) const
 Return airmass value for the object (for atmosphere-dependent calculations) More...
 

Static Public Attributes

static constexpr InfoStringGroup AllInfo
 A pre-defined "all available" set of specifiers for the getInfoString flags argument to getInfoString. More...
 
static constexpr InfoStringGroup DefaultInfo
 A pre-defined "default" set of specifiers for the getInfoString flags argument to getInfoString It appears useful to propose this set as post-install settings and let users configure more on demand. More...
 
static constexpr InfoStringGroup ShortInfo = static_cast<InfoStringGroup>(Name|CatalogNumber|Magnitude|RaDecJ2000)
 A pre-defined "shortest useful" set of specifiers for the getInfoString flags argument to getInfoString.
 

Protected Member Functions

QString getCommonInfoString (const StelCore *core, const InfoStringGroup &flags) const
 Format the positional info string containing J2000/of date/altaz/hour angle positions and constellation, sidereal time, etc. More...
 
virtual QString getMagnitudeInfoString (const StelCore *core, const InfoStringGroup &flags, const int decimals=1) const
 Format the magnitude info string for the object. More...
 
QString getSolarLunarInfoString (const StelCore *core, const InfoStringGroup &flags) const
 Add a section to the InfoString with just horizontal data for the Sun and Moon, when observed from Earth. More...
 
void postProcessInfoString (QString &str, const InfoStringGroup &flags) const
 Apply post processing on the info string. More...
 

Detailed Description

Normally you should use StelObjectP instead of StelObject* which have by default the same behaviour, but which can be added reference counting if needed.

See also
StelObjectP

Member Enumeration Documentation

◆ InfoStringGroupFlags

The precise definition of these should be documented in the getInfoString documentation for the derived classes for all specifiers which are defined in that derivative. Use InfoStringGroup instead.

Enumerator
None 

Show Nothing.

Name 

An object's name.

CatalogNumber 

Catalog numbers.

Magnitude 

Magnitude related data.

RaDecJ2000 

The equatorial position (J2000 ref)

RaDecOfDate 

The equatorial position (of date)

AltAzi 

The position (Altitude/Azimuth)

Distance 

Info about an object's distance.

Elongation 

Info about elongation, phase angle etc. Most useful for Planets, but possible for all objects.

Size 

Info about an object's size.

Velocity 

Info about object's velocity.

ProperMotion 

Annual proper motion (for stars) or hourly motion (for Planets)

Extra 

Derived class-specific extra fields.

HourAngle 

The hour angle + DE (of date)

AbsoluteMagnitude 

The absolute magnitude.

GalacticCoord 

The galactic position.

SupergalacticCoord 

The supergalactic position.

OtherCoord 

Unspecified additional coordinates. These can be "injected" into the extraInfoStrings by plugins.

ObjectType 

The type of the object (star, planet, etc.)

EclipticCoordJ2000 

The ecliptic position (J2000.0 ref) [+ XYZ of VSOP87A (used mainly for debugging, not public)].

EclipticCoordOfDate 

The ecliptic position (of date)

IAUConstellation 

Three-letter constellation code (And, Boo, Cas, ...)

SiderealTime 

Mean and Apparent Sidereal Time.

RTSTime 

Time of rise, transit and set of celestial object.

SolarLunarPosition 

Show Solar and Lunar horizontal position (on Earth location only)

Script 

Should be used by Scripts only which can inject extraInfoStrings.

DebugAid 

Can be used for development only, place messages into extraInfoStrings. Comment them away or delete for releases.

PlainText 

Strip HTML tags from output.

Member Function Documentation

◆ addToExtraInfoString

virtual void StelObject::addToExtraInfoString ( const StelObject::InfoStringGroup &  flags,
const QString &  str 
)
virtualslot

This should be preferrable over hard setting. Can be used by plugins to show extra info for the selected object, or for debugging. The strings will be shown in the InfoString for the selected object, below the default fields per-flag. Additional coordinates not fitting into one of the predefined coordinate sets should be flagged with OtherCoords, and must be adapted to table or non-table layout as required. 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. See getCommonInfoString() or the respective getInfoString() in the subclasses for details of use.

Note
: If this breaks some const declaration, you can use StelObjectMgr::addToExtraInfoString() instead.

◆ getAirmass()

virtual float StelObject::getAirmass ( const StelCore core) const
virtual
Parameters
core
Returns
airmass value or -1.f if calculations are not applicable or meaningless

◆ getAltAzPosApparent()

Vec3d StelObject::getAltAzPosApparent ( const StelCore core) const

taking the refraction effect into account. The frame has its Z axis at the zenith

◆ getAltAzPosAuto()

Vec3d StelObject::getAltAzPosAuto ( const StelCore core) const

taking the refraction effect into account if atmosphere is on. The frame has its Z axis at the zenith

◆ getAltAzPosGeometric()

Vec3d StelObject::getAltAzPosGeometric ( const StelCore core) const

without taking refraction effect into account. The frame has its Z axis at the zenith

◆ getAngularRadius()

virtual double StelObject::getAngularRadius ( const StelCore core) const
inlinevirtual
Returns
radius in degree. This value is the apparent angular size of the object, and is independent of the current FOV.
Note
The default implementation just returns zero.

Reimplemented in Planet, NomenclatureItem, Satellite, and Nebula.

◆ getCommonInfoString()

QString StelObject::getCommonInfoString ( const StelCore core,
const InfoStringGroup &  flags 
) const
protected

for the object FIXME: We should split this and provide shorter virtual methods for various parts of the InfoString. The ExtraInfoStrings should be placed per flag, where they best fit.

◆ getExtraInfoStrings

QStringList StelObject::getExtraInfoStrings ( const InfoStringGroup &  flags) const
slot

Normally the order matches the order of addition, but this cannot be guaranteed.

Note
: Usually objects should keep their extraInfoStrings to themselves. But there are cases where StelObjectMgr::setExtraInfoString() has been set.

◆ getID()

virtual QString StelObject::getID ( ) const
pure virtual

The ID should be unique for all objects of the same type, but may freely conflict with IDs of other types, so getType() must also be tested.

With this it should be possible to at least identify the same object in a different instance of Stellarium running the same version, but it would even be better if the ID provides some degree of forward-compatibility. For some object types (e.g. planets) this may simply return getEnglishName(), but better candidates may be official designations or at least (stable) internal IDs.

An object may have multiple IDs (different catalog numbers, etc). StelObjectMgr::searchByID() should search through all ID variants, but this method only returns one of them.

Implemented in Planet, StarWrapper3, StarWrapper2, Satellite, StarWrapper1, NomenclatureItem, MeteorShower, Exoplanet, Pulsar, Quasar, Supernova, Nova, CustomObject, Nebula, and TelescopeClient.

◆ getInfoMap()

virtual QVariantMap StelObject::getInfoMap ( const StelCore core) const
virtual

Useful in a context like scripting. Derived objects can add their own special information tags.

Parameters
corethe current StelCore
Returns
a map of object data. Keys:
  • above-horizon : true, if celestial body is above horizon
  • altitude : apparent altitude angle in decimal degrees
  • azimuth : apparent azimuth angle in decimal degrees
  • altitude-geometric : geometric altitude angle in decimal degrees
  • azimuth-geometric : geometric azimuth angle in decimal degrees
  • airmass : number of airmasses the object's light had to pass through the atmosphere. For negative altitudes this number may be meaningless.
  • ra : right ascension angle (current date frame) in decimal degrees
  • dec : declination angle (current date frame) in decimal degrees
  • raJ2000 : right ascension angle (J2000 frame) in decimal degrees
  • decJ2000 : declination angle (J2000 frame) in decimal degrees
  • parallacticAngle : parallactic angle in decimal degrees (for non-star objects only)
  • hourAngle-dd : hour angle in decimal degrees
  • hourAngle-hms : hour angle in HMS format (formatted string)
  • iauConstellation : 3-letter abbreviation of IAU constellation (string)
  • meanSidTm : mean sidereal time, in decimal degrees (on Earth only!)
  • appSidTm : mean sidereal time, in decimal degrees (on Earth only!)
  • glong : galactic longitude in decimal degrees
  • glat : galactic latitude in decimal degrees
  • sglong : supergalactic longitude in decimal degrees
  • sglat : supergalactic latitude in decimal degrees
  • elong : ecliptic longitude in decimal degrees (on Earth only!)
  • elat : ecliptic latitude in decimal degrees (on Earth only!)
  • elongJ2000 : ecliptic longitude (Earth's J2000 frame) in decimal degrees
  • elatJ2000 : ecliptic latitude (Earth's J2000 frame) in decimal degrees
  • vmag : visual magnitude
  • vmage : visual magnitude (after atmospheric extinction)
  • size: angular size (diameter) in radians
  • size-dd : angular size (diameter) in decimal degrees
  • size-deg : angular size (diameter) in decimal degrees (formatted string)
  • size-dms : angular size (diameter) in DMS format
  • rise : time of rise in HM format
  • rise-dhr : time of rise in decimal hours
  • transit : time of transit in HM format
  • transit-dhr : time of transit in decimal hours
  • set : time of set in HM format
  • set-dhr : time of set in decimal hours
  • name : english name of the object
  • localized-name : localized name
  • type: type of object' class
  • object-type: English lowercase name of the type of the object
Note
Coordinate values may need modulo operation to bring them into ranges [0..360].

Reimplemented in Planet, Satellite, Nebula, StarWrapper1, MeteorShower, Exoplanet, Pulsar, Quasar, Supernova, Nova, and Comet.

◆ getInfoString()

virtual QString StelObject::getInfoString ( const StelCore core,
const InfoStringGroup &  flags = StelObject::AllInfo 
) const
pure virtual
Parameters
corethe StelCore object to use
flagsa set of InfoStringGroup flags which are used to filter the return value - including specified types of information and altering the output format.
Returns
an HTML string containing information about the StelObject.

Implemented in Planet, Satellite, Nebula, NomenclatureItem, StarWrapper1, MeteorShower, Exoplanet, Pulsar, Quasar, Supernova, TelescopeClient, Nova, CustomObject, and StarWrapperBase.

◆ getMagnitudeInfoString()

virtual QString StelObject::getMagnitudeInfoString ( const StelCore core,
const InfoStringGroup &  flags,
const int  decimals = 1 
) const
protectedvirtual
Parameters
core
flags
decimalssignificant digits after the comma.

Reimplemented in Nebula, and Supernova.

◆ getPointInRegion()

virtual Vec3d StelObject::getPointInRegion ( ) const
inlinevirtual

Return the J2000 Equatorial Position of the object.

Implements StelRegionObject.

◆ getRegion()

virtual SphericalRegionP StelObject::getRegion ( ) const
inlinevirtual

Return the spatial region of the object.

Implements StelRegionObject.

Reimplemented in Nebula.

◆ getRTSTime()

virtual Vec4d StelObject::getRTSTime ( const StelCore core,
const double  altitude = 0. 
) const
virtual
Parameters
corethe currently active StelCore object
altitude(optional; default=0) altitude of the object, degrees. Setting this to -6. for the Sun will find begin and end for civil twilight.
Returns
Vec4d - time of rise, transit and set closest to current time; JD.
Note
The fourth element flags particular conditions:
  • +100. for circumpolar objects. Rise and set give lower culmination times.
  • -100. for objects never rising. Rise and set give transit times.
  • -1000. is used as "invalid" value. The result should then not be used.
This is an abbreviated version of the method implemented in the Planet class.

Reimplemented in Planet, and NomenclatureItem.

◆ getSiderealPosApparent()

Vec3d StelObject::getSiderealPosApparent ( const StelCore core) const

taking the refraction effect into account. The frame has its Z axis at the planet's current rotation axis

◆ getSiderealPosGeometric()

Vec3d StelObject::getSiderealPosGeometric ( const StelCore core) const

without taking refraction effect into account. The frame has its Z axis at the planet's current rotation axis

◆ getSolarLunarInfoString()

QString StelObject::getSolarLunarInfoString ( const StelCore core,
const InfoStringGroup &  flags 
) const
protected

The application of this is to have quick info while observing other objects.

◆ getVMagnitudeWithExtinction()

float StelObject::getVMagnitudeWithExtinction ( const StelCore core) const

Extinction obviously only if atmosphere=on.

◆ isAboveHorizon()

bool StelObject::isAboveHorizon ( const StelCore core) const
Returns
true if object an above mathematical horizon

◆ isAboveRealHorizon()

bool StelObject::isAboveRealHorizon ( const StelCore core) const
Returns
true if object an above real horizon (uses test for landscapes)

◆ postProcessInfoString()

void StelObject::postProcessInfoString ( QString &  str,
const InfoStringGroup &  flags 
) const
protected

This also removes all extraInfoStrings possibly injected by modules (plugins) etc., except for Script and DebugAid types.

◆ removeExtraInfoStrings

void StelObject::removeExtraInfoStrings ( const InfoStringGroup &  flags)
slot

This is a finer-grained removal than just extraInfoStrings.remove(flags), as it allows a combination of flags. After display, InfoPanel::setTextFromObjects() auto-clears the strings of the selected object using the AllInfo constant. extraInfoStrings having been set with the DebugAid and Script flags have to be removed by separate calls of this method. Those which have been set by scripts have to persist at least as long as the selection remains active. The behaviour of DebugAid texts depends on the use case.

Note
: Usually objects should keep their extraInfoStrings to themselves. But there are cases where StelObjectMgr::setExtraInfoString() has been set.

◆ setExtraInfoString

virtual void StelObject::setExtraInfoString ( const InfoStringGroup &  flags,
const QString &  str 
)
virtualslot

Can be used by plugins to show extra info for the selected object, or for debugging. Hard-set this string group to a single str, or delete all messages when str==""

Note
This should be used with caution. Usually you want to use addToExtraInfoString().
: If this breaks some const declaration, you can use StelObjectMgr::setExtraInfoString() instead.

Field Documentation

◆ AllInfo

constexpr InfoStringGroup StelObject::AllInfo
staticconstexpr

◆ DefaultInfo

constexpr InfoStringGroup StelObject::DefaultInfo
staticconstexpr