Stellarium 0.11.4 | |||
Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · File Structure |
00001 /* 00002 * Stellarium 00003 * Copyright (C) 2002 Fabien Chereau 00004 * Copyright (c) 2010 Bogdan Marinov 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. 00019 */ 00020 00021 #ifndef _SOLARSYSTEM_HPP_ 00022 #define _SOLARSYSTEM_HPP_ 00023 //sun is already defined in Sun C/Solaris 00024 #if defined(sun) 00025 #undef sun 00026 #endif 00027 00028 #include <QFont> 00029 #include "StelObjectModule.hpp" 00030 #include "StelTextureTypes.hpp" 00031 #include "Planet.hpp" 00032 00033 class Orbit; 00034 class StelTranslator; 00035 class StelObject; 00036 class StelCore; 00037 class StelProjector; 00038 class QSettings; 00039 00040 typedef QSharedPointer<Planet> PlanetP; 00041 00045 class SolarSystem : public StelObjectModule 00046 { 00047 Q_OBJECT 00048 00049 public: 00050 SolarSystem(); 00051 virtual ~SolarSystem(); 00052 00054 // Methods defined in the StelModule class 00060 virtual void init(); 00061 00066 virtual void draw(StelCore *core); 00067 00070 virtual void update(double deltaTime); 00071 00073 virtual double getCallOrder(StelModuleActionName actionName) const; 00074 00076 // Methods defined in StelObjectManager class 00085 virtual QList<StelObjectP> searchAround(const Vec3d& v, double limitFov, const StelCore* core) const; 00086 00090 virtual StelObjectP searchByNameI18n(const QString& nameI18n) const; 00091 00095 virtual StelObjectP searchByName(const QString& name) const; 00096 00103 virtual QStringList listMatchingObjectsI18n(const QString& objPrefix, int maxNbItem=5) const; 00104 00105 public slots: 00107 // Method callable from script and GUI 00108 // Properties setters and getters 00110 void setFlagPlanets(bool b); 00112 bool getFlagPlanets() const; 00113 00115 void setFlagTrails(bool b); 00117 bool getFlagTrails() const; 00118 00120 void setFlagHints(bool b); 00122 bool getFlagHints() const; 00123 00125 void setFlagLabels(bool b); 00127 bool getFlagLabels() const; 00128 00132 void setLabelsAmount(float a) {labelsAmount=a;} 00135 float getLabelsAmount(void) const {return labelsAmount;} 00136 00138 void setFlagOrbits(bool b); 00140 bool getFlagOrbits() const {return flagOrbits;} 00141 00143 void setFlagLightTravelTime(bool b); 00146 bool getFlagLightTravelTime(void) const {return flagLightTravelTime;} 00147 00149 void setFontSize(float newFontSize); 00150 00152 void setLabelsColor(const Vec3f& c); 00154 const Vec3f& getLabelsColor(void) const; 00155 00157 void setOrbitsColor(const Vec3f& c); 00159 Vec3f getOrbitsColor(void) const; 00160 00162 void setTrailsColor(const Vec3f& c) {trailColor=c;} 00164 Vec3f getTrailsColor() const {return trailColor;} 00165 00167 void setFlagMoonScale(bool b); 00169 bool getFlagMoonScale(void) const {return flagMoonScale;} 00170 00172 void setMoonScale(float f); 00174 float getMoonScale(void) const {return moonScale;} 00175 00177 void updateI18n(); 00178 00183 float getPlanetVMagnitude(QString planetName, bool withExtinction=false) const; 00184 00185 public: 00187 // Other public methods 00191 PlanetP searchByEnglishName(QString planetEnglishName) const; 00192 00194 PlanetP getSun() const {return sun;} 00195 00197 PlanetP getEarth() const {return earth;} 00198 00200 PlanetP getMoon() const {return moon;} 00201 00203 bool nearLunarEclipse(); 00204 00206 QStringList getAllPlanetEnglishNames() const; 00207 00209 QStringList getAllPlanetLocalizedNames() const; 00210 00212 void reloadPlanets(); 00213 00215 // DEPRECATED 00221 QString getPlanetHashString(); 00222 00227 void computePositions(double date, const Vec3d& observerPos = Vec3d(0.)); 00228 00231 const QList<PlanetP>& getAllPlanets() const {return systemPlanets;} 00232 00233 private slots: 00235 void selectedObjectChange(StelModule::StelModuleSelectAction action); 00236 00238 void setStelStyle(const QString& section); 00239 00240 00241 private: 00247 StelObjectP search(Vec3d v, const StelCore* core) const; 00248 00251 void computeTransMatrices(double date, const Vec3d& observerPos = Vec3d(0.)); 00252 00254 void drawPointer(const StelCore* core); 00255 00260 void loadPlanets(); 00261 00263 bool loadPlanets(const QString& filePath); 00264 00265 void recreateTrails(); 00266 00267 PlanetP sun; 00268 PlanetP moon; 00269 PlanetP earth; 00270 00273 void setSelected(const QString& englishName); 00275 void setSelected(PlanetP obj); 00277 PlanetP getSelected(void) const {return selected;} 00279 PlanetP selected; 00280 00281 // Moon scale value 00282 bool flagMoonScale; 00283 float moonScale; 00284 00285 QFont planetNameFont; 00286 00288 float labelsAmount; 00289 00291 QList<PlanetP> systemPlanets; 00292 00293 // Master settings 00294 bool flagOrbits; 00295 bool flagLightTravelTime; 00296 00298 StelTextureSP texPointer; 00299 00300 bool flagShow; 00301 00302 class TrailGroup* allTrails; 00303 LinearFader trailFader; 00304 Vec3f trailColor; 00305 00307 // DEPRECATED 00309 QList<Orbit*> orbits; // Pointers on created elliptical orbits 00310 }; 00311 00312 00313 #endif // _SOLARSYSTEM_HPP_