• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Stellarium / stellarium / 15291801018

28 May 2025 04:52AM UTC coverage: 11.931% (-0.02%) from 11.951%
15291801018

push

github

alex-w
Added new set of navigational stars (XIX century)

0 of 6 new or added lines in 2 files covered. (0.0%)

14124 existing lines in 74 files now uncovered.

14635 of 122664 relevant lines covered (11.93%)

18291.42 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/plugins/NavStars/src/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 "StelTextureTypes.hpp"
27

28
#include <QSettings>
29

30
#include "NavStarsCalculator.hpp"
31

32
class StelButton;
33
class StelPainter;
34
class StelPropertyMgr;
35
class NavStarsWindow;
36

37
/*! @defgroup navigationalStars Navigational Stars Plug-in
38
@{
39
The Navigational Stars plugin marks the 58 navigational stars of The
40
Nautical Almanac and the 2102-D Rude Star Finder on the sky. Alternatively,
41
the French, German, and Russian selection of navigational stars or alignment
42
stars for various telescopes are also available.
43

44
The NavStars class is the main class of the plug-in. It manages the list of
45
navigational stars and manipulate show/hide markers of them. Markers
46
are not objects!
47

48
The plugin is also an example of a custom plugin that just marks existing stars.
49

50
<b>Configuration</b>
51

52
The plug-ins' configuration data is stored in Stellarium's main configuration
53
file (section [NavigationalStars]).
54

55
@}
56
*/
57

