Stellarium 0.11.4
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  * Copyright (C) 2012 Timothy Reaves
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.
00020  */
00021 
00022 #ifndef _LANDSCAPEMGR_HPP_
00023 #define _LANDSCAPEMGR_HPP_
00024 
00025 #include "StelModule.hpp"
00026 #include "StelUtils.hpp"
00027 
00028 #include <QMap>
00029 #include <QStringList>
00030 
00031 class Landscape;
00032 class Atmosphere;
00033 class Cardinals;
00034 class QSettings;
00035 
00041 class LandscapeMgr : public StelModule
00042 {
00043     Q_OBJECT
00044     Q_PROPERTY(bool atmosphereDisplayed
00045                READ getFlagAtmosphere
00046                WRITE setFlagAtmosphere
00047                NOTIFY atmosphereDisplayedChanged)
00048     Q_PROPERTY(bool cardinalsPointsDisplayed
00049                READ getFlagCardinalsPoints
00050                WRITE setFlagCardinalsPoints
00051                NOTIFY cardinalsPointsDisplayedChanged)
00052     Q_PROPERTY(bool fogDisplayed
00053                READ getFlagFog
00054                WRITE setFlagFog
00055                NOTIFY fogDisplayedChanged)
00056     Q_PROPERTY(bool landscapeDisplayed
00057                READ getFlagLandscape
00058                WRITE setFlagLandscape
00059                NOTIFY landscapeDisplayedChanged)
00060 
00061 public:
00062     LandscapeMgr();
00063     virtual ~LandscapeMgr();
00064 
00066     // Methods defined in the StelModule class
00071     virtual void init();
00072 
00074     virtual void draw(StelCore* core);
00075 
00082     virtual void update(double deltaTime);
00083 
00085     virtual double getCallOrder(StelModuleActionName actionName) const;
00086 
00087 
00089     // Method specific to the landscape manager
00091     float getLuminance();
00092 
00095     bool loadLandscape(QMap<QString, QString>& param);
00096 
00105     Landscape* createFromFile(const QString& landscapeFile, const QString& landscapeId);
00106 
00107 public slots:
00109     // Methods callable from script and GUI
00113     QStringList getAllLandscapeNames() const;
00114 
00118     QStringList getAllLandscapeIDs() const;
00119 
00123     QStringList getUserLandscapeIDs() const;
00124 
00126     const QString& getCurrentLandscapeID() const {return currentLandscapeID;}
00130     bool setCurrentLandscapeID(const QString& id);
00131     
00133     QString getCurrentLandscapeName() const;
00136     bool setCurrentLandscapeName(const QString& name);
00137 
00139     const QString& getDefaultLandscapeID() const {return defaultLandscapeID;}
00143     bool setDefaultLandscapeID(const QString& id);
00144 
00146     QString getCurrentLandscapeHtmlDescription() const;
00147 
00149     QString getDescription() const;
00150 
00152     bool getFlagLandscape() const;
00154     void setFlagLandscape(const bool displayed);
00155 
00157     bool getFlagFog() const;
00159     void setFlagFog(const bool displayed);
00160 
00162     bool getFlagLandscapeSetsLocation() const {return flagLandscapeSetsLocation;}
00164     void setFlagLandscapeSetsLocation(bool b) {flagLandscapeSetsLocation=b;}
00165 
00167     bool getFlagCardinalsPoints() const;
00169     void setFlagCardinalsPoints(const bool displayed);
00170 
00172     Vec3f getColorCardinalPoints() const;
00174     void setColorCardinalPoints(const Vec3f& v);
00175 
00177     bool getFlagAtmosphere() const;
00179     void setFlagAtmosphere(const bool displayed);
00180 
00182     float getAtmosphereFadeDuration() const;
00184     void setAtmosphereFadeDuration(float f);
00185 
00187     void setAtmosphereBortleLightPollution(int bIndex);
00189     int getAtmosphereBortleLightPollution();
00190 
00195     void setZRotation(float d);
00196 
00227     QString installLandscapeFromArchive(QString pathToSourceArchive, bool display = false, bool forAllUsers = false);
00228 
00246     //QString installLandscapeFromDirectory(QString pathToSourceLandscapeIni, bool display = false, bool forAllUsers = false);
00247 
00257     bool removeLandscape(QString landscapeID);
00258 
00263     QString loadLandscapeName(QString landscapeID);
00264 
00269     quint64 loadLandscapeSize(QString landscapeID);
00270 
00271 signals:
00272     void atmosphereDisplayedChanged(const bool displayed);
00273     void cardinalsPointsDisplayedChanged(const bool displayed);
00274     void fogDisplayedChanged(const bool displayed);
00275     void landscapeDisplayedChanged(const bool displayed);
00276 
00280     void landscapesChanged();
00281 
00286     void errorUnableToOpen(QString path);
00290     void errorNotArchive();
00295     void errorNotUnique(QString nameOrID);
00300     void errorRemoveManually(QString path);
00301 
00302 private slots:
00304     void setStelStyle(const QString& section);
00305 
00307     void updateI18n();  
00308 
00309 private:
00311     float getAtmosphereLightPollutionLuminance() const;
00313     void setAtmosphereLightPollutionLuminance(float f);
00314 
00318     QString nameToID(const QString& name);
00319 
00321     QMap<QString,QString> getNameToDirMap() const;
00322 
00327     QString getLandscapePath(QString landscapeID);
00328 
00329     Atmosphere* atmosphere;         // Atmosphere
00330     Cardinals* cardinalsPoints;     // Cardinals points
00331     Landscape* landscape;           // The landscape i.e. the fog, the ground and "decor"
00332 
00333     // Define whether the observer location is to be updated when the landscape is updated.
00334     bool flagLandscapeSetsLocation;
00335 
00336     // The ID of the currently loaded landscape
00337     QString currentLandscapeID;
00338 
00339     // The ID of the default landscape
00340     QString defaultLandscapeID;
00341 
00347     QStringList packagedLandscapeIDs;
00348 };
00349 
00350 #endif // _LANDSCAPEMGR_HPP_
Generated on Sat Aug 25 22:13:29 2012 for Stellarium by  doxygen 1.6.3