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

Stellarium / stellarium / 17072145787

19 Aug 2025 02:06PM UTC coverage: 11.755%. First build
17072145787

Pull #4459

github

10110111
Shift HiPS without "type" field by 180° in longitude

The planetary surveys from alasky.cds.unistra.fr appear to have a
reference frame that's rotated by 180° in longitude relative to that
of Stellarium's planetary surveys. These surveys were created by
Aladin/HipsGen, which I assume to be more or less a reference
implementation.

Since we can't easily change Stellarium's frame without backwards
compatibility issues, and the "type" field is a custom field not used
outside of Stellarium, we can use it as an indicator whether we need to
fixup the coordinates of a survey.
Pull Request #4459: Make it possible to choose between multiple planetary HiPS per planet

0 of 231 new or added lines in 7 files covered. (0.0%)

14706 of 125102 relevant lines covered (11.76%)

18070.18 hits per line

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

0.0
/src/core/StelHips.hpp
1
/*
2
 * Stellarium
3
 * Copyright (C) 2017 Guillaume Chereau
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
 */
19

20
// Support for HiPS surveys.
21

22
#ifndef STELHIPS_HPP
23
#define STELHIPS_HPP
24

25
#include <QObject>
26
#include <QCache>
27
#include <QImage>
28
#include <QJsonObject>
29
#include <QUrl>
30
#include <functional>
31

32
#include "StelTexture.hpp"
33
#include "VecMath.hpp"
34
#include "StelFader.hpp"
35

36
class StelPainter;
37
class HipsTile;
38
class QNetworkReply;
39
class SphericalCap;
40
class HipsSurvey;
41
class StelProgressController;
42

43
typedef QSharedPointer<HipsSurvey> HipsSurveyP;
44
Q_DECLARE_METATYPE(HipsSurveyP)
×
45

