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

modules/LandscapeMgr.hpp

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 
00071     virtual void updateSkyCulture(const QString& skyCultureDir) {;}
00072 
00074     virtual void setStelStyle(const StelStyle& style);
00075 
00077     virtual double getCallOrder(StelModuleActionName actionName) const;
00078 
00079 
00081     // Method specific to the landscape manager
00083     float getLuminance(void);
00084 
00087     bool loadLandscape(QMap<QString, QString>& param);
00088 
00097     Landscape* createFromFile(const QString& landscapeFile, const QString& landscapeId);
00098 
00099 public slots:
00101     // Methods callable from script and GUI
00105     QStringList getAllLandscapeNames() const;
00106 
00110     QStringList getAllLandscapeIDs() const;
00111 
00113     const QString& getCurrentLandscapeID() const {return currentLandscapeID;}
00122     bool setCurrentLandscapeID(const QString& id, bool inThread=false);
00124     QString getCurrentLandscapeName() const;
00133     bool setCurrentLandscapeName(const QString& name, bool inThread=false);
00134 
00136     const QString& getDefaultLandscapeID() const {return defaultLandscapeID;}
00140     bool setDefaultLandscapeID(const QString& id);
00141 
00143     QString getCurrentLandscapeHtmlDescription() const;
00144 
00146     bool getFlagLandscape() const;
00148     void setFlagLandscape(bool b);
00149 
00151     bool getFlagFog() const;
00153     void setFlagFog(bool b);
00154 
00156     bool getFlagLandscapeSetsLocation() const {return flagLandscapeSetsLocation;}
00158     void setFlagLandscapeSetsLocation(bool b) {flagLandscapeSetsLocation=b;}
00159 
00161     bool getFlagCardinalsPoints() const;
00163     void setFlagCardinalsPoints(bool b);
00164 
00166     Vec3f getColorCardinalPoints() const;
00168     void setColorCardinalPoints(const Vec3f& v);
00169 
00171     bool getFlagAtmosphere() const;
00173     void setFlagAtmosphere(bool b);
00174 
00176     float getAtmosphereFadeDuration() const;
00178     void setAtmosphereFadeDuration(float f);
00179 
00181     void setAtmosphereBortleLightPollution(int bIndex);
00183     int getAtmosphereBortleLightPollution(void);
00184 
00189     void setZRotation(double d);
00190 
00191 signals:
00192     // used for multi-threaded mode callbacks
00193     void requestSetCurrentLandscapeID(const QString& id);
00194     void requestCompleteSetCurrentLandscapeID(bool success);
00195     void requestSetCurrentLandscapeName(const QString& name);
00196     void requestCompleteSetCurrentLandscapeName(bool success);
00197 
00198 private slots:
00199     // Callbacks for threaded mode landscape setting which use signals
00200 
00204     bool doSetCurrentLandscapeID(QString id);
00208     bool doSetCurrentLandscapeName(const QString& name);
00209 
00210 private:
00212     double getAtmosphereLightPollutionLuminance() const;
00214     void setAtmosphereLightPollutionLuminance(double f);
00215 
00219     QString nameToID(const QString& name);
00220 
00227     Landscape* createFromHash(QMap<QString, QString>& param);
00228 
00230     QMap<QString,QString> getNameToDirMap(void) const;
00231 
00232     Atmosphere* atmosphere;         // Atmosphere
00233     Cardinals* cardinalsPoints;     // Cardinals points
00234     Landscape* landscape;           // The landscape i.e. the fog, the ground and "decor"
00235 
00236     // Define whether the observer location is to be updated when the landscape is updated.
00237     bool flagLandscapeSetsLocation;
00238 
00239     // The ID of the currently loaded landscape
00240     QString currentLandscapeID;
00241 
00242     // The ID of the default landscape
00243     QString defaultLandscapeID;
00244 };
00245 
00246 #endif // _LANDSCAPEMGR_HPP_

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