Stellarium  0.16.1
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 #include "StelObjectType.hpp"
25 #include "StelRegionObject.hpp"
26 
27 #include <QFlags>
28 #include <QString>
29 
30 class StelCore;
31 
37 {
38  //Required for Q_FLAGS macro, this requires this header to be MOC'ed
39  Q_GADGET
40  Q_FLAGS(InfoStringGroupFlags InfoStringGroup)
41 public:
48  {
49  Name = 0x00000001,
50  CatalogNumber = 0x00000002,
51  Magnitude = 0x00000004,
52  RaDecJ2000 = 0x00000008,
53  RaDecOfDate = 0x00000010,
54  AltAzi = 0x00000020,
55  Distance = 0x00000040,
56  Size = 0x00000080,
57  Extra = 0x00000100,
58  HourAngle = 0x00000200,
59  AbsoluteMagnitude = 0x00000400,
60  GalacticCoord = 0x00000800,
61  SupergalacticCoord = 0x00001000,
62  ObjectType = 0x00002000,
63  EclipticCoordJ2000 = 0x00004000,
64  EclipticCoordOfDate = 0x00008000,
65  IAUConstellation = 0x00010000,
66  SiderealTime = 0x00020000,
67  NoFont = 0x00040000,
68  PlainText = 0x00080000,
69 // TODO GZ
70 // RaDecJ2000Planetocentric = 0x00020000, //!< The planetocentric equatorial position (J2000 ref) [Mostly to compare with almanacs]
71 // RaDecOfDatePlanetocentric = 0x00040000 //!< The planetocentric equatorial position (of date)
72 
73 
74  };
75  Q_DECLARE_FLAGS(InfoStringGroup, InfoStringGroupFlags)
76 
77 
83 
84  virtual ~StelObject() {}
85 
89 
92  virtual Vec3d getPointInRegion() const {return getJ2000EquatorialPos(Q_NULLPTR);}
93 
100  virtual QString getInfoString(const StelCore *core, const InfoStringGroup& flags=StelObject::AllInfo) const = 0;
101 
131  virtual QVariantMap getInfoMap(const StelCore *core) const;
132 
134  virtual QString getType() const = 0;
135 
148  virtual QString getID() const = 0;
149 
151  virtual QString getEnglishName() const = 0;
152 
154  virtual QString getNameI18n() const = 0;
155 
157  virtual Vec3d getJ2000EquatorialPos(const StelCore* core) const = 0;
158 
162  Vec3d getEquinoxEquatorialPos(const StelCore* core) const;
166  Vec3d getEquinoxEquatorialPosAuto(const StelCore* core) const;
167 
169  Vec3d getGalacticPos(const StelCore* core) const;
170 
172  Vec3d getSupergalacticPos(const StelCore* core) const;
173 
177  Vec3d getSiderealPosGeometric(const StelCore* core) const;
178 
182  Vec3d getSiderealPosApparent(const StelCore* core) const;
183 
187  Vec3d getAltAzPosGeometric(const StelCore* core) const;
188 
192  Vec3d getAltAzPosApparent(const StelCore* core) const;
193 
197  Vec3d getAltAzPosAuto(const StelCore* core) const;
198 
201  bool isAboveHorizon(const StelCore* core) const;
202 
205  bool isAboveRealHorizon(const StelCore* core) const;
206 
208  virtual float getVMagnitude(const StelCore* core) const;
209 
212  float getVMagnitudeWithExtinction(const StelCore* core) const;
213 
216  virtual float getSelectPriority(const StelCore*) const;
217 
219  virtual Vec3f getInfoColor() const {return Vec3f(1,1,1);}
220 
222  virtual double getCloseViewFov(const StelCore*) const {return 10.;}
223 
225  virtual double getSatellitesFov(const StelCore*) const {return -1.;}
226  virtual double getParentSatellitesFov(const StelCore*) const {return -1.;}
227 
231  virtual double getAngularSize(const StelCore* core) const = 0;
232 
233 protected:
234 
236  QString getCommonInfoString(const StelCore *core, const InfoStringGroup& flags) const;
237 
239  void postProcessInfoString(QString& str, const InfoStringGroup& flags) const;
240 private:
241  static int stelObjectPMetaTypeID;
242 };
243 
244 Q_DECLARE_OPERATORS_FOR_FLAGS(StelObject::InfoStringGroup)
245 
246 #endif // _STELOBJECT_HPP_
QString getCommonInfoString(const StelCore *core, const InfoStringGroup &flags) const
Format the positional info string contain J2000/of date/altaz/hour angle positions and constellation...
Vec3d getAltAzPosAuto(const StelCore *core) const
Get observer-centered alt/az position It is the automatic position, i.e.
The supergalactic position.
Definition: StelObject.hpp:61
static const InfoStringGroupFlags AllInfo
A pre-defined set of specifiers for the getInfoString flags argument to getInfoString.
Definition: StelObject.hpp:78
The type of the object (star, planet, etc.)
Definition: StelObject.hpp:62
virtual double getAngularSize(const StelCore *core) const =0
Return the angular radius of a circle containing the object as seen from the observer with the circle...
virtual QString getInfoString(const StelCore *core, const InfoStringGroup &flags=StelObject::AllInfo) const =0
Write I18n information about the object in QString.
Magnitude related data.
Definition: StelObject.hpp:51
virtual QString getType() const =0
Return object&#39;s type. It should be the name of the class.
Vec3d getAltAzPosGeometric(const StelCore *core) const
Get observer-centered alt/az position It is the geometric position, i.e.
The base abstract class for sky objects used in Stellarium like Stars, Planets, Constellations etc...
Definition: StelObject.hpp:36
The galactic position.
Definition: StelObject.hpp:60
Mean and Apparent Sidereal Time.
Definition: StelObject.hpp:66
A shared pointer on a SphericalRegion.
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.
The position (Altitude/Azimuth)
Definition: StelObject.hpp:54
virtual double getCloseViewFov(const StelCore *) const
Return the best FOV in degree to use for a close view of the object.
Definition: StelObject.hpp:222
Main class for Stellarium core processing.
Definition: StelCore.hpp:48
The hour angle + DE (of date)
Definition: StelObject.hpp:58
virtual Vec3d getJ2000EquatorialPos(const StelCore *core) const =0
Get observer-centered equatorial coordinates at equinox J2000.
The ecliptic position (of date)
Definition: StelObject.hpp:64
virtual QVariantMap getInfoMap(const StelCore *core) const
Return a key/value map with data about an object&#39;s position, magnitude and so on. ...
Info about an object&#39;s distance.
Definition: StelObject.hpp:55
Special SphericalRegion for a point on the sphere.
Vec3d getEquinoxEquatorialPos(const StelCore *core) const
Get observer-centered equatorial coordinate at the current equinox The frame has its Z axis at the pl...
Strip HTML tags from output.
Definition: StelObject.hpp:68
virtual Vec3f getInfoColor() const
Get a color used to display info about the object.
Definition: StelObject.hpp:219
The ecliptic position (J2000.0 ref) [+ XYZ of VSOP87A (used mainly for debugging, not public)]...
Definition: StelObject.hpp:63
InfoStringGroupFlags
Used as named bitfield flags as specifiers to filter results of getInfoString.
Definition: StelObject.hpp:47
virtual QString getEnglishName() const =0
Return object&#39;s name in english.
void postProcessInfoString(QString &str, const InfoStringGroup &flags) const
Apply post processing on the info string.
The equatorial position (J2000 ref)
Definition: StelObject.hpp:52
Define the StelObjectP type.
virtual SphericalRegionP getRegion() const
Default implementation of the getRegion method.
Definition: StelObject.hpp:88
The equatorial position (of date)
Definition: StelObject.hpp:53
An object&#39;s name.
Definition: StelObject.hpp:49
virtual QString getID() const =0
Returns a unique identifier for this object.
Catalog numbers.
Definition: StelObject.hpp:50
virtual float getVMagnitude(const StelCore *core) const
Return object&#39;s apparent V magnitude as seen from observer, without including extinction.
virtual Vec3d getPointInRegion() const
Default implementation of the getPointInRegion method.
Definition: StelObject.hpp:92
Vec3d getEquinoxEquatorialPosAuto(const StelCore *core) const
Like getEquinoxEquatorialPos(core), but adds refraction correction to the position if atmosphere is a...
Vec3d getEquinoxEquatorialPosApparent(const StelCore *core) const
Like getEquinoxEquatorialPos(core), but always adds refraction correction to the position.
virtual QString getNameI18n() const =0
Return translated object&#39;s name.
Vec3d getSiderealPosApparent(const StelCore *core) const
Get observer-centered hour angle + declination (at current equinox) It is the apparent position...
Three-letter constellation code (And, Boo, Cas, ...)
Definition: StelObject.hpp:65
The absolute magnitude.
Definition: StelObject.hpp:59
Simple abstract class defining basic methods implemented by all objects that need to be stored in a S...
Vec3d getAltAzPosApparent(const StelCore *core) const
Get observer-centered alt/az position It is the apparent position, i.e.
bool isAboveRealHorizon(const StelCore *core) const
Checking position an object above real horizon for current location.
float getVMagnitudeWithExtinction(const StelCore *core) const
Return object&#39;s apparent V magnitude as seen from observer including extinction.
static const InfoStringGroupFlags ShortInfo
A pre-defined set of specifiers for the getInfoString flags argument to getInfoString.
Definition: StelObject.hpp:82
Info about an object&#39;s size.
Definition: StelObject.hpp:56
bool isAboveHorizon(const StelCore *core) const
Checking position an object above mathematical horizon for current location.
Vec3d getSiderealPosGeometric(const StelCore *core) const
Get observer-centered hour angle + declination (at current equinox) It is the geometric position...
Derived class-specific extra fields.
Definition: StelObject.hpp:57
Vec3d getGalacticPos(const StelCore *core) const
Get observer-centered galactic coordinates.
Vec3d getSupergalacticPos(const StelCore *core) const
Get observer-centered supergalactic coordinates.
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 s...
Definition: StelObject.hpp:225