58
//! @class NavStars
59
//! Main class of the %Navigational Stars plugin.
60
//! @author Alexander Wolf
61
//! @author Andy Kirkham
62
//! @ingroup navigationalStars
63
class NavStars : public StelModule
64
{
65
        Q_OBJECT
66
        Q_PROPERTY(bool navStarsVisible                READ getNavStarsMarks                WRITE setNavStarsMarks                NOTIFY navStarsMarksChanged)
67
        Q_PROPERTY(bool displayAtStartup        READ getEnableAtStartup                WRITE setEnableAtStartup        NOTIFY enableAtStartupChanged)
68
        Q_PROPERTY(bool highlightWhenVisible        READ getHighlightWhenVisible        WRITE setHighlightWhenVisible   NOTIFY highlightWhenVisibleChanged)
69
        Q_PROPERTY(bool limitInfoToNavStars        READ getLimitInfoToNavStars        WRITE setLimitInfoToNavStars        NOTIFY limitInfoToNavStarsChanged)
70
        Q_PROPERTY(bool upperLimb                READ getUpperLimb                WRITE setUpperLimb                NOTIFY upperLimbChanged)
71
        Q_PROPERTY(bool tabulatedDisplay        READ getTabulatedDisplay        WRITE setTabulatedDisplay        NOTIFY tabulatedDisplayChanged)
72
        Q_PROPERTY(bool showExtraDecimals        READ getShowExtraDecimals        WRITE setShowExtraDecimals        NOTIFY showExtraDecimalsChanged)
73
        Q_PROPERTY(bool useUTCTime                READ getFlagUseUTCTime                WRITE setFlagUseUTCTime                NOTIFY flagUseUTCTimeChanged)
74
public:        
75
        //! @enum NavigationalStarsSet
76
        //! Available sets of navigational stars
77
        enum NavigationalStarsSet
78
        {
79
                AngloAmerican,   //!< Anglo-American set (The Nautical Almanac)
80
                French,          //!< French set (Ephémérides Nautiques)
81
                British,         //!< British set from XVIII century (Maskelyne's "British Mariner's Guide", 1764)
82
                Wrinkles,        //!< British set from XIX century (Lecky's "Wrinkles" in practical navigation", 1884)
83
                Russian,         //!< Russian set (Морской астрономический ежегодник)
84
                USSRAvia,        //!< The set of navigational stars which was used for Soviet aviation
85
                USSRSpace,       //!< The set of navigational stars for Soviet and Russian manned space programs Voskhod and Soyuz
86
                German,          //!< German set (Nautisches Jahrbuch)
87
                GeminiAPS,       //!< Gemini APS Alignment Star List
88
                MeadeLX200,      //!< Meade LX200 Alignment Star Library
89
                MeadeETX,        //!< Meade ETX Alignment Star Library
90
                MeadeAS494,      //!< Meade Autostar #494 Alignment Stars
91
                MeadeAS497,      //!< Meade Autostar #497 Alignment Stars
92
                CelestronNS,     //!< Celestron NexStar Alignment Star List
93
                Apollo,          //!< Apollo Alignment Star List
94
                SkywatcherSS,    //!< Skywatcher SynScan Hand Controller and SynScan Pro App
95
                VixenSB,         //!< Vixen Starbook Alignment Stars
96
                ArgoNavis,       //!< Alignment stars for Argo Navis digital setting circles
97
                OrionIS,         //!< Alignment stars for Orion Intelliscope mounts
98
                SkyCommander     //!< Alignment stars for Sky Commander DSCs
99
        };
UNCOV
100
        Q_ENUM(NavigationalStarsSet)
×
101

102
        NavStars();
103
        ~NavStars() override;
104

105
        ///////////////////////////////////////////////////////////////////////////
106
        // Methods defined in the StelModule class
107
        void init() override;
108
        void deinit() override;
109
        void update(double deltaTime) override;
110
        void draw(StelCore* core) override;
111
        double getCallOrder(StelModuleActionName actionName) const override;
112
        bool configureGui(bool show) override;
113

114
        //! Set up the plugin with default values.  This means clearing out the NavigationalStars section in the
115
        //! main config.ini (if one already exists), and populating it with default values.
116
        void restoreDefaultConfiguration(void);
117

118
        //! Read (or re-read) settings from the main config file.  This will be called from init and also
119
        //! when restoring defaults (i.e. from the configuration dialog / restore defaults button).
120
        void loadConfiguration(void);
121

122
        //! Save the settings to the main configuration file.
123
        void saveConfiguration(void);
124

125
        void populateNavigationalStarsSet(void);
126

UNCOV
127
        QList<int> getStarsNumbers(void) { return starNumbers; }
×
128

129
public slots:
130
        //! Set flag of displaying markers of the navigational stars
131
        //! Emits navStarsMarksChanged() if the value changes.
132
        void setNavStarsMarks(const bool b);
133
        //! Get flag of displaying markers of the navigational stars
134
        bool getNavStarsMarks(void) const;
135

136
        void setEnableAtStartup(bool b);
UNCOV
137
        bool getEnableAtStartup(void) const { return enableAtStartup; }
×
138

139
        void setHighlightWhenVisible(bool b);
UNCOV
140
        bool getHighlightWhenVisible(void) const { return highlightWhenVisible; }
×
141

142
        void setLimitInfoToNavStars(bool b);
UNCOV
143
        bool getLimitInfoToNavStars(void) const { return limitInfoToNavStars; }
×
144

145
        void setUpperLimb(bool b);
UNCOV
146
        bool getUpperLimb(void) const { return upperLimb; }
×
147

148
        void setTabulatedDisplay(bool b);
UNCOV
149
        bool getTabulatedDisplay(void) const { return tabulatedDisplay; }
×
150

151
        void setShowExtraDecimals(bool b);
UNCOV
152
        bool getShowExtraDecimals(void) const { return NavStarsCalculator::useExtraDecimals; }
×
153

154
        void setFlagUseUTCTime(bool b);
UNCOV
155
        bool getFlagUseUTCTime(void) const { return useUTCTime; }
×
156

157
        //! Set the set of navigational stars
UNCOV
158
        void setCurrentNavigationalStarsSet(NavigationalStarsSet nsset)
×
159
        {
UNCOV
160
                currentNSSet = nsset;
×
161
        }
×
162
        //! Get the set of navigational stars
UNCOV
163
        NavStars::NavigationalStarsSet getCurrentNavigationalStarsSet() const
×
164
        {
UNCOV
165
                return currentNSSet;
×
166
        }
167
        //! Get the key of current set of navigational stars
168
        QString getCurrentNavigationalStarsSetKey(void) const;
169
        QString getCurrentNavigationalStarsSetDescription(void) const;
170
        //! Set the set of navigational stars from its key
171
        void setCurrentNavigationalStarsSetKey(const QString &key);
172

173
        //! Adds StelObject::ExtraInfo for selected object.
174
        void addExtraInfo(StelCore* core);
175

176
        //! For the currently select object add the extraString info
177
        //! in a format that matches the Nautical Almanac.
178
        void extraInfo(StelCore* core, const StelObjectP& selectedObject);
179

180
        //! Used to display the extraInfoStrings in standard "paired" lines (for example gha/dev)
181
        static void displayStandardInfo(const StelObjectP& selectedObject, NavStarsCalculator& calc, const QString& extraText);
182

183
        //! Used to display the extraInfoStrings in tabulated form more suited to students of CN
184
        //! as found when using Nautical Almanacs.
185
        static void displayTabulatedInfo(const StelObjectP& selectedObject, NavStarsCalculator& calc, const QString& extraText);
186

187
        //! Given two QStrings return in a format consistent with the
188
        //! property setting of "withTables".
189
        //! @param QString a The cell left value
190
        //! @param QString b The cell right value
191
        //! @return QString The representation of the extraString info.
192
        static QString oneRowTwoCells(const QString& a, const QString& b, const QString& extra, bool tabulatedView);
193

194
        //! If information output is limited to the currently active navigational stars (getLimitInfoToNavStars()),
195
        //! check a dedicated list of exceptions (Sun, Moon, planets apart from Mercury) to also add information.
196
        static bool isPermittedObject(const QString& s);
197

198
private slots:
199
        //! Call when button "Save settings" in main GUI are pressed
UNCOV
200
        void saveSettings() { saveConfiguration(); }
×
201
        void setUseDecimalDegrees(bool flag);
202

203
signals:
204
        //! Emitted when display of markers have been changed.
205
        void navStarsMarksChanged(bool b);
206
        void enableAtStartupChanged(bool b);
207
        void highlightWhenVisibleChanged(bool b);
208
        void limitInfoToNavStarsChanged(bool b);
209
        void upperLimbChanged(bool b);
210
        void tabulatedDisplayChanged(bool b);
211
        void showExtraDecimalsChanged(bool b);
212
        void flagUseUTCTimeChanged(bool b);
213

214
private:
215
        NavStarsWindow* mainWindow;
216
        StelPropertyMgr* propMgr;
217
        QSettings* conf;        
218

219
        // The current set of navigational stars
220
        NavigationalStarsSet currentNSSet;
221

222
        bool enableAtStartup;
223
        bool starLabelsState;      // Keep track of setting in the main program
224
        bool upperLimb;            // Computation for Sun/Moon on upper or lower limb
225
        bool highlightWhenVisible; // Show only when sky is dark enough
226
        bool limitInfoToNavStars;  // Don't show nav data for non-nav stars
227
        bool tabulatedDisplay;     // Use tabular layout for nav strings in InfoText
228
        bool useUTCTime;           // Use UTC timezone while active
229

230
        QString timeZone;
231

232
        //! List of the navigational stars' HIP numbers.
233
        QList<int> starNumbers;
234
        //! List of pointers to the objects representing the stars.
235
        QVector<StelObjectP> stars;
236
        
237
        StelTextureSP markerTexture;
238
        //! Color used to paint each star's marker and additional label.
239
        Vec3f markerColor;        
240
        LinearFader markerFader;        
241

242
        //! Button for the bottom toolbar.
243
        StelButton* toolbarButton;
244
};
245

246

247
#include <QObject>
248
#include "StelPluginInterface.hpp"
249

250
//! This class is used by Qt to manage a plug-in interface
251
class NavStarsStelPluginInterface : public QObject, public StelPluginInterface
252
{
253
        Q_OBJECT
254
        Q_PLUGIN_METADATA(IID StelPluginInterface_iid)
255
        Q_INTERFACES(StelPluginInterface)
256
public:
257
        StelModule* getStelModule() const override;
258
        StelPluginInfo getPluginInfo() const override;
259
        //QObjectList getExtensionList() const override { return QObjectList(); }
260
};
261

262
#endif // NAVSTARS_HPP
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc