Stellarium 0.13.0
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;
108  // empty for now
109  virtual QStringList listAllObjects(bool inEnglish) const { Q_UNUSED(inEnglish) return QStringList(); }
110  virtual QString getName() const { return "Nebulae"; }
111 
113  float computeMaxMagHint(const class StelSkyDrawer* skyDrawer) const;
114 
116  // Properties setters and getters
117 public slots:
124  void setCirclesColor(const Vec3f& c);
126  const Vec3f& getCirclesColor(void) const;
127 
129  void setCircleScale(float scale);
131  float getCircleScale(void) const;
132 
135  void setHintsFadeDuration(float duration) {hintsFader.setDuration((int) (duration * 1000.f));}
136 
138  void setFlagHints(bool b) {hintsFader=b;}
140  bool getFlagHints(void) const {return hintsFader;}
141 
143  void setFlagShow(bool b) { flagShow = b; }
145  bool getFlagShow(void) const { return flagShow; }
146 
153  void setLabelsColor(const Vec3f& c);
155  const Vec3f& getLabelsColor(void) const;
156 
160  void setLabelsAmount(float a) {labelsAmount=a;}
163  float getLabelsAmount(void) const {return labelsAmount;}
164 
168  void setHintsAmount(float f) {hintsAmount = f;}
171  float getHintsAmount(void) const {return hintsAmount;}
172 
173 private slots:
176  void setStelStyle(const QString& section);
177 
181  void updateI18n();
182 
183 
184 private:
185 
187  NebulaP search(const QString& name);
188 
190  NebulaP search(const Vec3d& pos);
191 
198  void loadNebulaSet(const QString& setName);
199 
201  void drawPointer(const StelCore* core, StelPainter& sPainter);
202 
203  NebulaP searchM(unsigned int M);
204  NebulaP searchNGC(unsigned int NGC);
205  NebulaP searchIC(unsigned int IC);
206  NebulaP searchC(unsigned int C);
207  bool loadNGC(const QString& fileName);
208  bool loadNGCOld(const QString& catNGC);
209  bool loadNGCNames(const QString& fileName);
210 
211  QVector<NebulaP> nebArray; // The nebulas list
212  QHash<unsigned int, NebulaP> ngcIndex;
213  LinearFader hintsFader;
214  LinearFader flagShow;
215 
217  StelSphericalIndex nebGrid;
218 
220  float hintsAmount;
222  float labelsAmount;
223 
225  StelTextureSP texPointer;
226 
227  QFont nebulaFont; // Font used for names printing
228 };
229 
230 #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:135
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.
Definition: StelSkyDrawer.hpp:45
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.
Definition: StelTranslator.hpp:51
bool getFlagShow(void) const
Get value of flag used to turn on and off Nebula rendering.
Definition: NebulaMgr.hpp:145
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.
float getLabelsAmount(void) const
Get the amount of nebulae labels.
Definition: NebulaMgr.hpp:163
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:160
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:140
Specialization of StelModule which manages a collection of StelObject.
Definition: StelObjectModule.hpp:35
void setFlagShow(bool b)
Set flag used to turn on and off Nebula rendering.
Definition: NebulaMgr.hpp:143
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.
Definition: StelToneReproducer.hpp:53
void setHintsAmount(float f)
Set the amount of nebulae hints.
Definition: NebulaMgr.hpp:168
Define the StelObjectP type.
Provides functions for performing openGL drawing operations.
Definition: StelPainter.hpp:71
void setFlagHints(bool b)
Set flag for displaying Nebulae Hints.
Definition: NebulaMgr.hpp:138
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:120
Container allowing to store and query SphericalRegion.
Definition: StelSphericalIndex.hpp:27
Definition: Nebula.hpp:33
float getHintsAmount(void) const
Get the amount of nebulae labels.
Definition: NebulaMgr.hpp:171
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.
Definition: StelTextureTypes.hpp:34
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.