Home · All Namespaces · All Classes · Functions · Coding Style · 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);
00182     
00187     void setZRotation(double d);
00188 
00189 signals:
00190     // used for multi-threaded mode callbacks
00191     void requestSetCurrentLandscapeID(const QString& id);
00192     void requestCompleteSetCurrentLandscapeID(bool success);
00193     void requestSetCurrentLandscapeName(const QString& name);
00194     void requestCompleteSetCurrentLandscapeName(bool success);
00195 
00196 private slots:
00197     // Callbacks for threaded mode landscape setting which use signals
00198 
00202     bool doSetCurrentLandscapeID(const QString& id);
00206     bool doSetCurrentLandscapeName(const QString& name);
00207     
00208 private:
00210     double getAtmosphereLightPollutionLuminance() const;
00212     void setAtmosphereLightPollutionLuminance(double f);
00213     
00217     QString nameToID(const QString& name);
00218     
00225     Landscape* createFromHash(QMap<QString, QString>& param);
00226     
00228     QMap<QString,QString> getNameToDirMap(void) const;
00229         
00230     Atmosphere* atmosphere;         // Atmosphere
00231     Cardinals* cardinalsPoints;     // Cardinals points
00232     Landscape* landscape;           // The landscape i.e. the fog, the ground and "decor"
00233     
00234     // Define whether the observer location is to be updated when the landscape is updated.
00235     bool flagLandscapeSetsLocation;
00236     
00237     // The ID of the currently loaded landscape
00238     QString currentLandscapeID;
00239     
00240     // The ID of the default landscape
00241     QString defaultLandscapeID;
00242 };
00243 
00244 #endif // _LANDSCAPEMGR_HPP_

Generated on Mon Mar 9 16:16:16 2009 for Stellarium by  doxygen 1.5.5