Stellarium 0.13.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 "StelModule.hpp"
23 #include "StelSkyLayer.hpp"
24 
25 #include <QString>
26 #include <QStringList>
27 #include <QMap>
28 
29 class StelCore;
30 class StelSkyImageTile;
31 
34 {
35  Q_OBJECT
36  Q_PROPERTY(bool visible READ getFlagShow WRITE setFlagShow)
37 
38 public:
40  ~StelSkyLayerMgr();
41 
43  // Methods defined in the StelModule class
45  virtual void init();
46 
48  virtual void draw(StelCore* core);
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 
74  bool getFlagShow() const {return flagShow;}
75 
76 public slots:
78  // Properties setters and getters
80  void setFlagShow(bool b) {flagShow = b;}
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  class StelProgressController* 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_
Manage the sky background images, including DSS and deep sky objects images.
QStringList getAllKeys() const
Return the list of all the layer currently loaded.
QString insertSkyLayer(StelSkyLayerP l, const QString &keyHint=QString(), bool show=true)
Add a new layer.
bool getShowLayer(const QString &id) const
Get the current shown status of a specified image.
virtual void update(double)
Update state which is time dependent.
bool getFlagShow() const
Get whether Sky Background should be displayed.
QMap< QString, StelSkyLayerP > getAllSkyLayers() const
Get the list of all the currently loaded layers.
void setFlagShow(bool b)
Set whether Sky Background should be displayed.
virtual void init()
Initialize.
Main class for Stellarium core processing.
Definition: StelCore.hpp:46
void removeSkyLayer(StelSkyLayerP l)
Remove a layer.
virtual void draw(StelCore *core)
Draws sky background.
void showLayer(const QString &id, bool b)
Decide to show or not to show a layer by it's ID.
bool loadSkyImageAltAz(const QString &id, const QString &filename, double alt0, double azi0, double alt1, double azi1, double alt2, double azi2, double alt3, double azi3, double minRes, double maxBright, bool visible)
Load an image from a file.
QString insertSkyImage(const QString &uri, const QString &keyHint=QString(), bool show=true)
Add a new SkyImage from its URI (URL or local file name).
StelModuleActionName
Define the possible action for which an order is defined.
Definition: StelModule.hpp:117
Maintain the state of a progress bar.
Abstract class defining the API to implement for all sky layer.
Base class for any astro image with a fixed position.
bool loadSkyImage(const QString &id, const QString &filename, double ra0, double dec0, double ra1, double dec1, double ra2, double dec2, double ra3, double dec3, double minRes, double maxBright, bool visible)
Load an image from a file.
virtual double getCallOrder(StelModuleActionName actionName) const
Determines the order in which the various modules are drawn.
This is the common base class for all the main components of stellarium.
Definition: StelModule.hpp:49