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  *
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 StelTranslator;
00034 class StelObject;
00035 class StelCore;
00036 class StelProjector;
00037 class StelNavigator;
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 void updateI18n();
00074 
00076     virtual void selectedObjectChangeCallBack(StelModuleSelectAction action=StelModule::ReplaceSelection);
00077 
00079     virtual void setStelStyle(const QString& section);
00080 
00082     virtual double getCallOrder(StelModuleActionName actionName) const;
00083 
00085     // Methods defined in StelObjectManager class
00094     virtual QList<StelObjectP> searchAround(const Vec3d& v, double limitFov, const StelCore* core) const;
00095 
00099     virtual StelObjectP searchByNameI18n(const QString& nameI18n) const;
00100 
00104     virtual StelObjectP searchByName(const QString& name) const;
00105 
00112     virtual QStringList listMatchingObjectsI18n(const QString& objPrefix, int maxNbItem=5) const;
00113 
00114 public slots:
00116     // Method callable from script and GUI
00117     // Properties setters and getters
00119     void setFlagPlanets(bool b);
00121     bool getFlagPlanets() const;
00122 
00124     void setFlagTrails(bool b);
00126     bool getFlagTrails() const;
00127 
00129     void setFlagHints(bool b);
00131     bool getFlagHints() const;
00132 
00134     void setFlagLabels(bool b);
00136     bool getFlagLabels() const;
00137 
00141     void setLabelsAmount(float a) {labelsAmount=a;}
00144     float getLabelsAmount(void) const {return labelsAmount;}
00145 
00147     void setFlagOrbits(bool b);
00149     bool getFlagOrbits() const {return flagOrbits;}
00150 
00152     void setFlagLightTravelTime(bool b);
00155     bool getFlagLightTravelTime(void) const {return flagLightTravelTime;}
00156 
00158     void setFontSize(float newFontSize);
00159 
00161     void setLabelsColor(const Vec3f& c);
00163     const Vec3f& getLabelsColor(void) const;
00164 
00166     void setOrbitsColor(const Vec3f& c);
00168     Vec3f getOrbitsColor(void) const;
00169 
00171     void setTrailsColor(const Vec3f& c) {trailColor=c;}
00173     Vec3f getTrailsColor() const {return trailColor;}
00174 
00176     void setFlagMoonScale(bool b);
00178     bool getFlagMoonScale(void) const {return flagMoonScale;}
00179 
00181     void setMoonScale(float f);
00183     float getMoonScale(void) const {return moonScale;}
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     // DEPRECATED
00214     QString getPlanetHashString();
00215 
00219     void computePositions(double date, const Vec3d& observerPos = Vec3d(0.));
00220 
00222     const QList<PlanetP>& getAllPlanets() const {return systemPlanets;}
00223 
00224 private:
00230     StelObjectP search(Vec3d v, const StelCore* core) const;
00231 
00234     void computeTransMatrices(double date, const Vec3d& observerPos = Vec3d(0.));
00235 
00237     void drawPointer(const StelCore* core);
00238 
00240     void loadPlanets();
00241 
00242     void recreateTrails();
00243 
00244     PlanetP sun;
00245     PlanetP moon;
00246     PlanetP earth;
00247 
00250     void setSelected(const QString& englishName);
00252     void setSelected(PlanetP obj);
00254     PlanetP getSelected(void) const {return selected;}
00256     PlanetP selected;
00257 
00258     // Moon scale value
00259     bool flagMoonScale;
00260     float moonScale;
00261 
00262     QFont planetNameFont;
00263 
00265     float labelsAmount;
00266 
00268     QList<PlanetP> systemPlanets;
00269 
00270     // Master settings
00271     bool flagOrbits;
00272     bool flagLightTravelTime;
00273 
00275     StelTextureSP texPointer;
00276 
00277     bool flagShow;
00278 
00279     class TrailGroup* allTrails;
00280     LinearFader trailFader;
00281     Vec3f trailColor;
00282 
00284     // DEPRECATED
00286     QList<Orbit*> orbits;           // Pointers on created elliptical orbits
00287 };
00288 
00289 
00290 #endif // _SOLARSYSTEM_HPP_

Generated on Wed Jun 2 13:11:13 2010 for Stellarium by  doxygen 1.5.5