Документ взят из кэша поисковой машины. Адрес оригинального документа : http://astro.uni-altai.ru/~aw/stellarium/api/LandscapeMgr_8hpp_source.html
Дата изменения: Unknown
Дата индексирования: Fri Feb 28 07:43:31 2014
Кодировка:

Поисковые слова: п п п п п п п п п п
Stellarium: core/modules/LandscapeMgr.hpp Source File
Stellarium 0.12.3
LandscapeMgr.hpp
1 /*
2  * Stellarium
3  * Copyright (C) 2006 Fabien Chereau
4  * Copyright (C) 2010 Bogdan Marinov (add/remove landscapes feature)
5  * Copyright (C) 2012 Timothy Reaves
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
20  */
21 
22 #ifndef _LANDSCAPEMGR_HPP_
23 #define _LANDSCAPEMGR_HPP_
24 
25 #include "StelModule.hpp"
26 #include "StelUtils.hpp"
27 
28 #include <QMap>
29 #include <QStringList>
30 
31 class Landscape;
32 class Atmosphere;
33 class Cardinals;
34 class QSettings;
35 
41 class LandscapeMgr : public StelModule
42 {
43  Q_OBJECT
44  Q_PROPERTY(bool atmosphereDisplayed
46  WRITE setFlagAtmosphere
47  NOTIFY atmosphereDisplayedChanged)
48  Q_PROPERTY(bool cardinalsPointsDisplayed
51  NOTIFY cardinalsPointsDisplayedChanged)
52  Q_PROPERTY(bool fogDisplayed
53  READ getFlagFog
54  WRITE setFlagFog
55  NOTIFY fogDisplayedChanged)
56  Q_PROPERTY(bool landscapeDisplayed
57  READ getFlagLandscape
58  WRITE setFlagLandscape
59  NOTIFY landscapeDisplayedChanged)
60 
61 public:
62  LandscapeMgr();
63  virtual ~LandscapeMgr();
64 
66  // Methods defined in the StelModule class
71  virtual void init();
72 
74  virtual void draw(StelCore* core, class StelRenderer* renderer);
75 
82  virtual void update(double deltaTime);
83 
85  virtual double getCallOrder(StelModuleActionName actionName) const;
86 
87 
89  // Method specific to the landscape manager
91  float getLuminance();
92 
95  bool loadLandscape(QMap<QString, QString>& param);
96 
105  Landscape* createFromFile(const QString& landscapeFile, const QString& landscapeId);
106 
107 public slots:
109  // Methods callable from script and GUI
113  QStringList getAllLandscapeNames() const;
114 
118  QStringList getAllLandscapeIDs() const;
119 
123  QStringList getUserLandscapeIDs() const;
124 
126  const QString& getCurrentLandscapeID() const {return currentLandscapeID;}
130  bool setCurrentLandscapeID(const QString& id);
131 
133  QString getCurrentLandscapeName() const;
136  bool setCurrentLandscapeName(const QString& name);
137 
139  const QString& getDefaultLandscapeID() const {return defaultLandscapeID;}
143  bool setDefaultLandscapeID(const QString& id);
144 
146  QString getCurrentLandscapeHtmlDescription() const;
147 
149  QString getDescription() const;
150 
152  bool getFlagLandscape() const;
154  void setFlagLandscape(const bool displayed);
155 
157  bool getFlagFog() const;
159  void setFlagFog(const bool displayed);
160 
162  bool getFlagLandscapeSetsLocation() const {return flagLandscapeSetsLocation;}
164  void setFlagLandscapeSetsLocation(bool b) {flagLandscapeSetsLocation=b;}
165 
167  bool getFlagCardinalsPoints() const;
169  void setFlagCardinalsPoints(const bool displayed);
170 
174  void setColorCardinalPoints(const Vec3f& v);
175 
177  bool getFlagAtmosphere() const;
179  void setFlagAtmosphere(const bool displayed);
180 
182  float getAtmosphereFadeDuration() const;
184  void setAtmosphereFadeDuration(float f);
185 
187  void setAtmosphereBortleLightPollution(int bIndex);
190 
195  void setZRotation(float d);
196 
227  QString installLandscapeFromArchive(QString pathToSourceArchive, bool display = false, bool forAllUsers = false);
228 
229  // //! Install a landscape from a directory.
230  // //! Expected directory structure: the name of the directory that contains
231  // //! a landscape.ini file is assumed to be the landscape ID and should be
232  // //! unique.
233  // //! This directory and all files in it will be installed, but its
234  // //! subdirectories will be skipped along with any other files or
235  // //! directories in the archive.
236  // //! @param pathToSourceLandscapeIni path to a landscape.ini file. Its parent
237  // //! directory is assumed to be the landscape source directory.
238  // //! @param display If true, the landscape will be set to be the current
239  // //! landscape after installation.
240  // //! @param forAllUsers If true, this function will try to install the
241  // //! landscape in a way that meakes it is available to all users of this
242  // //! computer. May require running Stellarium as an administrator (root)
243  // //! on some Windows or *nix systems. (NOT IMPLEMENTED!)
244  // //! @returns the installed landscape's identifier (the folder name), or
245  // //! an empty string on failure.
246  // QString installLandscapeFromDirectory(QString pathToSourceLandscapeIni, bool display = false, bool forAllUsers = false);
247 
257  bool removeLandscape(QString landscapeID);
258 
263  QString loadLandscapeName(QString landscapeID);
264 
269  quint64 loadLandscapeSize(QString landscapeID);
270 
271 signals:
272  void atmosphereDisplayedChanged(const bool displayed);
273  void cardinalsPointsDisplayedChanged(const bool displayed);
274  void fogDisplayedChanged(const bool displayed);
275  void landscapeDisplayedChanged(const bool displayed);
276 
280  void landscapesChanged();
281 
286  void errorUnableToOpen(QString path);
290  void errorNotArchive();
295  void errorNotUnique(QString nameOrID);
300  void errorRemoveManually(QString path);
301 
302 private slots:
304  void setStelStyle(const QString& section);
305 
307  void updateI18n();
308 
310  float getInitialLandscapeBrightness() const {return initialLandscapeBrightness;}
312  void setInitialLandscapeBrightness(float b) {initialLandscapeBrightness=b;}
313 
314 private:
316  float getAtmosphereLightPollutionLuminance() const;
318  void setAtmosphereLightPollutionLuminance(float f);
319 
323  QString nameToID(const QString& name);
324 
326  QMap<QString,QString> getNameToDirMap() const;
327 
332  QString getLandscapePath(QString landscapeID);
333 
334  Atmosphere* atmosphere; // Atmosphere
335  Cardinals* cardinalsPoints; // Cardinals points
336  Landscape* landscape; // The landscape i.e. the fog, the ground and "decor"
337 
338  // Define whether the observer location is to be updated when the landscape is updated.
339  bool flagLandscapeSetsLocation;
340 
341  // The ID of the currently loaded landscape
342  QString currentLandscapeID;
343 
344  // The ID of the default landscape
345  QString defaultLandscapeID;
346 
352  QStringList packagedLandscapeIDs;
353 
354  float initialLandscapeBrightness;
355 };
356 
357 #endif // _LANDSCAPEMGR_HPP_