-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Expand file tree
/
Copy pathStelSkyImageTile.hpp
More file actions
168 lines (123 loc) · 4.91 KB
/
StelSkyImageTile.hpp
File metadata and controls
168 lines (123 loc) · 4.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/*
* Copyright (C) 2008 Fabien Chereau
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/
#ifndef STELSKYIMAGETILE_HPP
#define STELSKYIMAGETILE_HPP
#include "MultiLevelJsonBase.hpp"
#include "StelSphereGeometry.hpp"
#include "StelTextureTypes.hpp"
#include <QTimeLine>
//#define DEBUG_STELSKYIMAGE_TILE 1
class QIODevice;
class StelCore;
class StelPainter;
//! Contain all the credits for a given server hosting the data
class ServerCredits
{
public:
//! Very short credit to display in the loading bar
QString shortCredits;
//! Full credits
QString fullCredits;
//! The URL where to get more info about the server
QString infoURL;
};
//! Contains all the credits for the creator of the image collection
class DataSetCredits
{
public:
//! Very short credit to display in the loading bar
QString shortCredits;
//! Full credits
QString fullCredits;
//! The URL where to get more info about the data collection
QString infoURL;
};
//! Base class for any astro image with a fixed position
class StelSkyImageTile : public MultiLevelJsonBase
{
Q_OBJECT
friend class StelSkyLayerMgr;
public:
//! Default constructor
StelSkyImageTile();
//! Constructor
StelSkyImageTile(const QString& url, StelSkyImageTile* parent=Q_NULLPTR, int decimateBy=1);
//! Constructor
StelSkyImageTile(const QVariantMap& map, StelSkyImageTile* parent, int decimateBy=1);
//! Destructor
~StelSkyImageTile() Q_DECL_OVERRIDE;
//! Draw the image on the screen.
void draw(StelCore* core, StelPainter& sPainter, float opacity=1.) Q_DECL_OVERRIDE;
//! Return the dataset credits to use in the progress bar
DataSetCredits getDataSetCredits() const {return dataSetCredits;}
//! Return the server credits to use in the progress bar
ServerCredits getServerCredits() const {return serverCredits;}
//! Return true if the tile is fully loaded and can be displayed
bool isReadyToDisplay() const;
//! Convert the image information to a map following the JSON structure.
//! It can be saved as JSON using the StelJsonParser methods.
QVariantMap toQVariantMap() const;
//! Return the absolute path/URL to the image file
QString getAbsoluteImageURI() const {return absoluteImageURI;}
//! Return an HTML description of the image to be displayed in the GUI.
virtual QString getLayerDescriptionHtml() const Q_DECL_OVERRIDE {return htmlDescription;}
protected:
//! Reimplement the abstract method.
//! Load the tile from a valid QVariantMap.
virtual void loadFromQVariantMap(const QVariantMap& map) Q_DECL_OVERRIDE;
//! The credits of the server where this data come from
ServerCredits serverCredits;
//! The credits for the data set
DataSetCredits dataSetCredits;
//! URL where the image is located
QString absoluteImageURI;
//! The image luminance in cd/m^2
float luminance;
//! Whether the texture must be blended
bool alphaBlend;
//! True if the tile is just a list of other tiles without texture for itself
bool noTexture;
//! list of all the polygons.
QList<SphericalRegionP> skyConvexPolygons;
//! The texture of the tile
StelTextureSP tex;
//! Minimum resolution of the data of the texture in degree/pixel
float minResolution;
//! Allow some images to be shown only after this date, e.g. Supernova remnants.
double birthJD;
//! Should usually be true. Allow disabling observation of aberration correction for script-loaded SkyImages.
bool withAberration;
private:
//! init the StelSkyImageTile
void initCtor();
//! Return the list of tiles which should be drawn.
//! @param result a map containing resolution, pointer to the tiles
void getTilesToDraw(QMultiMap<double, StelSkyImageTile*>& result, StelCore* core, const SphericalRegionP& viewPortPoly, float limitLuminance, bool recheckIntersect=true);
//! Draw the image on the screen.
//! @return true if the tile was actually displayed
bool drawTile(StelCore* core, StelPainter& sPainter, const Vec3d &vel);
//! Return the minimum resolution
double getMinResolution() const {return static_cast<double>(minResolution);}
//! The list of all the subTiles URL or already loaded JSON map for this tile
QVariantList subTilesUrls;
// Used for smooth fade in
QTimeLine* texFader;
QString htmlDescription;
int decimation; //!> Allow texture size reduction for very weak hardware. Default 1, useful 2..8.
};
#endif // STELSKYIMAGETILE_HPP