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 
129 
131  // Properties setters and getters
132 public slots:
139  void setCirclesColor(const Vec3f& c);
141  const Vec3f& getCirclesColor(void) const;
142 
149  void setGalaxyColor(const Vec3f& c);
151  const Vec3f& getGalaxyColor(void) const;
152 
159  void setActiveGalaxyColor(const Vec3f& c);
161  const Vec3f& getActiveGalaxyColor(void) const;
162 
169  void setInteractingGalaxyColor(const Vec3f& c);
171  const Vec3f& getInteractingGalaxyColor(void) const;
172 
179  void setRadioGalaxyColor(const Vec3f& c);
181  const Vec3f& getRadioGalaxyColor(void) const;
182 
189  void setQuasarColor(const Vec3f& c);
191  const Vec3f& getQuasarColor(void) const;
192 
200  void setBrightNebulaColor(const Vec3f& c);
203  const Vec3f& getBrightNebulaColor(void) const;
204 
211  void setNebulaColor(const Vec3f& c);
213  const Vec3f& getNebulaColor(void) const;
214 
221  void setPlanetaryNebulaColor(const Vec3f& c);
223  const Vec3f& getPlanetaryNebulaColor(void) const;
224 
231  void setReflectionNebulaColor(const Vec3f& c);
233  const Vec3f& getReflectionNebulaColor(void) const;
234 
241  void setBipolarNebulaColor(const Vec3f& c);
243  const Vec3f& getBipolarNebulaColor(void) const;
244 
251  void setEmissionNebulaColor(const Vec3f& c);
253  const Vec3f& getEmissionNebulaColor(void) const;
254 
261  void setHydrogenRegionColor(const Vec3f& c);
263  const Vec3f& getHydrogenRegionColor(void) const;
264 
271  void setSupernovaRemnantColor(const Vec3f& c);
273  const Vec3f& getSupernovaRemnantColor(void) const;
274 
281  void setInterstellarMatterColor(const Vec3f& c);
283  const Vec3f& getInterstellarMatterColor(void) const;
284 
291  void setDarkNebulaColor(const Vec3f& c);
293  const Vec3f& getDarkNebulaColor(void) const;
294 
301  void setClusterWithNebulosityColor(const Vec3f& c);
303  const Vec3f& getClusterWithNebulosityColor(void) const;
304 
311  void setClusterColor(const Vec3f& c);
313  const Vec3f& getClusterColor(void) const;
314 
321  void setOpenClusterColor(const Vec3f& c);
323  const Vec3f& getOpenClusterColor(void) const;
324 
331  void setGlobularClusterColor(const Vec3f& c);
333  const Vec3f& getGlobularClusterColor(void) const;
334 
341  void setStellarAssociationColor(const Vec3f& c);
343  const Vec3f& getStellarAssociationColor(void) const;
344 
351  void setStarCloudColor(const Vec3f& c);
353  const Vec3f& getStarCloudColor(void) const;
354 
361  void setEmissionObjectColor(const Vec3f& c);
363  const Vec3f& getEmissionObjectColor(void) const;
364 
371  void setBlLacObjectColor(const Vec3f& c);
373  const Vec3f& getBlLacObjectColor(void) const;
374 
381  void setBlazarColor(const Vec3f& c);
383  const Vec3f& getBlazarColor(void) const;
384 
391  void setMolecularCloudColor(const Vec3f& c);
393  const Vec3f& getMolecularCloudColor(void) const;
394 
401  void setYoungStellarObjectColor(const Vec3f& c);
403  const Vec3f& getYoungStellarObjectColor(void) const;
404 
411  void setPossibleQuasarColor(const Vec3f& c);
413  const Vec3f& getPossibleQuasarColor(void) const;
414 
421  void setPossiblePlanetaryNebulaColor(const Vec3f& c);
423  const Vec3f& getPossiblePlanetaryNebulaColor(void) const;
424 
431  void setProtoplanetaryNebulaColor(const Vec3f& c);
433  const Vec3f& getProtoplanetaryNebulaColor(void) const;
434 
441  void setStarColor(const Vec3f& c);
443  const Vec3f& getStarColor(void) const;
444 
446  void setCircleScale(float scale);
448  float getCircleScale(void) const;
449 
452  void setHintsFadeDuration(float duration) {hintsFader.setDuration((int) (duration * 1000.f));}
453 
455  void setFlagHints(bool b) {hintsFader=b;}
457  bool getFlagHints(void) const {return hintsFader;}
458 
460  void setHintsProportional(const bool proportional);
462  bool getHintsProportional(void) const;
463 
465  void setFlagSurfaceBrightnessUsage(const bool usage) { Nebula::surfaceBrightnessUsage=usage; }
467  bool getFlagSurfaceBrightnessUsage(void) const { return Nebula::surfaceBrightnessUsage; }
468 
470  void setFlagShow(bool b) { flagShow = b; }
472  bool getFlagShow(void) const { return flagShow; }
473 
475  void setFlagTypeFiltersUsage(bool b) { Nebula::flagUsageTypeFilter=b; }
477  bool getFlagTypeFiltersUsage(void) const { return Nebula::flagUsageTypeFilter; }
478 
485  void setLabelsColor(const Vec3f& c);
487  const Vec3f& getLabelsColor(void) const;
488 
492  void setLabelsAmount(float a) {labelsAmount=a;}
495  float getLabelsAmount(void) const {return labelsAmount;}
496 
500  void setHintsAmount(float f) {hintsAmount = f;}
503  float getHintsAmount(void) const {return hintsAmount;}
504 
505 private slots:
509  void updateI18n();
510 
511 
512 private:
513 
515  NebulaP search(const QString& name);
516 
518  NebulaP search(const Vec3d& pos);
519 
526  void loadNebulaSet(const QString& setName);
527 
529  void drawPointer(const StelCore* core, StelPainter& sPainter);
530 
531  NebulaP searchDSO(unsigned int DSO);
532  NebulaP searchM(unsigned int M);
533  NebulaP searchNGC(unsigned int NGC);
534  NebulaP searchIC(unsigned int IC);
535  NebulaP searchC(unsigned int C);
536  NebulaP searchB(unsigned int B);
537  NebulaP searchSh2(unsigned int Sh2);
538  NebulaP searchVdB(unsigned int VdB);
539  NebulaP searchRCW(unsigned int RCW);
540  NebulaP searchLDN(unsigned int LDN);
541  NebulaP searchLBN(unsigned int LBN);
542  NebulaP searchCr(unsigned int Cr);
543  NebulaP searchMel(unsigned int Mel);
544  NebulaP searchPGC(unsigned int PGC);
545  NebulaP searchUGC(unsigned int UGC);
546  NebulaP searchCed(QString Ced);
547 
548  // Load catalog of DSO
549  bool loadDSOCatalog(const QString& filename);
550  void convertDSOCatalog(const QString& in, const QString& out, bool decimal);
551  // Load proper names for DSO
552  bool loadDSONames(const QString& filename);
553 
554  QVector<NebulaP> dsoArray; // The DSO list
555  QHash<unsigned int, NebulaP> dsoIndex;
556 
557  LinearFader hintsFader;
558  LinearFader flagShow;
559 
561  StelSphericalIndex nebGrid;
562 
564  float hintsAmount;
566  float labelsAmount;
567 
569  StelTextureSP texPointer;
570 
571  QFont nebulaFont; // Font used for names printing
572 
573  // For DSO convertor
574  bool flagConverter;
575  bool flagDecimalCoordinates;
576 };
577 
578 #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:452
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:465
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:472
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:495
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.
bool getFlagSurfaceBrightnessUsage(void) const
Get whether hints (symbols) are visible according to surface brightness value.
Definition: NebulaMgr.hpp:467
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:492
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:457
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:470
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:500
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:455
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:503
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:477
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:475
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).