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 jde0,
double jde,
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);
185 const QString& getTextMapName()
const {
return texMapName;}
186 const QString getPlanetTypeString()
const {
return pTypeMap.value(pType);}
189 void setNativeName(QString planet) { nativeName = planet; }
191 ApparentMagnitudeAlgorithm getApparentMagnitudeAlgorithm()
const {
return vMagAlgorithm; }
192 const QString getApparentMagnitudeAlgorithmString()
const {
return vMagAlgorithmMap.value(vMagAlgorithm); }
193 void setApparentMagnitudeAlgorithm(QString algorithm);
199 Mat4d getRotEquatorialToVsop87(
void)
const;
200 void setRotEquatorialToVsop87(
const Mat4d &m);
205 void computePositionWithoutOrbits(
const double dateJDE);
206 void computePosition(
const double dateJDE);
210 void computeTransMatrix(
double JD,
double JDE);
213 double getPhaseAngle(
const Vec3d& obsPos)
const;
215 double getElongation(
const Vec3d& obsPos)
const;
217 double getSpheroidAngularSize(
const StelCore* core)
const;
219 float getPhase(
const Vec3d& obsPos)
const;
222 void setRotationElements(
float _period,
float _offset,
double _epoch,
223 float _obliquity,
float _ascendingNode,
224 float _precessionRate,
double _siderealPeriod);
225 double getRotAscendingnode(
void)
const {
return re.ascendingNode;}
228 double getRotObliquity(
double JDE)
const;
234 Vec3d getHeliocentricEclipticPos()
const;
238 void setHeliocentricEclipticPos(
const Vec3d &pos);
241 double computeDistance(
const Vec3d& obsHelioPos);
242 double getDistance(
void)
const {
return distance;}
244 void setRings(
Ring* r) {rings = r;}
246 void setSphereScale(
float s) {sphereScale = s;}
247 float getSphereScale(
void)
const {
return sphereScale;}
249 const QSharedPointer<Planet> getParent(
void)
const {
return parent;}
251 static void setLabelColor(
const Vec3f& lc) {labelColor = lc;}
252 static const Vec3f& getLabelColor(
void) {
return labelColor;}
255 virtual void update(
int deltaTime);
264 void setFlagNativeName(
bool b) { flagNativeName = b; }
265 bool getFlagNativeName(
void) {
return flagNativeName; }
267 bool flagTranslatedName;
268 void setFlagTranslatedName(
bool b) { flagTranslatedName = b; }
269 bool getFlagTranslatedName(
void) {
return flagTranslatedName; }
280 Vec3d orbit[ORBIT_SEGMENTS+1];
281 Vec3d orbitP[ORBIT_SEGMENTS+1];
284 double deltaOrbitJDE;
290 static Vec3f orbitColor;
291 static void setOrbitColor(
const Vec3f& oc) {orbitColor = oc;}
292 static const Vec3f& getOrbitColor() {
return orbitColor;}
294 static bool permanentDrawingOrbits;
302 void computeModelMatrix(
Mat4d &result)
const;
305 QString getSkyLabel(
const StelCore* core)
const;
311 void drawSphere(
StelPainter* painter,
float screenSz,
bool drawOnlyRing=
false);
314 void drawHints(
const StelCore* core,
const QFont& planetNameFont);
320 QString normalMapName;
324 double oneMinusOblateness;
328 Vec3d previousScreenPos;
332 Mat4d rotLocalToParent;
345 posFuncType coordFunc;
348 OsculatingFunctType *
const osculatingFunc;
349 QSharedPointer<Planet> parent;
350 QList<QSharedPointer<Planet> > satellites;
359 ApparentMagnitudeAlgorithm vMagAlgorithm;
361 static Vec3f labelColor;
363 static QMap<PlanetType, QString> pTypeMap;
364 static QMap<ApparentMagnitudeAlgorithm, QString> vMagAlgorithmMap;
368 int projectionMatrix;
370 int unprojectedVertex;
382 void initLocations(QOpenGLShaderProgram*);
385 static QOpenGLShaderProgram* planetShaderProgram;
397 static QOpenGLShaderProgram* ringPlanetShaderProgram;
405 static QOpenGLShaderProgram* moonShaderProgram;
407 static void initShader();
408 static void deinitShader();
411 #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.
double getSiderealTime(double JD, double JDE) const
Compute the z rotation to use from equatorial to geographic coordinates.
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)
double getOneMinusOblateness(void) const
Get the value (1-f) for oblateness f.
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).