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

Stellarium / stellarium / 15291801018

28 May 2025 04:52AM UTC coverage: 11.931% (-0.02%) from 11.951%
15291801018

push

github

alex-w
Added new set of navigational stars (XIX century)

0 of 6 new or added lines in 2 files covered. (0.0%)

14124 existing lines in 74 files now uncovered.

14635 of 122664 relevant lines covered (11.93%)

18291.42 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
//! GZ NEW: The nativeName should be accessible in a GUI option, so that e.g. original names as written in a
47
//! concrete book where a skyculture has been taken from can be assured even when translation is available.
48
//! TODO: There should be a distinction between constellations and asterisms, which are "unofficial" figures within a sky culture.
49
//! For example, Western sky culture has a "Big Dipper", "Coathanger", etc. These would be nice to see, but in different style.
50
class Constellation : public StelObject
51
{
52
        friend class ConstellationMgr;
53
private:
54
        static const QString CONSTELLATION_TYPE;
55
        Constellation();
56
        ~Constellation() override;
57

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

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

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

77
        //! @param data a JSON formatted constellation record from index.json
78
        //! @param starMgr a pointer to the StarManager object.
79
        //! @return false if can't parse record (invalid result!), else true.
80
        bool read(const QJsonObject& data, StarMgr *starMgr);
81

82
        //! Draw the constellation name. Depending on completeness of names and data, there may be a rich set of options to display.
83
        void drawName(StelPainter& sPainter) const;
84
        //! Draw the constellation art
85
        void drawArt(StelPainter& sPainter) const;
86
        //! Draw the constellation boundary. obsVelocity used for aberration
87
        void drawBoundaryOptim(StelPainter& sPainter, const Vec3d &obsVelocity) const;
88

89
        //! Test if a star is part of a Constellation.
90
        //! This member tests to see if a star is one of those which make up
91
        //! the lines of a Constellation.
92
        //! @return a pointer to the constellation which the star is a part of,
93
        //! or nullptr if the star is not part of a constellation
94
        //! @note: Dark constellations by definition cannot be found here.
95
        const Constellation* isStarIn(const StelObject*) const;
96

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

103
        //! Get the translated name for the Constellation.
UNCOV
104
        QString getNameI18n() const override {return culturalName.translatedI18n;}
×
105
        //! Get the English name for the Constellation.
UNCOV
106
        QString getEnglishName() const override {return culturalName.translated;}
×
107
        //! Get the native name for the Constellation
UNCOV
108
        QString getNameNative() const override {return culturalName.native;}
×
109
        //! Get (translated) pronouncement of the native name for the Constellation
UNCOV
110
        QString getNamePronounce() const override {return (culturalName.pronounceI18n.isEmpty() ? culturalName.native : culturalName.pronounceI18n);}
×
111
        //! Get the short name for the Constellation (returns the translated version of abbreviation).
UNCOV
112
        QString getShortName() const {return abbreviationI18n;}
×
113
        //! Combine screen label from various components, depending on settings in SkyCultureMgr
114
        QString getScreenLabel() const override;
115
        //! Combine InfoString label from various components, depending on settings in SkyCultureMgr
116
        QString getInfoLabel() const override;
117
        //! Underlying worker
118
        QString getCultureLabel(StelObject::CulturalDisplayStyle style) const;
119
        //! Draw the lines for the Constellation.
120
        //! This method uses the coords of the stars (optimized for use through
121
        //! the class ConstellationMgr only).
122
        void drawOptim(StelPainter& sPainter, const StelCore* core, const SphericalCap& viewportHalfspace) const;
123
        //! Draw the art texture, optimized function to be called through a constellation manager only.  obsVelocity used for aberration
124
        void drawArtOptim(StelPainter& sPainter, const SphericalRegion& region, const Vec3d& obsVelocity) const;
125
        //! Update fade levels according to time since various events.
126
        void update(int deltaTime);
127
        //! Turn on and off Constellation line rendering.
128
        //! @param b new state for line drawing.
129
        void setFlagLines(const bool b) {lineFader=b;}
×
130
        //! Turn on and off Constellation boundary rendering.
131
        //! @param b new state for boundary drawing.
132
        void setFlagBoundaries(const bool b) {boundaryFader=b;}
×
133
        //! Turn on and off Constellation name label rendering.
134
        //! @param b new state for name label drawing.
135
        void setFlagLabels(const bool b) {nameFader=b;}
×
136
        //! Turn on and off Constellation art rendering.
137
        //! @param b new state for art drawing.
UNCOV
138
        void setFlagArt(const bool b) {artFader=b;}
×
139
        //! Get the current state of Constellation line rendering.
140
        //! @return true if Constellation line rendering it turned on, else false.
141
        bool getFlagLines() const {return lineFader;}
142
        //! Get the current state of Constellation boundary rendering.
143
        //! @return true if Constellation boundary rendering it turned on, else false.
144
        bool getFlagBoundaries() const {return boundaryFader;}
145
        //! Get the current state of Constellation name label rendering.
146
        //! @return true if Constellation name label rendering it turned on, else false.
147
        bool getFlagLabels() const {return nameFader;}
148
        //! Get the current state of Constellation art rendering.
149
        //! @return true if Constellation art rendering it turned on, else false.
150
        bool getFlagArt() const {return artFader;}
151

152
        //! Check visibility of sky culture elements (using for seasonal rules)
153
        //! @return true if sky culture elements rendering it turned on, else false.
154
        bool isSeasonallyVisible() const;
155

156
        //! Constellation name. This is a culture-dependent thing, and in each skyculture a constellation has one name entry only.
157
        //! Given multiple aspects of naming, we need all the components and more.
158
        CulturalName culturalName;
159
        //! Abbreviation (the short name or designation of constellations)
160
        //! For non-IAU constellations, a skyculture designer must invent it. (usually 2-5 Latin letters and numerics)
161
        //! This MUST be filled and be unique within a sky culture.
162
        //! @note Given their possible screen use, using numerical labels as abbreviation is not recommended.
163
        QString abbreviation;
164
        //! Translated version of abbreviation (the short name or designation of constellations)
165
        //! Latin-based languages should not translate it, but it may be useful to translate for other glyph systems.
166
        QString abbreviationI18n;
167
        //! The context for English name of constellation (using for correct translation via gettext)
168
        QString context;
169
        //! Direction vector pointing on constellation name drawing position
170
        Vec3d XYZname;
171
        Vec3d XYname;
172
        //! Number of segments in the lines
173
        unsigned int numberOfSegments;
174
        //! Month [1..12] of start visibility of constellation (seasonal rules)
175
        int beginSeason;
176
        //! Month [1..12] of end visibility of constellation (seasonal rules)
177
        int endSeason;
178
        //! List of stars forming the segments
179
        std::vector<StelObjectP> constellation;
180
        //! List of coordinates forming the segments of a dark constellation (outlining dark cloud in front of the Milky Way)
181
        //! If this is not null, the constellation is a "dark constellation"
182
        std::vector<Vec3d> dark_constellation;
183
        //! In case this describes a single-star constellation (i.e. just one line segment that starts and ends at the same star),
184
        //! or we have a line segment with such single star somewhere within the constellation,
185
        //! we will draw a circle with this opening radius.
186
        double singleStarConstellationRadius;
187

188
        StelTextureSP artTexture;
189
        StelVertexArray artPolygon;
190
        SphericalCap boundingCap;
191

192
        //! Define whether art, lines, names and boundary must be drawn
193
        LinearFader artFader, lineFader, nameFader, boundaryFader;
194
        //! Constellation art opacity
195
        float artOpacity;
196
        std::vector<std::vector<Vec3d> *> isolatedBoundarySegments;
197
        std::vector<std::vector<Vec3d> *> sharedBoundarySegments;
198

199
        //! Currently we only need one color for all constellations, this may change at some point
200
        static Vec3f lineColor;
201
        static Vec3f labelColor;
202
        static Vec3f boundaryColor;
203

204
        static bool singleSelected;        
205
        static bool seasonalRuleEnabled;
206
        // set by ConstellationMgr to fade out art on small FOV values
207
        // see LP:#1294483
208
        static float artIntensityFovScale;
209
};
210

211
#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