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(PlanetOrbitColorStyle)
80 Q_ENUMS(ApparentMagnitudeAlgorithm)
101 enum PlanetOrbitColorStyle
117 enum ApparentMagnitudeAlgorithm
131 Planet(
const QString& englishName,
137 const QString& texMapName,
138 const QString& normalMapName,
139 posFuncType _coordFunc,
141 OsculatingFunctType *osculatingFunc,
146 const QString &pTypeStr);
169 virtual QString getInfoString(
const StelCore *core,
const InfoStringGroup& flags)
const;
181 virtual QVariantMap getInfoMap(
const StelCore *core)
const;
182 virtual double getCloseViewFov(
const StelCore* core)
const;
183 virtual double getSatellitesFov(
const StelCore* core)
const;
184 virtual double getParentSatellitesFov(
const StelCore* core)
const;
185 virtual float getVMagnitude(
const StelCore* core)
const;
186 virtual float getSelectPriority(
const StelCore* core)
const;
187 virtual Vec3f getInfoColor(
void)
const;
188 virtual QString
getType(
void)
const {
return "Planet";}
189 virtual Vec3d getJ2000EquatorialPos(
const StelCore *core)
const;
190 virtual QString getEnglishName(
void)
const;
191 virtual QString getNameI18n(
void)
const;
193 virtual double getAngularSize(
const StelCore* core)
const;
194 virtual bool hasAtmosphere(
void) {
return atmosphere;}
195 virtual bool hasHalo(
void) {
return halo;}
204 virtual void draw(
StelCore* core,
float maxMagLabels,
const QFont& planetNameFont);
219 double getMeanSolarDay(
void)
const;
223 const QString& getTextMapName()
const {
return texMapName;}
224 const QString getPlanetTypeString()
const {
return pTypeMap.value(pType);}
227 void setNativeName(QString planet) { nativeName = planet; }
233 float getMeanOppositionMagnitude()
const;
234 ApparentMagnitudeAlgorithm getApparentMagnitudeAlgorithm()
const {
return vMagAlgorithm; }
235 const QString getApparentMagnitudeAlgorithmString()
const {
return vMagAlgorithmMap.value(vMagAlgorithm); }
236 void setApparentMagnitudeAlgorithm(QString algorithm);
241 double getSiderealTime(
double JD,
double JDE)
const;
242 Mat4d getRotEquatorialToVsop87(
void)
const;
243 void setRotEquatorialToVsop87(
const Mat4d &m);
247 void setRotationElements(
float _period,
float _offset,
double _epoch,
248 float _obliquity,
float _ascendingNode,
249 float _precessionRate,
double _siderealPeriod);
250 double getRotAscendingnode(
void)
const {
return re.ascendingNode;}
253 double getRotObliquity(
double JDE)
const;
258 void computePositionWithoutOrbits(
const double dateJDE);
259 void computePosition(
const double dateJDE);
263 void computeTransMatrix(
double JD,
double JDE);
266 double getPhaseAngle(
const Vec3d& obsPos)
const;
268 double getElongation(
const Vec3d& obsPos)
const;
270 double getSpheroidAngularSize(
const StelCore* core)
const;
272 float getPhase(
const Vec3d& obsPos)
const;
275 Vec3d getEclipticPos()
const;
278 Vec3d getHeliocentricEclipticPos()
const {
return getHeliocentricPos(eclipticPos);}
282 void setHeliocentricEclipticPos(
const Vec3d &pos);
285 double computeDistance(
const Vec3d& obsHelioPos);
286 double getDistance(
void)
const {
return distance;}
288 void setRings(
Ring* r) {rings = r;}
290 void setSphereScale(
float s) {sphereScale = s;}
291 float getSphereScale(
void)
const {
return sphereScale;}
293 const QSharedPointer<Planet> getParent(
void)
const {
return parent;}
295 static void setLabelColor(
const Vec3f& lc) {labelColor = lc;}
296 static const Vec3f& getLabelColor(
void) {
return labelColor;}
299 virtual void update(
int deltaTime);
308 void setFlagNativeName(
bool b) { flagNativeName = b; }
309 bool getFlagNativeName(
void) {
return flagNativeName; }
311 bool flagTranslatedName;
312 void setFlagTranslatedName(
bool b) { flagTranslatedName = b; }
313 bool getFlagTranslatedName(
void) {
return flagTranslatedName; }
324 Vec3d orbit[ORBIT_SEGMENTS+1];
325 Vec3d orbitP[ORBIT_SEGMENTS+1];
328 double deltaOrbitJDE;
334 static Vec3f orbitColor;
335 static void setOrbitColor(
const Vec3f& oc) {orbitColor = oc;}
336 static const Vec3f& getOrbitColor() {
return orbitColor;}
338 static Vec3f orbitMajorPlanetsColor;
339 static void setMajorPlanetOrbitColor(
const Vec3f& oc) { orbitMajorPlanetsColor = oc;}
340 static const Vec3f& getMajorPlanetOrbitColor() {
return orbitMajorPlanetsColor;}
342 static Vec3f orbitMoonsColor;
343 static void setMoonOrbitColor(
const Vec3f& oc) { orbitMoonsColor = oc;}
344 static const Vec3f& getMoonOrbitColor() {
return orbitMoonsColor;}
346 static Vec3f orbitMinorPlanetsColor;
347 static void setMinorPlanetOrbitColor(
const Vec3f& oc) { orbitMinorPlanetsColor = oc;}
348 static const Vec3f& getMinorPlanetOrbitColor() {
return orbitMinorPlanetsColor;}
350 static Vec3f orbitDwarfPlanetsColor;
351 static void setDwarfPlanetOrbitColor(
const Vec3f& oc) { orbitDwarfPlanetsColor = oc;}
352 static const Vec3f& getDwarfPlanetOrbitColor() {
return orbitDwarfPlanetsColor;}
354 static Vec3f orbitCubewanosColor;
355 static void setCubewanoOrbitColor(
const Vec3f& oc) { orbitCubewanosColor = oc;}
356 static const Vec3f& getCubewanoOrbitColor() {
return orbitCubewanosColor;}
358 static Vec3f orbitPlutinosColor;
359 static void setPlutinoOrbitColor(
const Vec3f& oc) { orbitPlutinosColor = oc;}
360 static const Vec3f& getPlutinoOrbitColor() {
return orbitPlutinosColor;}
362 static Vec3f orbitScatteredDiscObjectsColor;
363 static void setScatteredDiscObjectOrbitColor(
const Vec3f& oc) { orbitScatteredDiscObjectsColor = oc;}
364 static const Vec3f& getScatteredDiscObjectOrbitColor() {
return orbitScatteredDiscObjectsColor;}
366 static Vec3f orbitOortCloudObjectsColor;
367 static void setOortCloudObjectOrbitColor(
const Vec3f& oc) { orbitOortCloudObjectsColor = oc;}
368 static const Vec3f& getOortCloudObjectOrbitColor() {
return orbitOortCloudObjectsColor;}
370 static Vec3f orbitCometsColor;
371 static void setCometOrbitColor(
const Vec3f& oc) { orbitCometsColor = oc;}
372 static const Vec3f& getCometOrbitColor() {
return orbitCometsColor;}
374 static Vec3f orbitSednoidsColor;
375 static void setSednoidOrbitColor(
const Vec3f& oc) { orbitSednoidsColor = oc;}
376 static const Vec3f& getSednoidOrbitColor() {
return orbitSednoidsColor;}
378 static Vec3f orbitMercuryColor;
382 static Vec3f orbitVenusColor;
386 static Vec3f orbitEarthColor;
390 static Vec3f orbitMarsColor;
394 static Vec3f orbitJupiterColor;
398 static Vec3f orbitSaturnColor;
402 static Vec3f orbitUranusColor;
406 static Vec3f orbitNeptuneColor;
410 static bool permanentDrawingOrbits;
411 static PlanetOrbitColorStyle orbitColorStyle;
414 QVector<const Planet*> getCandidatesForShadow()
const;
419 void computeModelMatrix(
Mat4d &result)
const;
421 Vec3f getCurrentOrbitColor();
424 QString getSkyLabel(
const StelCore* core)
const;
430 void drawSphere(
StelPainter* painter,
float screenSz,
bool drawOnlyRing=
false);
433 void drawHints(
const StelCore* core,
const QFont& planetNameFont);
439 QString normalMapName;
443 double oneMinusOblateness;
447 Vec3d previousScreenPos;
451 float absoluteMagnitude;
453 Mat4d rotLocalToParent;
466 posFuncType coordFunc;
469 OsculatingFunctType *
const osculatingFunc;
470 QSharedPointer<Planet> parent;
471 QList<QSharedPointer<Planet> > satellites;
480 ApparentMagnitudeAlgorithm vMagAlgorithm;
482 static Vec3f labelColor;
484 static QMap<PlanetType, QString> pTypeMap;
485 static QMap<ApparentMagnitudeAlgorithm, QString> vMagAlgorithmMap;
487 static bool flagCustomGrsSettings;
488 static double customGrsJD;
489 static int customGrsLongitude;
490 static double customGrsDrift;
494 int projectionMatrix;
496 int unprojectedVertex;
508 void initLocations(QOpenGLShaderProgram*);
511 static QOpenGLShaderProgram* planetShaderProgram;
523 static QOpenGLShaderProgram* ringPlanetShaderProgram;
531 static QOpenGLShaderProgram* moonShaderProgram;
533 static void initShader();
534 static void deinitShader();
537 #endif // _PLANET_HPP_ double getAlbedo(void) const
Get albedo.
virtual void update(double deltaTime)
Update time-varying components.
void setFlagOrbits(bool b)
Set flag which determines if planet orbits are drawn or hidden.
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...
Define the StelTextureSP type.
Vec3f getNeptuneOrbitColor(void) const
Get the current color used to draw Neptune orbit line.
PlanetType
numeric typecodes for the type descriptions in ssystem.ini
Vec3f getSaturnOrbitColor(void) const
Get the current color used to draw Saturn orbit line.
void setEarthOrbitColor(const Vec3f &c)
Set the color used to draw Earth orbit line.
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.
Vec3f getUranusOrbitColor(void) const
Get the current color used to draw Uranus orbit line.
Vec3f getMercuryOrbitColor(void) const
Get the current color used to draw Mercury orbit line.
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.
void setVenusOrbitColor(const Vec3f &c)
Set the color used to draw Venus orbit line.
void setJupiterOrbitColor(const Vec3f &c)
Set the color used to draw Jupiter orbit line.
This StelObjectModule derivative is used to model SolarSystem bodies.
void setNeptuneOrbitColor(const Vec3f &c)
Set the color used to draw Neptune orbit line.
double getSiderealDay(void) const
Get duration of sidereal day.
Vec3f getJupiterOrbitColor(void) const
Get the current color used to draw Jupiter orbit line.
Provides functions for performing openGL drawing operations.
virtual void init()
Initialize the SolarSystem.
Vec3f getVenusOrbitColor(void) const
Get the current color used to draw Venus orbit line.
void setMarsOrbitColor(const Vec3f &c)
Set the color used to draw Mars orbit line.
QSharedPointer< ModelViewTranform > ModelViewTranformP
Shared pointer on a ModelViewTranform instance (implement reference counting)
Vec3f getMarsOrbitColor(void) const
Get the current color used to draw Mars orbit line.
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.
A templatized 3d vector compatible with openGL.
Define the StelProjectorP type.
void setSaturnOrbitColor(const Vec3f &c)
Set the color used to draw Saturn orbit line.
virtual QString getType(void) const
Return object's type. It should be the name of the class.
float getAbsoluteMagnitude() const
Return the absolute magnitude (read from file ssystem.ini)
QSharedPointer< StelTexture > StelTextureSP
Use shared pointer to simplify memory managment.
void setMercuryOrbitColor(const Vec3f &c)
Set the color used to draw Mercury orbit line.
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.
Vec3f getEarthOrbitColor(void) const
Get the current color used to draw Earth orbit line.
void setUranusOrbitColor(const Vec3f &c)
Set the color used to draw Uranus orbit line.
virtual void draw(StelCore *core)
Draw SolarSystem objects (planets).