Stellarium 0.11.0
Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · File Structure

core/modules/SolarSystem.hpp

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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, 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 StelNavigator;
00039 class QSettings;
00040 
00041 typedef QSharedPointer<Planet> PlanetP;
00042 
00046 class SolarSystem : public StelObjectModule
00047 {
00048     Q_OBJECT
00049 
00050 public:
00051     SolarSystem();
00052     virtual ~SolarSystem();
00053 
00055     // Methods defined in the StelModule class
00061     virtual void init();
00062 
00067     virtual void draw(StelCore *core);
00068 
00071     virtual void update(double deltaTime);
00072 
00074     virtual double getCallOrder(StelModuleActionName actionName) const;
00075 
00077     // Methods defined in StelObjectManager class
00086     virtual QList<StelObjectP> searchAround(const Vec3d& v, double limitFov, const StelCore* core) const;
00087 
00091     virtual StelObjectP searchByNameI18n(const QString& nameI18n) const;
00092 
00096     virtual StelObjectP searchByName(const QString& name) const;
00097 
00104     virtual QStringList listMatchingObjectsI18n(const QString& objPrefix, int maxNbItem=5) const;
00105 
00106 public slots:
00108     // Method callable from script and GUI
00109     // Properties setters and getters
00111     void setFlagPlanets(bool b);
00113     bool getFlagPlanets() const;
00114 
00116     void setFlagTrails(bool b);
00118     bool getFlagTrails() const;
00119 
00121     void setFlagHints(bool b);
00123     bool getFlagHints() const;
00124 
00126     void setFlagLabels(bool b);
00128     bool getFlagLabels() const;
00129 
00133     void setLabelsAmount(float a) {labelsAmount=a;}
00136     float getLabelsAmount(void) const {return labelsAmount;}
00137 
00139     void setFlagOrbits(bool b);
00141     bool getFlagOrbits() const {return flagOrbits;}
00142 
00144     void setFlagLightTravelTime(bool b);
00147     bool getFlagLightTravelTime(void) const {return flagLightTravelTime;}
00148 
00150     void setFontSize(float newFontSize);
00151 
00153     void setLabelsColor(const Vec3f& c);
00155     const Vec3f& getLabelsColor(void) const;
00156 
00158     void setOrbitsColor(const Vec3f& c);
00160     Vec3f getOrbitsColor(void) const;
00161 
00163     void setTrailsColor(const Vec3f& c) {trailColor=c;}
00165     Vec3f getTrailsColor() const {return trailColor;}
00166 
00168     void setFlagMoonScale(bool b);
00170     bool getFlagMoonScale(void) const {return flagMoonScale;}
00171 
00173     void setMoonScale(float f);
00175     float getMoonScale(void) const {return moonScale;}
00176 
00178     void updateI18n();
00179 
00180 public:
00182     // Other public methods
00186     PlanetP searchByEnglishName(QString planetEnglishName) const;
00187 
00189     PlanetP getSun() const {return sun;}
00190 
00192     PlanetP getEarth() const {return earth;}
00193 
00195     PlanetP getMoon() const {return moon;}
00196 
00198     bool nearLunarEclipse();
00199 
00201     QStringList getAllPlanetEnglishNames() const;
00202 
00204     QStringList getAllPlanetLocalizedNames() const;
00205 
00207     void reloadPlanets();
00208 
00210     // DEPRECATED
00216     QString getPlanetHashString();
00217 
00223     void computePositions(double date, const Vec3d& observerPos = Vec3d(0.));
00224 
00227     const QList<PlanetP>& getAllPlanets() const {return systemPlanets;}
00228 
00229 private slots:
00231     void selectedObjectChange(StelModule::StelModuleSelectAction action);
00232 
00234     void setStelStyle(const QString& section);
00235 
00236 
00237 private:
00243     StelObjectP search(Vec3d v, const StelCore* core) const;
00244 
00247     void computeTransMatrices(double date, const Vec3d& observerPos = Vec3d(0.));
00248 
00250     void drawPointer(const StelCore* core);
00251 
00256     void loadPlanets();
00257 
00259     bool loadPlanets(const QString& filePath);
00260 
00261     void recreateTrails();
00262 
00263     PlanetP sun;
00264     PlanetP moon;
00265     PlanetP earth;
00266 
00269     void setSelected(const QString& englishName);
00271     void setSelected(PlanetP obj);
00273     PlanetP getSelected(void) const {return selected;}
00275     PlanetP selected;
00276 
00277     // Moon scale value
00278     bool flagMoonScale;
00279     float moonScale;
00280 
00281     QFont planetNameFont;
00282 
00284     float labelsAmount;
00285 
00287     QList<PlanetP> systemPlanets;
00288 
00289     // Master settings
00290     bool flagOrbits;
00291     bool flagLightTravelTime;
00292 
00294     StelTextureSP texPointer;
00295 
00296     bool flagShow;
00297 
00298     class TrailGroup* allTrails;
00299     LinearFader trailFader;
00300     Vec3f trailColor;
00301 
00303     // DEPRECATED
00305     QList<Orbit*> orbits;           // Pointers on created elliptical orbits
00306 };
00307 
00308 
00309 #endif // _SOLARSYSTEM_HPP_