Stellarium 0.12.4
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 
96  virtual QStringList listMatchingObjectsI18n(const QString& objPrefix, int maxNbItem=5, bool useStartOfWords=false) const;
102  virtual QStringList listMatchingObjects(const QString& objPrefix, int maxNbItem=5, bool useStartOfWords=false) const;
103  // empty for now
104  virtual QStringList listAllObjects(bool inEnglish) const { Q_UNUSED(inEnglish) return QStringList(); }
105  virtual QString getName() const { return "Nebulae"; }
106 
108  // Properties setters and getters
109 public slots:
111  void setCirclesColor(const Vec3f& c);
113  const Vec3f& getCirclesColor(void) const;
114 
116  void setCircleScale(float scale);
118  float getCircleScale(void) const;
119 
122  void setHintsFadeDuration(float duration) {hintsFader.setDuration((int) (duration * 1000.f));}
123 
125  void setFlagHints(bool b) {hintsFader=b;}
127  bool getFlagHints(void) const {return hintsFader;}
128 
130  void setFlagShow(bool b) { flagShow = b; }
132  bool getFlagShow(void) const { return flagShow; }
133 
135  void setLabelsColor(const Vec3f& c);
137  const Vec3f& getLabelsColor(void) const;
138 
142  void setLabelsAmount(float a) {labelsAmount=a;}
145  float getLabelsAmount(void) const {return labelsAmount;}
146 
150  void setHintsAmount(float f) {hintsAmount = f;}
153  float getHintsAmount(void) const {return hintsAmount;}
154 
155 private slots:
158  void setStelStyle(const QString& section);
159 
163  void updateI18n();
164 
165 
166 private:
168  NebulaP search(const QString& name);
169 
171  NebulaP search(const Vec3d& pos);
172 
179  void loadNebulaSet(const QString& setName);
180 
182  void drawPointer(const StelCore* core, class StelRenderer* renderer);
183 
184  NebulaP searchM(unsigned int M);
185  NebulaP searchNGC(unsigned int NGC);
186  NebulaP searchIC(unsigned int IC);
187  NebulaP searchC(unsigned int C);
188  bool loadNGC(const QString& fileName);
189  bool loadNGCOld(const QString& catNGC);
190  bool loadNGCNames(const QString& fileName);
191 
192  QVector<NebulaP> nebArray; // The nebulas list
193  QHash<unsigned int, NebulaP> ngcIndex;
194  LinearFader hintsFader;
195  LinearFader flagShow;
196 
198  StelSphericalIndex nebGrid;
199 
201  float hintsAmount;
203  float labelsAmount;
204 
206  StelTextureNew* texPointer;
207 
208  QFont nebulaFont; // Font used for names printing
209 
211  Nebula::NebulaHintTextures nebulaHintTextures;
212 };
213 
214 #endif // _NEBULAMGR_HPP_