Stellarium 0.15.2
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  Constellation();
55  ~Constellation();
56 
57  // StelObject method to override
64  virtual QString getInfoString(const StelCore*, const InfoStringGroup& flags) const;
65 
68  virtual QString getType() const {return "Constellation";}
69 
71  virtual Vec3d getJ2000EquatorialPos(const StelCore*) const {return XYZname;}
72 
73  virtual double getAngularSize(const StelCore*) const {Q_ASSERT(0); return 0;} // TODO
74 
82  bool read(const QString& record, StarMgr *starMgr);
83 
85  void drawName(StelPainter& sPainter, ConstellationMgr::ConstellationDisplayStyle style) const;
87  void drawArt(StelPainter& sPainter) const;
89  void drawBoundaryOptim(StelPainter& sPainter) const;
90 
96  const Constellation* isStarIn(const StelObject*) const;
97 
102  StelObjectP getBrightestStarInConstellation(void) const;
103 
105  QString getNameI18n() const {return nameI18;}
107  QString getEnglishName() const {return englishName;}
109  QString getShortName() const {return abbreviation;}
113  void drawOptim(StelPainter& sPainter, const StelCore* core, const SphericalCap& viewportHalfspace) const;
115  void drawArtOptim(StelPainter& sPainter, const SphericalRegion& region) const;
117  void update(int deltaTime);
120  void setFlagLines(const bool b) {lineFader=b;}
123  void setFlagBoundaries(const bool b) {boundaryFader=b;}
126  void setFlagLabels(const bool b) {nameFader=b;}
129  void setFlagArt(const bool b) {artFader=b;}
132  bool getFlagLines() const {return lineFader;}
135  bool getFlagBoundaries() const {return boundaryFader;}
138  bool getFlagLabels() const {return nameFader;}
141  bool getFlagArt() const {return artFader;}
142 
145  bool checkVisibility() const;
146 
148  QString nameI18;
150  QString englishName;
154  QString nativeName;
158  QString abbreviation;
160  Vec3d XYZname;
161  Vec3d XYname;
163  unsigned int numberOfSegments;
165  int beginSeason;
167  int endSeason;
169  StelObjectP* asterism;
170 
171  StelTextureSP artTexture;
172  StelVertexArray artPolygon;
173  SphericalCap boundingCap;
174 
176  LinearFader artFader, lineFader, nameFader, boundaryFader;
177  std::vector<std::vector<Vec3f> *> isolatedBoundarySegments;
178  std::vector<std::vector<Vec3f> *> sharedBoundarySegments;
179 
181  static Vec3f lineColor;
182  static Vec3f labelColor;
183  static Vec3f boundaryColor;
184 
185  static bool singleSelected;
186  static bool seasonalRuleEnabled;
187  // set by ConstellationMgr to fade out art on small FOV values
188  // see LP:#1294483
189  static float artIntensityFovScale;
190 };
191 
192 #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:88
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.