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

Stellarium / stellarium / 13280109945

12 Feb 2025 07:19AM UTC coverage: 12.129% (+0.03%) from 12.099%
13280109945

Pull #3751

github

10110111
Regenerate the SC .pot file
Pull Request #3751: Switch skycultures to the new format

14613 of 120480 relevant lines covered (12.13%)

18988.36 hits per line

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

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

22
#ifndef CONSTELLATION_HPP
23
#define CONSTELLATION_HPP
24

25
#include "StelObject.hpp"
26
#include "StelTranslator.hpp"
27
#include "StelFader.hpp"
28
#include "StelTextureTypes.hpp"
29
#include "StelSphereGeometry.hpp"
30
#include "ConstellationMgr.hpp"
31

32
#include <vector>
33
#include <QJsonObject>
34
#include <QString>
35
#include <QFont>
36

37
class StarMgr;
38
class StelPainter;
39

40
//! @class Constellation
41
//! The Constellation class models a grouping of stars in a Sky Culture.
42
//! Each Constellation consists of a list of stars identified by their
43
//! abbreviation and Hipparcos catalogue numbers (taken from file: constellationship.fab),
44
//! another entry in file constellation_names.eng.fab with the defining abbreviated name,
45
//! nativeName, and translatable englishName (translation goes into nameI18),
46
//! boundary shape from file constellation_boundaries.dat and an (optional) artistic pictorial representation.
47
//! GZ NEW: The nativeName should be accessible in a GUI option, so that e.g. original names as written in a
48
//! concrete book where a skyculture has been taken from can be assured even when translation is available.
49
//! TODO: There should be a distinction between constellations and asterisms, which are "unofficial" figures within a sky culture.
50
//! For example, Western sky culture has a "Big Dipper", "Coathanger", etc. These would be nice to see, but in different style.
51
class Constellation : public StelObject
52
{
53
        friend class ConstellationMgr;
54
private:
55
        static const QString CONSTELLATION_TYPE;
56
        Constellation();
57
        ~Constellation() override;
58

59
        // StelObject method to override
60
        //! Get a string with data about the Constellation.
61
        //! Constellations support the following InfoStringGroup flags:
62
        //! - Name
63
        //! @param core the StelCore object
64
        //! @param flags a set of InfoStringGroup items to include in the return value.
65
        //! @return a QString a description of the constellation.
66
        QString getInfoString(const StelCore*, const InfoStringGroup& flags) const override;
67

68
        //! Get the module/object type string.
69
        //! @return "Constellation"
70
        QString getType() const override {return CONSTELLATION_TYPE;}
×
71
        QString getObjectType() const override { return N_("constellation"); }
×
72
        QString getObjectTypeI18n() const override { return q_(getObjectType()); }
×
73
        QString getID() const override { return abbreviation; }
×
74

75
        //! observer centered J2000 coordinates.
76
        Vec3d getJ2000EquatorialPos(const StelCore*) const override {return XYZname;}
×
77

78
        //! @param record string containing the following whitespace
79
        //! separated fields: abbreviation - a three character abbreviation
80
        //! for the constellation, a number of lines (pairs), and a list of Hipparcos
81
        //! catalogue numbers which, when connected pairwise, form the lines of the
82
        //! constellation.
83
        //! @param starMgr a pointer to the StarManager object.
84
        //! @return false if can't parse record (invalid result!), else true.
85
        bool read(const QJsonObject& data, StarMgr *starMgr, bool preferNativeNames);
86

87
        //! Draw the constellation name
88
        void drawName(StelPainter& sPainter, ConstellationMgr::ConstellationDisplayStyle style) const;
89
        //! Draw the constellation art
90
        void drawArt(StelPainter& sPainter) const;
91
        //! Draw the constellation boundary. obsVelocity used for aberration
92
        void drawBoundaryOptim(StelPainter& sPainter, const Vec3d &obsVelocity) const;
93

94
        //! Test if a star is part of a Constellation.
95
        //! This member tests to see if a star is one of those which make up
96
        //! the lines of a Constellation.
97
        //! @return a pointer to the constellation which the star is a part of,
98
        //! or Q_NULLPTR if the star is not part of a constellation
99
        const Constellation* isStarIn(const StelObject*) const;
100

101
        //! Get the brightest star in a Constellation.
102
        //! Checks all stars which make up the constellation lines, and returns
103
        //! a pointer to the one with the brightest apparent magnitude.
104
        //! @return a pointer to the brightest star
105
        StelObjectP getBrightestStarInConstellation(void) const;
106

107
        //! Get the translated name for the Constellation.
108
        QString getNameI18n() const override {return nameI18;}
×
109
        //! Get the English name for the Constellation.
110
        QString getEnglishName() const override {return englishName;}
×
111
        //! Get the short name for the Constellation (returns the abbreviation).
112
        QString getShortName() const {return abbreviation;}
×
113
        //! Draw the lines for the Constellation.
114
        //! This method uses the coords of the stars (optimized for use through
115
        //! the class ConstellationMgr only).
116
        void drawOptim(StelPainter& sPainter, const StelCore* core, const SphericalCap& viewportHalfspace) const;
117
        //! Draw the art texture, optimized function to be called through a constellation manager only.  obsVelocity used for aberration
118
        void drawArtOptim(StelPainter& sPainter, const SphericalRegion& region, const Vec3d& obsVelocity) const;
119
        //! Update fade levels according to time since various events.
120
        void update(int deltaTime);
121
        //! Turn on and off Constellation line rendering.
122
        //! @param b new state for line drawing.
123
        void setFlagLines(const bool b) {lineFader=b;}
×
124
        //! Turn on and off Constellation boundary rendering.
125
        //! @param b new state for boundary drawing.
126
        void setFlagBoundaries(const bool b) {boundaryFader=b;}
×
127
        //! Turn on and off Constellation name label rendering.
128
        //! @param b new state for name label drawing.
129
        void setFlagLabels(const bool b) {nameFader=b;}
×
130
        //! Turn on and off Constellation art rendering.
131
        //! @param b new state for art drawing.
132
        void setFlagArt(const bool b) {artFader=b;}
×
133
        //! Get the current state of Constellation line rendering.
134
        //! @return true if Constellation line rendering it turned on, else false.
135
        bool getFlagLines() const {return lineFader;}
136
        //! Get the current state of Constellation boundary rendering.
137
        //! @return true if Constellation boundary rendering it turned on, else false.
138
        bool getFlagBoundaries() const {return boundaryFader;}
139
        //! Get the current state of Constellation name label rendering.
140
        //! @return true if Constellation name label rendering it turned on, else false.
141
        bool getFlagLabels() const {return nameFader;}
142
        //! Get the current state of Constellation art rendering.
143
        //! @return true if Constellation art rendering it turned on, else false.
144
        bool getFlagArt() const {return artFader;}
145

146
        //! Check visibility of starlore elements (using for seasonal rules)
147
        //! @return true if starlore elements rendering it turned on, else false.
148
        bool checkVisibility() const;
149

150
        //! International name (translated using gettext)
151
        QString nameI18;
152
        //! Name in english (column 3 in constellation_names.eng.fab)
153
        QString englishName;
154
        //! Name in native language (column 2 in constellation_names.eng.fab).
155
        //! According to practice as of V0.13.1, this may be an empty string.
156
        //! If empty, will be filled with englishName.
157
        QString nativeName;
158
        //! Abbreviation (of the latin name for western constellations)
159
        //! For non-western, a skyculture designer must invent it. (usually 2-5 letters)
160
        //! This MUST be filled and be unique within a sky culture.
161
        QString abbreviation;
162
        QString context;
163
        //! Direction vector pointing on constellation name drawing position
164
        Vec3d XYZname;
165
        Vec3d XYname;
166
        //! Number of segments in the lines
167
        unsigned int numberOfSegments;
168
        //! Month [1..12] of start visibility of constellation (seasonal rules)
169
        int beginSeason;
170
        //! Month [1..12] of end visibility of constellation (seasonal rules)
171
        int endSeason;
172
        //! List of stars forming the segments
173
        std::vector<StelObjectP> constellation;
174

175
        StelTextureSP artTexture;
176
        StelVertexArray artPolygon;
177
        SphericalCap boundingCap;
178

179
        //! Define whether art, lines, names and boundary must be drawn
180
        LinearFader artFader, lineFader, nameFader, boundaryFader;
181
        //! Constellation art opacity
182
        float artOpacity;
183
        std::vector<std::vector<Vec3d> *> isolatedBoundarySegments;
184
        std::vector<std::vector<Vec3d> *> sharedBoundarySegments;
185

186
        //! Currently we only need one color for all constellations, this may change at some point
187
        static Vec3f lineColor;
188
        static Vec3f labelColor;
189
        static Vec3f boundaryColor;
190

191
        static bool singleSelected;        
192
        static bool seasonalRuleEnabled;
193
        // set by ConstellationMgr to fade out art on small FOV values
194
        // see LP:#1294483
195
        static float artIntensityFovScale;
196
};
197

198
#endif // CONSTELLATION_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