• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Stellarium / stellarium / 15670918640

16 Jun 2025 02:08AM UTC coverage: 11.775% (-0.2%) from 11.931%
15670918640

push

github

alex-w
Updated data

14700 of 124846 relevant lines covered (11.77%)

18324.52 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/core/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

35
//! Contain all the credits for a given server hosting the data
36
class ServerCredits
37
{
38
public:
39
        //! Very short credit to display in the loading bar
40
        QString shortCredits;
41

42
        //! Full credits
43
        QString fullCredits;
44

45
        //! The URL where to get more info about the server
46
        QString infoURL;
47
};
48

49
//! Contains all the credits for the creator of the image collection
50
class DataSetCredits
51
{
52
public:
53
        //! Very short credit to display in the loading bar
54
        QString shortCredits;
55

56
        //! Full credits
57
        QString fullCredits;
58

59
        //! The URL where to get more info about the data collection
60
        QString infoURL;
61
};
62

63
//! Base class for any astro image with a fixed position
64
class StelSkyImageTile : public MultiLevelJsonBase
65
{
66
        Q_OBJECT
67

68
        friend class StelSkyLayerMgr;
69

70
public:
71
        //! Default constructor
72
        StelSkyImageTile();
73

74
        //! Constructor
75
        StelSkyImageTile(const QString& url, StelSkyImageTile* parent=Q_NULLPTR, int decimateBy=1);
76
        //! Constructor
77
        StelSkyImageTile(const QVariantMap& map, StelSkyImageTile* parent, int decimateBy=1);
78

79
        //! Destructor
80
        ~StelSkyImageTile() override;
81

82
        //! Draw the image on the screen.
83
        void draw(StelCore* core, StelPainter& sPainter, float opacity=1.) override;
84

85
        //! Return the dataset credits to use in the progress bar
86
        DataSetCredits getDataSetCredits() const {return dataSetCredits;}
87

88
        //! Return the server credits to use in the progress bar
89
        ServerCredits getServerCredits() const {return serverCredits;}
90

91
        //! Return true if the tile is fully loaded and can be displayed
92
        bool isReadyToDisplay() const;
93

94
        //! Convert the image information to a map following the JSON structure.
95
        //! It can be saved as JSON using the StelJsonParser methods.
96
        QVariantMap toQVariantMap() const;
97

98
        //! Return the absolute path/URL to the image file
99
        QString getAbsoluteImageURI() const {return absoluteImageURI;}
100

101
        //! Return an HTML description of the image to be displayed in the GUI.
102
        QString getLayerDescriptionHtml() const override {return htmlDescription;}
×
103

104
        //! Set Visible Flag.
105
        void setVisible(bool b){flagVisible = b;}
×
106

107
        //! Get Visible Flag.
108
        bool getVisible(){return flagVisible;}
×
109

110
        //! return list of all the polygons.
111
        QList<SphericalRegionP> getSkyConvexPolygons(){return skyConvexPolygons;}
×
112

113
protected:
114
        //! Reimplement the abstract method.
115
        //! Load the tile from a valid QVariantMap.
116
        void loadFromQVariantMap(const QVariantMap& map) override;
117

118
        //! The credits of the server where this data come from
119
        ServerCredits serverCredits;
120

121
        //! The credits for the data set
122
        DataSetCredits dataSetCredits;
123

124
        //! URL where the image is located
125
        QString absoluteImageURI;
126

127
        //! The image luminance in cd/m^2
128
        float luminance;
129

130
        //! Whether the texture must be blended
131
        bool alphaBlend;
132

133
        //! True if the tile is just a list of other tiles without texture for itself
134
        bool noTexture;
135

136
        //! list of all the polygons.
137
        QList<SphericalRegionP> skyConvexPolygons;
138

139
        //! The texture of the tile
140
        StelTextureSP tex;
141

142
        //! Minimum resolution of the data of the texture in degree/pixel
143
        float minResolution;
144

145
        //! Allow some images to be shown only after this date, e.g. Supernova remnants.
146
        double birthJD;
147

148
        //! Should usually be true. Allow disabling observation of aberration correction for script-loaded SkyImages.
149
        bool withAberration;
150

151
        //! Should be default true. Control visible of single tile.
152
        bool flagVisible;
153

154
private:
155
        //! init the StelSkyImageTile
156
        void initCtor();
157

158
        //! Return the list of tiles which should be drawn.
159
        //! @param result a map containing resolution, pointer to the tiles
160
        void getTilesToDraw(QMultiMap<double, StelSkyImageTile*>& result, StelCore* core, const SphericalRegionP& viewPortPoly, float limitLuminance, bool recheckIntersect=true);
161

162
        //! Draw the image on the screen.
163
        //! @return true if the tile was actually displayed
164
        bool drawTile(StelCore* core, StelPainter& sPainter, const Vec3d &vel);
165

166
        //! Return the minimum resolution
167
        double getMinResolution() const {return static_cast<double>(minResolution);}
168

169
        //! The list of all the subTiles URL or already loaded JSON map for this tile
170
        QVariantList subTilesUrls;
171

172
        // Used for smooth fade in
173
        QTimeLine* texFader;
174

175
        QString htmlDescription;
176

177
        int decimation; //!> Allow texture size reduction for very weak hardware. Default 1, useful 2..8.
178
};
179

180
#endif // STELSKYIMAGETILE_HPP
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc