Stellarium 0.13.0
Nebula.hpp
1 /*
2  * Stellarium
3  * Copyright (C) 2002 Fabien Chereau
4  * Copyright (C) 2011 Alexander Wolf
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 _NEBULA_HPP_
22 #define _NEBULA_HPP_
23 
24 #include "StelObject.hpp"
25 #include "StelTranslator.hpp"
26 #include "StelTextureTypes.hpp"
27 
28 #include <QString>
29 
30 class StelPainter;
31 class QDataStream;
32 
33 class Nebula : public StelObject
34 {
35 friend class NebulaMgr;
36 public:
37  Nebula();
38  ~Nebula();
39 
53  virtual QString getInfoString(const StelCore *core, const InfoStringGroup& flags) const;
54  virtual QString getType() const {return "Nebula";}
55  virtual Vec3d getJ2000EquatorialPos(const StelCore*) const {return XYZ;}
56  virtual double getCloseViewFov(const StelCore* core = NULL) const;
57  virtual float getVMagnitude(const StelCore* core) const;
58  virtual float getSelectPriority(const StelCore* core) const;
59  virtual Vec3f getInfoColor() const;
60  virtual QString getNameI18n() const {return nameI18;}
61  virtual QString getEnglishName() const {return englishName;}
62  virtual double getAngularSize(const StelCore*) const {return angularSize*0.5;}
63  virtual SphericalRegionP getRegion() const {return pointRegion;}
64 
65  // Methods specific to Nebula
66  void setLabelColor(const Vec3f& v) {labelColor = v;}
67  void setCircleColor(const Vec3f& v) {circleColor = v;}
68 
71  QString getTypeString() const;
72 
73 private:
74  friend struct DrawNebulaFuncObject;
75 
77  enum NebulaType
78  {
79  NebGx=0,
80  NebOc=1,
81  NebGc=2,
82  NebN=3,
83  NebPn=4,
84  NebDn=5,
85  NebIg=6,
86  NebCn=7,
87  NebUnknown=8
88  };
89 
91  void translateName(const StelTranslator& trans) {nameI18 = trans.qtranslate(englishName);}
92 
93  bool readNGC(char *record);
94  void readNGC(QDataStream& in);
95 
96  void drawLabel(StelPainter& sPainter, float maxMagLabel);
97  void drawHints(StelPainter& sPainter, float maxMagHints);
98 
99  unsigned int M_nb; // Messier Catalog number
100  unsigned int NGC_nb; // New General Catalog number
101  unsigned int IC_nb; // Index Catalog number
102  unsigned int C_nb; // Caldwell Catalog number
103  QString englishName; // English name
104  QString nameI18; // Nebula name
105  float mag; // Apparent magnitude
106  float angularSize; // Angular size in degree
107  Vec3d XYZ; // Cartesian equatorial position
108  Vec3d XY; // Store temporary 2D position
109  NebulaType nType;
110 
111  SphericalRegionP pointRegion;
112 
113  static StelTextureSP texCircle; // The symbolic circle texture
114  static StelTextureSP texGalaxy;
115  static StelTextureSP texOpenCluster;
116  static StelTextureSP texGlobularCluster;
117  static StelTextureSP texPlanetaryNebula;
118  static StelTextureSP texDiffuseNebula;
119  static StelTextureSP texOpenClusterWithNebulosity;
120  static float hintsBrightness;
121 
122  static Vec3f labelColor, circleColor;
123  static float circleScale; // Define the scaling of the hints circle
124 };
125 
126 #endif // _NEBULA_HPP_
127 
virtual float getVMagnitude(const StelCore *core) const
Return object's apparent V magnitude as seen from observer, without including extinction.
virtual float getSelectPriority(const StelCore *core) const
Return a priority value which is used to discriminate objects by priority As for magnitudes, the lower is the higher priority.
Class used to translate strings to any language.
Definition: StelTranslator.hpp:51
virtual QString getType() const
Return object's type. It should be the name of the class.
Definition: Nebula.hpp:54
virtual SphericalRegionP getRegion() const
Default implementation of the getRegion method.
Definition: Nebula.hpp:63
The base abstract class for sky objects used in Stellarium like Stars, Planets, Constellations etc...
Definition: StelObject.hpp:36
A shared pointer on a SphericalRegion.
Definition: StelSphereGeometry.hpp:51
virtual double getCloseViewFov(const StelCore *core=NULL) const
Return the best FOV in degree to use for a close view of the object.
Define the StelTextureSP type.
Main class for Stellarium core processing.
Definition: StelCore.hpp:46
virtual QString getNameI18n() const
Return translated object's name.
Definition: Nebula.hpp:60
virtual Vec3d getJ2000EquatorialPos(const StelCore *) const
Get observer-centered equatorial coordinates at equinox J2000.
Definition: Nebula.hpp:55
Define some translation macros.
virtual QString getEnglishName() const
Return object's name in english.
Definition: Nebula.hpp:61
virtual QString getInfoString(const StelCore *core, const InfoStringGroup &flags) const
Nebula support the following InfoStringGroup flags:
Provides functions for performing openGL drawing operations.
Definition: StelPainter.hpp:71
virtual double getAngularSize(const StelCore *) const
Return the angular radius of a circle containing the object as seen from the observer with the circle...
Definition: Nebula.hpp:62
Definition: Nebula.hpp:33
QString qtranslate(const QString &s, const QString &c=QString()) const
Translate input message and return it as a QString.
QString getTypeString() const
Get the printable nebula Type.
QSharedPointer< StelTexture > StelTextureSP
Use shared pointer to simplify memory managment.
Definition: StelTextureTypes.hpp:34
virtual Vec3f getInfoColor() const
Get a color used to display info about the object.
Manage a collection of nebulae.
Definition: NebulaMgr.hpp:47