23 #include "StelObject.hpp"
24 #include "StelProjector.hpp"
25 #include "VecMath.hpp"
26 #include "StelFader.hpp"
34 typedef void (*posFuncType)(double,
double*,
void*);
36 typedef void (OsculatingFunctType)(
double jd0,
double jd,
double xyz[3]);
39 #define J2000 2451545.0
40 #define ORBIT_SEGMENTS 360
45 class QOpenGLShaderProgram;
51 RotationElements(
void) : period(1.), offset(0.), epoch(J2000), obliquity(0.), ascendingNode(0.), precessionRate(0.), siderealPeriod(0.) {}
58 double siderealPeriod;
65 Ring(
float radiusMin,
float radiusMax,
const QString &texname);
66 double getSize(
void)
const {
return radiusMax;}
67 const float radiusMin;
68 const float radiusMax;
79 Q_ENUMS(ApparentMagnitudeAlgorithm)
99 enum ApparentMagnitudeAlgorithm
108 Planet(
const QString& englishName,
114 const QString& texMapName,
115 const QString& normalMapName,
116 posFuncType _coordFunc,
118 OsculatingFunctType *osculatingFunc,
123 const QString &pTypeStr);
149 virtual double getParentSatellitesFov(
const StelCore* core)
const;
153 virtual QString
getType(
void)
const {
return "Planet";}
158 virtual bool hasAtmosphere(
void) {
return atmosphere;}
159 virtual bool hasHalo(
void) {
return halo;}
168 virtual void draw(
StelCore* core,
float maxMagLabels,
const QFont& planetNameFont);
183 const QString& getTextMapName()
const {
return texMapName;}
184 const QString getPlanetTypeString()
const {
return pTypeMap.value(pType);}
187 void setNativeName(QString planet) { nativeName = planet; }
189 ApparentMagnitudeAlgorithm getApparentMagnitudeAlgorithm()
const {
return vMagAlgorithm; }
190 const QString getApparentMagnitudeAlgorithmString()
const {
return vMagAlgorithmMap.value(vMagAlgorithm); }
191 void setApparentMagnitudeAlgorithm(QString algorithm);
194 double getSiderealTime(
double jd)
const;
195 Mat4d getRotEquatorialToVsop87(
void)
const;
196 void setRotEquatorialToVsop87(
const Mat4d &m);
201 void computePositionWithoutOrbits(
const double dateJD);
203 void computePosition(
const double dateJD);
206 void computeTransMatrix(
double date);
209 double getPhaseAngle(
const Vec3d& obsPos)
const;
211 double getElongation(
const Vec3d& obsPos)
const;
213 double getSpheroidAngularSize(
const StelCore* core)
const;
215 float getPhase(
const Vec3d& obsPos)
const;
218 void setRotationElements(
float _period,
float _offset,
double _epoch,
219 float _obliquity,
float _ascendingNode,
220 float _precessionRate,
double _siderealPeriod);
221 double getRotAscendingnode(
void)
const {
return re.ascendingNode;}
222 double getRotObliquity(
double JDay)
const;
228 Vec3d getHeliocentricEclipticPos()
const;
232 void setHeliocentricEclipticPos(
const Vec3d &pos);
235 double computeDistance(
const Vec3d& obsHelioPos);
236 double getDistance(
void)
const {
return distance;}
238 void setRings(
Ring* r) {rings = r;}
240 void setSphereScale(
float s) {sphereScale = s;}
241 float getSphereScale(
void)
const {
return sphereScale;}
243 const QSharedPointer<Planet> getParent(
void)
const {
return parent;}
245 static void setLabelColor(
const Vec3f& lc) {labelColor = lc;}
246 static const Vec3f& getLabelColor(
void) {
return labelColor;}
249 virtual void update(
int deltaTime);
258 void setFlagNativeName(
bool b) { flagNativeName = b; }
259 bool getFlagNativeName(
void) {
return flagNativeName; }
261 bool flagTranslatedName;
262 void setFlagTranslatedName(
bool b) { flagTranslatedName = b; }
263 bool getFlagTranslatedName(
void) {
return flagTranslatedName; }
274 Vec3d orbit[ORBIT_SEGMENTS+1];
275 Vec3d orbitP[ORBIT_SEGMENTS+1];
284 static Vec3f orbitColor;
285 static void setOrbitColor(
const Vec3f& oc) {orbitColor = oc;}
286 static const Vec3f& getOrbitColor() {
return orbitColor;}
294 void computeModelMatrix(
Mat4d &result)
const;
297 QString getSkyLabel(
const StelCore* core)
const;
303 void drawSphere(
StelPainter* painter,
float screenSz,
bool drawOnlyRing=
false);
306 void drawHints(
const StelCore* core,
const QFont& planetNameFont);
312 QString normalMapName;
316 double oneMinusOblateness;
320 Vec3d previousScreenPos;
324 Mat4d rotLocalToParent;
335 posFuncType coordFunc;
338 OsculatingFunctType *
const osculatingFunc;
339 QSharedPointer<Planet> parent;
340 QList<QSharedPointer<Planet> > satellites;
349 ApparentMagnitudeAlgorithm vMagAlgorithm;
351 static Vec3f labelColor;
353 static QMap<PlanetType, QString> pTypeMap;
354 static QMap<ApparentMagnitudeAlgorithm, QString> vMagAlgorithmMap;
358 int projectionMatrix;
360 int unprojectedVertex;
371 void initLocations(QOpenGLShaderProgram*);
374 static QOpenGLShaderProgram* planetShaderProgram;
386 static QOpenGLShaderProgram* ringPlanetShaderProgram;
394 static QOpenGLShaderProgram* moonShaderProgram;
396 static void initShader();
397 static void deinitShader();
400 #endif // _PLANET_HPP_
Q_ENUMS(PlanetType) Q_ENUMS(ApparentMagnitudeAlgorithm) enum PlanetType
numeric typecodes for the type descriptions in ssystem.ini
QVector< const Planet * > getCandidatesForShadow() const
Return the list of planets which project some shadow on this planet.
virtual void update(double deltaTime)
Update time-varying components.
void setFlagOrbits(bool b)
Set flag which determines if planet orbits are drawn or hidden.
double getMeanSolarDay(void) const
Get duration of mean solar day.
virtual double getSiderealPeriod(void) const
Get duration of sidereal year.
Class used to translate strings to any language.
Implementation of StelFader which implements a linear transition.
The base abstract class for sky objects used in Stellarium like Stars, Planets, Constellations etc...
virtual QString getNameI18n(void) const
Return translated object's name.
Define the StelTextureSP type.
virtual double getAngularSize(const StelCore *core) const
Return the angular radius of a circle containing the object as seen from the observer with the circle...
virtual Vec3f getInfoColor(void) const
Get a color used to display info about the object.
Main class for Stellarium core processing.
void setFlagHints(bool b)
Set flag which determines if planet hints are drawn or hidden along labels.
void setFlagLabels(bool b)
Set flag which determines if planet labels are drawn or hidden.
bool getFlagLabels() const
Get the current value of the flag which determines if planet labels are drawn or hidden.
double getRadius(void) const
Get the radius of the planet in AU.
virtual QString getEnglishName(void) const
Return object's name in english.
This StelObjectModule derivative is used to model SolarSystem bodies.
virtual QString getInfoString(const StelCore *core, const InfoStringGroup &flags) const
Get a string with data about the Planet.
virtual double getCloseViewFov(const StelCore *core) const
Return the best FOV in degree to use for a close view of the object.
double getSiderealDay(void) const
Get duration of sidereal day.
virtual double getSatellitesFov(const StelCore *core) const
Return the best FOV in degree to use for a global view of the object satellite system (if there are s...
virtual Vec3d getJ2000EquatorialPos(const StelCore *core) const
Get observer-centered equatorial coordinates at equinox J2000.
Provides functions for performing openGL drawing operations.
virtual void translateName(const StelTranslator &trans)
Translate planet name using the passed translator.
virtual float getVMagnitude(const StelCore *core) const
Return object's apparent V magnitude as seen from observer, without including extinction.
QSharedPointer< ModelViewTranform > ModelViewTranformP
Shared pointer on a ModelViewTranform instance (implement reference counting)
bool getFlagOrbits() const
Get the current value of the flag which determines if planet orbits are drawn or hidden.
static void init()
Initializes static vars. Must be called before creating first planet.
Define the StelProjectorP type.
virtual QString getType(void) const
Return object's type. It should be the name of the class.
Vec3d getEclipticPos() const
Get the Planet position in the parent Planet ecliptic coordinate in AU.
QSharedPointer< StelTexture > StelTextureSP
Use shared pointer to simplify memory managment.
bool getFlagHints() const
Get the current value of the flag which determines if planet hints are drawn or hidden along labels...
QString getPlanetType(QString planetName) const
Get type for Solar system bodies from scripts.
virtual float getSelectPriority(const StelCore *core) const
Return a priority value which is used to discriminate objects by priority As for magnitudes, the lower is the higher priority.
virtual void draw(StelCore *core)
Draw SolarSystem objects (planets).