Stellarium 0.14.3
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  {
66  if (flags&Name) return getNameI18n() + "(" + getShortName() + ")";
67  else return "";
68  }
69 
72  virtual QString getType() const {return "Constellation";}
73 
75  virtual Vec3d getJ2000EquatorialPos(const StelCore*) const {return XYZname;}
76 
77  virtual double getAngularSize(const StelCore*) const {Q_ASSERT(0); return 0;} // TODO
78 
86  bool read(const QString& record, StarMgr *starMgr);
87 
89  void drawName(StelPainter& sPainter, ConstellationMgr::ConstellationDisplayStyle style) const;
91  void drawArt(StelPainter& sPainter) const;
93  void drawBoundaryOptim(StelPainter& sPainter) const;
94 
100  const Constellation* isStarIn(const StelObject*) const;
101 
106  StelObjectP getBrightestStarInConstellation(void) const;
107 
109  QString getNameI18n() const {return nameI18;}
111  QString getEnglishName() const {return abbreviation;}
113  QString getShortName() const {return abbreviation;}
117  void drawOptim(StelPainter& sPainter, const StelCore* core, const SphericalCap& viewportHalfspace) const;
119  void drawArtOptim(StelPainter& sPainter, const SphericalRegion& region) const;
121  void update(int deltaTime);
124  void setFlagLines(const bool b) {lineFader=b;}
127  void setFlagBoundaries(const bool b) {boundaryFader=b;}
130  void setFlagLabels(const bool b) {nameFader=b;}
133  void setFlagArt(const bool b) {artFader=b;}
136  bool getFlagLines() const {return lineFader;}
139  bool getFlagBoundaries() const {return boundaryFader;}
142  bool getFlagLabels() const {return nameFader;}
145  bool getFlagArt() const {return artFader;}
146 
149  bool checkVisibility() const;
150 
152  QString nameI18;
154  QString englishName;
158  QString nativeName;
162  QString abbreviation;
164  Vec3d XYZname;
165  Vec3d XYname;
167  unsigned int numberOfSegments;
169  int beginSeason;
171  int endSeason;
173  StelObjectP* asterism;
174 
175  StelTextureSP artTexture;
176  StelVertexArray artPolygon;
177  SphericalCap boundingCap;
178 
180  LinearFader artFader, lineFader, nameFader, boundaryFader;
181  std::vector<std::vector<Vec3f> *> isolatedBoundarySegments;
182  std::vector<std::vector<Vec3f> *> sharedBoundarySegments;
183 
185  static Vec3f lineColor;
186  static Vec3f labelColor;
187  static Vec3f boundaryColor;
188 
189  static bool singleSelected;
190  static bool seasonalRuleEnabled;
191 };
192 
193 #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
An object's name.
Definition: StelObject.hpp:46
Stores the star catalogue data.
Definition: StarMgr.hpp:80
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.