Stellarium 0.12.4
StelSkyImageTile.hpp
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 
20 #ifndef _STELSKYIMAGETILE_HPP_
21 #define _STELSKYIMAGETILE_HPP_
22 
23 #include <QTimeLine>
24 
25 #include "MultiLevelJsonBase.hpp"
26 #include "StelSphereGeometry.hpp"
27 
28 //#define DEBUG_STELSKYIMAGE_TILE 1
29 
30 class QIODevice;
31 class StelCore;
32 
35 {
36 public:
38  QString shortCredits;
39 
41  QString fullCredits;
42 
44  QString infoURL;
45 };
46 
49 {
50 public:
52  QString shortCredits;
53 
55  QString fullCredits;
56 
58  QString infoURL;
59 };
60 
63 {
64  Q_OBJECT
65 
66  friend class StelSkyLayerMgr;
67 
68 public:
71 
73  StelSkyImageTile(const QString& url, StelSkyImageTile* parent=NULL);
75  StelSkyImageTile(const QVariantMap& map, StelSkyImageTile* parent);
76 
79 
81  void draw(StelCore* core, class StelRenderer* renderer, StelProjectorP projector, float opacity=1.);
82 
85 
88 
90  bool isReadyToDisplay() const;
91 
94  QVariantMap toQVariantMap() const;
95 
97  QString getAbsoluteImageURI() const {return absoluteImageURI;}
98 
100  virtual QString getLayerDescriptionHtml() const {return htmlDescription;}
101 
102 protected:
105  virtual void loadFromQVariantMap(const QVariantMap& map);
106 
109 
112 
115 
117  float luminance;
118 
121 
123  bool noTexture;
124 
126  QList<SphericalRegionP> skyConvexPolygons;
127 
130 
133 
134 private:
136  void initCtor();
137 
140  void getTilesToDraw(QMultiMap<double, StelSkyImageTile*>& result,
141  StelCore* core,
142  StelRenderer* renderer,
143  const SphericalRegionP& viewPortPoly,
144  float limitLuminance,
145  bool recheckIntersect=true);
146 
149  bool drawTile(StelCore* core, StelRenderer* renderer, StelProjectorP projector);
150 
152  double getMinResolution() const {return minResolution;}
153 
155  QVariantList subTilesUrls;
156 
157  // Used for smooth fade in
158  QTimeLine* texFader;
159 
160  QString htmlDescription;
161 };
162 
163 #endif // _STELSKYIMAGETILE_HPP_