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  //StelActions
52  Q_PROPERTY(bool flagHintDisplayed
53  READ getFlagHints
54  WRITE setFlagHints
56  Q_PROPERTY(bool flagTypeFiltersUsage
60  //StelProperties
61  Q_PROPERTY(Nebula::TypeGroup typeFilters
62  READ getTypeFilters
63  WRITE setTypeFilters
64  NOTIFY typeFiltersChanged
65  )
66  Q_PROPERTY(Nebula::CatalogGroup catalogFilters
67  READ getCatalogFilters
68  WRITE setCatalogFilters
70  )
71  Q_PROPERTY(bool hintsProportional
74  NOTIFY hintsProportionalChanged
75  )
76  Q_PROPERTY(bool flagSurfaceBrightnessUsage
79  NOTIFY flagSurfaceBrightnessUsageChanged
80  )
81  Q_PROPERTY(double labelsAmount
82  READ getLabelsAmount
83  WRITE setLabelsAmount
84  NOTIFY labelsAmountChanged
85  )
86  Q_PROPERTY(double hintsAmount
87  READ getHintsAmount
88  WRITE setHintsAmount
89  NOTIFY hintsAmountChanged
90  )
91  Q_PROPERTY(bool flagDesignationLabels
94  NOTIFY designationUsageChanged
95  )
96 public:
97  NebulaMgr();
98  virtual ~NebulaMgr();
99 
101  // Methods defined in the StelModule class
109  virtual void init();
110 
112  virtual void draw(StelCore* core);
113 
115  virtual void update(double deltaTime) {hintsFader.update((int)(deltaTime*1000)); flagShow.update((int)(deltaTime*1000));}
116 
118  virtual double getCallOrder(StelModuleActionName actionName) const;
119 
121  // Methods defined in StelObjectManager class
127  virtual QList<StelObjectP> searchAround(const Vec3d& v, double limitFov, const StelCore* core) const;
128 
132  virtual StelObjectP searchByNameI18n(const QString& nameI18n) const;
133 
136  virtual StelObjectP searchByName(const QString& name) const;
137 
143  virtual QStringList listMatchingObjects(const QString& objPrefix, int maxNbItem=5, bool useStartOfWords=false, bool inEnglish=false) const;
145  virtual QStringList listAllObjects(bool inEnglish) const;
146  virtual QStringList listAllObjectsByType(const QString& objType, bool inEnglish) const;
147  virtual QString getName() const { return "Deep-sky objects"; }
148 
150  float computeMaxMagHint(const class StelSkyDrawer* skyDrawer) const;
151 
152  bool objectInDisplayedCatalog(NebulaP n);
153 
158 
160  // Properties setters and getters
161 public slots:
162  void setCatalogFilters(Nebula::CatalogGroup cflags);
163  Nebula::CatalogGroup getCatalogFilters() const { return Nebula::catalogFilters; }
164 
165  void setTypeFilters(Nebula::TypeGroup tflags);
166  Nebula::TypeGroup getTypeFilters() const { return Nebula::typeFilters; }
167 
174  void setCirclesColor(const Vec3f& c);
176  const Vec3f& getCirclesColor(void) const;
177 
184  void setGalaxyColor(const Vec3f& c);
186  const Vec3f& getGalaxyColor(void) const;
187 
194  void setActiveGalaxyColor(const Vec3f& c);
196  const Vec3f& getActiveGalaxyColor(void) const;
197 
204  void setInteractingGalaxyColor(const Vec3f& c);
206  const Vec3f& getInteractingGalaxyColor(void) const;
207 
214  void setRadioGalaxyColor(const Vec3f& c);
216  const Vec3f& getRadioGalaxyColor(void) const;
217 
224  void setQuasarColor(const Vec3f& c);
226  const Vec3f& getQuasarColor(void) const;
227 
235  void setBrightNebulaColor(const Vec3f& c);
238  const Vec3f& getBrightNebulaColor(void) const;
239 
246  void setNebulaColor(const Vec3f& c);
248  const Vec3f& getNebulaColor(void) const;
249 
256  void setPlanetaryNebulaColor(const Vec3f& c);
258  const Vec3f& getPlanetaryNebulaColor(void) const;
259 
266  void setReflectionNebulaColor(const Vec3f& c);
268  const Vec3f& getReflectionNebulaColor(void) const;
269 
276  void setBipolarNebulaColor(const Vec3f& c);
278  const Vec3f& getBipolarNebulaColor(void) const;
279 
286  void setEmissionNebulaColor(const Vec3f& c);
288  const Vec3f& getEmissionNebulaColor(void) const;
289 
296  void setHydrogenRegionColor(const Vec3f& c);
298  const Vec3f& getHydrogenRegionColor(void) const;
299 
306  void setSupernovaRemnantColor(const Vec3f& c);
308  const Vec3f& getSupernovaRemnantColor(void) const;
309 
316  void setInterstellarMatterColor(const Vec3f& c);
318  const Vec3f& getInterstellarMatterColor(void) const;
319 
326  void setDarkNebulaColor(const Vec3f& c);
328  const Vec3f& getDarkNebulaColor(void) const;
329 
336  void setClusterWithNebulosityColor(const Vec3f& c);
338  const Vec3f& getClusterWithNebulosityColor(void) const;
339 
346  void setClusterColor(const Vec3f& c);
348  const Vec3f& getClusterColor(void) const;
349 
356  void setOpenClusterColor(const Vec3f& c);
358  const Vec3f& getOpenClusterColor(void) const;
359 
366  void setGlobularClusterColor(const Vec3f& c);
368  const Vec3f& getGlobularClusterColor(void) const;
369 
376  void setStellarAssociationColor(const Vec3f& c);
378  const Vec3f& getStellarAssociationColor(void) const;
379 
386  void setStarCloudColor(const Vec3f& c);
388  const Vec3f& getStarCloudColor(void) const;
389 
396  void setEmissionObjectColor(const Vec3f& c);
398  const Vec3f& getEmissionObjectColor(void) const;
399 
406  void setBlLacObjectColor(const Vec3f& c);
408  const Vec3f& getBlLacObjectColor(void) const;
409 
416  void setBlazarColor(const Vec3f& c);
418  const Vec3f& getBlazarColor(void) const;
419 
426  void setMolecularCloudColor(const Vec3f& c);
428  const Vec3f& getMolecularCloudColor(void) const;
429 
436  void setYoungStellarObjectColor(const Vec3f& c);
438  const Vec3f& getYoungStellarObjectColor(void) const;
439 
446  void setPossibleQuasarColor(const Vec3f& c);
448  const Vec3f& getPossibleQuasarColor(void) const;
449 
456  void setPossiblePlanetaryNebulaColor(const Vec3f& c);
458  const Vec3f& getPossiblePlanetaryNebulaColor(void) const;
459 
466  void setProtoplanetaryNebulaColor(const Vec3f& c);
468  const Vec3f& getProtoplanetaryNebulaColor(void) const;
469 
476  void setStarColor(const Vec3f& c);
478  const Vec3f& getStarColor(void) const;
479 
482  void setHintsFadeDuration(float duration) {hintsFader.setDuration((int) (duration * 1000.f));}
483 
485  void setFlagHints(bool b) { if (hintsFader!=b) { hintsFader=b; emit flagHintsDisplayedChanged(b);}}
487  bool getFlagHints(void) const {return hintsFader;}
488 
490  void setHintsProportional(const bool proportional);
492  bool getHintsProportional(void) const;
493 
495  void setDesignationUsage(const bool flag);
497  bool getDesignationUsage(void) const;
498 
500  void setFlagSurfaceBrightnessUsage(const bool usage) {if(usage!=Nebula::surfaceBrightnessUsage){ Nebula::surfaceBrightnessUsage=usage; emit flagSurfaceBrightnessUsageChanged(usage);}}
502  bool getFlagSurfaceBrightnessUsage(void) const { return Nebula::surfaceBrightnessUsage; }
503 
505  void setFlagShow(bool b) { flagShow = b; }
507  bool getFlagShow(void) const { return flagShow; }
508 
510  void setFlagUseTypeFilters(bool b) { if (Nebula::flagUseTypeFilters!=b) { Nebula::flagUseTypeFilters=b; emit flagUseTypeFiltersChanged(b);}}
512  bool getFlagUseTypeFilters(void) const { return Nebula::flagUseTypeFilters; }
513 
520  void setLabelsColor(const Vec3f& c);
522  const Vec3f& getLabelsColor(void) const;
523 
527  void setLabelsAmount(double a) {if(a!=labelsAmount){labelsAmount=a; emit labelsAmountChanged(a);}}
530  double getLabelsAmount(void) const {return labelsAmount;}
531 
535  void setHintsAmount(double f) {if(hintsAmount!=f){hintsAmount = f; emit hintsAmountChanged(f);}}
538  double getHintsAmount(void) const {return hintsAmount;}
539 signals:
541  void flagHintsDisplayedChanged(bool b);
543  void flagUseTypeFiltersChanged(bool b);
545  void catalogFiltersChanged(Nebula::CatalogGroup flags);
547  void typeFiltersChanged(Nebula::TypeGroup flags);
548  void hintsProportionalChanged(bool b);
549  void designationUsageChanged(bool b);
550  void flagSurfaceBrightnessUsageChanged(bool b);
551  void labelsAmountChanged(double a);
552  void hintsAmountChanged(double f);
553 
554 private slots:
558  void updateI18n();
559 
560 
561 private:
562 
564  NebulaP search(const QString& name);
565 
567  NebulaP search(const Vec3d& pos);
568 
575  void loadNebulaSet(const QString& setName);
576 
578  void drawPointer(const StelCore* core, StelPainter& sPainter);
579 
580  NebulaP searchDSO(unsigned int DSO);
581  NebulaP searchM(unsigned int M);
582  NebulaP searchNGC(unsigned int NGC);
583  NebulaP searchIC(unsigned int IC);
584  NebulaP searchC(unsigned int C);
585  NebulaP searchB(unsigned int B);
586  NebulaP searchSh2(unsigned int Sh2);
587  NebulaP searchVdB(unsigned int VdB);
588  NebulaP searchRCW(unsigned int RCW);
589  NebulaP searchLDN(unsigned int LDN);
590  NebulaP searchLBN(unsigned int LBN);
591  NebulaP searchCr(unsigned int Cr);
592  NebulaP searchMel(unsigned int Mel);
593  NebulaP searchPGC(unsigned int PGC);
594  NebulaP searchUGC(unsigned int UGC);
595  NebulaP searchCed(QString Ced);
596 
597  // Load catalog of DSO
598  bool loadDSOCatalog(const QString& filename);
599  void convertDSOCatalog(const QString& in, const QString& out, bool decimal);
600  // Load proper names for DSO
601  bool loadDSONames(const QString& filename);
602 
603  QVector<NebulaP> dsoArray; // The DSO list
604  QHash<unsigned int, NebulaP> dsoIndex;
605 
606  LinearFader hintsFader;
607  LinearFader flagShow;
608 
610  StelSphericalIndex nebGrid;
611 
613  double hintsAmount;
615  double labelsAmount;
616 
618  StelTextureSP texPointer;
619 
620  QFont nebulaFont; // Font used for names printing
621 
622  // For DSO convertor
623  bool flagConverter;
624  bool flagDecimalCoordinates;
625 };
626 
627 #endif // _NEBULAMGR_HPP_
const Vec3f & getStellarAssociationColor(void) const
Get current value of the stellar association symbol color.
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:482
virtual void update(double deltaTime)
Update state which is time dependent.
Definition: NebulaMgr.hpp:115
virtual StelObjectP searchByName(const QString &name) const
Return the matching nebula if exists or NULL.
void setYoungStellarObjectColor(const Vec3f &c)
Set the color used to draw the young stellar objects symbols.
const Vec3f & getYoungStellarObjectColor(void) const
Get current value of the young stellar object symbol color.
const Vec3f & getOpenClusterColor(void) const
Get current value of the open star cluster symbol color.
const Vec3f & getBlLacObjectColor(void) const
Get current value of the BL Lac object symbol color.
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 setBlazarColor(const Vec3f &c)
Set the color used to draw the blazars symbols.
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:500
void setClusterWithNebulosityColor(const Vec3f &c)
Set the color used to draw the cluster associated with nebulosity symbols.
Class used to translate strings to any language.
void setPlanetaryNebulaColor(const Vec3f &c)
Set the color used to draw the planetary nebulae symbols.
bool getFlagShow(void) const
Get value of flag used to turn on and off Nebula rendering.
Definition: NebulaMgr.hpp:507
void setStellarAssociationColor(const Vec3f &c)
Set the color used to draw the stellar associations symbols.
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
const Vec3f & getBlazarColor(void) const
Get current value of the blazar symbol color.
Define the StelTextureSP type.
virtual QStringList listAllObjects(bool inEnglish) const
const Vec3f & getBipolarNebulaColor(void) const
Get current value of the bipolar nebula circle color.
const Vec3f & getReflectionNebulaColor(void) const
Get current value of the reflection nebula circle color.
void setStarCloudColor(const Vec3f &c)
Set the color used to draw the star clouds symbols.
QString getLatestSelectedDSODesignation()
Get designation for latest selected DSO with priority.
void flagUseTypeFiltersChanged(bool b)
Emitted when filter types are changed.
bool getFlagSurfaceBrightnessUsage(void) const
Get whether hints (symbols) are visible according to surface brightness value.
Definition: NebulaMgr.hpp:502
const Vec3f & getPossiblePlanetaryNebulaColor(void) const
Get current value of the possible planetary nebula symbol color.
const Vec3f & getGlobularClusterColor(void) const
Get current value of the globular star cluster symbol color.
const Vec3f & getStarColor(void) const
Get current value of the star symbol color.
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.
void setHintsAmount(double f)
Set the amount of nebulae hints.
Definition: NebulaMgr.hpp:535
const Vec3f & getRadioGalaxyColor(void) const
Get current value of the radio galaxy symbol color.
void setBipolarNebulaColor(const Vec3f &c)
Set the color used to draw the bipolar nebulae symbols.
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 setMolecularCloudColor(const Vec3f &c)
Set the color used to draw the molecular clouds symbols.
float computeMaxMagHint(const class StelSkyDrawer *skyDrawer) const
Compute the maximum magntiude for which hints will be displayed.
void setEmissionObjectColor(const Vec3f &c)
Set the color used to draw the emission objects symbols.
void setNebulaColor(const Vec3f &c)
Set the color used to draw the bright nebula symbols (emission nebula boxes, planetary nebulae circle...
bool getFlagHints(void) const
Get flag for displaying Nebulae Hints.
Definition: NebulaMgr.hpp:487
void catalogFiltersChanged(Nebula::CatalogGroup flags)
Emitted when the catalog filter is changed.
Specialization of StelModule which manages a collection of StelObject.
void setQuasarColor(const Vec3f &c)
Set the color used to draw the quasars symbols (ellipses).
void setFlagShow(bool b)
Set flag used to turn on and off Nebula rendering.
Definition: NebulaMgr.hpp:505
void setProtoplanetaryNebulaColor(const Vec3f &c)
Set the color used to draw the protoplanetary nebulae symbols.
const Vec3f & getCirclesColor(void) const
Get current value of the nebula circle color.
const Vec3f & getNebulaColor(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 star cluster symbol color.
void setCirclesColor(const Vec3f &c)
Set the default color used to draw the nebula symbols (default circles, etc).
void setInterstellarMatterColor(const Vec3f &c)
Set the color used to draw the interstellar matter symbols.
Converts tones in function of the eye adaptation to luminance.
const Vec3f & getDarkNebulaColor(void) const
Get current value of the dark nebula color.
void setStarColor(const Vec3f &c)
Set the color used to draw the stars symbols.
void setReflectionNebulaColor(const Vec3f &c)
Set the color used to draw the reflection nebulae symbols.
const Vec3f & getPossibleQuasarColor(void) const
Get current value of the possible quasar symbol 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:485
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.
const Vec3f & getInterstellarMatterColor(void) const
Get current value of the interstellar matter symbol color.
const Vec3f & getEmissionNebulaColor(void) const
Get current value of the emission nebula circle color.
double getHintsAmount(void) const
Get the amount of nebulae labels.
Definition: NebulaMgr.hpp:538
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.
void setEmissionNebulaColor(const Vec3f &c)
Set the color used to draw the emission nebulae symbols.
const Vec3f & getActiveGalaxyColor(void) const
Get current value of the active galaxy symbol color.
const Vec3f & getClusterWithNebulosityColor(void) const
Get current value of the cluster associated with nebulosity color.
void setPossibleQuasarColor(const Vec3f &c)
Set the color used to draw the possible quasars symbols.
const Vec3f & getSupernovaRemnantColor(void) const
Get current value of the supernova remnant symbol color.
virtual QStringList listAllObjectsByType(const QString &objType, bool inEnglish) const
List all StelObjects by type.
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.
const Vec3f & getPlanetaryNebulaColor(void) const
Get current value of the planetary nebula circle color.
void typeFiltersChanged(Nebula::TypeGroup flags)
Emitted when the type filter is changed.
void setBlLacObjectColor(const Vec3f &c)
Set the color used to draw the BL Lac objects symbols.
double getLabelsAmount(void) const
Get the amount of nebulae labels.
Definition: NebulaMgr.hpp:530
const Vec3f & getStarCloudColor(void) const
Get current value of the star cloud symbol color.
const Vec3f & getMolecularCloudColor(void) const
Get current value of the molecular cloud symbol color.
const Vec3f & getEmissionObjectColor(void) const
Get current value of the emission object symbol color.
bool getDesignationUsage(void) const
Get flag for usage designations of DSO for their labels instead common names.
void setOpenClusterColor(const Vec3f &c)
Set the color used to draw the open star cluster symbols.
void setDesignationUsage(const bool flag)
Set flag for usage designations of DSO for their labels instead common names.
void setLabelsAmount(double a)
Set the amount of nebulae labels.
Definition: NebulaMgr.hpp:527
const Vec3f & getQuasarColor(void) const
Get current value of the quasar symbol color.
void setGalaxyColor(const Vec3f &c)
Set the color used to draw the galaxy symbols (ellipses).
void setGlobularClusterColor(const Vec3f &c)
Set the color used to draw the globular star cluster symbols.
virtual QStringList listMatchingObjects(const QString &objPrefix, int maxNbItem=5, bool useStartOfWords=false, bool inEnglish=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.
void setPossiblePlanetaryNebulaColor(const Vec3f &c)
Set the color used to draw the possible planetary nebulae symbols.
const Vec3f & getBrightNebulaColor(void) const
Get current value of the nebula circle color.
bool getFlagUseTypeFilters(void) const
Get value of flag used to turn on and off DSO type filtering.
Definition: NebulaMgr.hpp:512
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.
Manage a collection of nebulae.
Definition: NebulaMgr.hpp:48
void setLabelsColor(const Vec3f &c)
Set the color used to draw nebula labels.
const Vec3f & getProtoplanetaryNebulaColor(void) const
Get current value of the protoplanetary nebula symbol color.
void setActiveGalaxyColor(const Vec3f &c)
Set the color used to draw the active galaxy symbols (ellipses).
void setFlagUseTypeFilters(bool b)
Set flag used to turn on and off DSO type filtering.
Definition: NebulaMgr.hpp:510
void flagHintsDisplayedChanged(bool b)
Emitted when hints are toggled.