Stellarium  0.16.1
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 "StelUtils.hpp"
27 #include "StelFader.hpp"
28 #include "StelTextureTypes.hpp"
29 #include "StelSphereGeometry.hpp"
30 #include "ConstellationMgr.hpp"
31 
32 #include <vector>
33 #include <QString>
34 #include <QFont>
35 
36 class StarMgr;
37 class StelPainter;
38 
50 class Constellation : public StelObject
51 {
52  friend class ConstellationMgr;
53 private:
54  static const QString CONSTELLATION_TYPE;
55  Constellation();
56  ~Constellation();
57 
58  // StelObject method to override
65  virtual QString getInfoString(const StelCore*, const InfoStringGroup& flags) const;
66 
69  virtual QString getType() const {return CONSTELLATION_TYPE;}
70  virtual QString getID() const { return abbreviation; }
71 
73  virtual Vec3d getJ2000EquatorialPos(const StelCore*) const {return XYZname;}
74 
75  virtual double getAngularSize(const StelCore*) const {Q_ASSERT(0); return 0.;} // TODO
76 
84  bool read(const QString& record, StarMgr *starMgr);
85 
87  void drawName(StelPainter& sPainter, ConstellationMgr::ConstellationDisplayStyle style) const;
89  void drawArt(StelPainter& sPainter) const;
91  void drawBoundaryOptim(StelPainter& sPainter) const;
92 
98  const Constellation* isStarIn(const StelObject*) const;
99 
104  StelObjectP getBrightestStarInConstellation(void) const;
105 
107  QString getNameI18n() const {return nameI18;}
109  QString getEnglishName() const {return englishName;}
111  QString getShortName() const {return abbreviation;}
115  void drawOptim(StelPainter& sPainter, const StelCore* core, const SphericalCap& viewportHalfspace) const;
117  void drawArtOptim(StelPainter& sPainter, const SphericalRegion& region) const;
119  void update(int deltaTime);
122  void setFlagLines(const bool b) {lineFader=b;}
125  void setFlagBoundaries(const bool b) {boundaryFader=b;}
128  void setFlagLabels(const bool b) {nameFader=b;}
131  void setFlagArt(const bool b) {artFader=b;}
134  bool getFlagLines() const {return lineFader;}
137  bool getFlagBoundaries() const {return boundaryFader;}
140  bool getFlagLabels() const {return nameFader;}
143  bool getFlagArt() const {return artFader;}
144 
147  bool checkVisibility() const;
148 
150  QString nameI18;
152  QString englishName;
156  QString nativeName;
160  QString abbreviation;
161  QString context;
163  Vec3d XYZname;
164  Vec3d XYname;
166  unsigned int numberOfSegments;
168  int beginSeason;
170  int endSeason;
172  StelObjectP* constellation;
173 
174  StelTextureSP artTexture;
175  StelVertexArray artPolygon;
176  SphericalCap boundingCap;
177 
179  LinearFader artFader, lineFader, nameFader, boundaryFader;
180  std::vector<std::vector<Vec3f> *> isolatedBoundarySegments;
181  std::vector<std::vector<Vec3f> *> sharedBoundarySegments;
182 
184  static Vec3f lineColor;
185  static Vec3f labelColor;
186  static Vec3f boundaryColor;
187 
188  static bool singleSelected;
189  static bool seasonalRuleEnabled;
190  // set by ConstellationMgr to fade out art on small FOV values
191  // see LP:#1294483
192  static float artIntensityFovScale;
193 };
194 
195 #endif // _CONSTELLATION_HPP_
bool getFlagBoundaries(void) const
Get whether constellation boundaries lines are displayed.
void setFlagArt(const bool displayed)
Set whether constellation art will be displayed.
void setFlagBoundaries(const bool displayed)
Set whether constellation boundaries lines will be displayed.
Implementation of StelFader which implements a linear transition.
Definition: StelFader.hpp:77
The base abstract class for sky objects used in Stellarium like Stars, Planets, Constellations etc...
Definition: StelObject.hpp:36
Define the StelTextureSP type.
virtual void update(double deltaTime)
Updates time-varying state for each Constellation.
A SphericalCap is defined by a direction and an aperture.
bool getFlagArt(void) const
Get whether constellation art is displayed.
The Constellation class models a grouping of stars in a Sky Culture.
Main class for Stellarium core processing.
Definition: StelCore.hpp:48
Provides functions for performing openGL drawing operations.
Definition: StelPainter.hpp:40
Stores the star catalogue data.
Definition: StarMgr.hpp:98
Abstract class defining a region of the sphere.
ConstellationDisplayStyle
Describes how to display constellation labels. The viewDialog GUI has a combobox which corresponds to...
void setFlagLabels(const bool displayed)
Set whether constellation names will be displayed.
Display and manage the constellations.
bool getFlagLabels(void) const
Set whether constellation names are displayed.
bool getFlagLines(void) const
Get whether constellation lines are displayed.
QSharedPointer< StelTexture > StelTextureSP
Use shared pointer to simplify memory managment.
void setFlagLines(const bool displayed)
Set whether constellation lines will be displayed.
Define all SphericalGeometry primitives as well as the SphericalRegionP type.