Planet.hpp   Planet.hpp 
skipping to change at line 23 skipping to change at line 23
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* 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 <list>
#include <QString> #include <QString>
#include "StelObject.hpp" #include "StelObject.hpp"
#include "ToneReproducer.hpp" #include "StelToneReproducer.hpp"
#include "vecmath.h" #include "VecMath.hpp"
#include "callbacks.hpp" #include "callbacks.hpp"
#include "Fader.hpp" #include "StelFader.hpp"
#include "Translator.hpp" #include "StelTranslator.hpp"
#include "STextureTypes.hpp" #include "StelTextureTypes.hpp"
#include "StelProjectorType.hpp"
// The callback type for the external position computation function // The callback type for the external position computation function
typedef boost::callback<void, double, double*> posFuncType; typedef boost::callback<void, double, double*> posFuncType;
typedef void (OsulatingFunctType)(double jd0,double jd,double xyz[3]); typedef void (OsulatingFunctType)(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 SFont; class StelFont;
class StelPainter;
struct TrailPoint struct TrailPoint
{ {
Vec3d point; Vec3d point;
double date; double date;
}; };
// Class used to store orbital elements // Class used to store orbital elements
class RotationElements class RotationElements
{ {
public: public:
RotationElements(void) : period(1.), offset(0.), epoch(J2000), obliquit y(0.), ascendingNode(0.), precessionRate(0.) {} RotationElements(void) : period(1.), offset(0.), epoch(J2000), obliquit y(0.), ascendingNode(0.), precessionRate(0.) {}
float period; // rotation period float period; // rotation period
float offset; // rotation at epoch float offset; // rotation at epoch
double epoch; double epoch;
skipping to change at line 71 skipping to change at line 72
float precessionRate; // rate of precession of rotation axis in rads/d ay float precessionRate; // rate of precession of rotation axis in rads/d ay
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(const Projector* prj,const Mat4d& mat,double screenSz); void draw(const StelPainter* painter,const Mat4d& mat,double screenS z);
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;
STextureSP tex; StelTextureSP tex;
}; };
class Planet : public StelObject class Planet : public StelObject
{ {
public: public:
friend class SolarSystem; friend class SolarSystem;
Planet(Planet *parent, Planet(const QString& englishName,
const QString& englishName,
int flagHalo,
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,
const QString& texHaloName, const QString& texHaloName,
posFuncType _coordFunc, posFuncType _coordFunc,
OsulatingFunctType *osculatingFunc, OsulatingFunctType *osculatingFunc,
bool closeOrbit, bool closeOrbit,
skipping to change at line 116 skipping to change at line 115
//! - Magnitude //! - Magnitude
//! - RaDec //! - RaDec
//! - AltAzi //! - AltAzi
//! - Distance //! - Distance
//! - Size //! - Size
//! - PlainText //! - PlainText
//! @param core the Stelore object //! @param core the Stelore 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 Navigator * nav) const; virtual double getCloseViewFov(const StelNavigator * nav) const;
virtual double getSatellitesFov(const Navigator * nav) const; virtual double getSatellitesFov(const StelNavigator * nav) const;
virtual double getParentSatellitesFov(const Navigator * nav) const; virtual double getParentSatellitesFov(const StelNavigator * nav) con
virtual float getVMagnitude(const Navigator * nav) const; st;
virtual float getSelectPriority(const Navigator *nav) const; virtual float getVMagnitude(const StelNavigator * nav) 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 getObsJ2000Pos(const Navigator *nav) const; virtual Vec3d getJ2000EquatorialPos(const StelNavigator *nav) 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
void translateName(Translator& trans) {nameI18 = trans.qtranslate(en glishName);} void translateName(StelTranslator& trans) {nameI18 = trans.qtranslat e(englishName);}
// Draw the Planet // Draw the Planet
void draw(StelCore* core, float maxMagLabels); void draw(StelCore* core, float maxMagLabels);
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// Methods specific to Planet // Methods specific to Planet
//! Set the planet's parent, i.e. the one around which it's orbiting
void setParent(Planet* parent);
//! Get the radius of the planet in AU. //! Get the radius of the planet in AU.
//! @return the radius of the planet in astronomical units. //! @return the radius of the planet in astronomical units.
double getRadius(void) const {return radius;} double getRadius(void) const {return radius;}
double getSiderealDay(void) const {return re.period;} double getSiderealDay(void) const {return re.period;}
const QString& getTextMapName() const {return texMapName;} const QString& getTextMapName() const {return texMapName;}
// Compute the z rotation to use from equatorial to geographic coord inates // Compute the z rotation to use from equatorial to geographic coord inates
double getSiderealTime(double jd) const; double getSiderealTime(double jd) const;
Mat4d getRotEquatorialToVsop87(void) const; Mat4d getRotEquatorialToVsop87(void) const;
skipping to change at line 171 skipping to change at line 173
double getPhase(Vec3d obsPos) const; double getPhase(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 e, double _siderealPeriod); float _obliquity, float _ascendingNode, float _precessionRat e, double _siderealPeriod);
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 //! 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);
// Compute the distance to the given position in heliocentric coordi nate (in AU) // Compute the distance to the given position in heliocentric coordi nate (in AU)
double computeDistance(const Vec3d& obsHelioPos); double computeDistance(const Vec3d& obsHelioPos);
double getDistance(void) const {return distance;} double getDistance(void) const {return distance;}
void setRings(Ring* r) {rings = r;} void setRings(Ring* r) {rings = r;}
void setSphereScale(float s) {sphereScale = s;} void setSphereScale(float s) {sphereScale = s;}
float getSphereScale(void) const {return sphereScale;} float getSphereScale(void) const {return sphereScale;}
const Planet *getParent(void) const {return parent;} const Planet* getParent(void) const {return parent;}
static void setFont(SFont* f) {planetNameFont = f;} static void setFont(StelFont* f) {planetNameFont = f;}
static void setLabelColor(const Vec3f& lc) {labelColor = lc;} static void setLabelColor(const Vec3f& lc) {labelColor = lc;}
static const Vec3f& getLabelColor(void) {return labelColor;} static const Vec3f& getLabelColor(void) {return labelColor;}
void update(int deltaTime); void update(int deltaTime);
void setFlagHints(bool b){hintFader = b;} void setFlagHints(bool b){hintFader = b;}
bool getFlagHints(void) const {return hintFader;} bool getFlagHints(void) const {return hintFader;}
void setFlagLabels(bool b){flagLabels = b;} void setFlagLabels(bool b){flagLabels = b;}
bool getFlagLabels(void) const {return flagLabels;} bool getFlagLabels(void) const {return flagLabels;}
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// DEPRECATED // DEPRECATED
///// Trail related code ///// Trail related code
// Should move to a TrailPath class which works on a StelObject, not on a Planet // Should move to a TrailPath class which works on a StelObject, not on a Planet
void updateTrail(const Navigator* nav); void updateTrail(const StelNavigator* nav);
void drawTrail(const Navigator * nav, const Projector* prj); void drawTrail(const StelCore* core);
//! Start/stop accumulating new trail data (clear old data) //! Start/stop accumulating new trail data (clear old data)
void startTrail(bool b); void startTrail(bool b);
void setFlagTrail(bool b){if(b == trailFader) return; trailFader = b ; startTrail(b);} void setFlagTrail(bool b){if(b == trailFader) return; trailFader = b ; startTrail(b);}
bool getFlagTrail(void) const {return trailFader;} bool getFlagTrail(void) const {return trailFader;}
static void setTrailColor(const Vec3f& c) { trailColor = c; } static void setTrailColor(const Vec3f& c) { trailColor = c; }
static const Vec3f& getTrailColor() { return trailColor; } static const Vec3f& getTrailColor() { return trailColor; }
static Vec3f trailColor; static Vec3f trailColor;
std::list<TrailPoint>trail; std::list<TrailPoint>trail;
bool trailOn; // accumulate trail data if true bool trailOn; // accumulate trail data if true
double DeltaTrail; double DeltaTrail;
int MaxTrail; int MaxTrail;
double lastTrailJD; double lastTrailJD;
bool firstPoint; // if need to take first point of tra il still bool firstPoint; // if need to take first point of tra il still
LinearFader trailFader; LinearFader trailFader;
///// Orbit related code ///// Orbit related code
// 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;}
static void setOrbitColor(const Vec3f& oc) {orbitColor = oc;} LinearFader orbitFader;
static const Vec3f& getOrbitColor() {return orbitColor;}
// draw orbital path of Planet // draw orbital path of Planet
void drawOrbit(const Navigator * nav, const Projector* prj); void drawOrbit(const StelCore*);
Vec3d orbit[ORBIT_SEGMENTS]; // store heliocentric coordinates for drawing the orbit Vec3d orbit[ORBIT_SEGMENTS]; // store heliocentric coordinates for drawing the orbit
double lastOrbitJD; double lastOrbitJD;
double deltaJD; double deltaJD;
double deltaOrbitJD; double deltaOrbitJD;
bool orbitCached; // whether orbit calculations are cac hed for drawing orbit yet bool orbitCached; // whether orbit calculations are cac hed for drawing orbit yet
bool closeOrbit; // whether to connect the beginning o f the orbit line to bool closeOrbit; // whether to connect the beginning o f the orbit line to
// the end: good for elliptical orbit s, bad for parabolic // the end: good for elliptical orbit s, bad for parabolic
// and hyperbolic orbits // and hyperbolic orbits
static Vec3f orbitColor; static Vec3f orbitColor;
LinearFader orbitFader; static void setOrbitColor(const Vec3f& oc) {orbitColor = oc;}
static const Vec3f& getOrbitColor() {return orbitColor;}
protected: protected:
static StelTextureSP texEarthShadow; // for lunar eclipses
// draw earth shadow on moon for lunar eclipses
void drawEarthShadow(StelCore* core);
// Return the information string "ready to print" :) // Return the information string "ready to print" :)
QString getSkyLabel(const Navigator * nav) const; QString getSkyLabel(const StelNavigator * nav) 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, const Mat4d& mat, float screenSz);
// Draw the 3D sphere // Draw the 3D sphere
void drawSphere(StelCore* core, const Mat4d& mat, float screenSz); void drawSphere(const 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); void drawHints(const StelCore* core);
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 flagHalo; // Set wether a little "star like" h alo will be drawn
int flagLighting; // Set wether light computation has to be proceed int flagLighting; // Set wether light computation has to be proceed
RotationElements re; // Rotation param RotationElements re; // Rotation param
double radius; // Planet radius in UA double radius; // Planet radius in UA
double oneMinusOblateness; // (polar radius)/(equatorial radius ) double oneMinusOblateness; // (polar radius)/(equatorial radius )
Vec3d eclipticPos; // Position in UA in the rectangular ecliptic coordinate system Vec3d eclipticPos; // Position in UA in the rectangular ecliptic coordinate system
// centered on the parent Planet // centered on the parent Planet
Vec3d screenPos; // Used to store temporarily the 2D position on screen Vec3d screenPos; // Used to store temporarily the 2D position on screen
Vec3d previousScreenPos; // The position of this planet in th e previous frame. Vec3d previousScreenPos; // The position of this planet in th 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 's axis float axisRotation; // Rotation angle of the Planet on it 's axis
STextureSP texMap; // Planet map texture StelTextureSP texMap; // Planet map texture
Ring* rings; // Planet rings Ring* rings; // Planet rings
double distance; // Temporary variable used to store the distance to a given point double distance; // Temporary variable used to store the distance to a given point
// it is used for sorting while draw ing // it is used for sorting while draw ing
float sphereScale; // Artificial scaling for better view ing float sphereScale; // Artificial scaling for better view ing
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;
OsulatingFunctType *const osculatingFunc; OsulatingFunctType *const osculatingFunc;
const Planet *parent; // Planet parent i.e. sun for earth const Planet *parent; // Planet parent i.e. sun for earth
std::list<Planet *> satellites; // satellites of the Planet QList<Planet*> satellites; // satellites of the Planet
static SFont* planetNameFont; // Font for names
static Vec3f labelColor;
static STextureSP hintCircleTex;
LinearFader hintFader; LinearFader hintFader;
LinearFader labelsFader; // Store the current state of the la bel for this planet LinearFader labelsFader; // Store the current state of the la bel for this planet
bool flagLabels; // Define whether labels should be d isplayed bool flagLabels; // Define whether labels should be d isplayed
bool hidden; // useful for fake planets used as o bool hidden; // useful for fake planets used as o
bservation bservation positions - not drawn or labeled
// positions - not drawn or labeled
bool atmosphere; // Does the planet have an atmospher e? bool atmosphere; // Does the planet have an atmospher e?
static StelFont* planetNameFont; // Font for names
static Vec3f labelColor;
static StelTextureSP hintCircleTex;
}; };
#endif // _PLANET_HPP_ #endif // _PLANET_HPP_
 End of changes. 28 change blocks. 
41 lines changed or deleted 49 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/