Stellarium 0.12.4
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 <QString>
25 #include "StelObject.hpp"
26 #include "StelTranslator.hpp"
27 #include "StelProjectorType.hpp"
28 
29 class QDataStream;
30 
31 class Nebula : public StelObject
32 {
33 friend class NebulaMgr;
34 public:
35  Nebula();
36  ~Nebula();
37 
51  virtual QString getInfoString(const StelCore *core, const InfoStringGroup& flags) const;
52  virtual QString getType() const {return "Nebula";}
53  virtual Vec3d getJ2000EquatorialPos(const StelCore*) const {return XYZ;}
54  virtual double getCloseViewFov(const StelCore* core = NULL) const;
55  virtual float getVMagnitude(const StelCore* core, bool withExtinction=false) const;
56  virtual float getSelectPriority(const StelCore* core) const;
57  virtual Vec3f getInfoColor() const;
58  virtual QString getNameI18n() const {return nameI18;}
59  virtual QString getEnglishName() const {return englishName;}
60  virtual double getAngularSize(const StelCore*) const {return angularSize*0.5;}
61  virtual SphericalRegionP getRegion() const {return pointRegion;}
62 
63  // Methods specific to Nebula
64  void setLabelColor(const Vec3f& v) {labelColor = v;}
65  void setCircleColor(const Vec3f& v) {circleColor = v;}
66 
69  QString getTypeString() const;
70 
71 private:
72  friend struct DrawNebulaFuncObject;
73 
75  struct NebulaHintTextures
76  {
78  class StelTextureNew* texCircle;
80  class StelTextureNew* texGalaxy;
82  class StelTextureNew* texOpenCluster;
84  class StelTextureNew* texGlobularCluster;
86  class StelTextureNew* texDiffuseNebula;
88  class StelTextureNew* texPlanetaryNebula;
90  class StelTextureNew* texOpenClusterWithNebulosity;
92  bool initialized;
93 
95  NebulaHintTextures(): initialized(false){}
97  ~NebulaHintTextures();
99  void lazyInit(class StelRenderer* renderer);
100  };
101 
103  enum NebulaType
104  {
105  NebGx=0,
106  NebOc=1,
107  NebGc=2,
108  NebN=3,
109  NebPn=4,
110  NebDn=5,
111  NebIg=6,
112  NebCn=7,
113  NebUnknown=8
114  };
115 
117  void translateName(StelTranslator& trans) {nameI18 = trans.qtranslate(englishName);}
118 
119  bool readNGC(char *record);
120  void readNGC(QDataStream& in);
121 
122  void drawHints(StelRenderer* renderer, float maxMagHints, NebulaHintTextures& hintTextures);
123  void drawLabel(StelRenderer* renderer, StelProjectorP projector, float maxMagLabel);
124 
125  unsigned int M_nb; // Messier Catalog number
126  unsigned int NGC_nb; // New General Catalog number
127  unsigned int IC_nb; // Index Catalog number
128  unsigned int C_nb; // Caldwell Catalog number
129  QString englishName; // English name
130  QString nameI18; // Nebula name
131  float mag; // Apparent magnitude
132  float angularSize; // Angular size in degree
133  Vec3d XYZ; // Cartesian equatorial position
134  Vec3d XY; // Store temporary 2D position
135  NebulaType nType;
136 
137  SphericalRegionP pointRegion;
138 
139  static float hintsBrightness;
140 
141  static Vec3f labelColor, circleColor;
142  static float circleScale; // Define the scaling of the hints circle
143 };
144 
145 #endif // _NEBULA_HPP_
146