![]() |
Home · All Namespaces · All Classes · Functions · Coding Style · Plugins · File Structure |
00001 /* 00002 * Stellarium 00003 * Copyright (C) 2006 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 _LANDSCAPEMGR_HPP_ 00021 #define _LANDSCAPEMGR_HPP_ 00022 00023 #include "StelModule.hpp" 00024 #include "StelUtils.hpp" 00025 00026 #include <QMap> 00027 #include <QStringList> 00028 00029 class Landscape; 00030 class Atmosphere; 00031 class Cardinals; 00032 class QSettings; 00033 00039 class LandscapeMgr : public StelModule 00040 { 00041 Q_OBJECT 00042 00043 public: 00044 LandscapeMgr(); 00045 virtual ~LandscapeMgr(); 00046 00048 // Methods defined in the StelModule class 00053 virtual void init(); 00054 00056 virtual void draw(StelCore* core); 00057 00064 virtual void update(double deltaTime); 00065 00067 virtual void updateI18n(); 00068 00070 virtual void updateSkyCulture() {;} 00071 00073 virtual void setStelStyle(const StelStyle& style); 00074 00076 virtual double getCallOrder(StelModuleActionName actionName) const; 00077 00078 00080 // Method specific to the landscape manager 00082 float getLuminance(void); 00083 00086 bool loadLandscape(QMap<QString, QString>& param); 00087 00096 Landscape* createFromFile(const QString& landscapeFile, const QString& landscapeId); 00097 00098 public slots: 00100 // Methods callable from script and GUI 00104 QStringList getAllLandscapeNames() const; 00105 00109 QStringList getAllLandscapeIDs() const; 00110 00112 const QString& getCurrentLandscapeID() const {return currentLandscapeID;} 00121 bool setCurrentLandscapeID(const QString& id, bool inThread=false); 00123 QString getCurrentLandscapeName() const; 00132 bool setCurrentLandscapeName(const QString& name, bool inThread=false); 00133 00135 const QString& getDefaultLandscapeID() const {return defaultLandscapeID;} 00139 bool setDefaultLandscapeID(const QString& id); 00140 00142 QString getCurrentLandscapeHtmlDescription() const; 00143 00145 bool getFlagLandscape() const; 00147 void setFlagLandscape(bool b); 00148 00150 bool getFlagFog() const; 00152 void setFlagFog(bool b); 00153 00155 bool getFlagLandscapeSetsLocation() const {return flagLandscapeSetsLocation;} 00157 void setFlagLandscapeSetsLocation(bool b) {flagLandscapeSetsLocation=b;} 00158 00160 bool getFlagCardinalsPoints() const; 00162 void setFlagCardinalsPoints(bool b); 00163 00165 Vec3f getColorCardinalPoints() const; 00167 void setColorCardinalPoints(const Vec3f& v); 00168 00170 bool getFlagAtmosphere() const; 00172 void setFlagAtmosphere(bool b); 00173 00175 float getAtmosphereFadeDuration() const; 00177 void setAtmosphereFadeDuration(float f); 00178 00180 void setAtmosphereBortleLightPollution(int bIndex); 00181 00186 void setZRotation(double d); 00187 00188 signals: 00189 // used for multi-threaded mode callbacks 00190 void requestSetCurrentLandscapeID(const QString& id); 00191 void requestCompleteSetCurrentLandscapeID(bool success); 00192 void requestSetCurrentLandscapeName(const QString& name); 00193 void requestCompleteSetCurrentLandscapeName(bool success); 00194 00195 private slots: 00196 // Callbacks for threaded mode landscape setting which use signals 00197 00201 bool doSetCurrentLandscapeID(const QString& id); 00205 bool doSetCurrentLandscapeName(const QString& name); 00206 00207 private: 00209 double getAtmosphereLightPollutionLuminance() const; 00211 void setAtmosphereLightPollutionLuminance(double f); 00212 00216 QString nameToID(const QString& name); 00217 00224 Landscape* createFromHash(QMap<QString, QString>& param); 00225 00227 QMap<QString,QString> getNameToDirMap(void) const; 00228 00229 Atmosphere* atmosphere; // Atmosphere 00230 Cardinals* cardinalsPoints; // Cardinals points 00231 Landscape* landscape; // The landscape i.e. the fog, the ground and "decor" 00232 00233 // Define whether the observer location is to be updated when the landscape is updated. 00234 bool flagLandscapeSetsLocation; 00235 00236 // The ID of the currently loaded landscape 00237 QString currentLandscapeID; 00238 00239 // The ID of the default landscape 00240 QString defaultLandscapeID; 00241 }; 00242 00243 #endif // _LANDSCAPEMGR_HPP_