Stellarium 0.12.2
StelSkyLayerMgr.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008 Fabien Chereau
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
17  */
18 
19 #ifndef _STELSKYLAYERMGR_HPP_
20 #define _STELSKYLAYERMGR_HPP_
21 
22 #include <QString>
23 #include <QStringList>
24 #include <QMap>
25 
26 #include "StelModule.hpp"
27 #include "StelSkyLayer.hpp"
28 
29 class StelCore;
30 class StelSkyImageTile;
31 class QProgressBar;
32 
35 {
36  Q_OBJECT
37 
38 public:
40  ~StelSkyLayerMgr();
41 
43  // Methods defined in the StelModule class
45  virtual void init();
46 
48  virtual void draw(StelCore* core, class StelRenderer* renderer);
49 
51  virtual void update(double) {;}
52 
54  virtual double getCallOrder(StelModuleActionName actionName) const;
55 
57  // Other specific methods
63  QString insertSkyLayer(StelSkyLayerP l, const QString& keyHint=QString(), bool show=true);
64 
66  void removeSkyLayer(StelSkyLayerP l);
67 
69  QMap<QString, StelSkyLayerP> getAllSkyLayers() const;
70 
71  StelSkyLayerP getSkyLayer(const QString& key) const;
72 
73 public slots:
75  // Properties setters and getters
77  void setFlagShow(bool b) {flagShow = b;}
79  bool getFlagShow() const {return flagShow;}
80 
98  bool loadSkyImage(const QString& id, const QString& filename,
99  double ra0, double dec0,
100  double ra1, double dec1,
101  double ra2, double dec2,
102  double ra3, double dec3,
103  double minRes, double maxBright, bool visible);
104 
122  bool loadSkyImageAltAz(const QString& id, const QString& filename,
123  double alt0, double azi0,
124  double alt1, double azi1,
125  double alt2, double azi2,
126  double alt3, double azi3,
127  double minRes, double maxBright, bool visible);
128 
129 
130 
136  void showLayer(const QString& id, bool b);
142  bool getShowLayer(const QString& id) const;
143 
145  // Other slots
153  QString insertSkyImage(const QString& uri, const QString& keyHint=QString(), bool show=true);
154 
160  void removeSkyLayer(const QString& key);
161 
163  QStringList getAllKeys() const {return allSkyLayers.keys();}
164 
165 private slots:
168  void loadingStateChanged(bool b);
169 
172  void percentLoadedChanged(int percentage);
173 
174 private:
175 
177  class SkyLayerElem
178  {
179  public:
180  SkyLayerElem(StelSkyLayerP t, bool show=true);
181  ~SkyLayerElem();
182  StelSkyLayerP layer;
183  QProgressBar* progressBar;
184  bool show;
185  };
186 
187  SkyLayerElem* skyLayerElemForLayer(const StelSkyLayer*);
188 
189  QString keyForLayer(const StelSkyLayer*);
190 
192  QMap<QString, SkyLayerElem*> allSkyLayers;
193 
194  // Whether to draw at all
195  bool flagShow;
196 };
197 
198 #endif // _STELSKYLAYERMGR_HPP_