2727
2828scm::ScmConstellation::ScmConstellation (const std::vector<scm::CoordinateLine> &coordinates,
2929 const std::vector<scm::StarLine> &stars)
30- : constellationCoordinates (coordinates)
31- , constellationStars (stars)
30+ : coordinates (coordinates)
31+ , stars (stars)
3232{
3333 QSettings *conf = StelApp::getInstance ().getSettings ();
3434 constellationNameFont.setPixelSize (conf->value (" viewing/constellation_font_size" , 15 ).toInt ());
@@ -65,32 +65,66 @@ void scm::ScmConstellation::setNativeName(const std::optional<QString> &name)
6565 nativeName = name;
6666}
6767
68+ std::optional<QString> scm::ScmConstellation::getNativeName () const
69+ {
70+ return nativeName;
71+ }
72+
6873void scm::ScmConstellation::setPronounce (const std::optional<QString> &pronounce)
6974{
7075 ScmConstellation::pronounce = pronounce;
7176}
7277
78+ std::optional<QString> scm::ScmConstellation::getPronounce () const
79+ {
80+ return pronounce;
81+ }
82+
7383void scm::ScmConstellation::setIPA (const std::optional<QString> &ipa)
7484{
7585 ScmConstellation::ipa = ipa;
7686}
7787
88+ std::optional<QString> scm::ScmConstellation::getIPA () const
89+ {
90+ return ipa;
91+ }
92+
7893void scm::ScmConstellation::setArtwork (const ScmConstellationArtwork &artwork)
7994{
8095 ScmConstellation::artwork = artwork;
8196}
8297
98+ const scm::ScmConstellationArtwork &scm::ScmConstellation::getArtwork () const
99+ {
100+ return artwork;
101+ }
102+
83103void scm::ScmConstellation::setConstellation (const std::vector<CoordinateLine> &coordinates,
84104 const std::vector<StarLine> &stars)
85105{
86- constellationCoordinates = coordinates;
87- constellationStars = stars;
106+ scm::ScmConstellation::coordinates = coordinates;
107+ scm::ScmConstellation::stars = stars;
88108
89109 updateTextPosition ();
90110}
91111
112+ const std::vector<scm::CoordinateLine>& scm::ScmConstellation::getCoordinates () const
113+ {
114+ return coordinates;
115+ }
116+
117+ const std::vector<scm::StarLine>& scm::ScmConstellation::getStars () const
118+ {
119+ return stars;
120+ }
121+
92122void scm::ScmConstellation::drawConstellation (StelCore *core, const Vec3f &lineColor, const Vec3f &nameColor) const
93123{
124+ if (isHidden)
125+ {
126+ return ;
127+ }
94128 StelPainter painter (core->getProjection (drawFrame));
95129 painter.setBlending (true );
96130 painter.setLineSmooth (true );
@@ -99,7 +133,7 @@ void scm::ScmConstellation::drawConstellation(StelCore *core, const Vec3f &lineC
99133 bool alpha = 1 .0f ;
100134 painter.setColor (lineColor, alpha);
101135
102- for (CoordinateLine p : constellationCoordinates )
136+ for (CoordinateLine p : coordinates )
103137 {
104138 painter.drawGreatCircleArc (p.start , p.end );
105139 }
@@ -111,11 +145,20 @@ void scm::ScmConstellation::drawConstellation(StelCore *core, const Vec3f &lineC
111145
112146void scm::ScmConstellation::drawConstellation (StelCore *core) const
113147{
148+ if (isHidden)
149+ {
150+ return ;
151+ }
114152 drawConstellation (core, defaultConstellationLineColor, defaultConstellationNameColor);
115153}
116154
117155void scm::ScmConstellation::drawNames (StelCore *core, StelPainter &sPainter , const Vec3f &nameColor) const
118156{
157+ if (isHidden)
158+ {
159+ return ;
160+ }
161+
119162 sPainter .setBlending (true );
120163
121164 Vec3d velocityObserver (0 .);
@@ -141,6 +184,11 @@ void scm::ScmConstellation::drawNames(StelCore *core, StelPainter &sPainter, con
141184
142185void scm::ScmConstellation::drawNames (StelCore *core, StelPainter &sPainter ) const
143186{
187+ if (isHidden)
188+ {
189+ return ;
190+ }
191+
144192 drawNames (core, sPainter , defaultConstellationNameColor);
145193}
146194
@@ -151,18 +199,18 @@ QJsonObject scm::ScmConstellation::toJson(const QString &skyCultureId) const
151199 // Assemble lines object
152200 QJsonArray linesArray;
153201
154- if (constellationStars .size () != 0 )
202+ if (stars .size () != 0 )
155203 {
156204 // Stars are NOT empty
157- for (const auto &star : constellationStars )
205+ for (const auto &star : stars )
158206 {
159207 linesArray.append (star.toJson ());
160208 }
161209 }
162210 else
163211 {
164212 // Stars are empty, use the coordinates
165- for (const auto &coord : constellationCoordinates )
213+ for (const auto &coord : coordinates )
166214 {
167215 linesArray.append (coord.toJson ());
168216 }
@@ -223,10 +271,20 @@ bool scm::ScmConstellation::saveArtwork(const QString &directory)
223271void scm::ScmConstellation::updateTextPosition ()
224272{
225273 XYZname.set (0 ., 0 ., 0 .);
226- for (CoordinateLine p : constellationCoordinates )
274+ for (CoordinateLine p : coordinates )
227275 {
228276 XYZname += p.end ;
229277 XYZname += p.start ;
230278 }
231279 XYZname.normalize ();
232280}
281+
282+ void scm::ScmConstellation::hide ()
283+ {
284+ isHidden = true ;
285+ }
286+
287+ void scm::ScmConstellation::show ()
288+ {
289+ isHidden = false ;
290+ }
0 commit comments