Stellarium 0.13.0
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.
Definition: StelSkyLayerMgr.hpp:33
Contain all the credits for a given server hosting the data.
Definition: StelSkyImageTile.hpp:36
Abstract base class for managing multi-level tree objects stored in JSON format.
Definition: MultiLevelJsonBase.hpp:34
A shared pointer on a SphericalRegion.
Definition: StelSphereGeometry.hpp:51
Define the StelTextureSP type.
QString infoURL
The URL where to get more info about the data collection.
Definition: StelSkyImageTile.hpp:60
QString fullCredits
Full credits.
Definition: StelSkyImageTile.hpp:57
Main class for Stellarium core processing.
Definition: StelCore.hpp:46
QString absoluteImageURI
URL where the image is located.
Definition: StelSkyImageTile.hpp:116
QString shortCredits
Very short credit to display in the loading bar.
Definition: StelSkyImageTile.hpp:54
StelSkyImageTile()
Default constructor.
ServerCredits serverCredits
The credits of the server where this data come from.
Definition: StelSkyImageTile.hpp:110
QString infoURL
The URL where to get more info about the server.
Definition: StelSkyImageTile.hpp:46
DataSetCredits getDataSetCredits() const
Return the dataset credits to use in the progress bar.
Definition: StelSkyImageTile.hpp:86
bool alphaBlend
Whether the texture must be blended.
Definition: StelSkyImageTile.hpp:122
DataSetCredits dataSetCredits
The credits for the data set.
Definition: StelSkyImageTile.hpp:113
QString getAbsoluteImageURI() const
Return the absolute path/URL to the image file.
Definition: StelSkyImageTile.hpp:99
float minResolution
Minimum resolution of the data of the texture in degree/pixel.
Definition: StelSkyImageTile.hpp:134
Provides functions for performing openGL drawing operations.
Definition: StelPainter.hpp:71
QVariantMap toQVariantMap() const
Convert the image informations to a map following the JSON structure.
QList< SphericalRegionP > skyConvexPolygons
list of all the polygons.
Definition: StelSkyImageTile.hpp:128
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.
Definition: StelSkyImageTile.hpp:89
QString fullCredits
Full credits.
Definition: StelSkyImageTile.hpp:43
StelTextureSP tex
The texture of the tile.
Definition: StelSkyImageTile.hpp:131
QString shortCredits
Very short credit to display in the loading bar.
Definition: StelSkyImageTile.hpp:40
bool noTexture
True if the tile is just a list of other tiles without texture for itself.
Definition: StelSkyImageTile.hpp:125
Base class for any astro image with a fixed position.
Definition: StelSkyImageTile.hpp:64
float luminance
The image luminance in cd/m^2.
Definition: StelSkyImageTile.hpp:119
virtual QString getLayerDescriptionHtml() const
Return an HTML description of the image to be displayed in the GUI.
Definition: StelSkyImageTile.hpp:102
QSharedPointer< StelTexture > StelTextureSP
Use shared pointer to simplify memory managment.
Definition: StelTextureTypes.hpp:34
~StelSkyImageTile()
Destructor.
Contains all the credits for the creator of the image collection.
Definition: StelSkyImageTile.hpp:50
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.