Stellarium 0.13.2
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
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  */
21 #ifndef _NEBULA_HPP_
22 #define _NEBULA_HPP_
24 #include "StelObject.hpp"
25 #include "StelTranslator.hpp"
26 #include "StelTextureTypes.hpp"
28 #include <QString>
30 class StelPainter;
31 class QDataStream;
33 class Nebula : public StelObject
34 {
35 friend class NebulaMgr;
36 public:
37  Nebula();
38  ~Nebula();
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;}
65  // Methods specific to Nebula
66  void setLabelColor(const Vec3f& v) {labelColor = v;}
67  void setCircleColor(const Vec3f& v) {circleColor = v;}
71  QString getTypeString() const;
73  float getSurfaceBrightness(const StelCore* core) const;
74  float getSurfaceBrightnessWithExtinction(const StelCore* core) const;
76 private:
77  friend struct DrawNebulaFuncObject;
80  enum NebulaType
81  {
82  NebGx=0,
83  NebOc=1,
84  NebGc=2,
85  NebN=3,
86  NebPn=4,
87  NebDn=5,
88  NebIg=6,
89  NebCn=7,
90  NebUnknown=8
91  };
94  void translateName(const StelTranslator& trans) {nameI18 = trans.qtranslate(englishName);}
96  bool readNGC(char *record);
97  void readNGC(QDataStream& in);
99  void drawLabel(StelPainter& sPainter, float maxMagLabel);
100  void drawHints(StelPainter& sPainter, float maxMagHints);
102  unsigned int M_nb; // Messier Catalog number
103  unsigned int NGC_nb; // New General Catalog number
104  unsigned int IC_nb; // Index Catalog number
105  unsigned int C_nb; // Caldwell Catalog number
106  QString englishName; // English name
107  QString nameI18; // Nebula name
108  float mag; // Apparent magnitude
109  float angularSize; // Angular size in degree
110  Vec3d XYZ; // Cartesian equatorial position
111  Vec3d XY; // Store temporary 2D position
112  NebulaType nType;
114  SphericalRegionP pointRegion;
116  static StelTextureSP texCircle; // The symbolic circle texture
117  static StelTextureSP texGalaxy;
118  static StelTextureSP texOpenCluster;
119  static StelTextureSP texGlobularCluster;
120  static StelTextureSP texPlanetaryNebula;
121  static StelTextureSP texDiffuseNebula;
122  static StelTextureSP texOpenClusterWithNebulosity;
123  static float hintsBrightness;
125  static Vec3f labelColor, circleColor;
126  static float circleScale; // Define the scaling of the hints circle
127 };
129 #endif // _NEBULA_HPP_
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.
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.
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:40
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
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.
virtual Vec3f getInfoColor() const
Get a color used to display info about the object.
Manage a collection of nebulae.
Definition: NebulaMgr.hpp:47