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

core/modules/LandscapeMgr.hpp

00001 /*
00002  * Stellarium
00003  * Copyright (C) 2006 Fabien Chereau
00004  * Copyright (C) 2010 Bogdan Marinov (add/remove landscapes feature)
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019  */
00020 
00021 #ifndef _LANDSCAPEMGR_HPP_
00022 #define _LANDSCAPEMGR_HPP_
00023 
00024 #include "StelModule.hpp"
00025 #include "StelUtils.hpp"
00026 
00027 #include <QMap>
00028 #include <QStringList>
00029 
00030 class Landscape;
00031 class Atmosphere;
00032 class Cardinals;
00033 class QSettings;
00034 
00040 class LandscapeMgr : public StelModule
00041 {
00042     Q_OBJECT
00043 
00044 public:
00045     LandscapeMgr();
00046     virtual ~LandscapeMgr();
00047 
00049     // Methods defined in the StelModule class
00054     virtual void init();
00055 
00057     virtual void draw(StelCore* core);
00058 
00065     virtual void update(double deltaTime);
00066 
00068     virtual double getCallOrder(StelModuleActionName actionName) const;
00069 
00070 
00072     // Method specific to the landscape manager
00074     float getLuminance();
00075 
00078     bool loadLandscape(QMap<QString, QString>& param);
00079 
00088     Landscape* createFromFile(const QString& landscapeFile, const QString& landscapeId);
00089 
00090 public slots:
00092     // Methods callable from script and GUI
00096     QStringList getAllLandscapeNames() const;
00097 
00101     QStringList getAllLandscapeIDs() const;
00102 
00106     QStringList getUserLandscapeIDs() const;
00107 
00109     const QString& getCurrentLandscapeID() const {return currentLandscapeID;}
00113     bool setCurrentLandscapeID(const QString& id);
00114     
00116     QString getCurrentLandscapeName() const;
00119     bool setCurrentLandscapeName(const QString& name);
00120 
00122     const QString& getDefaultLandscapeID() const {return defaultLandscapeID;}
00126     bool setDefaultLandscapeID(const QString& id);
00127 
00129     QString getCurrentLandscapeHtmlDescription() const;
00130 
00132     QString getDescription() const;
00133 
00135     bool getFlagLandscape() const;
00137     void setFlagLandscape(bool b);
00138 
00140     bool getFlagFog() const;
00142     void setFlagFog(bool b);
00143 
00145     bool getFlagLandscapeSetsLocation() const {return flagLandscapeSetsLocation;}
00147     void setFlagLandscapeSetsLocation(bool b) {flagLandscapeSetsLocation=b;}
00148 
00150     bool getFlagCardinalsPoints() const;
00152     void setFlagCardinalsPoints(bool b);
00153 
00155     Vec3f getColorCardinalPoints() const;
00157     void setColorCardinalPoints(const Vec3f& v);
00158 
00160     bool getFlagAtmosphere() const;
00162     void setFlagAtmosphere(bool b);
00163 
00165     float getAtmosphereFadeDuration() const;
00167     void setAtmosphereFadeDuration(float f);
00168 
00170     void setAtmosphereBortleLightPollution(int bIndex);
00172     int getAtmosphereBortleLightPollution();
00173 
00178     void setZRotation(float d);
00179 
00210     QString installLandscapeFromArchive(QString pathToSourceArchive, bool display = false, bool forAllUsers = false);
00211 
00229     //QString installLandscapeFromDirectory(QString pathToSourceLandscapeIni, bool display = false, bool forAllUsers = false);
00230 
00240     bool removeLandscape(QString landscapeID);
00241 
00246     QString loadLandscapeName(QString landscapeID);
00247 
00252     quint64 loadLandscapeSize(QString landscapeID);
00253 
00254 signals:
00258     void landscapesChanged();
00259 
00264     void errorUnableToOpen(QString path);
00268     void errorNotArchive();
00273     void errorNotUnique(QString nameOrID);
00278     void errorRemoveManually(QString path);
00279 
00280 private slots:
00282     void setStelStyle(const QString& section);
00283 
00285     void updateI18n();  
00286 
00287 private:
00289     float getAtmosphereLightPollutionLuminance() const;
00291     void setAtmosphereLightPollutionLuminance(float f);
00292 
00296     QString nameToID(const QString& name);
00297 
00299     QMap<QString,QString> getNameToDirMap() const;
00300 
00305     QString getLandscapePath(QString landscapeID);
00306 
00307     Atmosphere* atmosphere;         // Atmosphere
00308     Cardinals* cardinalsPoints;     // Cardinals points
00309     Landscape* landscape;           // The landscape i.e. the fog, the ground and "decor"
00310 
00311     // Define whether the observer location is to be updated when the landscape is updated.
00312     bool flagLandscapeSetsLocation;
00313 
00314     // The ID of the currently loaded landscape
00315     QString currentLandscapeID;
00316 
00317     // The ID of the default landscape
00318     QString defaultLandscapeID;
00319 
00325     QStringList packagedLandscapeIDs;
00326 };
00327 
00328 #endif // _LANDSCAPEMGR_HPP_