2021-01-13 15:51:38 -05:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Copyright (C) 2021 Jon Beniston, M7RCE //
|
|
|
|
// Copyright (C) 2020 Edouard Griffiths, F4EXB //
|
|
|
|
// //
|
|
|
|
// This program is free software; you can redistribute it and/or modify //
|
|
|
|
// it under the terms of the GNU General Public License as published by //
|
|
|
|
// the Free Software Foundation as version 3 of the License, or //
|
|
|
|
// (at your option) any later version. //
|
|
|
|
// //
|
|
|
|
// This program is distributed in the hope that it will be useful, //
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
|
|
|
// GNU General Public License V3 for more details. //
|
|
|
|
// //
|
|
|
|
// You should have received a copy of the GNU General Public License //
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef INCLUDE_FEATURE_STARTRACKERGUI_H_
|
|
|
|
#define INCLUDE_FEATURE_STARTRACKERGUI_H_
|
|
|
|
|
|
|
|
#include <QTimer>
|
|
|
|
#include <QtCharts>
|
2021-01-22 11:58:24 -05:00
|
|
|
#include <QNetworkRequest>
|
2021-01-29 07:57:58 -05:00
|
|
|
#include <QImage>
|
|
|
|
#include <QProgressDialog>
|
2021-01-13 15:51:38 -05:00
|
|
|
|
|
|
|
#include "feature/featuregui.h"
|
|
|
|
#include "util/messagequeue.h"
|
2021-01-29 07:57:58 -05:00
|
|
|
#include "util/fits.h"
|
|
|
|
#include "gui/httpdownloadmanagergui.h"
|
2022-01-08 23:27:12 -05:00
|
|
|
#include "settings/rollupstate.h"
|
|
|
|
|
2021-01-13 15:51:38 -05:00
|
|
|
#include "startrackersettings.h"
|
|
|
|
|
|
|
|
class PluginAPI;
|
|
|
|
class FeatureUISet;
|
|
|
|
class StarTracker;
|
2021-01-22 11:58:24 -05:00
|
|
|
class QNetworkAccessManager;
|
|
|
|
class QNetworkReply;
|
2021-06-25 08:00:59 -04:00
|
|
|
class GraphicsViewZoom;
|
|
|
|
class QGraphicsPixmapItem;
|
2021-01-13 15:51:38 -05:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class StarTrackerGUI;
|
|
|
|
}
|
|
|
|
|
2022-11-17 09:36:12 -05:00
|
|
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
2021-01-13 15:51:38 -05:00
|
|
|
using namespace QtCharts;
|
2022-11-17 09:36:12 -05:00
|
|
|
#endif
|
2021-01-13 15:51:38 -05:00
|
|
|
|
|
|
|
class StarTrackerGUI : public FeatureGUI {
|
|
|
|
Q_OBJECT
|
2021-10-12 06:07:56 -04:00
|
|
|
|
|
|
|
struct LoSMarker {
|
|
|
|
QString m_name;
|
|
|
|
float m_l;
|
|
|
|
float m_b;
|
|
|
|
float m_d;
|
|
|
|
QGraphicsTextItem* m_text;
|
|
|
|
};
|
|
|
|
|
2021-01-13 15:51:38 -05:00
|
|
|
public:
|
|
|
|
static StarTrackerGUI* create(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *feature);
|
|
|
|
virtual void destroy();
|
|
|
|
|
|
|
|
void resetToDefaults();
|
|
|
|
QByteArray serialize() const;
|
|
|
|
bool deserialize(const QByteArray& data);
|
|
|
|
virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
|
2022-05-13 16:24:48 -04:00
|
|
|
virtual void setWorkspaceIndex(int index);
|
2022-04-05 10:26:57 -04:00
|
|
|
virtual int getWorkspaceIndex() const { return m_settings.m_workspaceIndex; }
|
|
|
|
virtual void setGeometryBytes(const QByteArray& blob) { m_settings.m_geometryBytes = blob; }
|
|
|
|
virtual QByteArray getGeometryBytes() const { return m_settings.m_geometryBytes; }
|
2021-01-13 15:51:38 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
Ui::StarTrackerGUI* ui;
|
|
|
|
PluginAPI* m_pluginAPI;
|
|
|
|
FeatureUISet* m_featureUISet;
|
|
|
|
StarTrackerSettings m_settings;
|
2022-11-30 01:21:59 -05:00
|
|
|
QList<QString> m_settingsKeys;
|
2022-01-08 23:27:12 -05:00
|
|
|
RollupState m_rollupState;
|
2021-01-13 15:51:38 -05:00
|
|
|
bool m_doApplySettings;
|
2023-08-26 09:41:57 -04:00
|
|
|
bool m_doPlotChart;
|
2021-01-13 15:51:38 -05:00
|
|
|
|
|
|
|
StarTracker* m_starTracker;
|
|
|
|
MessageQueue m_inputMessageQueue;
|
|
|
|
QTimer m_statusTimer;
|
2021-01-22 11:58:24 -05:00
|
|
|
QTimer m_solarFluxTimer;
|
2021-01-13 15:51:38 -05:00
|
|
|
int m_lastFeatureState;
|
|
|
|
|
2021-02-26 15:33:39 -05:00
|
|
|
QChart *m_azElLineChart;
|
|
|
|
QPolarChart *m_azElPolarChart;
|
2023-04-03 11:53:51 -04:00
|
|
|
QTimer m_redrawTimer;
|
2021-02-26 15:33:39 -05:00
|
|
|
|
2021-01-13 15:51:38 -05:00
|
|
|
QChart m_chart;
|
|
|
|
QDateTimeAxis m_chartXAxis;
|
|
|
|
QValueAxis m_chartYAxis;
|
|
|
|
|
2021-01-29 07:57:58 -05:00
|
|
|
QCategoryAxis m_skyTempGalacticLXAxis;
|
|
|
|
QCategoryAxis m_skyTempRAXAxis;
|
|
|
|
QValueAxis m_skyTempYAxis;
|
|
|
|
|
2021-10-12 06:07:56 -04:00
|
|
|
QChart *m_solarFluxChart;
|
2021-01-29 07:57:58 -05:00
|
|
|
|
2021-01-22 11:58:24 -05:00
|
|
|
QNetworkAccessManager *m_networkManager;
|
|
|
|
QNetworkRequest m_networkRequest;
|
2021-01-29 07:57:58 -05:00
|
|
|
HttpDownloadManagerGUI m_dlm;
|
|
|
|
|
2021-06-25 08:00:59 -04:00
|
|
|
// Solar flux plot
|
2021-01-29 07:57:58 -05:00
|
|
|
double m_solarFlux; // 10.7cm/2800MHz
|
|
|
|
bool m_solarFluxesValid;
|
|
|
|
int m_solarFluxes[8]; // Frequency (MHz), flux density (sfu)
|
|
|
|
const int m_solarFluxFrequencies[8] = {245, 410, 610, 1415, 2695, 4995, 8800, 15400};
|
|
|
|
|
2021-06-25 08:00:59 -04:00
|
|
|
// Sky temperature
|
2021-01-29 07:57:58 -05:00
|
|
|
QList<QImage> m_images;
|
2021-01-22 11:58:24 -05:00
|
|
|
|
2021-06-25 08:00:59 -04:00
|
|
|
// Galactic line of sight
|
|
|
|
QList<QPixmap> m_milkyWayImages;
|
|
|
|
GraphicsViewZoom* m_zoom;
|
|
|
|
QList<QGraphicsPixmapItem *> m_milkyWayItems;
|
|
|
|
QGraphicsLineItem* m_lineOfSight;
|
2021-10-12 06:07:56 -04:00
|
|
|
QList<LoSMarker *> m_lineOfSightMarkers;
|
|
|
|
|
|
|
|
// Images that are part of the animation
|
|
|
|
QList<QImage> m_animationImages;
|
|
|
|
|
|
|
|
// Sun and Moon position for drawing on Sky Temperature chart
|
|
|
|
double m_sunRA;
|
|
|
|
double m_sunDec;
|
|
|
|
double m_moonRA;
|
|
|
|
double m_moonDec;
|
2021-06-25 08:00:59 -04:00
|
|
|
|
2021-01-13 15:51:38 -05:00
|
|
|
explicit StarTrackerGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *feature, QWidget* parent = nullptr);
|
|
|
|
virtual ~StarTrackerGUI();
|
|
|
|
|
|
|
|
void blockApplySettings(bool block);
|
2023-08-26 09:41:57 -04:00
|
|
|
void blockPlotChart();
|
|
|
|
void unblockPlotChartAndPlot();
|
2021-01-13 15:51:38 -05:00
|
|
|
void applySettings(bool force = false);
|
|
|
|
void displaySettings();
|
|
|
|
void updateForTarget();
|
|
|
|
bool handleMessage(const Message& message);
|
|
|
|
void updateLST();
|
2021-05-24 07:34:38 -04:00
|
|
|
void mapRaDec(double ra, double dec, bool galactic, double& x, double& y);
|
|
|
|
QList<QLineSeries*> createDriftScan(bool galactic);
|
|
|
|
QColor getSeriesColor(int series);
|
2021-02-26 15:33:39 -05:00
|
|
|
void plotElevationLineChart();
|
|
|
|
void plotElevationPolarChart();
|
2021-01-29 07:57:58 -05:00
|
|
|
void plotSkyTemperatureChart();
|
|
|
|
void plotSolarFluxChart();
|
2021-06-25 08:00:59 -04:00
|
|
|
void plotGalacticLineOfSight();
|
|
|
|
void createGalacticLineOfSightScene();
|
2021-10-12 06:07:56 -04:00
|
|
|
void plotGalacticMarker(LoSMarker* marker);
|
2021-01-13 15:51:38 -05:00
|
|
|
void plotChart();
|
2021-01-29 07:57:58 -05:00
|
|
|
void removeAllAxes();
|
|
|
|
double convertSolarFluxUnits(double sfu);
|
|
|
|
QString solarFluxUnit();
|
2021-10-12 06:07:56 -04:00
|
|
|
double calcSolarFlux(double freqMhz);
|
2021-01-22 11:58:24 -05:00
|
|
|
void displaySolarFlux();
|
2021-01-29 12:00:56 -05:00
|
|
|
QString getSolarFluxFilename();
|
2021-01-29 07:57:58 -05:00
|
|
|
bool readSolarFlux();
|
|
|
|
void raDecChanged();
|
|
|
|
void updateChartSubSelect();
|
|
|
|
void updateSolarFlux(bool all);
|
2022-04-04 04:23:52 -04:00
|
|
|
void makeUIConnections();
|
2023-04-03 11:53:51 -04:00
|
|
|
void limitAzElRange(double& azimuth, double& elevation) const;
|
2023-05-23 17:32:26 -04:00
|
|
|
void updateSatelliteTrackerList(const QList<StarTrackerSettings::AvailableFeature>& satelliteTrackers);
|
2021-01-13 15:51:38 -05:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void onMenuDialogCalled(const QPoint &p);
|
|
|
|
void onWidgetRolled(QWidget* widget, bool rollDown);
|
|
|
|
void handleInputMessages();
|
|
|
|
void on_startStop_toggled(bool checked);
|
2021-10-12 06:07:56 -04:00
|
|
|
void on_link_clicked(bool checked=false);
|
2021-01-13 15:51:38 -05:00
|
|
|
void on_useMyPosition_clicked(bool checked=false);
|
|
|
|
void on_latitude_valueChanged(double value);
|
|
|
|
void on_longitude_valueChanged(double value);
|
|
|
|
void on_rightAscension_editingFinished();
|
|
|
|
void on_declination_editingFinished();
|
2021-05-24 07:34:38 -04:00
|
|
|
void on_azimuth_valueChanged(double value);
|
|
|
|
void on_elevation_valueChanged(double value);
|
2021-10-12 06:07:56 -04:00
|
|
|
void on_azimuthOffset_valueChanged(double value);
|
|
|
|
void on_elevationOffset_valueChanged(double value);
|
|
|
|
void on_galacticLatitude_valueChanged(double value);
|
|
|
|
void on_galacticLongitude_valueChanged(double value);
|
2021-01-29 07:57:58 -05:00
|
|
|
void on_frequency_valueChanged(int value);
|
|
|
|
void on_beamwidth_valueChanged(double value);
|
2021-01-13 15:51:38 -05:00
|
|
|
void on_target_currentTextChanged(const QString &text);
|
|
|
|
void on_displaySettings_clicked();
|
|
|
|
void on_dateTimeSelect_currentTextChanged(const QString &text);
|
|
|
|
void on_dateTime_dateTimeChanged(const QDateTime &datetime);
|
|
|
|
void updateStatus();
|
|
|
|
void on_viewOnMap_clicked();
|
2021-01-29 07:57:58 -05:00
|
|
|
void on_chartSelect_currentIndexChanged(int index);
|
|
|
|
void on_chartSubSelect_currentIndexChanged(int index);
|
|
|
|
void plotAreaChanged(const QRectF &plotArea);
|
|
|
|
void autoUpdateSolarFlux();
|
|
|
|
void on_downloadSolarFlux_clicked();
|
2021-04-19 20:27:43 -04:00
|
|
|
void on_darkTheme_clicked(bool checked);
|
2021-06-25 08:00:59 -04:00
|
|
|
void on_zoomIn_clicked();
|
|
|
|
void on_zoomOut_clicked();
|
2021-10-12 06:07:56 -04:00
|
|
|
void on_addAnimationFrame_clicked();
|
|
|
|
void on_clearAnimation_clicked();
|
|
|
|
void on_saveAnimation_clicked();
|
|
|
|
void on_drawSun_clicked(bool checked);
|
|
|
|
void on_drawMoon_clicked(bool checked);
|
2021-01-22 11:58:24 -05:00
|
|
|
void networkManagerFinished(QNetworkReply *reply);
|
2021-01-29 07:57:58 -05:00
|
|
|
void downloadFinished(const QString& filename, bool success);
|
2021-01-13 15:51:38 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // INCLUDE_FEATURE_STARTRACKERGUI_H_
|