Stellarium 0.14.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 #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;
147 
154  void setActiveGalaxyColor(const Vec3f& c);
156  const Vec3f& getActiveGalaxyColor(void) const;
157 
164  void setInteractingGalaxyColor(const Vec3f& c);
166  const Vec3f& getInteractingGalaxyColor(void) const;
167 
174  void setRadioGalaxyColor(const Vec3f& c);
176  const Vec3f& getRadioGalaxyColor(void) const;
177 
184  void setQuasarColor(const Vec3f& c);
186  const Vec3f& getQuasarColor(void) const;
187 
195  void setBrightNebulaColor(const Vec3f& c);
198  const Vec3f& getBrightNebulaColor(void) const;
199 
206  void setNebulaColor(const Vec3f& c);
208  const Vec3f& getNebulaColor(void) const;
209 
216  void setPlanetaryNebulaColor(const Vec3f& c);
218  const Vec3f& getPlanetaryNebulaColor(void) const;
219 
226  void setReflectionNebulaColor(const Vec3f& c);
228  const Vec3f& getReflectionNebulaColor(void) const;
229 
236  void setBipolarNebulaColor(const Vec3f& c);
238  const Vec3f& getBipolarNebulaColor(void) const;
239 
246  void setEmissionNebulaColor(const Vec3f& c);
248  const Vec3f& getEmissionNebulaColor(void) const;
249 
256  void setHydrogenRegionColor(const Vec3f& c);
258  const Vec3f& getHydrogenRegionColor(void) const;
259 
266  void setSupernovaRemnantColor(const Vec3f& c);
268  const Vec3f& getSupernovaRemnantColor(void) const;
269 
276  void setInterstellarMatterColor(const Vec3f& c);
278  const Vec3f& getInterstellarMatterColor(void) const;
279 
286  void setDarkNebulaColor(const Vec3f& c);
288  const Vec3f& getDarkNebulaColor(void) const;
289 
296  void setClusterWithNebulosityColor(const Vec3f& c);
298  const Vec3f& getClusterWithNebulosityColor(void) const;
299 
306  void setClusterColor(const Vec3f& c);
308  const Vec3f& getClusterColor(void) const;
309 
316  void setOpenClusterColor(const Vec3f& c);
318  const Vec3f& getOpenClusterColor(void) const;
319 
326  void setGlobularClusterColor(const Vec3f& c);
328  const Vec3f& getGlobularClusterColor(void) const;
329 
336  void setStellarAssociationColor(const Vec3f& c);
338  const Vec3f& getStellarAssociationColor(void) const;
339 
346  void setStarCloudColor(const Vec3f& c);
348  const Vec3f& getStarCloudColor(void) const;
349 
356  void setEmissionObjectColor(const Vec3f& c);
358  const Vec3f& getEmissionObjectColor(void) const;
359 
366  void setBlLacObjectColor(const Vec3f& c);
368  const Vec3f& getBlLacObjectColor(void) const;
369 
376  void setBlazarColor(const Vec3f& c);
378  const Vec3f& getBlazarColor(void) const;
379 
386  void setMolecularCloudColor(const Vec3f& c);
388  const Vec3f& getMolecularCloudColor(void) const;
389 
396  void setYoungStellarObjectColor(const Vec3f& c);
398  const Vec3f& getYoungStellarObjectColor(void) const;
399 
406  void setPossibleQuasarColor(const Vec3f& c);
408  const Vec3f& getPossibleQuasarColor(void) const;
409 
416  void setPossiblePlanetaryNebulaColor(const Vec3f& c);
418  const Vec3f& getPossiblePlanetaryNebulaColor(void) const;
419 
426  void setProtoplanetaryNebulaColor(const Vec3f& c);
428  const Vec3f& getProtoplanetaryNebulaColor(void) const;
429 
436  void setStarColor(const Vec3f& c);
438  const Vec3f& getStarColor(void) const;
439 
441  void setCircleScale(float scale);
443  float getCircleScale(void) const;
444 
447  void setHintsFadeDuration(float duration) {hintsFader.setDuration((int) (duration * 1000.f));}
448 
450  void setFlagHints(bool b) {hintsFader=b;}
452  bool getFlagHints(void) const {return hintsFader;}
453 
455  void setHintsProportional(const bool proportional);
457  bool getHintsProportional(void) const;
458 
460  void setFlagSurfaceBrightnessUsage(const bool usage) { Nebula::surfaceBrightnessUsage=usage; }
462  bool getFlagSurfaceBrightnessUsage(void) const { return Nebula::surfaceBrightnessUsage; }
463 
465  void setFlagShow(bool b) { flagShow = b; }
467  bool getFlagShow(void) const { return flagShow; }
468 
470  void setFlagTypeFiltersUsage(bool b) { Nebula::flagUsageTypeFilter=b; }
472  bool getFlagTypeFiltersUsage(void) const { return Nebula::flagUsageTypeFilter; }
473 
480  void setLabelsColor(const Vec3f& c);
482  const Vec3f& getLabelsColor(void) const;
483 
487  void setLabelsAmount(float a) {labelsAmount=a;}
490  float getLabelsAmount(void) const {return labelsAmount;}
491 
495  void setHintsAmount(float f) {hintsAmount = f;}
498  float getHintsAmount(void) const {return hintsAmount;}
499 
500 private slots:
503  void setStelStyle(const QString& section);
504 
508  void updateI18n();
509 
510 
511 private:
512 
514  NebulaP search(const QString& name);
515 
517  NebulaP search(const Vec3d& pos);
518 
525  void loadNebulaSet(const QString& setName);
526 
528  void drawPointer(const StelCore* core, StelPainter& sPainter);
529 
530  NebulaP searchDSO(unsigned int DSO);
531  NebulaP searchM(unsigned int M);
532  NebulaP searchNGC(unsigned int NGC);
533  NebulaP searchIC(unsigned int IC);
534  NebulaP searchC(unsigned int C);
535  NebulaP searchB(unsigned int B);
536  NebulaP searchSh2(unsigned int Sh2);
537  NebulaP searchVdB(unsigned int VdB);
538  NebulaP searchRCW(unsigned int RCW);
539  NebulaP searchLDN(unsigned int LDN);
540  NebulaP searchLBN(unsigned int LBN);
541  NebulaP searchCr(unsigned int Cr);
542  NebulaP searchMel(unsigned int Mel);
543  NebulaP searchPGC(unsigned int PGC);
544  NebulaP searchUGC(unsigned int UGC);
545  NebulaP searchCed(QString Ced);
546 
547  // Load catalog of DSO
548  bool loadDSOCatalog(const QString& filename);
549  void convertDSOCatalog(const QString& in, const QString& out, bool decimal);
550  // Load proper names for DSO
551  bool loadDSONames(const QString& filename);
552 
553  QVector<NebulaP> dsoArray; // The DSO list
554  QHash<unsigned int, NebulaP> dsoIndex;
555 
556  LinearFader hintsFader;
557  LinearFader flagShow;
558 
560  StelSphericalIndex nebGrid;
561 
563  float hintsAmount;
565  float labelsAmount;
566 
568  StelTextureSP texPointer;
569 
570  QFont nebulaFont; // Font used for names printing
571 
572  // For DSO convertor
573  bool flagConverter;
574  bool flagDecimalCoordinates;
575 };
576 
577 #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:447
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 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:460
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:467
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.
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
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.
float getLabelsAmount(void) const
Get the amount of nebulae labels.
Definition: NebulaMgr.hpp:490
void setStarCloudColor(const Vec3f &c)
Set the color used to draw the star clouds symbols.
bool getFlagSurfaceBrightnessUsage(void) const
Get whether hints (symbols) are visible according to surface brightness value.
Definition: NebulaMgr.hpp:462
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...
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.
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 setLabelsAmount(float a)
Set the amount of nebulae labels.
Definition: NebulaMgr.hpp:487
void setMolecularCloudColor(const Vec3f &c)
Set the color used to draw the molecular clouds symbols.
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.
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:452
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:465
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.
void setHintsAmount(float f)
Set the amount of nebulae hints.
Definition: NebulaMgr.hpp:495
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:450
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.
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.
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 setBlLacObjectColor(const Vec3f &c)
Set the color used to draw the BL Lac objects symbols.
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.
void setOpenClusterColor(const Vec3f &c)
Set the color used to draw the open star cluster symbols.
float getHintsAmount(void) const
Get the amount of nebulae labels.
Definition: NebulaMgr.hpp:498
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) 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 getFlagTypeFiltersUsage(void) const
Get value of flag used to turn on and off DSO type filtering.
Definition: NebulaMgr.hpp:472
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:470
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).