Planet.hpp   Planet.hpp 
skipping to change at line 26 skipping to change at line 26
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA.
*/ */
#ifndef _PLANET_HPP_ #ifndef _PLANET_HPP_
#define _PLANET_HPP_ #define _PLANET_HPP_
#include <QString> #include <QString>
#include "StelObject.hpp" #include "StelObject.hpp"
#include "StelProjector.hpp"
#include "VecMath.hpp" #include "VecMath.hpp"
#include "StelFader.hpp" #include "StelFader.hpp"
#include "StelTextureTypes.hpp" #include "StelTextureTypes.hpp"
#include "StelProjectorType.hpp" #include "StelProjectorType.hpp"
// The callback type for the external position computation function // The callback type for the external position computation function
// The last variable is the userData pointer. // The last variable is the userData pointer.
typedef void (*posFuncType)(double, double*, void*); typedef void (*posFuncType)(double, double*, void*);
typedef void (OsulatingFunctType)(double jd0,double jd,double xyz[3]); typedef void (OsculatingFunctType)(double jd0,double jd,double xyz[3]);
// epoch J2000: 12 UT on 1 Jan 2000 // epoch J2000: 12 UT on 1 Jan 2000
#define J2000 2451545.0 #define J2000 2451545.0
#define ORBIT_SEGMENTS 72 #define ORBIT_SEGMENTS 72
class StelFont; class StelFont;
class StelPainter; class StelPainter;
class StelTranslator; class StelTranslator;
struct TrailPoint struct TrailPoint
skipping to change at line 71 skipping to change at line 72
float precessionRate; // rate of precession of rotation axis in rad s/day float precessionRate; // rate of precession of rotation axis in rad s/day
double siderealPeriod; // sidereal period (Planet year in earth days ) double siderealPeriod; // sidereal period (Planet year in earth days )
}; };
// Class to manage rings for planets like saturn // Class to manage rings for planets like saturn
class Ring class Ring
{ {
public: public:
Ring(double radiusMin,double radiusMax,const QString &texname); Ring(double radiusMin,double radiusMax,const QString &texname);
~Ring(void); ~Ring(void);
void draw(StelPainter* painter,const Mat4d& mat,double screenSz); void draw(StelPainter* painter, StelProjector::ModelViewTranformP tr ansfo, double screenSz);
double getSize(void) const {return radiusMax;} double getSize(void) const {return radiusMax;}
private: private:
const double radiusMin; const double radiusMin;
const double radiusMax; const double radiusMax;
StelTextureSP tex; StelTextureSP tex;
}; };
class Planet : public StelObject class Planet : public StelObject
{ {
public: public:
friend class SolarSystem; friend class SolarSystem;
Planet(const QString& englishName, Planet(const QString& englishName,
int flagLighting, int flagLighting,
double radius, double radius,
double oblateness, double oblateness,
Vec3f color, Vec3f color,
float albedo, float albedo,
const QString& texMapName, const QString& texMapName,
posFuncType _coordFunc, posFuncType _coordFunc,
void* userDataPtr, void* userDataPtr,
OsulatingFunctType *osculatingFunc, OsculatingFunctType *osculatingFunc,
bool closeOrbit, bool closeOrbit,
bool hidden, bool hidden,
bool hasAtmosphere); bool hasAtmosphere);
~Planet(); ~Planet();
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// Methods inherited from StelObject // Methods inherited from StelObject
//! Get a string with data about the Planet. //! Get a string with data about the Planet.
//! Planets support the following InfoStringGroup flags: //! Planets support the following InfoStringGroup flags:
//! - Name //! - Name
//! - Magnitude //! - Magnitude
//! - RaDec //! - RaDec
//! - AltAzi //! - AltAzi
//! - Distance //! - Distance
//! - Size //! - Size
//! - PlainText //! - PlainText
//! @param core the Stelore object //! - Extra1: Heliocentric Ecliptical Coordinates
//! - Extra2: Observer-planetocentric Ecliptical Coordinates
//! @param core the StelCore object
//! @param flags a set of InfoStringGroup items to include in the re turn value. //! @param flags a set of InfoStringGroup items to include in the re turn value.
//! @return a QString containing an HMTL encoded description of the Planet. //! @return a QString containing an HMTL encoded description of the Planet.
virtual QString getInfoString(const StelCore *core, const InfoString Group& flags) const; virtual QString getInfoString(const StelCore *core, const InfoString Group& flags) const;
virtual double getCloseViewFov(const StelNavigator * nav) const; virtual double getCloseViewFov(const StelCore* core) const;
virtual double getSatellitesFov(const StelNavigator * nav) const; virtual double getSatellitesFov(const StelCore* core) const;
virtual double getParentSatellitesFov(const StelNavigator * nav) con virtual double getParentSatellitesFov(const StelCore* core) const;
st; virtual float getVMagnitude(const StelCore* core) const;
virtual float getVMagnitude(const StelNavigator * nav) const; virtual float getSelectPriority(const StelCore* core) const;
virtual float getSelectPriority(const StelNavigator *nav) const;
virtual Vec3f getInfoColor(void) const; virtual Vec3f getInfoColor(void) const;
virtual QString getType(void) const {return "Planet";} virtual QString getType(void) const {return "Planet";}
virtual Vec3d getJ2000EquatorialPos(const StelNavigator *nav) const; virtual Vec3d getJ2000EquatorialPos(const StelCore *core) const;
virtual QString getEnglishName(void) const {return englishName;} virtual QString getEnglishName(void) const {return englishName;}
virtual QString getNameI18n(void) const {return nameI18;} virtual QString getNameI18n(void) const {return nameI18;}
virtual double getAngularSize(const StelCore* core) const; virtual double getAngularSize(const StelCore* core) const;
virtual bool hasAtmosphere(void) {return atmosphere;} virtual bool hasAtmosphere(void) {return atmosphere;}
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// Methods of SolarSystem object // Methods of SolarSystem object
//! Translate planet name using the passed translator //! Translate planet name using the passed translator
virtual void translateName(StelTranslator& trans); virtual void translateName(StelTranslator& trans);
skipping to change at line 165 skipping to change at line 168
// Compute the transformation matrix from the local Planet coordinat e to the parent Planet coordinate // Compute the transformation matrix from the local Planet coordinat e to the parent Planet coordinate
void computeTransMatrix(double date); void computeTransMatrix(double date);
// Get the phase angle for an observer at pos obsPos in the heliocen tric coordinate (in AU) // Get the phase angle for an observer at pos obsPos in the heliocen tric coordinate (in AU)
double getPhase(const Vec3d& obsPos) const; double getPhase(const Vec3d& obsPos) const;
// Get the angular size of the spheroid of the planet (i.e. without the rings) // Get the angular size of the spheroid of the planet (i.e. without the rings)
double getSpheroidAngularSize(const StelCore* core) const; double getSpheroidAngularSize(const StelCore* core) const;
// Set the orbital elements // Set the orbital elements
void setRotationElements(float _period, float _offset, double _epoch , void setRotationElements(float _period, float _offset, double _epoch ,
float _obliquity, float _ascendingNode, float _precessionRat float _obliquity, float _ascendingNode,
e, double _siderealPeriod); float _precessionRate, double _siderealPeri
od);
double getRotAscendingnode(void) const {return re.ascendingNode;} double getRotAscendingnode(void) const {return re.ascendingNode;}
double getRotObliquity(void) const {return re.obliquity;} double getRotObliquity(void) const {return re.obliquity;}
//! Get the Planet position in the parent Planet ecliptic coordinate in AU //! Get the Planet position in the parent Planet ecliptic coordinate in AU
Vec3d getEclipticPos() const; Vec3d getEclipticPos() const;
// Return the heliocentric ecliptical position // Return the heliocentric ecliptical position
Vec3d getHeliocentricEclipticPos() const; Vec3d getHeliocentricEclipticPos() const;
void setHeliocentricEclipticPos(const Vec3d &pos); void setHeliocentricEclipticPos(const Vec3d &pos);
skipping to change at line 211 skipping to change at line 215
// Should move to an OrbitPath class which works on a SolarSystemObj ect, not a Planet // Should move to an OrbitPath class which works on a SolarSystemObj ect, not a Planet
void setFlagOrbits(bool b){orbitFader = b;} void setFlagOrbits(bool b){orbitFader = b;}
bool getFlagOrbits(void) const {return orbitFader;} bool getFlagOrbits(void) const {return orbitFader;}
LinearFader orbitFader; LinearFader orbitFader;
// draw orbital path of Planet // draw orbital path of Planet
void drawOrbit(const StelCore*); void drawOrbit(const StelCore*);
Vec3d orbit[ORBIT_SEGMENTS+1]; // store heliocentric coordinates f or drawing the orbit Vec3d orbit[ORBIT_SEGMENTS+1]; // store heliocentric coordinates f or drawing the orbit
double lastOrbitJD; double lastOrbitJD;
double deltaJD; double deltaJD;
double deltaOrbitJD; double deltaOrbitJD;
bool orbitCached; // whether orbit calculations are cac bool orbitCached; // whether orbit calculations are c
hed for drawing orbit yet ached for drawing orbit yet
bool closeOrbit; // whether to connect the beginning o bool closeOrbit; // whether to connect the beginning
f the orbit line to of the orbit line to
// the en // the end: good for elliptical orb
d: good for elliptical orbits, bad for parabolic its, bad for parabolic
// and hy // and hyperbolic orbits
perbolic orbits
static Vec3f orbitColor; static Vec3f orbitColor;
static void setOrbitColor(const Vec3f& oc) {orbitColor = oc;} static void setOrbitColor(const Vec3f& oc) {orbitColor = oc;}
static const Vec3f& getOrbitColor() {return orbitColor;} static const Vec3f& getOrbitColor() {return orbitColor;}
protected: protected:
static StelTextureSP texEarthShadow; // for lunar eclipses static StelTextureSP texEarthShadow; // for lunar eclipses
// draw earth shadow on moon for lunar eclipses // draw earth shadow on moon for lunar eclipses
void drawEarthShadow(StelCore* core, StelPainter* sPainter); void drawEarthShadow(StelCore* core, StelPainter* sPainter);
// Return the information string "ready to print" :) // Return the information string "ready to print" :)
QString getSkyLabel(const StelNavigator * nav) const; QString getSkyLabel(const StelCore* core) const;
// Draw the 3d model. Call the proper functions if there are rings e tc.. // Draw the 3d model. Call the proper functions if there are rings e tc..
void draw3dModel(StelCore* core, const Mat4d& mat, float screenSz); void draw3dModel(StelCore* core, StelProjector::ModelViewTranformP t ransfo, float screenSz);
// Draw the 3D sphere // Draw the 3D sphere
void drawSphere(StelPainter* painter, float screenSz); void drawSphere(StelPainter* painter, float screenSz);
// Draw the circle and name of the Planet // Draw the circle and name of the Planet
void drawHints(const StelCore* core, const QFont& planetNameFont); void drawHints(const StelCore* core, const QFont& planetNameFont);
QString englishName; // english planet name QString englishName; // english planet name
QString nameI18; // International translated name QString nameI18; // International translated name
QString texMapName; // Texture file path QString texMapName; // Texture file path
int flagLighting; // Set whether light computation has int flagLighting; // Set whether light computation ha
to be proceed s to be proceed
RotationElements re; // Rotation param RotationElements re; // Rotation param
double radius; // Planet radius in UA double radius; // Planet radius in AU
double oneMinusOblateness; // (polar radius)/(equatorial radius double oneMinusOblateness; // (polar radius)/(equatorial radiu
) s)
Vec3d eclipticPos; // Position in UA in the rectangular Vec3d eclipticPos; // Position in AU in the rectangula
ecliptic coordinate system r ecliptic coordinate system
// c // centered on the parent Planet
entered on the parent Planet Vec3d screenPos; // Used to store temporarily the 2D
Vec3d screenPos; // Used to store temporarily the 2D position on screen
position on screen Vec3d previousScreenPos; // The position of this planet in t
Vec3d previousScreenPos; // The position of this planet in th he previous frame.
e previous frame.
Vec3f color; Vec3f color;
float albedo; // Planet albedo float albedo; // Planet albedo
Mat4d rotLocalToParent; Mat4d rotLocalToParent;
float axisRotation; // Rotation angle of the Planet on it float axisRotation; // Rotation angle of the Planet on
's axis it's axis
StelTextureSP texMap; // Planet map texture StelTextureSP texMap; // Planet map texture
Ring* rings; // Planet rings Ring* rings; // Planet rings
double distance; // Temporary variable used to store double distance; // Temporary variable used to store
the distance to a given point the distance to a given point
// i // it is used for sorting while dra
t is used for sorting while drawing wing
float sphereScale; // Artificial scaling for better view float sphereScale; // Artificial scaling for better vi
ing ewing
double lastJD; double lastJD;
// The callback for the calculation of the equatorial rect heliocent ric position at time JD. // The callback for the calculation of the equatorial rect heliocent ric position at time JD.
posFuncType coordFunc; posFuncType coordFunc;
void* userDataPtr; void* userDataPtr;
OsulatingFunctType *const osculatingFunc; OsculatingFunctType *const osculatingFunc;
QSharedPointer<Planet> parent; // Planet parent i.e. sun f or earth QSharedPointer<Planet> parent; // Planet parent i.e. sun f or earth
QList<QSharedPointer<Planet> > satellites; // satellites of the Planet QList<QSharedPointer<Planet> > satellites; // satellites of the Planet
LinearFader hintFader; LinearFader hintFader;
LinearFader labelsFader; // Store the current state of the la LinearFader labelsFader; // Store the current state of the l
bel for this planet abel for this planet
bool flagLabels; // Define whether labels should be d bool flagLabels; // Define whether labels should be
isplayed displayed
bool hidden; // useful for fake planets used as o bool hidden; // useful for fake planets used as
bservation positions - not drawn or labeled observation positions - not drawn or labeled
bool atmosphere; // Does the planet have an atmospher bool atmosphere; // Does the planet have an atmosphe
e? re?
static Vec3f labelColor; static Vec3f labelColor;
static StelTextureSP hintCircleTex; static StelTextureSP hintCircleTex;
}; };
#endif // _PLANET_HPP_ #endif // _PLANET_HPP_
 End of changes. 16 change blocks. 
60 lines changed or deleted 61 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/