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

modules/SolarSystem.hpp

00001 /*
00002  * Stellarium
00003  * Copyright (C) 2002 Fabien Chereau
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018  */
00019 
00020 #ifndef _SOLARSYSTEM_HPP_
00021 #define _SOLARSYSTEM_HPP_
00022 //sun is already defined in Sun C/Solaris
00023 #if defined(sun)
00024 #undef sun
00025 #endif
00026 
00027 #include <QFont>
00028 #include "StelObjectModule.hpp"
00029 #include "StelTextureTypes.hpp"
00030 #include "Planet.hpp"
00031 
00032 class Orbit;
00033 class StelLoadingBar;
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 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     // Methods defined in StelObjectManager class
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     // Method callable from script and GUI
00118     // Properties setters and getters
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) {trailColor=c;}
00174     Vec3f getTrailsColor() const {return trailColor;}
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     // Other public methods
00192     PlanetP searchByEnglishName(QString planetEnglishName) const;
00193 
00195     PlanetP getSun() const {return sun;}
00196 
00198     PlanetP getEarth() const {return earth;}
00199 
00201     PlanetP getMoon() const {return moon;}
00202 
00204     bool nearLunarEclipse();
00205 
00207     QStringList getAllPlanetEnglishNames() const;
00208 
00210     // DEPRECATED
00215     QString getPlanetHashString();
00216 
00220     void computePositions(double date, const Vec3d& observerPos = Vec3d(0.));
00221 
00223     const QList<PlanetP>& getAllPlanets() const {return systemPlanets;}
00224 
00225 private:
00231     StelObjectP search(Vec3d v, const StelCore* core) const;
00232 
00235     void computeTransMatrices(double date, const Vec3d& observerPos = Vec3d(0.));
00236 
00238     void drawPointer(const StelCore* core);
00239 
00241     void loadPlanets();
00242 
00243     void recreateTrails();
00244 
00245     PlanetP sun;
00246     PlanetP moon;
00247     PlanetP earth;
00248 
00251     void setSelected(const QString& englishName);
00253     void setSelected(PlanetP obj);
00255     PlanetP getSelected(void) const {return selected;}
00257     PlanetP selected;
00258 
00259     // Moon scale value
00260     bool flagMoonScale;
00261     float moonScale;
00262 
00263     QFont planetNameFont;
00264 
00266     float labelsAmount;
00267 
00269     QList<PlanetP> systemPlanets;
00270 
00271     // Master settings
00272     bool flagOrbits;
00273     bool flagLightTravelTime;
00274 
00276     StelTextureSP texPointer;
00277 
00278     bool flagShow;
00279 
00280     class TrailGroup* allTrails;
00281     LinearFader trailFader;
00282     Vec3f trailColor;
00283 
00285     // DEPRECATED
00287     QList<Orbit*> orbits;           // Pointers on created elliptical orbits
00288 };
00289 
00290 
00291 #endif // _SOLARSYSTEM_HPP_

Generated on Mon Mar 22 09:55:38 2010 for Stellarium by  doxygen 1.5.5