00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _SOLARSYSTEM_HPP_
00021 #define _SOLARSYSTEM_HPP_
00022
00023 #if defined(sun)
00024 #undef sun
00025 #endif
00026 #include <vector>
00027 #include <functional>
00028
00029 #include "StelObjectModule.hpp"
00030 #include "StelTextureTypes.hpp"
00031
00032 class Orbit;
00033 class StelLoadingBar;
00034 class StelTranslator;
00035 class StelObject;
00036 class Planet;
00037 class StelFont;
00038 class StelCore;
00039 class StelProjector;
00040 class StelNavigator;
00041 class QSettings;
00042
00046 class SolarSystem : public StelObjectModule
00047 {
00048 Q_OBJECT
00049
00050 public:
00051 SolarSystem();
00052 virtual ~SolarSystem();
00053
00055
00061 virtual void init();
00062
00067 virtual void draw(StelCore *core);
00068
00071 virtual void update(double deltaTime);
00072
00074 virtual void updateI18n();
00075
00077 virtual void selectedObjectChangeCallBack(StelModuleSelectAction action=StelModule::ReplaceSelection);
00078
00080 virtual void setStelStyle(const StelStyle& style);
00081
00083 virtual double getCallOrder(StelModuleActionName actionName) const;
00084
00086
00095 virtual QList<StelObjectP> searchAround(const Vec3d& v, double limitFov, const StelCore* core) const;
00096
00100 virtual StelObjectP searchByNameI18n(const QString& nameI18n) const;
00101
00105 virtual StelObjectP searchByName(const QString& name) const;
00106
00113 virtual QStringList listMatchingObjectsI18n(const QString& objPrefix, int maxNbItem=5) const;
00114
00115 public slots:
00117
00118
00120 void setFlagPlanets(bool b);
00122 bool getFlagPlanets() const;
00123
00125 void setFlagTrails(bool b);
00127 bool getFlagTrails() const;
00128
00130 void setFlagHints(bool b);
00132 bool getFlagHints() const;
00133
00135 void setFlagLabels(bool b);
00137 bool getFlagLabels() const;
00138
00142 void setLabelsAmount(float a) {labelsAmount=a;}
00145 float getLabelsAmount(void) const {return labelsAmount;}
00146
00148 void setFlagOrbits(bool b);
00150 bool getFlagOrbits() const {return flagOrbits;}
00151
00153 void setFlagLightTravelTime(bool b);
00156 bool getFlagLightTravelTime(void) const {return flagLightTravelTime;}
00157
00159 void setFontSize(float newFontSize);
00160
00162 void setLabelsColor(const Vec3f& c);
00164 const Vec3f& getLabelsColor(void) const;
00165
00167 void setOrbitsColor(const Vec3f& c);
00169 Vec3f getOrbitsColor(void) const;
00170
00172 void setTrailsColor(const Vec3f& c);
00174 Vec3f getTrailsColor(void) const;
00175
00177 void setFlagMoonScale(bool b);
00179 bool getFlagMoonScale(void) const {return flagMoonScale;}
00180
00182 void setMoonScale(float f);
00184 float getMoonScale(void) const {return moonScale;}
00185
00186 public:
00188
00192 Planet* searchByEnglishName(QString planetEnglishName) const;
00193
00195 Planet* getSun(void) const {return sun;}
00196
00198 Planet* getEarth(void) const {return earth;}
00199
00201 Planet* getMoon(void) const {return moon;}
00202
00204 bool nearLunarEclipse();
00205
00207 QStringList getAllPlanetEnglishNames() const;
00208
00210
00215 QString getPlanetHashString();
00216
00220 void computePositions(double date, const Vec3d& observerPos = Vec3d(0,0,0));
00221
00223 const std::vector<Planet*>& getAllPlanets() const {return systemPlanets;}
00224
00225 private:
00231 StelObject* search(Vec3d v, const StelCore* core) const;
00232
00234
00235
00237 void startTrails(bool b);
00238
00241 void computeTransMatrices(double date, const Vec3d& observerPos = Vec3d(0,0,0));
00242
00244 void drawPointer(const StelCore* core);
00245
00247 void loadPlanets();
00248
00249 Planet* sun;
00250 Planet* moon;
00251 Planet* earth;
00252
00255 void setSelected(const QString& englishName);
00257 void setSelected(StelObject* obj);
00259 StelObject* getSelected(void) const {return selected;}
00261 StelObject* selected;
00262
00263 bool flagMoonScale;
00264 float moonScale;
00265
00266 double fontSize;
00267 StelFont& planetNameFont;
00268
00270 float labelsAmount;
00271
00272 std::vector<Planet*> systemPlanets;
00273
00274
00275 struct biggerDistance : public std::binary_function<Planet*, Planet*, bool>
00276 {
00277 bool operator()(Planet* p1, Planet* p2);
00278 };
00279
00280
00281 bool flagOrbits;
00282 bool flagLightTravelTime;
00283
00284 StelTextureSP texPointer;
00285
00286 bool flagShow;
00287
00289
00291 const Planet* lastHomePlanet;
00292 std::vector<Orbit*> orbits;
00293 };
00294
00295
00296 #endif // _SOLARSYSTEM_HPP_