Stellarium 0.13.3
NebulaMgr.hpp
1 /*
2  * Stellarium
3  * Copyright (C) 2002 Fabien Chereau
4  * Copyright (C) 2011 Alexander Wolf
5  * Copyright (C) 2015 Georg Zotti
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
20  */
21 
22 #ifndef _NEBULAMGR_HPP_
23 #define _NEBULAMGR_HPP_
24 
25 #include "StelObjectType.hpp"
26 #include "StelFader.hpp"
27 #include "StelSphericalIndex.hpp"
28 #include "StelObjectModule.hpp"
29 #include "StelTextureTypes.hpp"
30 
31 #include <QString>
32 #include <QStringList>
33 #include <QFont>
34 
35 class Nebula;
36 class StelTranslator;
37 class StelToneReproducer;
38 class QSettings;
39 class StelPainter;
40 
41 typedef QSharedPointer<Nebula> NebulaP;
42 
46 // GZ: This doc seems outdated/misleading - photo textures are not mamaged here but in StelSkyImageTile
47 
49 {
50  Q_OBJECT
51  Q_PROPERTY(bool flagHintDisplayed
52  READ getFlagHints
53  WRITE setFlagHints)
54 
55 public:
56  NebulaMgr();
57  virtual ~NebulaMgr();
58 
60  // Methods defined in the StelModule class
68  virtual void init();
69 
71  virtual void draw(StelCore* core);
72 
74  virtual void update(double deltaTime) {hintsFader.update((int)(deltaTime*1000)); flagShow.update((int)(deltaTime*1000));}
75 
77  virtual double getCallOrder(StelModuleActionName actionName) const;
78 
80  // Methods defined in StelObjectManager class
86  virtual QList<StelObjectP> searchAround(const Vec3d& v, double limitFov, const StelCore* core) const;
87 
91  virtual StelObjectP searchByNameI18n(const QString& nameI18n) const;
92 
95  virtual StelObjectP searchByName(const QString& name) const;
96 
102  virtual QStringList listMatchingObjectsI18n(const QString& objPrefix, int maxNbItem=5, bool useStartOfWords=false) const;
108  virtual QStringList listMatchingObjects(const QString& objPrefix, int maxNbItem=5, bool useStartOfWords=false) const;
110  virtual QStringList listAllObjects(bool inEnglish) const;
111  virtual QStringList listAllObjectsByType(const QString& objType, bool inEnglish) const;
112  virtual QString getName() const { return "Deep-sky objects"; }
113 
115  float computeMaxMagHint(const class StelSkyDrawer* skyDrawer) const;
116 
118  // Properties setters and getters
119 public slots:
126  void setCirclesColor(const Vec3f& c);
128  const Vec3f& getCirclesColor(void) const;
129 
131  void setCircleScale(float scale);
133  float getCircleScale(void) const;
134 
137  void setHintsFadeDuration(float duration) {hintsFader.setDuration((int) (duration * 1000.f));}
138 
140  void setFlagHints(bool b) {hintsFader=b;}
142  bool getFlagHints(void) const {return hintsFader;}
143 
145  void setHintsProportional(const bool proportional);
147  bool getHintsProportional(void) const;
148 
150  void setFlagShow(bool b) { flagShow = b; }
152  bool getFlagShow(void) const { return flagShow; }
153 
160  void setLabelsColor(const Vec3f& c);
162  const Vec3f& getLabelsColor(void) const;
163 
167  void setLabelsAmount(float a) {labelsAmount=a;}
170  float getLabelsAmount(void) const {return labelsAmount;}
171 
175  void setHintsAmount(float f) {hintsAmount = f;}
178  float getHintsAmount(void) const {return hintsAmount;}
179 
180 private slots:
183  void setStelStyle(const QString& section);
184 
188  void updateI18n();
189 
190 
191 private:
192 
194  NebulaP search(const QString& name);
195 
197  NebulaP search(const Vec3d& pos);
198 
205  void loadNebulaSet(const QString& setName);
206 
208  void drawPointer(const StelCore* core, StelPainter& sPainter);
209 
210  NebulaP searchM(unsigned int M);
211  NebulaP searchNGC(unsigned int NGC);
212  NebulaP searchIC(unsigned int IC);
213  NebulaP searchC(unsigned int C);
214  NebulaP searchB(unsigned int B);
215  NebulaP searchSh2(unsigned int Sh2);
216  NebulaP searchVdB(unsigned int VdB);
217  NebulaP searchRCW(unsigned int RCW);
218  NebulaP searchLDN(unsigned int LDN);
219  NebulaP searchLBN(unsigned int LBN);
220  NebulaP searchCr(unsigned int Cr);
221  NebulaP searchMel(unsigned int Mel);
222  bool loadNGC(const QString& fileName);
223  bool loadNGCOld(const QString& catNGC);
224  bool loadNGCNames(const QString& fileName);
225  bool loadBarnard(const QString& filename);
226  bool loadSharpless(const QString& filename);
227  bool loadVandenBergh(const QString& filename);
228  bool loadRCW(const QString& filename);
229  bool loadLDN(const QString& filename);
230  bool loadLBN(const QString& filename);
231 
232  QVector<NebulaP> nebArray; // The nebulas list
233  QHash<unsigned int, NebulaP> ngcIndex;
234  LinearFader hintsFader;
235  LinearFader flagShow;
236 
238  StelSphericalIndex nebGrid;
239 
241  float hintsAmount;
243  float labelsAmount;
244 
246  StelTextureSP texPointer;
247 
248  QFont nebulaFont; // Font used for names printing
249 };
250 
251 #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:137
virtual void update(double deltaTime)
Update state which is time dependent.
Definition: NebulaMgr.hpp:74
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:152
Implementation of StelFader which implements a linear transition.
Definition: StelFader.hpp:77
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:170
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:167
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:142
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:150
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:175
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:140
void setHintsProportional(const bool proportional)
Set whether hints (symbols) should be scaled according to nebula size.
virtual double getCallOrder(StelModuleActionName actionName) const
Determines the order in which the various modules are drawn.
bool getHintsProportional(void) const
Get whether hints (symbols) are scaled according to nebula size.
StelModuleActionName
Define the possible action for which an order is defined.
Definition: StelModule.hpp:117
Container allowing to store and query SphericalRegion.
float getHintsAmount(void) const
Get the amount of nebulae labels.
Definition: NebulaMgr.hpp:178
A templatized 3d vector compatible with openGL.
Definition: VecMath.hpp:33
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:48
void setLabelsColor(const Vec3f &c)
Set the color used to draw nebula labels.