Stellarium 0.13.3
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 // This only draws nebula icons. For the DSO images, see StelSkylayerMgr and StelSkyImageTile.
34 class Nebula : public StelObject
35 {
36 friend class NebulaMgr;
37 public:
38  Nebula();
39  ~Nebula();
54  virtual QString getInfoString(const StelCore *core, const InfoStringGroup& flags) const;
55  virtual QString getType() const {return "Nebula";}
56  virtual Vec3d getJ2000EquatorialPos(const StelCore*) const {return XYZ;}
57  virtual double getCloseViewFov(const StelCore* core = NULL) const;
58  virtual float getVMagnitude(const StelCore* core) const;
59  virtual float getSelectPriority(const StelCore* core) const;
60  virtual Vec3f getInfoColor() const;
61  virtual QString getNameI18n() const {return nameI18;}
62  virtual QString getEnglishName() const {return englishName;}
63  virtual double getAngularSize(const StelCore*) const {return angularSize*0.5;}
64  virtual SphericalRegionP getRegion() const {return pointRegion;}
66  // Methods specific to Nebula
67  void setLabelColor(const Vec3f& v) {labelColor = v;}
68  void setCircleColor(const Vec3f& v) {circleColor = v;}
72  QString getTypeString() const;
74  float getSurfaceBrightness(const StelCore* core) const;
75  float getSurfaceBrightnessWithExtinction(const StelCore* core) const;
77 private:
78  friend struct DrawNebulaFuncObject;
81  enum NebulaType
82  {
83  NebGx=0,
84  NebOc=1,
85  NebGc=2,
86  NebN=3,
87  NebPn=4,
88  NebDn=5,
89  NebIg=6,
90  NebCn=7,
91  NebUnknown=8
92  };
95  void translateName(const StelTranslator& trans) {nameI18 = trans.qtranslate(englishName);}
97  bool readNGC(char *record);
98  void readNGC(QDataStream& in);
100  void drawLabel(StelPainter& sPainter, float maxMagLabel);
101  void drawHints(StelPainter& sPainter, float maxMagHints);
103  unsigned int M_nb; // Messier Catalog number
104  unsigned int NGC_nb; // New General Catalog number
105  unsigned int IC_nb; // Index Catalog number
106  unsigned int C_nb; // Caldwell Catalog number
107  QString englishName; // English name
108  QString nameI18; // Nebula name
109  float mag; // Apparent magnitude
110  float angularSize; // Angular size in degree
111  Vec3d XYZ; // Cartesian equatorial position
112  Vec3d XY; // Store temporary 2D position
113  NebulaType nType;
115  SphericalRegionP pointRegion;
117  static StelTextureSP texCircle; // The symbolic circle texture
118  static StelTextureSP texGalaxy;
119  static StelTextureSP texOpenCluster;
120  static StelTextureSP texGlobularCluster;
121  static StelTextureSP texPlanetaryNebula;
122  static StelTextureSP texDiffuseNebula;
123  static StelTextureSP texOpenClusterWithNebulosity;
124  static float hintsBrightness;
126  static Vec3f labelColor, circleColor;
127  static float circleScale; // Define the scaling of the hints circle
128 };
130 #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:55
virtual SphericalRegionP getRegion() const
Default implementation of the getRegion method.
Definition: Nebula.hpp:64
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:61
virtual Vec3d getJ2000EquatorialPos(const StelCore *) const
Get observer-centered equatorial coordinates at equinox J2000.
Definition: Nebula.hpp:56
Define some translation macros.
virtual QString getEnglishName() const
Return object's name in english.
Definition: Nebula.hpp:62
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:63
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