Stellarium 0.15.0
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 #include "Nebula.hpp"
31 
32 #include <QString>
33 #include <QStringList>
34 #include <QFont>
35 
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 
117  void setCatalogFilters(const Nebula::CatalogGroup& cflags);
118  const Nebula::CatalogGroup& getCatalogFilters() const { return Nebula::catalogFilters; }
119 
120  void setTypeFilters(const Nebula::TypeGroup& tflags) { Nebula::typeFilters=tflags; }
121  const Nebula::TypeGroup& getTypeFilters() const { return Nebula::typeFilters; }
122 
123  bool objectInDisplayedCatalog(NebulaP n);
124 
126  // Properties setters and getters
127 public slots:
134  void setCirclesColor(const Vec3f& c);
136  const Vec3f& getCirclesColor(void) const;
137 
144  void setGalaxyColor(const Vec3f& c);
146  const Vec3f& getGalaxyColor(void) const;
153  void setActiveGalaxyColor(const Vec3f& c);
155  const Vec3f& getActiveGalaxyColor(void) const;
162  void setInteractingGalaxyColor(const Vec3f& c);
164  const Vec3f& getInteractingGalaxyColor(void) const;
171  void setRadioGalaxyColor(const Vec3f& c);
173  const Vec3f& getRadioGalaxyColor(void) const;
180  void setBrightNebulaColor(const Vec3f& c);
182  const Vec3f& getBrightNebulaColor(void) const;
189  void setHydrogenRegionColor(const Vec3f& c);
191  const Vec3f& getHydrogenRegionColor(void) const;
198  void setSupernovaRemnantColor(const Vec3f& c);
200  const Vec3f& getSupernovaRemnantColor(void) const;
207  void setDarkNebulaColor(const Vec3f& c);
209  const Vec3f& getDarkNebulaColor(void) const;
216  void setClusterColor(const Vec3f& c);
218  const Vec3f& getClusterColor(void) const;
219 
220 
222  void setCircleScale(float scale);
224  float getCircleScale(void) const;
225 
228  void setHintsFadeDuration(float duration) {hintsFader.setDuration((int) (duration * 1000.f));}
229 
231  void setFlagHints(bool b) {hintsFader=b;}
233  bool getFlagHints(void) const {return hintsFader;}
234 
236  void setHintsProportional(const bool proportional);
238  bool getHintsProportional(void) const;
239 
241  void setFlagSurfaceBrightnessUsage(const bool usage) { Nebula::surfaceBrightnessUsage=usage; }
243  bool getFlagSurfaceBrightnessUsage(void) const { return Nebula::surfaceBrightnessUsage; }
244 
246  void setFlagShow(bool b) { flagShow = b; }
248  bool getFlagShow(void) const { return flagShow; }
249 
251  void setFlagTypeFiltersUsage(bool b) { Nebula::flagUsageTypeFilter=b; }
253  bool getFlagTypeFiltersUsage(void) const { return Nebula::flagUsageTypeFilter; }
254 
261  void setLabelsColor(const Vec3f& c);
263  const Vec3f& getLabelsColor(void) const;
264 
268  void setLabelsAmount(float a) {labelsAmount=a;}
271  float getLabelsAmount(void) const {return labelsAmount;}
272 
276  void setHintsAmount(float f) {hintsAmount = f;}
279  float getHintsAmount(void) const {return hintsAmount;}
280 
281 private slots:
284  void setStelStyle(const QString& section);
285 
289  void updateI18n();
290 
291 
292 private:
293 
295  NebulaP search(const QString& name);
296 
298  NebulaP search(const Vec3d& pos);
299 
306  void loadNebulaSet(const QString& setName);
307 
309  void drawPointer(const StelCore* core, StelPainter& sPainter);
310 
311  NebulaP searchDSO(unsigned int DSO);
312  NebulaP searchM(unsigned int M);
313  NebulaP searchNGC(unsigned int NGC);
314  NebulaP searchIC(unsigned int IC);
315  NebulaP searchC(unsigned int C);
316  NebulaP searchB(unsigned int B);
317  NebulaP searchSh2(unsigned int Sh2);
318  NebulaP searchVdB(unsigned int VdB);
319  NebulaP searchRCW(unsigned int RCW);
320  NebulaP searchLDN(unsigned int LDN);
321  NebulaP searchLBN(unsigned int LBN);
322  NebulaP searchCr(unsigned int Cr);
323  NebulaP searchMel(unsigned int Mel);
324  NebulaP searchPGC(unsigned int PGC);
325  NebulaP searchUGC(unsigned int UGC);
326  NebulaP searchCed(QString Ced);
327 
328  // Load catalog of DSO
329  bool loadDSOCatalog(const QString& filename);
330  void convertDSOCatalog(const QString& in, const QString& out, bool decimal);
331  // Load proper names for DSO
332  bool loadDSONames(const QString& filename);
333 
334  QVector<NebulaP> dsoArray; // The DSO list
335  QHash<unsigned int, NebulaP> dsoIndex;
336 
337  LinearFader hintsFader;
338  LinearFader flagShow;
339 
341  StelSphericalIndex nebGrid;
342 
344  float hintsAmount;
346  float labelsAmount;
347 
349  StelTextureSP texPointer;
350 
351  QFont nebulaFont; // Font used for names printing
352 
353  // For DSO convertor
354  bool flagConverter;
355  bool flagDecimalCoordinates;
356 };
357 
358 #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:228
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.
void setInteractingGalaxyColor(const Vec3f &c)
Set the color used to draw the interacting galaxy symbols (ellipses).
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.
void setClusterColor(const Vec3f &c)
Set the color used to draw the star cluster symbols (Open/Globular).
void setFlagSurfaceBrightnessUsage(const bool usage)
Set whether hints (symbols) should be visible according to surface brightness value.
Definition: NebulaMgr.hpp:241
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:248
void setBrightNebulaColor(const Vec3f &c)
Set the color used to draw the bright nebula symbols (emission nebula boxes, planetary nebulae circle...
Implementation of StelFader which implements a linear transition.
Definition: StelFader.hpp:77
void setCircleScale(float scale)
Set Nebulae Hints circle scale.
A templatized 3d vector compatible with openGL.
Definition: VecMath.hpp:33
Define the StelTextureSP type.
virtual QStringList listAllObjects(bool inEnglish) const
float getLabelsAmount(void) const
Get the amount of nebulae labels.
Definition: NebulaMgr.hpp:271
bool getFlagSurfaceBrightnessUsage(void) const
Get whether hints (symbols) are visible according to surface brightness value.
Definition: NebulaMgr.hpp:243
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.
const Vec3f & getRadioGalaxyColor(void) const
Get current value of the radio galaxy symbol color.
virtual void init()
Initialize the NebulaMgr object.
const Vec3f & getInteractingGalaxyColor(void) const
Get current value of the interacting galaxy symbol color.
Main class for Stellarium core processing.
Definition: StelCore.hpp:48
void setLabelsAmount(float a)
Set the amount of nebulae labels.
Definition: NebulaMgr.hpp:268
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:233
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:246
const Vec3f & getCirclesColor(void) const
Get current value of the nebula circle color.
void setHydrogenRegionColor(const Vec3f &c)
Set the color used to draw the ionized hydrogen region symbols.
const Vec3f & getClusterColor(void) const
Get current value of the nebula circle color.
void setCirclesColor(const Vec3f &c)
Set the default color used to draw the nebula symbols (default circles, etc).
Converts tones in function of the eye adaptation to luminance.
void setHintsAmount(float f)
Set the amount of nebulae hints.
Definition: NebulaMgr.hpp:276
const Vec3f & getDarkNebulaColor(void) const
Get current value of the dark nebula color.
void setRadioGalaxyColor(const Vec3f &c)
Set the color used to draw the radio galaxy symbols (ellipses).
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:231
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.
const Vec3f & getGalaxyColor(void) const
Get current value of the galaxy symbol color.
const Vec3f & getActiveGalaxyColor(void) const
Get current value of the active galaxy symbol color.
const Vec3f & getSupernovaRemnantColor(void) const
Get current value of the supernova remnant symbol color.
StelModuleActionName
Define the possible action for which an order is defined.
Definition: StelModule.hpp:117
Container allowing to store and query SphericalRegion.
const Vec3f & getHydrogenRegionColor(void) const
Get current value of the hydrogen region symbol color.
float getHintsAmount(void) const
Get the amount of nebulae labels.
Definition: NebulaMgr.hpp:279
void setGalaxyColor(const Vec3f &c)
Set the color used to draw the galaxy symbols (ellipses).
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.
const Vec3f & getBrightNebulaColor(void) const
Get current value of the nebula circle color.
bool getFlagTypeFiltersUsage(void) const
Get value of flag used to turn on and off DSO type filtering.
Definition: NebulaMgr.hpp:253
void setSupernovaRemnantColor(const Vec3f &c)
Set the color used to draw the supernova remnant symbols.
void setDarkNebulaColor(const Vec3f &c)
Set the color used to draw the dark nebula symbols (gray boxes).
virtual void draw(StelCore *core)
Draws all nebula objects.
void setFlagTypeFiltersUsage(bool b)
Set flag used to turn on and off DSO type filtering.
Definition: NebulaMgr.hpp:251
Manage a collection of nebulae.
Definition: NebulaMgr.hpp:48
void setLabelsColor(const Vec3f &c)
Set the color used to draw nebula labels.
void setActiveGalaxyColor(const Vec3f &c)
Set the color used to draw the active galaxy symbols (ellipses).