• 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/MosaicCamera/src/MosaicCamera.hpp
1
/*
2
 * Copyright (C) 2024 Josh Meyers
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 MOSAICCAMERA_HPP
20
#define MOSAICCAMERA_HPP
21

22
#include "StelGui.hpp"
23
#include "StelModule.hpp"
24
#include "StelPluginInterface.hpp"
25

26
class StelButton;
27
class MosaicCameraDialog;
28

29
/*! @defgroup mosaicCamera Mosaic Camera plug-in
30
@{
31
The Mosaic Camera plugin overlays camera sensor boundaries on the sky.
32
@}
33
*/
34

35
/// @brief Represents a set of polygons with associated properties.
36
struct PolygonSet
37
{
38
        QString name;                                                ///< The name of the polygon set.
39
        QVector<QVector<QPointF>> corners;        ///< Polygons as vectors of corner points.
40
        QColor color;                                                ///< Color associated with the polygon set.
41
};
42

43

44
/// @brief Represents a camera with its properties and associated polygon sets.
45
struct Camera
46
{
47
        QString name;                                                ///< The name of the camera.
48
        QString cameraName;                                        ///< The name of the camera in the GUI.
49
        QString cameraDescription;                        ///< The description of the camera.
50
        QString cameraURLDetails;                        ///< URL for more details about the camera.
51
        double ra;                                                        ///< Right Ascension of camera pointing [deg]
52
        double dec;                                                        ///< Declination of camera pointing [deg]
53
        double rotation;                                        ///< Rotation angle of the camera [deg]
54
        bool visible;                                                ///< Visibility status of the camera.
55
        QVector<PolygonSet> polygon_sets;        ///< Collection of polygon sets associated with the camera.
56
        double fieldDiameter;                                ///< Estimated field diameter of the camera [deg]
57
};
58

