Stellarium 0.13.1
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 "MultiLevelJsonBase.hpp"
24 #include "StelSphereGeometry.hpp"
25 #include "StelTextureTypes.hpp"
26 
27 #include <QTimeLine>
28 
29 //#define DEBUG_STELSKYIMAGE_TILE 1
30 
31 class QIODevice;
32 class StelCore;
33 class StelPainter;
34 
37 {
38 public:
40  QString shortCredits;
41 
43  QString fullCredits;
44 
46  QString infoURL;
47 };
48 
51 {
52 public:
54  QString shortCredits;
55 
57  QString fullCredits;
58 
60  QString infoURL;
61 };
62 
65 {
66  Q_OBJECT
67 
68  friend class StelSkyLayerMgr;
69 
70 public:
73 
75  StelSkyImageTile(const QString& url, StelSkyImageTile* parent=NULL);
77  StelSkyImageTile(const QVariantMap& map, StelSkyImageTile* parent);
78 
81 
83  void draw(StelCore* core, StelPainter& sPainter, float opacity=1.);
84 
87 
90 
92  bool isReadyToDisplay() const;
93 
96  QVariantMap toQVariantMap() const;
97 
99  QString getAbsoluteImageURI() const {return absoluteImageURI;}
100 
102  virtual QString getLayerDescriptionHtml() const {return htmlDescription;}
103 
104 protected:
107  virtual void loadFromQVariantMap(const QVariantMap& map);
108 
111 
114 
117 
119  float luminance;
120 
123 
125  bool noTexture;
126 
128  QList<SphericalRegionP> skyConvexPolygons;
129 
132 
135 
136 private:
138  void initCtor();
139 
142  void getTilesToDraw(QMultiMap<double, StelSkyImageTile*>& result, StelCore* core, const SphericalRegionP& viewPortPoly, float limitLuminance, bool recheckIntersect=true);
143 
146  bool drawTile(StelCore* core, StelPainter& sPainter);
147 
149  double getMinResolution() const {return minResolution;}
150 
152  QVariantList subTilesUrls;
153 
154  // Used for smooth fade in
155  QTimeLine* texFader;
156 
157  QString htmlDescription;
158 };
159 
160 #endif // _STELSKYIMAGETILE_HPP_
Manage the sky background images, including DSS and deep sky objects images.
Contain all the credits for a given server hosting the data.
Abstract base class for managing multi-level tree objects stored in JSON format.
A shared pointer on a SphericalRegion.
Define the StelTextureSP type.
QString infoURL
The URL where to get more info about the data collection.
QString fullCredits
Full credits.
Main class for Stellarium core processing.
Definition: StelCore.hpp:46
QString absoluteImageURI
URL where the image is located.
QString shortCredits
Very short credit to display in the loading bar.
StelSkyImageTile()
Default constructor.
ServerCredits serverCredits
The credits of the server where this data come from.
QString infoURL
The URL where to get more info about the server.
DataSetCredits getDataSetCredits() const
Return the dataset credits to use in the progress bar.
bool alphaBlend
Whether the texture must be blended.
DataSetCredits dataSetCredits
The credits for the data set.
QString getAbsoluteImageURI() const
Return the absolute path/URL to the image file.
float minResolution
Minimum resolution of the data of the texture in degree/pixel.
Provides functions for performing openGL drawing operations.
Definition: StelPainter.hpp:40
QVariantMap toQVariantMap() const
Convert the image informations to a map following the JSON structure.
QList< SphericalRegionP > skyConvexPolygons
list of all the polygons.
void draw(StelCore *core, StelPainter &sPainter, float opacity=1.)
Draw the image on the screen.
ServerCredits getServerCredits() const
Return the server credits to use in the progress bar.
QString fullCredits
Full credits.
StelTextureSP tex
The texture of the tile.
QString shortCredits
Very short credit to display in the loading bar.
bool noTexture
True if the tile is just a list of other tiles without texture for itself.
Base class for any astro image with a fixed position.
float luminance
The image luminance in cd/m^2.
virtual QString getLayerDescriptionHtml() const
Return an HTML description of the image to be displayed in the GUI.
QSharedPointer< StelTexture > StelTextureSP
Use shared pointer to simplify memory managment.
~StelSkyImageTile()
Destructor.
Contains all the credits for the creator of the image collection.
Define all SphericalGeometry primitives as well as the SphericalRegionP type.
bool isReadyToDisplay() const
Return true if the tile is fully loaded and can be displayed.
virtual void loadFromQVariantMap(const QVariantMap &map)
Reimplement the abstract method.