Home · All Namespaces · All Classes · Functions · Coding Style · 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 #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     // 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);
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     // Other public methods
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     // DEPRECATED
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     // void updateTrails(const StelNavigator* nav);
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;                 // Moon scale value
00265 
00266     double fontSize;
00267     StelFont& planetNameFont;
00268     
00270     float labelsAmount;
00271     
00272     std::vector<Planet*> systemPlanets;  // Vector containing all the bodies of the system 
00273 
00274     // And sort them from the furthest to the closest to the observer
00275     struct biggerDistance : public std::binary_function<Planet*, Planet*, bool>
00276     {
00277         bool operator()(Planet* p1, Planet* p2);
00278     };
00279 
00280     // Master settings
00281     bool flagOrbits;
00282     bool flagLightTravelTime;
00283     
00284     StelTextureSP texPointer;           // The selection pointer texture
00285     
00286     bool flagShow;
00287     
00289     // DEPRECATED
00291     const Planet* lastHomePlanet;    // for tracking home planet changes for trails
00292     std::vector<Orbit*> orbits;           // Pointers on created elliptical orbits
00293 };
00294 
00295 
00296 #endif // _SOLARSYSTEM_HPP_

Generated on Mon Feb 2 17:23:47 2009 for Stellarium by  doxygen 1.5.5