59
//! @class MosaicCamera
60
//! @ingroup mosaicCamera
61
//! Main class of the Mosaic Camera plug-in.
62
//! @author Josh Meyers
63
class MosaicCamera : public StelModule
64
{
65
        Q_OBJECT
66
        /**
67
        * @name Camera properties
68
        * @{
69
        * We maintain the concept of a "current" camera primarily for the convenience of
70
        * setting and getting properties through the Stellarium Remove Control HTTP API.
71
        */
72

73
        /// @property enabled
74
        /// @brief Are mosaic camera overlays enabled?
75
        Q_PROPERTY(bool enabled                        READ isEnabled                        WRITE enableMosaicCamera                NOTIFY flagMosaicCameraVisibilityChanged)
76

77
        Q_PROPERTY(bool showButton                READ getFlagShowButton        WRITE setFlagShowButton                NOTIFY flagShowButtonChanged)
78

79
        /// @property currentCamera
80
        /// @brief The name of the current camera
81
        Q_PROPERTY(QString currentCamera        READ getCurrentCamera        WRITE setCurrentCamera                NOTIFY currentCameraChanged)
82

83
        /// @property ra
84
        /// @brief Set or get the current camera's right ascension [deg]
85
        Q_PROPERTY(double ra                                READ getCurrentRA                WRITE setCurrentRA                        NOTIFY currentRAChanged)
86

87
        /// @property dec
88
        /// @brief Set or get the current camera's declination [deg]
89
        Q_PROPERTY(double dec                        READ getCurrentDec                WRITE setCurrentDec                        NOTIFY currentDecChanged)
90

91
        /// @property rotation
92
        /// @brief Set or get the current camera's rotation [deg]
93
        Q_PROPERTY(double rotation                READ getCurrentRotation        WRITE setCurrentRotation                NOTIFY currentRotationChanged)
94

95
        /// @property visible
96
        /// @brief Set or get the current camera's visibility
97
        Q_PROPERTY(bool visible                        READ getCurrentVisibility        WRITE setCurrentVisibility                NOTIFY currentVisibilityChanged)
98

99
        /** @} */
100

101
public:
102
        MosaicCamera();
103
        ~MosaicCamera() override;
104

105
        void init() override;
106
        void draw(StelCore* core) override;
107
        double getCallOrder(StelModuleActionName actionName) const override;
108

109
        bool configureGui(bool show=true) override;
110

111
        Q_INVOKABLE double getRA(const QString& cameraName) const;
112
        Q_INVOKABLE double getDec(const QString& cameraName) const;
113
        Q_INVOKABLE double getRotation(const QString& cameraName) const;
114
        Q_INVOKABLE bool getVisibility(const QString& cameraName) const;
115

116
        QString getCurrentCamera() const { return currentCamera; }
×
117
        double getCurrentRA() const { return getRA(currentCamera); }
×
UNCOV
118
        double getCurrentDec() const { return getDec(currentCamera); }
×
119
        double getCurrentRotation() const { return getRotation(currentCamera); }
×
120
        double getCurrentVisibility() const { return getVisibility(currentCamera); }
×
121

UNCOV
122
        bool isEnabled() const { return flagShowMosaicCamera; }
×
UNCOV
123
        bool getFlagShowButton() const { return flagShowButton; }
×
124

125
        void loadSettings();
126

127
        QStringList getCameraNames() const;
128
        void readPolygonSetsFromJson(const QString& cameraName, const QString& filename);
129

130
signals:
131
        void flagMosaicCameraVisibilityChanged(bool b);
132
        void flagShowButtonChanged(bool b);
133
        void currentCameraChanged(const QString& cameraName);
134
        void currentRAChanged(double ra);
135
        void currentDecChanged(double dec);
136
        void currentRotationChanged(double rotation);
137
        void currentVisibilityChanged(bool visible);
138

139
public slots:
140
        void setRA(const QString& cameraName, double ra);
141
        void setDec(const QString& cameraName, double dec);
142
        void setRotation(const QString& cameraName, double rotation);
143
        void setVisibility(const QString& cameraName, bool visible);
144
        void setPosition(const QString& cameraName, double ra, double dec, double rotation);
145
        void setRADecToView();
146
        void setRADecToObject();
147
        void setViewToCamera();
148
        void incrementRotation();
149
        void decrementRotation();
150
        void nextCamera();
151
        void previousCamera();
152

153
        void enableMosaicCamera(bool b);
154
        void setFlagShowButton(bool b);
155
        void setCurrentCamera(const QString& cameraName);
156
        void setCurrentRA(double ra);
157
        void setCurrentDec(double dec);
158
        void setCurrentRotation(double rotation);
159
        void setCurrentVisibility(bool visible);
160

161
        void saveSettings() const;
162
        void restoreDefaults();
163

164
private:
165
        QHash<QString, Camera> cameras;
166
        QStringList cameraOrder;
167
        QString userDirectory;
168
        QSettings* conf;
169

170
        QString currentCamera;
171
        bool flagShowMosaicCamera;
172
        bool flagShowButton;
173

174
        void loadBuiltInCameras();
175
        void loadCameraOrder();
176
        void initializeUserData();
177
        void copyResourcesToUserDirectory();
178
        void setCameraFieldDiameter(Camera& camera);
179
        static double gnomonicChordSeparationSquared(const QPointF& p1, const QPointF& p2);
180

181
        StelGui* gui;
182
        MosaicCameraDialog* configDialog;
183
        StelButton* toolbarButton;
184
        StelCore* core;
185
};
186

187
class MosaicCameraStelPluginInterface : public QObject, public StelPluginInterface
188
{
189
        Q_OBJECT
190
        Q_PLUGIN_METADATA(IID StelPluginInterface_iid)
191
        Q_INTERFACES(StelPluginInterface)
192
public:
193
        StelModule* getStelModule() const override;
194
        StelPluginInfo getPluginInfo() const override;
195
};
196

197
#endif /* MOSAICCAMERA_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