Stellarium  0.16.1
Asterism.hpp
1 /*
2  * Stellarium
3  * Copyright (C) 2017 Alexander Wolf
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
18  */
19 
20 #ifndef _ASTERISM_HPP_
21 #define _ASTERISM_HPP_
22 
23 #include "StelObject.hpp"
24 #include "StelUtils.hpp"
25 #include "StelFader.hpp"
26 #include "StelSphereGeometry.hpp"
27 #include "AsterismMgr.hpp"
28 
29 #include <vector>
30 #include <QString>
31 #include <QFont>
32 
33 class StarMgr;
34 class StelPainter;
35 
42 class Asterism : public StelObject
43 {
44  friend class AsterismMgr;
45 private:
46  static const QString ASTERISM_TYPE;
47  Asterism();
48  ~Asterism();
49 
50  // StelObject method to override
57  virtual QString getInfoString(const StelCore*, const InfoStringGroup& flags) const;
58 
61  virtual QString getType() const {return ASTERISM_TYPE;}
62  virtual QString getID() const { return abbreviation; }
63 
65  virtual Vec3d getJ2000EquatorialPos(const StelCore*) const {return XYZname;}
66 
67  virtual double getAngularSize(const StelCore*) const {Q_ASSERT(0); return 0;} // TODO
68 
76  bool read(const QString& record, StarMgr *starMgr);
77 
79  void drawName(StelPainter& sPainter) const;
80 
86  const Asterism* isStarIn(const StelObject*) const;
87 
89  QString getNameI18n() const {return nameI18;}
91  QString getEnglishName() const {return englishName;}
95  void drawOptim(StelPainter& sPainter, const StelCore* core, const SphericalCap& viewportHalfspace) const;
97  void update(int deltaTime);
100  void setFlagLines(const bool b) { lineFader=b; }
103  void setFlagRayHelpers(const bool b) { rayHelperFader=b; }
106  void setFlagLabels(const bool b) { nameFader=b; }
109  bool getFlagLines() const { return lineFader; }
112  bool getFlagRayHelpers() const { return rayHelperFader; }
115  bool getFlagLabels() const { return nameFader; }
116 
117  bool isAsterism() const { return flagAsterism; }
118 
120  QString nameI18;
122  QString englishName;
126  QString abbreviation;
128  QString context;
130  Vec3d XYZname;
131  Vec3d XYname;
133  unsigned int numberOfSegments;
135  int typeOfAsterism;
136  bool flagAsterism;
138  StelObjectP* asterism;
139 
140  SphericalCap boundingCap;
141 
143  LinearFader lineFader, rayHelperFader, nameFader;
144 
146  static Vec3f lineColor;
147  static Vec3f rayHelperColor;
148  static Vec3f labelColor;
149 };
150 
151 #endif // _ASTERISM_HPP_
void setFlagLabels(const bool displayed)
Set whether asterism names will be displayed.
void setFlagLines(const bool displayed)
Set whether asterism 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
A SphericalCap is defined by a direction and an aperture.
Main class for Stellarium core processing.
Definition: StelCore.hpp:48
virtual void update(double deltaTime)
Updates time-varying state for each Constellation.
bool getFlagLines(void) const
Get whether asterism lines are displayed.
Provides functions for performing openGL drawing operations.
Definition: StelPainter.hpp:40
Display and manage the asterisms.
Definition: AsterismMgr.hpp:42
The Asterism class models a grouping of stars in a Sky Culture.
Definition: Asterism.hpp:42
Stores the star catalogue data.
Definition: StarMgr.hpp:98
bool getFlagRayHelpers(void) const
Get whether ray helpers are displayed.
void setFlagRayHelpers(const bool displayed)
Set whether ray helpers will be displayed.
bool getFlagLabels(void) const
Set whether asterism names are displayed.
Define all SphericalGeometry primitives as well as the SphericalRegionP type.