Stellarium 0.15.2
NavStars.hpp
1 /*
2  * Navigational Stars plug-in
3  * Copyright (C) 2014-2016 Alexander Wolf
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
18  */
19 
20 #ifndef _NAVSTARS_HPP_
21 #define _NAVSTARS_HPP_
22 
23 #include "StelFader.hpp"
24 #include "StelModule.hpp"
25 #include "StelObject.hpp" // For StelObjectP
26 #include "StelTexture.hpp"
27 
28 #include <QSettings>
29 
30 class StelButton;
31 class StelPainter;
32 class StelPropertyMgr;
33 class NavStarsWindow;
34 
54 class NavStars : public StelModule
59 {
60  Q_OBJECT
61  Q_ENUMS(NavigationalStarsSet)
62  Q_PROPERTY(bool navStarsVisible
63  READ getNavStarsMarks
64  WRITE setNavStarsMarks
65  NOTIFY navStarsMarksChanged)
66 public:
70  {
74  };
75 
76  NavStars();
77  virtual ~NavStars();
78 
80  // Methods defined in the StelModule class
81  virtual void init();
82  virtual void deinit();
83  virtual void update(double deltaTime);
84  virtual void draw(StelCore* core);
85  virtual double getCallOrder(StelModuleActionName actionName) const;
86  virtual bool configureGui(bool show);
87 
90  void restoreDefaultConfiguration(void);
91 
94  void loadConfiguration(void);
95 
97  void saveConfiguration(void);
98 
99  void populateNavigationalStarsSet(void);
100 
101 public slots:
104  void setNavStarsMarks(const bool b);
106  bool getNavStarsMarks(void) const;
107 
110  {
111  currentNSSet = nsset;
112  }
115  {
116  return currentNSSet;
117  }
119  QString getCurrentNavigationalStarsSetKey(void) const;
120  QString getCurrentNavigationalStarsSetDescription(void) const;
122  void setCurrentNavigationalStarsSetKey(QString key);
123 
124 signals:
126  void navStarsMarksChanged(bool b);
127 
128 private slots:
130  void starNamesChanged(const bool b);
131 
132 private:
133  NavStarsWindow* mainWindow;
134  StelPropertyMgr* propMgr;
135  QSettings* conf;
136 
137  // The current set of navigational stars
138  NavigationalStarsSet currentNSSet;
139 
141  QList<int> starNumbers;
143  QVector<StelObjectP> stars;
144 
145  StelTextureSP markerTexture;
147  Vec3f markerColor;
148  LinearFader markerFader;
149 
151  StelButton* toolbarButton;
152 };
153 
154 
155 
156 #include <QObject>
157 #include "StelPluginInterface.hpp"
158 
160 class NavStarsStelPluginInterface : public QObject, public StelPluginInterface
161 {
162  Q_OBJECT
163  Q_PLUGIN_METADATA(IID StelPluginInterface_iid)
164  Q_INTERFACES(StelPluginInterface)
165 public:
166  virtual StelModule* getStelModule() const;
167  virtual StelPluginInfo getPluginInfo() const;
168 };
169 
170 #endif // _NAVSTARS_HPP_
void setCurrentNavigationalStarsSetKey(QString key)
Set the set of navigational stars from its key.
void setCurrentNavigationalStarsSet(NavigationalStarsSet nsset)
Set the set of navigational stars.
Definition: NavStars.hpp:109
Define the interface to implement when creating a plugin.
Implementation of StelFader which implements a linear transition.
Definition: StelFader.hpp:77
Anglo-American set (The Nautical Almanach)
Definition: NavStars.hpp:71
void saveConfiguration(void)
Save the settings to the main configuration file.
Main class for Stellarium core processing.
Definition: StelCore.hpp:48
virtual void draw(StelCore *core)
Execute all the drawing functions for this module.
NavigationalStarsSet getCurrentNavigationalStarsSet() const
Get the set of navigational stars.
Definition: NavStars.hpp:114
virtual double getCallOrder(StelModuleActionName actionName) const
Return the value defining the order of call for the given action For example if stars.callOrder[ActionDraw] == 10 and constellation.callOrder[ActionDraw] == 11, the stars module will be drawn before the constellations.
void loadConfiguration(void)
Read (or re-read) settings from the main config file.
Provides functions for performing openGL drawing operations.
Definition: StelPainter.hpp:40
void navStarsMarksChanged(bool b)
Emitted when display of markers have been changed.
A Button Graphicsitem for use in Stellarium&#39;s graphic widgets.
Manages the registration of specific object properties with the StelProperty system.
NavigationalStarsSet
Available sets of navigational stars.
Definition: NavStars.hpp:69
QString getCurrentNavigationalStarsSetKey(void) const
Get the key of current set of navigational stars.
StelModuleActionName
Define the possible action for which an order is defined.
Definition: StelModule.hpp:121
virtual void init()
Initialize itself.
This class is used by Qt to manage a plug-in interface.
Definition: NavStars.hpp:160
void setNavStarsMarks(const bool b)
Set flag of displaying markers of the navigational stars Emits navStarsMarksChanged() if the value ch...
void restoreDefaultConfiguration(void)
Set up the plugin with default values.
Main class of the Navigational Stars plugin.
Definition: NavStars.hpp:58
QSharedPointer< StelTexture > StelTextureSP
Use shared pointer to simplify memory managment.
virtual void deinit()
Called before the module will be delete, and before the openGL context is suppressed.
virtual void update(double deltaTime)
Update the module with respect to the time.
bool getNavStarsMarks(void) const
Get flag of displaying markers of the navigational stars.
This is the common base class for all the main components of stellarium.
Definition: StelModule.hpp:49
French set (Ephémérides Nautiques)
Definition: NavStars.hpp:72
Russian set (Морской астрономический ежегодник)
Definition: NavStars.hpp:73
Main window of the Navigational Stars plug-in.
Contains information about a Stellarium plugin.
virtual bool configureGui(bool show)
Detect or show the configuration GUI elements for the module.