• 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/LensDistortionEstimator/src/LensDistortionEstimator.hpp
1
/*
2
 * Copyright (C) 2023 Ruslan Kabatsayev
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 LENSDISTORTIONESTIMATOR_HPP
20
#define LENSDISTORTIONESTIMATOR_HPP
21

22
#include <memory>
23
#include "StelCore.hpp"
24
#include "StelModule.hpp"
25
#include <QOpenGLBuffer>
26
#include <QOpenGLTexture>
27
#include <QOpenGLShaderProgram>
28
#include <QOpenGLVertexArrayObject>
29

30
class QSettings;
31
class StelButton;
32
class QMouseEvent;
33
class LensDistortionEstimatorDialog;
34
class LensDistortionEstimator : public StelModule
35
{
36
        Q_OBJECT
37
        Q_PROPERTY(bool dialogVisible READ isDialogVisible WRITE setDialogVisible NOTIFY dialogToggled)
38
        Q_PROPERTY(bool imageEnabled READ isImageEnabled WRITE setImageEnabled NOTIFY imageToggled)
39
        Q_PROPERTY(bool imageAxesEnabled READ areImageAxesEnabled WRITE setImageAxesEnabled NOTIFY imageAxesToggled)
40
        Q_PROPERTY(bool pointMarkersEnabled READ arePointMarkersEnabled WRITE setPointMarkersEnabled NOTIFY pointMarkersToggled)
41
        Q_PROPERTY(bool projectionCenterMarkerEnabled READ isProjectionCenterMarkerEnabled WRITE setProjectionCenterMarkerEnabled NOTIFY projectionCenterMarkerToggled)
42
        Q_PROPERTY(bool imgPosResetOnLoadingEnabled READ isImgPosResetOnLoadingEnabled WRITE setImgPosResetOnLoadingEnabled NOTIFY imgPosResetOnLoadingToggled)
43
        Q_PROPERTY(Vec3f selectedPointMarkerColor READ getSelectedPointMarkerColor WRITE setSelectedPointMarkerColor NOTIFY selectedPointMarkerColorChanged )
44
        Q_PROPERTY(Vec3f pointMarkerColor READ getPointMarkerColor WRITE setPointMarkerColor NOTIFY pointMarkerColorChanged )
45
        Q_PROPERTY(Vec3f projectionCenterMarkerColor READ getProjectionCenterMarkerColor WRITE setProjectionCenterMarkerColor NOTIFY projectionCenterMarkerColorChanged )
46
        Q_PROPERTY(Vec3f imageAxesColor READ getImageAxesColor WRITE setImageAxesColor NOTIFY imageAxesColorChanged )
47
public:
48
        enum class DistortionModel
49
        {
50
                Poly3,
51
                Poly5,
52
                PTLens,
53
        };
54

55
        LensDistortionEstimator();
56
        ~LensDistortionEstimator() override;
57

58
        void init() override;
59
        void draw(StelCore* core) override;
60
        double getCallOrder(StelModuleActionName actionName) const override;
61
        void handleMouseClicks(QMouseEvent* event) override;
62
        bool handleMouseMoves(int x, int y, Qt::MouseButtons) override;
63
        bool configureGui(bool show = true) override;
64
        bool arePointMarkersEnabled() const { return pointMarkersEnabled; }
×
65
        bool isProjectionCenterMarkerEnabled() const { return projectionCenterMarkerEnabled; }
×
66
        bool isImgPosResetOnLoadingEnabled() const { return imgPosResetOnLoadingEnabled; }
×
67
        bool areImageAxesEnabled() const { return imageAxesEnabled; }
×
UNCOV
68
        bool isImageEnabled() const { return imageEnabled; }
×
69
        bool isDialogVisible() const { return dialogVisible; }
×
70
        QCursor getPointPickCursor() const;
71
        Vec3f getProjectionCenterMarkerColor() const { return projectionCenterMarkerColor; }
×
72
        Vec3f getSelectedPointMarkerColor() const { return selectedPointMarkerColor; }
×
UNCOV
73
        Vec3f getPointMarkerColor() const { return pointMarkerColor; }
×
UNCOV
74
        Vec3f getImageAxesColor() const { return imageAxesColor; }
×
75
        void restoreDefaultSettings();
76

77
public slots:
78
        void setImageEnabled(bool enable);
79
        void setDialogVisible(bool enable);
80
        void setImageAxesEnabled(bool enabled);
81
        void setPointMarkersEnabled(bool enabled);
82
        void setProjectionCenterMarkerEnabled(bool enabled);
83
        void setImgPosResetOnLoadingEnabled(bool enabled);
84
        void setProjectionCenterMarkerColor(const Vec3f& color);
85
        void setSelectedPointMarkerColor(const Vec3f& color);
86
        void setPointMarkerColor(const Vec3f& color);
87
        void setImageAxesColor(const Vec3f& color);
88
signals:
89
        void imageToggled(bool enabled);
90
        void dialogToggled(bool enabled);
91
        void imageAxesToggled(bool enabled);
92
        void pointMarkersToggled(bool enabled);
93
        void imgPosResetOnLoadingToggled(bool enabled);
94
        void projectionCenterMarkerToggled(bool enabled);
95
        void projectionCenterMarkerColorChanged(const Vec3f& color);
96
        void selectedPointMarkerColorChanged(const Vec3f& color);
97
        void pointMarkerColorChanged(const Vec3f& color);
98
        void imageAxesColorChanged(const Vec3f& color);
99
private:
100
        void loadSettings();
101
        void setupCurrentVAO();
102
        void bindVAO();
103
        void releaseVAO();
104
        void renderPointMarker(StelPainter& sPainter, float x, float y, float radius, const Vec3f& color) const;
105
        void renderProjectionCenterMarker(StelPainter& sPainter, float x, float y, float radius, const Vec3f& color) const;
106
        Vec2d screenPointToImagePoint(int x, int y) const;
107
        void dragImage(const Vec2d& src, const Vec2d& dst);
108
        void rotateImage(const Vec2d& dragSrcPoint, const Vec2d& dragDstPoint);
109
private:
110
        struct
111
        {
112
                int imageTex;
113
                int imageUpDir;
114
                int projectionCenterDir;
115
                int distNormalizationCoef;
116
                int normCoordToTexCoordCoefs;
117
                int imageAxesEnabled;
118
                int imageAxesColor;
119
                int imageCenterShift;
120
                int bgToSubtract;
121
                int imageBrightness;
122
                int distortionModel;
123
                int distortionTerm1;
124
                int distortionTerm2;
125
                int distortionTerm3;
126
                int maxUndistortedR;
127
                int projectionMatrixInverse;
128
        } shaderVars;
129

130
        QSettings* conf_;
131
        StelButton* toolbarButton_ = nullptr;
132
        StelProjectorP prevProjector_;
133
        std::unique_ptr<QOpenGLBuffer> vbo_;
134
        std::unique_ptr<QOpenGLVertexArrayObject> vao_;
135
        std::unique_ptr<QOpenGLShaderProgram> renderProgram_;
136
        std::unique_ptr<LensDistortionEstimatorDialog> dialog_;
137
        std::unique_ptr<QOpenGLTexture> imageTex_;
138
        QPointF dragStartPoint_{0,0};
139
        Vec2d imgPointToRotateAbout_{0,0};
140
        double dragStartProjCenterElevation_ = 0;
141
        double dragStartProjCenterAzimuth_ = 0;
142
        double dragStartImgFieldRotation_ = 0;
143
        double dragStartImgSmallerSideFoV_ = 0;
144
        bool draggingImage_ = false;
145
        bool rotatingImage_ = false;
146
        bool pointMarkersEnabled = true;
147
        bool projectionCenterMarkerEnabled = false;
148
        bool imgPosResetOnLoadingEnabled = true;
149
        bool imageAxesEnabled = false;
150
        bool imageEnabled = true;
151
        bool dialogVisible = false;
152
        Vec3f imageAxesColor = Vec3f(0,0,0);
153
        Vec3f pointMarkerColor = Vec3f(0,0,0);
154
        Vec3f selectedPointMarkerColor = Vec3f(0,0,0);
155
        Vec3f projectionCenterMarkerColor = Vec3f(0,0,0);
156
};
157

158

159
#include <QObject>
160
#include "StelPluginInterface.hpp"
161

162
class LensDistortionEstimatorStelPluginInterface : public QObject, public StelPluginInterface
163
{
164
        Q_OBJECT
165
        Q_PLUGIN_METADATA(IID StelPluginInterface_iid)
166
        Q_INTERFACES(StelPluginInterface)
167
public:
168
        StelModule* getStelModule() const override;
169
        StelPluginInfo getPluginInfo() const override;
170
};
171

172
#endif
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