Stellarium 0.15.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 
35 
37 {
38  Q_OBJECT
39  Q_PROPERTY(bool flagShow READ getFlagShow WRITE setFlagShow NOTIFY flagShowChanged)
40 
41 public:
43  ~StelSkyLayerMgr();
44 
46  // Methods defined in the StelModule class
48  virtual void init();
49 
51  virtual void draw(StelCore* core);
52 
54  virtual void update(double) {;}
55 
57  virtual double getCallOrder(StelModuleActionName actionName) const;
58 
60  // Other specific methods
66  QString insertSkyLayer(StelSkyLayerP l, const QString& keyHint=QString(), bool show=true);
67 
69  void removeSkyLayer(StelSkyLayerP l);
70 
72  QMap<QString, StelSkyLayerP> getAllSkyLayers() const;
73 
74  StelSkyLayerP getSkyLayer(const QString& key) const;
75 
77  bool getFlagShow() const {return flagShow;}
78 
79 public slots:
81  // Properties setters and getters
83  void setFlagShow(bool b) {if (flagShow !=b) { flagShow = b; emit flagShowChanged(b);}}
106  bool loadSkyImage(const QString& id, const QString& filename,
107  double long0, double lat0,
108  double long1, double lat1,
109  double long2, double lat2,
110  double long3, double lat3,
111  double minRes, double maxBright, bool visible, StelCore::FrameType frameType=StelCore::FrameJ2000);
112 
132  bool loadSkyImageAltAz(const QString& id, const QString& filename,
133  double alt0, double azi0,
134  double alt1, double azi1,
135  double alt2, double azi2,
136  double alt3, double azi3,
137  double minRes, double maxBright, bool visible);
138 
144  void showLayer(const QString& id, bool b);
150  bool getShowLayer(const QString& id) const;
151 
153  // Other slots
161  QString insertSkyImage(const QString& uri, const QString& keyHint=QString(), bool show=true);
162 
168  void removeSkyLayer(const QString& key);
169 
171  QStringList getAllKeys() const {return allSkyLayers.keys();}
172 
173 signals:
174  void flagShowChanged(bool b);
175 
176 private slots:
179  void loadingStateChanged(bool b);
180 
183  void percentLoadedChanged(int percentage);
184 
185 private:
186 
188  class SkyLayerElem
189  {
190  public:
191  SkyLayerElem(StelSkyLayerP t, bool show=true);
192  ~SkyLayerElem();
193  StelSkyLayerP layer;
194  class StelProgressController* progressBar;
195  bool show;
196  };
197 
198  SkyLayerElem* skyLayerElemForLayer(const StelSkyLayer*);
199 
200  QString keyForLayer(const StelSkyLayer*);
201 
203  QMap<QString, SkyLayerElem*> allSkyLayers;
204 
205  // Whether to draw at all
206  bool flagShow;
207 };
208 
209 #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.
bool loadSkyImage(const QString &id, const QString &filename, double long0, double lat0, double long1, double lat1, double long2, double lat2, double long3, double lat3, double minRes, double maxBright, bool visible, StelCore::FrameType frameType=StelCore::FrameJ2000)
Load an image from a file into a quad described with 4 corner coordinates.
QMap< QString, StelSkyLayerP > getAllSkyLayers() const
Get the list of all the currently loaded layers.
Equatorial reference frame at the J2000 equinox centered on the observer. This is also the ICRS refer...
Definition: StelCore.hpp:79
void setFlagShow(bool b)
Set whether Sky Background should be displayed.
virtual void init()
Initialize.
Main class for Stellarium core processing.
Definition: StelCore.hpp:48
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 its ID.
FrameType
Supported reference frame types.
Definition: StelCore.hpp:69
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 into AzAltimuthal coordinates.
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:121
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.
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