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

Stellarium / stellarium / 6137516109

10 Sep 2023 01:39PM UTC coverage: 11.857% (-0.03%) from 11.889%
6137516109

Pull #3399

github

alex-w
Fix proper motion
Pull Request #3399: New plugin "Missing Stars"

355 of 355 new or added lines in 7 files covered. (100.0%)

14816 of 124956 relevant lines covered (11.86%)

26472.98 hits per line

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

0.0
/plugins/MissingStars/src/MissingStars.hpp
1
/*
2
 * Copyright (C) 2023 Alexander Wolf
3
 *
4
 * This program is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU General Public License
6
 * as published by the Free Software Foundation; either version 2
7
 * of the License, or (at your option) any later version.
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program; if not, write to the Free Software
16
 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.
17
 */
18

19
#ifndef MISSINGSTARS_HPP
20
#define MISSINGSTARS_HPP
21

22
#include "StelObjectModule.hpp"
23
#include "StelObject.hpp"
24
#include "StelTextureTypes.hpp"
25
#include "MissingStar.hpp"
26
#include <QFont>
27
#include <QVariantMap>
28
#include <QDateTime>
29
#include <QList>
30
#include <QSharedPointer>
31

32
class QSettings;
33
class MissingStarsDialog;
34

35
class StelPainter;
36

37
/*! @defgroup missingStars Missing Stars Plug-in
38
@{
39
The %Missing Stars plugin displays the positions some missing stars.
40

41
<b>Missing Stars Catalog</b>
42

43
The missing stars catalog is stored on the disk in [JSON](http://www.json.org/)
44
format, in a file named "missingstars.json". A default copy is embedded in the
45
plug-in at compile time. A working copy is kept in the user data directory.
46

47
<b>Configuration</b>
48

49
The plug-ins' configuration data is stored in Stellarium's main configuration
50
file.
51

52
@}
53
*/
54

55
//! @ingroup missingStars
56
typedef QSharedPointer<MissingStar> MissingStarP;
57

58
//! @class MissingStars
59
//! Main class of the %Missing Stars plugin.
60
//! @author Alexander Wolf
61
//! @ingroup missingStars
62
class MissingStars : public StelObjectModule
63
{
64
        Q_OBJECT
65
public:        
66
        MissingStars();
67
        virtual ~MissingStars() Q_DECL_OVERRIDE;
68

69
        ///////////////////////////////////////////////////////////////////////////
70
        // Methods defined in the StelModule class
71
        virtual void init() Q_DECL_OVERRIDE;
72
        virtual void deinit() Q_DECL_OVERRIDE;
73
        virtual void draw(StelCore* core) Q_DECL_OVERRIDE;
74
        virtual void drawPointer(StelCore* core, StelPainter& painter);
75
        virtual double getCallOrder(StelModuleActionName actionName) const Q_DECL_OVERRIDE;
76

77
        ///////////////////////////////////////////////////////////////////////////
78
        // Methods defined in StelObjectModule class
79
        //! Used to get a list of objects which are near to some position.
80
        //! @param v a vector representing the position in th sky around which to search for missing stars.
81
        //! @param limitFov the field of view around the position v in which to search for missing stars.
82
        //! @param core the StelCore to use for computations.
83
        //! @return a list containing the missing stars located inside the limitFov circle around position v.
84
        virtual QList<StelObjectP> searchAround(const Vec3d& v, double limitFov, const StelCore* core) const Q_DECL_OVERRIDE;
85

86
        //! Return the matching missing stars object's pointer if exists or Q_NULLPTR.
87
        //! @param nameI18n The case in-sensitive localized star name
88
        virtual StelObjectP searchByNameI18n(const QString& nameI18n) const Q_DECL_OVERRIDE;
89

90
        //! Return the matching missing star if exists or Q_NULLPTR.
91
        //! @param name The case in-sensitive english star name
92
        virtual StelObjectP searchByName(const QString& name) const Q_DECL_OVERRIDE;
93

94
        //! Return the matching missing star if exists, or an "empty" pointer.
95
        //! @param id The missing star id
96
        virtual StelObjectP searchByID(const QString &id) const Q_DECL_OVERRIDE
×
97
        {
98
                return qSharedPointerCast<StelObject>(getByID(id));
×
99
        }
100

101
        virtual QStringList listAllObjects(bool inEnglish) const Q_DECL_OVERRIDE;
102

103
        virtual QString getName() const Q_DECL_OVERRIDE { return "Missing Stars"; }
×
104
        virtual QString getStelObjectType() const Q_DECL_OVERRIDE { return MissingStar::MISSINGSTAR_TYPE; }
×
105

106
        //! get a star object by identifier
107
        MissingStarP getByID(const QString& id) const;
108

109
        //! Get list of designations for missing stars
110
        QString getMissingStarsList() const;
111

112
        //! Implement this to tell the main Stellarium GUI that there is a GUI element to configure this
113
        //! plugin.
114
        virtual bool configureGui(bool show=true) Q_DECL_OVERRIDE;
115

116
public slots:
117
        //! Connect this to StelApp font size.
118
        void setFontSize(int s){font.setPixelSize(s);}
×
119

120
private slots:
121
        void setFlagShowStars(const bool b) { flagShowStars = b; }
×
122
        void setFlagShowLabels(const bool b) { MissingStar::flagShowLabels = b; }
×
123

124
private:
125
        // Font used for displaying our text
126
        QFont font;
127

128
        //! Read the JSON file and create list of missing stars.
129
        void readJsonFile(void);
130

131
        //! Parse JSON file and load missing stars to map
132
        QVariantMap loadMissingStarsMap();
133

134
        //! Set items for list of struct from data map
135
        void setMissingStarsMap(const QVariantMap& map);
136

137
        StelTextureSP texPointer;
138
        QList<MissingStarP> missingstars;
139
        QStringList designations;
140

141
        //QSettings* conf;
142

143
        bool flagShowStars;
144

145
        // GUI
146
        MissingStarsDialog* configDialog;        
147
};
148

149
#include <QObject>
150
#include "StelPluginInterface.hpp"
151

152
//! This class is used by Qt to manage a plug-in interface
153
class MissingStarsStelPluginInterface : public QObject, public StelPluginInterface
154
{
155
        Q_OBJECT
156
        Q_PLUGIN_METADATA(IID StelPluginInterface_iid)
157
        Q_INTERFACES(StelPluginInterface)
158
public:
159
        virtual StelModule* getStelModule() const Q_DECL_OVERRIDE;
160
        virtual StelPluginInfo getPluginInfo() const Q_DECL_OVERRIDE;
161
        virtual QObjectList getExtensionList() const Q_DECL_OVERRIDE { return QObjectList(); }
×
162
};
163

164
#endif /* MISSINGSTARS_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