Stellarium 0.12.3
NebulaMgr.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 _NEBULAMGR_HPP_
22 #define _NEBULAMGR_HPP_
23 
24 #include <QString>
25 #include <QStringList>
26 #include <QFont>
27 #include "Nebula.hpp"
28 #include "StelObjectType.hpp"
29 #include "StelFader.hpp"
30 #include "StelSphericalIndex.hpp"
31 #include "StelObjectModule.hpp"
32 
33 class Nebula;
34 class StelTranslator;
35 class StelToneReproducer;
36 class QSettings;
37 
38 typedef QSharedPointer<Nebula> NebulaP;
39 
43 // GZ: This doc seems outdated/misleading - photo textures are not mamaged here but in StelSkyImageTile
44 
46 {
47  Q_OBJECT
48 
49 public:
50  NebulaMgr();
51  virtual ~NebulaMgr();
52 
54  // Methods defined in the StelModule class
62  virtual void init();
63 
65  virtual void draw(StelCore* core, class StelRenderer* renderer);
66 
68  virtual void update(double deltaTime) {hintsFader.update((int)(deltaTime*1000)); flagShow.update((int)(deltaTime*1000));}
69 
71  virtual double getCallOrder(StelModuleActionName actionName) const;
72 
74  // Methods defined in StelObjectManager class
80  virtual QList<StelObjectP> searchAround(const Vec3d& v, double limitFov, const StelCore* core) const;
81 
85  virtual StelObjectP searchByNameI18n(const QString& nameI18n) const;
86 
89  virtual StelObjectP searchByName(const QString& name) const;
90 
95  virtual QStringList listMatchingObjectsI18n(const QString& objPrefix, int maxNbItem=5) const;
100  virtual QStringList listMatchingObjects(const QString& objPrefix, int maxNbItem=5) const;
101  // empty for now
102  virtual QStringList listAllObjects(bool inEnglish) const { Q_UNUSED(inEnglish) return QStringList(); }
103  virtual QString getName() const { return "Nebulae"; }
104 
106  // Properties setters and getters
107 public slots:
109  void setCirclesColor(const Vec3f& c);
111  const Vec3f& getCirclesColor(void) const;
112 
114  void setCircleScale(float scale);
116  float getCircleScale(void) const;
117 
120  void setHintsFadeDuration(float duration) {hintsFader.setDuration((int) (duration * 1000.f));}
121 
123  void setFlagHints(bool b) {hintsFader=b;}
125  bool getFlagHints(void) const {return hintsFader;}
126 
128  void setFlagShow(bool b) { flagShow = b; }
130  bool getFlagShow(void) const { return flagShow; }
131 
133  void setLabelsColor(const Vec3f& c);
135  const Vec3f& getLabelsColor(void) const;
136 
140  void setLabelsAmount(float a) {labelsAmount=a;}
143  float getLabelsAmount(void) const {return labelsAmount;}
144 
148  void setHintsAmount(float f) {hintsAmount = f;}
151  float getHintsAmount(void) const {return hintsAmount;}
152 
153 private slots:
156  void setStelStyle(const QString& section);
157 
161  void updateI18n();
162 
163 
164 private:
166  NebulaP search(const QString& name);
167 
169  NebulaP search(const Vec3d& pos);
170 
177  void loadNebulaSet(const QString& setName);
178 
180  void drawPointer(const StelCore* core, class StelRenderer* renderer);
181 
182  NebulaP searchM(unsigned int M);
183  NebulaP searchNGC(unsigned int NGC);
184  NebulaP searchIC(unsigned int IC);
185  NebulaP searchC(unsigned int C);
186  bool loadNGC(const QString& fileName);
187  bool loadNGCOld(const QString& catNGC);
188  bool loadNGCNames(const QString& fileName);
189 
190  QVector<NebulaP> nebArray; // The nebulas list
191  QHash<unsigned int, NebulaP> ngcIndex;
192  LinearFader hintsFader;
193  LinearFader flagShow;
194 
196  StelSphericalIndex nebGrid;
197 
199  float hintsAmount;
201  float labelsAmount;
202 
204  StelTextureNew* texPointer;
205 
206  QFont nebulaFont; // Font used for names printing
207 
209  Nebula::NebulaHintTextures nebulaHintTextures;
210 };
211 
212 #endif // _NEBULAMGR_HPP_