Stellarium 0.13.1
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 "StelObjectType.hpp"
25 #include "StelFader.hpp"
26 #include "StelSphericalIndex.hpp"
27 #include "StelObjectModule.hpp"
28 #include "StelTextureTypes.hpp"
29 
30 #include <QString>
31 #include <QStringList>
32 #include <QFont>
33 
34 class Nebula;
35 class StelTranslator;
36 class StelToneReproducer;
37 class QSettings;
38 class StelPainter;
39 
40 typedef QSharedPointer<Nebula> NebulaP;
41 
45 // GZ: This doc seems outdated/misleading - photo textures are not mamaged here but in StelSkyImageTile
46 
48 {
49  Q_OBJECT
50  Q_PROPERTY(bool flagHintDisplayed
51  READ getFlagHints
52  WRITE setFlagHints)
53 
54 public:
55  NebulaMgr();
56  virtual ~NebulaMgr();
57 
59  // Methods defined in the StelModule class
67  virtual void init();
68 
70  virtual void draw(StelCore* core);
71 
73  virtual void update(double deltaTime) {hintsFader.update((int)(deltaTime*1000)); flagShow.update((int)(deltaTime*1000));}
74 
76  virtual double getCallOrder(StelModuleActionName actionName) const;
77 
79  // Methods defined in StelObjectManager class
85  virtual QList<StelObjectP> searchAround(const Vec3d& v, double limitFov, const StelCore* core) const;
86 
90  virtual StelObjectP searchByNameI18n(const QString& nameI18n) const;
91 
94  virtual StelObjectP searchByName(const QString& name) const;
95 
101  virtual QStringList listMatchingObjectsI18n(const QString& objPrefix, int maxNbItem=5, bool useStartOfWords=false) const;
107  virtual QStringList listMatchingObjects(const QString& objPrefix, int maxNbItem=5, bool useStartOfWords=false) const;
109  virtual QStringList listAllObjects(bool inEnglish) const;
110  virtual QStringList listAllObjectsByType(const QString& objType, bool inEnglish) const;
111  virtual QString getName() const { return "Deep-sky objects"; }
112 
114  float computeMaxMagHint(const class StelSkyDrawer* skyDrawer) const;
115 
117  // Properties setters and getters
118 public slots:
125  void setCirclesColor(const Vec3f& c);
127  const Vec3f& getCirclesColor(void) const;
128 
130  void setCircleScale(float scale);
132  float getCircleScale(void) const;
133 
136  void setHintsFadeDuration(float duration) {hintsFader.setDuration((int) (duration * 1000.f));}
137 
139  void setFlagHints(bool b) {hintsFader=b;}
141  bool getFlagHints(void) const {return hintsFader;}
142 
144  void setFlagShow(bool b) { flagShow = b; }
146  bool getFlagShow(void) const { return flagShow; }
147 
154  void setLabelsColor(const Vec3f& c);
156  const Vec3f& getLabelsColor(void) const;
157 
161  void setLabelsAmount(float a) {labelsAmount=a;}
164  float getLabelsAmount(void) const {return labelsAmount;}
165 
169  void setHintsAmount(float f) {hintsAmount = f;}
172  float getHintsAmount(void) const {return hintsAmount;}
173 
174 private slots:
177  void setStelStyle(const QString& section);
178 
182  void updateI18n();
183 
184 
185 private:
186 
188  NebulaP search(const QString& name);
189 
191  NebulaP search(const Vec3d& pos);
192 
199  void loadNebulaSet(const QString& setName);
200 
202  void drawPointer(const StelCore* core, StelPainter& sPainter);
203 
204  NebulaP searchM(unsigned int M);
205  NebulaP searchNGC(unsigned int NGC);
206  NebulaP searchIC(unsigned int IC);
207  NebulaP searchC(unsigned int C);
208  bool loadNGC(const QString& fileName);
209  bool loadNGCOld(const QString& catNGC);
210  bool loadNGCNames(const QString& fileName);
211 
212  QVector<NebulaP> nebArray; // The nebulas list
213  QHash<unsigned int, NebulaP> ngcIndex;
214  LinearFader hintsFader;
215  LinearFader flagShow;
216 
218  StelSphericalIndex nebGrid;
219 
221  float hintsAmount;
223  float labelsAmount;
224 
226  StelTextureSP texPointer;
227 
228  QFont nebulaFont; // Font used for names printing
229 };
230 
231 #endif // _NEBULAMGR_HPP_
void setHintsFadeDuration(float duration)
Set how long it takes for nebula hints to fade in and out when turned on and off. ...
Definition: NebulaMgr.hpp:136
virtual void update(double deltaTime)
Update state which is time dependent.
Definition: NebulaMgr.hpp:73
virtual StelObjectP searchByName(const QString &name) const
Return the matching nebula if exists or NULL.
Provide a set of methods used to draw sky objects taking into account eyes adaptation, zoom level, instrument model and artificially set magnitude limits.
virtual StelObjectP searchByNameI18n(const QString &nameI18n) const
Return the matching nebula object's pointer if exists or NULL.
Class used to translate strings to any language.
bool getFlagShow(void) const
Get value of flag used to turn on and off Nebula rendering.
Definition: NebulaMgr.hpp:146
Implementation of StelFader which implements a linear transition.
Definition: StelFader.hpp:79
void setCircleScale(float scale)
Set Nebulae Hints circle scale.
Define the StelTextureSP type.
virtual QStringList listAllObjects(bool inEnglish) const
float getLabelsAmount(void) const
Get the amount of nebulae labels.
Definition: NebulaMgr.hpp:164
virtual QStringList listMatchingObjectsI18n(const QString &objPrefix, int maxNbItem=5, bool useStartOfWords=false) const
Find and return the list of at most maxNbItem objects auto-completing the passed object I18n name...
virtual QList< StelObjectP > searchAround(const Vec3d &v, double limitFov, const StelCore *core) const
Used to get a vector of objects which are near to some position.
virtual void init()
Initialize the NebulaMgr object.
Main class for Stellarium core processing.
Definition: StelCore.hpp:46
void setLabelsAmount(float a)
Set the amount of nebulae labels.
Definition: NebulaMgr.hpp:161
float getCircleScale(void) const
Get Nebulae Hints circle scale.
float computeMaxMagHint(const class StelSkyDrawer *skyDrawer) const
Compute the maximum magntiude for which hints will be displayed.
bool getFlagHints(void) const
Get flag for displaying Nebulae Hints.
Definition: NebulaMgr.hpp:141
Specialization of StelModule which manages a collection of StelObject.
void setFlagShow(bool b)
Set flag used to turn on and off Nebula rendering.
Definition: NebulaMgr.hpp:144
const Vec3f & getCirclesColor(void) const
Get current value of the nebula circle color.
void setCirclesColor(const Vec3f &c)
Set the color used to draw the nebula symbols (circles, boxes.
Converts tones in function of the eye adaptation to luminance.
void setHintsAmount(float f)
Set the amount of nebulae hints.
Definition: NebulaMgr.hpp:169
Define the StelObjectP type.
Provides functions for performing openGL drawing operations.
Definition: StelPainter.hpp:40
void setFlagHints(bool b)
Set flag for displaying Nebulae Hints.
Definition: NebulaMgr.hpp:139
virtual double getCallOrder(StelModuleActionName actionName) const
Determines the order in which the various modules are drawn.
StelModuleActionName
Define the possible action for which an order is defined.
Definition: StelModule.hpp:119
Container allowing to store and query SphericalRegion.
float getHintsAmount(void) const
Get the amount of nebulae labels.
Definition: NebulaMgr.hpp:172
virtual QStringList listMatchingObjects(const QString &objPrefix, int maxNbItem=5, bool useStartOfWords=false) const
Find and return the list of at most maxNbItem objects auto-completing the passed object English name...
const Vec3f & getLabelsColor(void) const
Get current value of the nebula label color.
QSharedPointer< StelTexture > StelTextureSP
Use shared pointer to simplify memory managment.
virtual void draw(StelCore *core)
Draws all nebula objects.
Manage a collection of nebulae.
Definition: NebulaMgr.hpp:47
void setLabelsColor(const Vec3f &c)
Set the color used to draw nebula labels.