46
class HipsSurvey : public QObject
47
{
48
        friend class HipsMgr;
49
        Q_OBJECT
50

51
        Q_PROPERTY(QString url MEMBER url CONSTANT)
52
        Q_PROPERTY(QJsonObject properties MEMBER properties NOTIFY propertiesChanged)
53
        Q_PROPERTY(bool isLoading READ isLoading NOTIFY statusChanged)
54
        Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
55
        //! The name of the planet the survey is attached to, or empty if this is a skysurvey.
56
        Q_PROPERTY(QString planet MEMBER planet)
57

58
public:
59
        typedef std::function<void(const QVector<Vec3d>& verts, const QVector<Vec2f>& tex,
60
                                   const QVector<uint16_t>& indices)> DrawCallback;
61
        //! Create a new HipsSurvey from its url.
62
        //! @param url The location of the survey.
63
        //! @param group A string that identifies a group of color/normals/horizons
64
        //!              surveys that this survey belongs to.
65
        //! @param frame The reference frame from the survey's \c hips_frame property.
66
        //! @param type Survey type from the survey's \c type property.
67
        //! @param releaseDate If known the UTC JD release date of the survey.  Used for cache busting.
68
        HipsSurvey(const QString& url, const QString& group, const QString& frame, const QString& type,
69
                   const QMap<QString, QString>& hipslistProps, double releaseDate=0.0);
70
        ~HipsSurvey() override;
71

72
        //! Get whether the survey is visible.
73
        bool isVisible() const;
74

75
        //! Define whether the survey should be visible.
76
        void setVisible(bool value);
77
        float getInterstate() const {return fader.getInterstate();}
×
78

79
        //! Render the survey.
80
        //! @param sPainter the painter to use.
81
        //! @param angle total visible angle of the survey in radians. This is used to optimize the rendering of planet
82
        //!         surveys.  Should be set to 2 pi for sky surveys.
83
        //! @param callback if set this will be called for each visible tile, and the callback should do it rendering
84
        //!         itself.  If set to Q_NULLPTR, the function will draw the tiles using the default shader.
85
        void draw(StelPainter* sPainter, double angle = 2.0 * M_PI, DrawCallback callback = Q_NULLPTR);
86

87
        //! Return the source URL of the survey.
88
        const QString& getUrl() const {return url;}
×
89

90
        //! Return the frame name of the survey (its \c hips_frame property).
91
        QString getFrame() const { return hipsFrame; }
×
92

93
        //! Return the type of the survey (its \c type property).
94
        QString getType() const { return type; }
×
95

96
        //! Return the group of of color/normals/horizons surveys that this survey belongs to.
NEW
97
        QString getGroup() const { return group; }
×
98

99
        //! Get whether the survey is still loading.
100
        bool isLoading(void) const;
101

102
        bool isPlanetarySurvey(void) const { return planetarySurvey; }
×
103

104
        void setNormalsSurvey(const HipsSurveyP& normals);
105
        void setHorizonsSurvey(const HipsSurveyP& horizons);
106

107
        //! Parse a hipslist file into a list of surveys.
108
        static QList<HipsSurveyP> parseHipslist(const QString& hipslistURL, const QString& data);
109

110
signals:
111
        void propertiesChanged(void);
112
        void statusChanged(void);
113
        void visibleChanged(bool);
114

115
private:
116
        void checkForPlanetarySurvey();
117

118
private:
119
        LinearFader fader;
120
        QString url;
121
        QString group;
122
        QString type;
123
        QString hipsFrame;
124
        QString planet;
125
        HipsSurveyP normals;
126
        HipsSurveyP horizons;
127
        double releaseDate; // As UTC Julian day.
128
        int order = -1;
129
        bool planetarySurvey;
130
        QCache<long int, HipsTile> tiles;
131
        // reply to the initial download of the properties file and to the
132
        // allsky texture.
133
        QNetworkReply *networkReply = Q_NULLPTR;
134

135
        QImage allsky = QImage();
136
        bool noAllsky = false;
137

138
        // Values from the property file.
139
        QJsonObject properties;
140

141
        // Used to show the loading progress.
142
        StelProgressController* progressBar = Q_NULLPTR;
143
        int nbVisibleTiles;
144
        int nbLoadedTiles;
145

146

147
        QString getTitle(void) const;
148
        QUrl getUrlFor(const QString& path) const;
149
        int getPropertyInt(const QString& key, int fallback = 0);
150
        bool getAllsky();
151
        HipsTile* getTile(int order, int pix);
152
        /*! @brief Bind textures for drawing
153

154
            If @p tile is not ready for drawing (e.g. not fully loaded), alter
155
            @p texCoordShift and @p texCoordScale so that they let us address
156
            the corresponding part of a parent texture that will be bound.
157

158
            @param tile The tile to draw
159
            @param orderMin Smallest available HiPS order of the current survey
160
            @param texCoordShift The UV coordinates shift to be applied to the
161
             texture coordinates to address a subtexture in the parent. Must be
162
             set to 0 before the initial call to this function.
163
            @param texCoordScale The UV coordinates scale to be applied to the
164
             texture coordinates to address a subtexture in the parent. Must be
165
             set to 1 before the initial call to this function.
166
            @param tileIsLoaded Gets set to \c false if it was the requested
167
             HiPS level isn't fully loaded. Must be set to \c true before the
168
             initial call to this function.
169

170
            @return Whether a tile has been successfully bound.
171
         */
172
        bool bindTextures(HipsTile& tile, int orderMin, Vec2f& texCoordShift, float& texCoordScale, bool& tileIsLoaded);
173
        // draw a single tile. observerVelocity (in the correct hipsFrame) is necessary for aberration correction. Set to 0 for no aberration correction.
174
        void drawTile(int order, int pix, int drawOrder, int splitOrder, bool outside,
175
                      const SphericalCap& viewportShape, StelPainter* sPainter, Vec3d observerVelocity, DrawCallback callback);
176

177
        // Fill the array for a given tile.
178
        int fillArrays(int order, int pix, int drawOrder, int splitOrder,
179
                       bool outside, StelPainter* sPainter, Vec3d observerVelocity,
180
                       const Vec2f& texCoordShift, const float texCoordScale,
181
                       QVector<Vec3d>& verts, QVector<Vec2f>& tex, QVector<uint16_t>& indices);
182

183
        void updateProgressBar(int nb, int total);
184
};
185

186
#endif // STELHIPS_
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