Stellarium 0.13.2
Constellation.hpp
1 /*
2  * Stellarium
3  * Copyright (C) 2002 Fabien Chereau
4  * Copyright (C) 2012 Timothy Reaves
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
19  */
20 
21 #ifndef _CONSTELLATION_HPP_
22 #define _CONSTELLATION_HPP_
23 
24 #include "StelObject.hpp"
25 #include "StelUtils.hpp"
26 #include "StelFader.hpp"
27 #include "StelTextureTypes.hpp"
28 #include "StelSphereGeometry.hpp"
29 
30 #include <vector>
31 #include <QString>
32 #include <QFont>
33 
34 class StarMgr;
35 class StelPainter;
36 
42 class Constellation : public StelObject
43 {
44  friend class ConstellationMgr;
45 private:
46  Constellation();
47  ~Constellation();
48 
49  // StelObject method to override
56  virtual QString getInfoString(const StelCore*, const InfoStringGroup& flags) const
57  {
58  if (flags&Name) return getNameI18n() + "(" + getShortName() + ")";
59  else return "";
60  }
61 
64  virtual QString getType() const {return "Constellation";}
65 
67  virtual Vec3d getJ2000EquatorialPos(const StelCore*) const {return XYZname;}
68 
69  virtual double getAngularSize(const StelCore*) const {Q_ASSERT(0); return 0;} // TODO
70 
78  bool read(const QString& record, StarMgr *starMgr);
79 
81  void drawName(StelPainter& sPainter) const;
83  void drawArt(StelPainter& sPainter) const;
85  void drawBoundaryOptim(StelPainter& sPainter) const;
86 
92  const Constellation* isStarIn(const StelObject*) const;
93 
98  StelObjectP getBrightestStarInConstellation(void) const;
99 
101  QString getNameI18n() const {return nameI18;}
103  QString getEnglishName() const {return abbreviation;}
105  QString getShortName() const {return abbreviation;}
109  void drawOptim(StelPainter& sPainter, const StelCore* core, const SphericalCap& viewportHalfspace) const;
111  void drawArtOptim(StelPainter& sPainter, const SphericalRegion& region) const;
113  void update(int deltaTime);
116  void setFlagLines(const bool b) {lineFader=b;}
119  void setFlagBoundaries(const bool b) {boundaryFader=b;}
122  void setFlagLabels(const bool b) {nameFader=b;}
125  void setFlagArt(const bool b) {artFader=b;}
128  bool getFlagLines() const {return lineFader;}
131  bool getFlagBoundaries() const {return boundaryFader;}
134  bool getFlagLabels() const {return nameFader;}
137  bool getFlagArt() const {return artFader;}
138 
141  bool checkVisibility() const;
142 
144  QString nameI18;
146  QString englishName;
148  QString nativeName;
150  QString abbreviation;
152  Vec3d XYZname;
153  Vec3d XYname;
155  unsigned int numberOfSegments;
157  int beginSeason;
159  int endSeason;
161  StelObjectP* asterism;
162 
163  StelTextureSP artTexture;
164  StelVertexArray artPolygon;
165  SphericalCap boundingCap;
166 
168  LinearFader artFader, lineFader, nameFader, boundaryFader;
169  std::vector<std::vector<Vec3f> *> isolatedBoundarySegments;
170  std::vector<std::vector<Vec3f> *> sharedBoundarySegments;
171 
173  static Vec3f lineColor;
174  static Vec3f labelColor;
175  static Vec3f boundaryColor;
176 
177  static bool singleSelected;
178  static bool seasonalRuleEnabled;
179 };
180 
181 #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:46
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.
void setFlagLabels(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 path lines are displayed.
QSharedPointer< StelTexture > StelTextureSP
Use shared pointer to simplify memory managment.
void setFlagLines(const bool displayed)
Set whether constellation path lines will be displayed.
Define all SphericalGeometry primitives as well as the SphericalRegionP type.