1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

Add galactic line of slight plot and galactic coords to Star Tracker

This commit is contained in:
Jon Beniston 2021-06-25 13:00:59 +01:00
parent 40778f87ef
commit af21350b40
19 changed files with 675 additions and 246 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View File

@ -32,6 +32,7 @@ if(NOT SERVER_MODE)
startracker150mhz.qrc startracker150mhz.qrc
startracker408mhz.qrc startracker408mhz.qrc
startracker1420mhz.qrc startracker1420mhz.qrc
startrackermilkyway.qrc
) )
set(startracker_HEADERS set(startracker_HEADERS
${startracker_HEADERS} ${startracker_HEADERS}

View File

@ -3,11 +3,13 @@
<h2>Introduction</h2> <h2>Introduction</h2>
The Star Tracker feature plugin is for use in radio astronomy and EME (Earth-Moon-Earth) communication. The Star Tracker feature plugin is for use in radio astronomy and EME (Earth-Moon-Earth) communication.
It calculates the azimuth and elevation of celestial objects and can send them to the Rotator Controller or other plugins to point an antenna at that object.
It can plot drift scan paths in both equatorial and galactic charts. * It calculates the azimuth and elevation of celestial objects and can send them to the Rotator Controller or other plugins to point an antenna at that object.
The overhead position of the Sun, Moon and selected star can be displayed on the Map Feature. * It can plot drift scan paths in both equatorial and galactic charts.
It can display local Sidereal time, solar flux density and sky temperature. * The overhead position of the Sun, Moon and selected star can be displayed on the Map Feature.
The plugin can communicate with Stellarium, allowing Stellarium to control SDRangel as though it was a telescope and for the direction the antenna is pointing to be displayed in Stellarium. * It can display local Sidereal time, solar flux density and sky temperature.
* It can plot the line of sight through the Milky Way.
* The plugin can communicate with Stellarium, allowing Stellarium to control SDRangel as though it was a telescope and for the direction the antenna is pointing to be displayed in Stellarium.
<h2>Settings</h2> <h2>Settings</h2>
@ -128,6 +130,14 @@ When target is set to Custom Az/El, you specify the elevation in degrees of the
For all other target settings, this displays the calculated elevation (angle in degrees - 0 to horizon and 90 to zenith) to the object. For all other target settings, this displays the calculated elevation (angle in degrees - 0 to horizon and 90 to zenith) to the object.
<h3>18: b - Galactic latitude</h3>
Displays the calculated galactic latitude (angle in degrees, positive to the North of the galactic plane) to the object.
<h3>19: l - Galactic longitude</h3>
Displays the calculated galactic longitude (angle in degrees, Eastward from the galactic centre) to the object.
<h2>Plots</h2> <h2>Plots</h2>
<h3>Light or dark theme</h3> <h3>Light or dark theme</h3>
@ -150,7 +160,7 @@ The Solar flux vs frequency plot, shows the solar flux density data from the Lea
<h3>Sky temperature</h3> <h3>Sky temperature</h3>
![Star Tracker sky temperature](../../../doc/img/StarTracker_skytemp.png) ![Star Tracker sky temperature equatorial](../../../doc/img/StarTracker_skytemp.png) ![Star Tracker sky temperature galactic](../../../doc/img/StarTracker_skytemp_galactic.png)
Background sky temperature maps are available for display at 150MHz, 408MHz and 1420MHz, in both equatorial and galactic coordinates. Background sky temperature maps are available for display at 150MHz, 408MHz and 1420MHz, in both equatorial and galactic coordinates.
For these first six temperature maps, the temperature reported, which is in Kelvin, is for the single pixel corresponding to the target coordinates. For these first six temperature maps, the temperature reported, which is in Kelvin, is for the single pixel corresponding to the target coordinates.
@ -170,6 +180,19 @@ To setup a drift scan through a particular target object, first set the target (
You may want to set the Time (8) to Custom and a few hours in the future, so that the elevation is at a maximum when pointing at the target. You may want to set the Time (8) to Custom and a few hours in the future, so that the elevation is at a maximum when pointing at the target.
Then switch the target to Custom Az/El and Time back to Now, and the drift scan path that sweeps through the object will displayed. Then switch the target to Custom Az/El and Time back to Now, and the drift scan path that sweeps through the object will displayed.
<h3>Galactic line of sight</h3>
Displays a top down image of the Milky Way and draws a line from the Sun along the galactic longitude through the target object.
This can be useful to help identify spiral arms in hydrogen line observations.
![Galactic line of sight](../../../doc/img/StarTracker_milkyway.png)
Two images of the Milky Way are availble: a purely graphical image and one annotated with the names of the major spiral arms and a grid with distance and galactic longitude.
![Galactic line of sight](../../../doc/img/StarTracker_milkywayannotated.png)
The image can be zoomed in to or out from using the mouse wheel or the buttons. Hold CTRL to pan with the mouse wheel.
<h2>Map</h2> <h2>Map</h2>
The Star Tracker feature can send the overhead position of the Sun, Moon and target Star to the Map. These can be enabled individually in the settings dialog. The Moon should be displayed with an approximate phase. Stars (or galaxies) are displayed as an image of a pulsar. The Star Tracker feature can send the overhead position of the Sun, Moon and target Star to the Map. These can be enabled individually in the settings dialog. The Moon should be displayed with an approximate phase. Stars (or galaxies) are displayed as an image of a pulsar.
@ -216,6 +239,8 @@ Solar radio flux measurements at 245, 410, 610, 1415, 2695, 4995, 8800 and 15400
408MHz (Haslam) destriped (Platania) All Sky image and spectral index (Platania) from Strasbourg astronomical Data Center: http://cdsarc.u-strasbg.fr/viz-bin/cat/J/A+A/410/847 408MHz (Haslam) destriped (Platania) All Sky image and spectral index (Platania) from Strasbourg astronomical Data Center: http://cdsarc.u-strasbg.fr/viz-bin/cat/J/A+A/410/847
Milky Way image from NASA/JPL-Caltech: https://photojournal.jpl.nasa.gov/catalog/PIA10748
Icons are by Adnen Kadri and Erik Madsen, from the Noun Project Noun Project: https://thenounproject.com/ Icons are by Adnen Kadri and Erik Madsen, from the Noun Project Noun Project: https://thenounproject.com/
Icons are by Freepik from Flaticon https://www.flaticon.com/ Icons are by Freepik from Flaticon https://www.flaticon.com/

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

@ -23,6 +23,7 @@
#include <QRegExp> #include <QRegExp>
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
#include <QNetworkReply> #include <QNetworkReply>
#include <QGraphicsScene>
#include <QtCharts/QChartView> #include <QtCharts/QChartView>
#include <QtCharts/QLineSeries> #include <QtCharts/QLineSeries>
@ -33,6 +34,7 @@
#include "feature/featurewebapiutils.h" #include "feature/featurewebapiutils.h"
#include "gui/basicfeaturesettingsdialog.h" #include "gui/basicfeaturesettingsdialog.h"
#include "gui/dmsspinbox.h" #include "gui/dmsspinbox.h"
#include "gui/graphicsviewzoom.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "device/deviceuiset.h" #include "device/deviceuiset.h"
#include "util/units.h" #include "util/units.h"
@ -169,7 +171,9 @@ StarTrackerGUI::StarTrackerGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet,
m_temps{FITS(":/startracker/startracker/150mhz_ra_dec.fits"), m_temps{FITS(":/startracker/startracker/150mhz_ra_dec.fits"),
FITS(":/startracker/startracker/408mhz_ra_dec.fits"), FITS(":/startracker/startracker/408mhz_ra_dec.fits"),
FITS(":/startracker/startracker/1420mhz_ra_dec.fits")}, FITS(":/startracker/startracker/1420mhz_ra_dec.fits")},
m_spectralIndex(":/startracker/startracker/408mhz_ra_dec_spectral_index.fits") m_spectralIndex(":/startracker/startracker/408mhz_ra_dec_spectral_index.fits"),
m_milkyWayImages{QPixmap(":/startracker/startracker/milkyway.png"),
QPixmap(":/startracker/startracker/milkywayannotated.png")}
{ {
ui->setupUi(this); ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose, true); setAttribute(Qt::WA_DeleteOnClose, true);
@ -191,6 +195,12 @@ StarTrackerGUI::StarTrackerGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet,
connect(ui->azimuth, SIGNAL(valueChanged(double)), this, SLOT(on_azimuth_valueChanged(double))); connect(ui->azimuth, SIGNAL(valueChanged(double)), this, SLOT(on_azimuth_valueChanged(double)));
ui->azimuth->setRange(0, 360.0); ui->azimuth->setRange(0, 360.0);
ui->elevation->setRange(-90.0, 90.0); ui->elevation->setRange(-90.0, 90.0);
ui->galacticLongitude->setRange(0, 360.0);
ui->galacticLatitude->setRange(-90.0, 90.0);
ui->galacticLatitude->setButtonSymbols(QAbstractSpinBox::NoButtons);
ui->galacticLongitude->setButtonSymbols(QAbstractSpinBox::NoButtons);
ui->galacticLatitude->setText("");
ui->galacticLongitude->setText("");
// Intialise chart // Intialise chart
m_chart.legend()->hide(); m_chart.legend()->hide();
@ -280,6 +290,8 @@ StarTrackerGUI::StarTrackerGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet,
connect(&m_solarFluxTimer, SIGNAL(timeout()), this, SLOT(autoUpdateSolarFlux())); connect(&m_solarFluxTimer, SIGNAL(timeout()), this, SLOT(autoUpdateSolarFlux()));
m_solarFluxTimer.start(1000*60*60*24); // Update every 24hours m_solarFluxTimer.start(1000*60*60*24); // Update every 24hours
autoUpdateSolarFlux(); autoUpdateSolarFlux();
createGalacticLineOfSightScene();
} }
StarTrackerGUI::~StarTrackerGUI() StarTrackerGUI::~StarTrackerGUI()
@ -307,10 +319,13 @@ void StarTrackerGUI::displaySettings()
ui->target->setCurrentIndex(ui->target->findText(m_settings.m_target)); ui->target->setCurrentIndex(ui->target->findText(m_settings.m_target));
ui->azimuth->setUnits((DMSSpinBox::DisplayUnits)m_settings.m_azElUnits); ui->azimuth->setUnits((DMSSpinBox::DisplayUnits)m_settings.m_azElUnits);
ui->elevation->setUnits((DMSSpinBox::DisplayUnits)m_settings.m_azElUnits); ui->elevation->setUnits((DMSSpinBox::DisplayUnits)m_settings.m_azElUnits);
ui->galacticLatitude->setUnits((DMSSpinBox::DisplayUnits)m_settings.m_azElUnits);
ui->galacticLongitude->setUnits((DMSSpinBox::DisplayUnits)m_settings.m_azElUnits);
if (m_settings.m_target == "Custom RA/Dec") if (m_settings.m_target == "Custom RA/Dec")
{ {
ui->rightAscension->setText(m_settings.m_ra); ui->rightAscension->setText(m_settings.m_ra);
ui->declination->setText(m_settings.m_dec); ui->declination->setText(m_settings.m_dec);
updateGalacticCoords();
} }
else if (m_settings.m_target == "Custom Az/El") else if (m_settings.m_target == "Custom Az/El")
{ {
@ -401,10 +416,21 @@ void StarTrackerGUI::on_longitude_valueChanged(double value)
plotChart(); plotChart();
} }
void StarTrackerGUI::updateGalacticCoords()
{
float ra = Astronomy::raToDecimal(m_settings.m_ra);
float dec = Astronomy::decToDecimal(m_settings.m_dec);
double l, b;
Astronomy::equatorialToGalactic(ra, dec, l, b);
ui->galacticLatitude->setValue(b);
ui->galacticLongitude->setValue(l);
}
void StarTrackerGUI::on_rightAscension_editingFinished() void StarTrackerGUI::on_rightAscension_editingFinished()
{ {
m_settings.m_ra = ui->rightAscension->text(); m_settings.m_ra = ui->rightAscension->text();
applySettings(); applySettings();
updateGalacticCoords();
plotChart(); plotChart();
} }
@ -412,6 +438,7 @@ void StarTrackerGUI::on_declination_editingFinished()
{ {
m_settings.m_dec = ui->declination->text(); m_settings.m_dec = ui->declination->text();
applySettings(); applySettings();
updateGalacticCoords();
plotChart(); plotChart();
} }
@ -602,6 +629,8 @@ void StarTrackerGUI::on_displaySettings_clicked()
applySettings(); applySettings();
ui->elevation->setUnits((DMSSpinBox::DisplayUnits)m_settings.m_azElUnits); ui->elevation->setUnits((DMSSpinBox::DisplayUnits)m_settings.m_azElUnits);
ui->azimuth->setUnits((DMSSpinBox::DisplayUnits)m_settings.m_azElUnits); ui->azimuth->setUnits((DMSSpinBox::DisplayUnits)m_settings.m_azElUnits);
ui->galacticLatitude->setUnits((DMSSpinBox::DisplayUnits)m_settings.m_azElUnits);
ui->galacticLongitude->setUnits((DMSSpinBox::DisplayUnits)m_settings.m_azElUnits);
displaySolarFlux(); displaySolarFlux();
if (ui->chartSelect->currentIndex() == 1) if (ui->chartSelect->currentIndex() == 1)
plotChart(); plotChart();
@ -639,21 +668,34 @@ void StarTrackerGUI::plotChart()
{ {
if (ui->chartSelect->currentIndex() == 0) if (ui->chartSelect->currentIndex() == 0)
{ {
if (ui->chartSubSelect->currentIndex() == 0) if (ui->chartSubSelect->currentIndex() == 0) {
plotElevationLineChart(); plotElevationLineChart();
else } else {
plotElevationPolarChart(); plotElevationPolarChart();
}
} }
else if (ui->chartSelect->currentIndex() == 1) else if (ui->chartSelect->currentIndex() == 1)
{
plotSolarFluxChart(); plotSolarFluxChart();
}
else if (ui->chartSelect->currentIndex() == 2) else if (ui->chartSelect->currentIndex() == 2)
{
plotSkyTemperatureChart(); plotSkyTemperatureChart();
}
else if (ui->chartSelect->currentIndex() == 3)
{
plotGalacticLineOfSight();
}
} }
void StarTrackerGUI::raDecChanged() void StarTrackerGUI::raDecChanged()
{ {
if (ui->chartSelect->currentIndex() == 2) updateGalacticCoords();
if (ui->chartSelect->currentIndex() == 2) {
plotSkyTemperatureChart(); plotSkyTemperatureChart();
} else if (ui->chartSelect->currentIndex() == 3) {
plotGalacticLineOfSight();
}
} }
void StarTrackerGUI::on_frequency_valueChanged(int value) void StarTrackerGUI::on_frequency_valueChanged(int value)
@ -679,6 +721,12 @@ void StarTrackerGUI::on_beamwidth_valueChanged(double value)
void StarTrackerGUI::plotSolarFluxChart() void StarTrackerGUI::plotSolarFluxChart()
{ {
ui->chart->setVisible(true);
ui->image->setVisible(false);
ui->darkTheme->setVisible(true);
ui->zoomIn->setVisible(false);
ui->zoomOut->setVisible(false);
m_solarFluxChart.removeAllSeries(); m_solarFluxChart.removeAllSeries();
if (m_solarFluxesValid) if (m_solarFluxesValid)
{ {
@ -830,8 +878,91 @@ QColor StarTrackerGUI::getSeriesColor(int series)
} }
} }
void StarTrackerGUI::createGalacticLineOfSightScene()
{
m_zoom = new GraphicsViewZoom(ui->image); // Deleted automatically when view is deleted
QGraphicsScene *scene = new QGraphicsScene(ui->image);
scene->setBackgroundBrush(QBrush(Qt::black));
// Milkyway images
for (int i = 0; i < m_milkyWayImages.size(); i++)
{
m_milkyWayItems.append(scene->addPixmap(m_milkyWayImages[i]));
m_milkyWayItems[i]->setPos(0, 0);
m_milkyWayItems[i]->setVisible(i == 0);
}
// Line of sight
QPen pen(QColor(255, 0, 0), 4, Qt::SolidLine);
m_lineOfSight = scene->addLine(511, 708, 511, 708, pen);
ui->image->setScene(scene);
ui->image->show();
}
void StarTrackerGUI::plotGalacticLineOfSight()
{
if (!ui->image->isVisible())
{
// Start zoomed out
ui->image->fitInView(m_milkyWayItems[0], Qt::KeepAspectRatio);
}
// Draw top-down image of Milky Way
ui->chart->setVisible(false);
ui->image->setVisible(true);
ui->darkTheme->setVisible(false);
ui->zoomIn->setVisible(true);
ui->zoomOut->setVisible(true);
// Select which Milky Way image to show
int imageIdx = ui->chartSubSelect->currentIndex();
for (int i = 0; i < m_milkyWayItems.size(); i++) {
m_milkyWayItems[i]->setVisible(i == imageIdx);
}
// Calculate Galactic longitude we're observing
float ra = Astronomy::raToDecimal(m_settings.m_ra);
float dec = Astronomy::decToDecimal(m_settings.m_dec);
double l, b;
Astronomy::equatorialToGalactic(ra, dec, l, b);
//l = ui->azimuth->value(); // For testing, just use azimuth
// Calculate length of line, as Sun is not at centre
// we assume end point lies on an ellipse, with Sun at foci
// See https://en.wikipedia.org/wiki/Ellipse Polar form relative to focus
QPointF sun(511, 708); // Location of Sun on Milky Way image
float a = sun.x() - 112; // semi-major axis
float c = sun.y() - sun.x(); // linear eccentricity
float e = c / a; // eccentricity
float r = a * (1.0f - e*e) / (1.0f - e * cos(Units::degreesToRadians(l)));
// Draw line from Sun along observation galactic longitude
QTransform rotation = QTransform().translate(sun.x(), -sun.y()).rotate(l).translate(-sun.x(), sun.y()); // Flip Y
QPointF point = rotation.map(QPointF(511, -sun.y() + r));
m_lineOfSight->setLine(sun.x(), sun.y(), point.x(), -point.y());
}
void StarTrackerGUI::on_zoomIn_clicked()
{
m_zoom->gentleZoom(1.25);
}
void StarTrackerGUI::on_zoomOut_clicked()
{
m_zoom->gentleZoom(0.75);
}
void StarTrackerGUI::plotSkyTemperatureChart() void StarTrackerGUI::plotSkyTemperatureChart()
{ {
ui->chart->setVisible(true);
ui->image->setVisible(false);
ui->darkTheme->setVisible(false);
ui->zoomIn->setVisible(false);
ui->zoomOut->setVisible(false);
bool galactic = (ui->chartSubSelect->currentIndex() & 1) == 1; bool galactic = (ui->chartSubSelect->currentIndex() & 1) == 1;
m_chart.removeAllSeries(); m_chart.removeAllSeries();
@ -1072,10 +1203,13 @@ void StarTrackerGUI::plotAreaChanged(const QRectF &plotArea)
// Scale the image to fit plot area // Scale the image to fit plot area
int imageIdx = ui->chartSubSelect->currentIndex(); int imageIdx = ui->chartSubSelect->currentIndex();
if (imageIdx == 6) if (imageIdx == -1) {
return;
} else if (imageIdx == 6) {
imageIdx = 2; imageIdx = 2;
else if (imageIdx == 7) } else if (imageIdx == 7) {
imageIdx = 3; imageIdx = 3;
}
QImage image = m_images[imageIdx].scaled(QSize(width, height), Qt::IgnoreAspectRatio); QImage image = m_images[imageIdx].scaled(QSize(width, height), Qt::IgnoreAspectRatio);
QImage translated(viewW, viewH, QImage::Format_ARGB32); QImage translated(viewW, viewH, QImage::Format_ARGB32);
translated.fill(Qt::white); translated.fill(Qt::white);
@ -1100,6 +1234,12 @@ void StarTrackerGUI::removeAllAxes()
// Plot target elevation angle over the day // Plot target elevation angle over the day
void StarTrackerGUI::plotElevationLineChart() void StarTrackerGUI::plotElevationLineChart()
{ {
ui->chart->setVisible(true);
ui->image->setVisible(false);
ui->darkTheme->setVisible(true);
ui->zoomIn->setVisible(false);
ui->zoomOut->setVisible(false);
QChart *oldChart = m_azElLineChart; QChart *oldChart = m_azElLineChart;
m_azElLineChart = new QChart(); m_azElLineChart = new QChart();
@ -1217,6 +1357,12 @@ void StarTrackerGUI::plotElevationLineChart()
// Plot target elevation angle over the day // Plot target elevation angle over the day
void StarTrackerGUI::plotElevationPolarChart() void StarTrackerGUI::plotElevationPolarChart()
{ {
ui->chart->setVisible(true);
ui->image->setVisible(false);
ui->darkTheme->setVisible(true);
ui->zoomIn->setVisible(false);
ui->zoomOut->setVisible(false);
QChart *oldChart = m_azElPolarChart; QChart *oldChart = m_azElPolarChart;
m_azElPolarChart = new QPolarChart(); m_azElPolarChart = new QPolarChart();
@ -1448,6 +1594,11 @@ void StarTrackerGUI::on_chartSelect_currentIndexChanged(int index)
ui->chartSubSelect->setCurrentIndex(2); ui->chartSubSelect->setCurrentIndex(2);
updateChartSubSelect(); updateChartSubSelect();
} }
else if (index == 3)
{
ui->chartSubSelect->addItem("Milky Way");
ui->chartSubSelect->addItem("Milky Way annotated");
}
ui->chartSubSelect->blockSignals(oldState); ui->chartSubSelect->blockSignals(oldState);
plotChart(); plotChart();
} }

View File

@ -36,6 +36,8 @@ class FeatureUISet;
class StarTracker; class StarTracker;
class QNetworkAccessManager; class QNetworkAccessManager;
class QNetworkReply; class QNetworkReply;
class GraphicsViewZoom;
class QGraphicsPixmapItem;
namespace Ui { namespace Ui {
class StarTrackerGUI; class StarTrackerGUI;
@ -86,15 +88,23 @@ private:
QNetworkRequest m_networkRequest; QNetworkRequest m_networkRequest;
HttpDownloadManagerGUI m_dlm; HttpDownloadManagerGUI m_dlm;
// Solar flux plot
double m_solarFlux; // 10.7cm/2800MHz double m_solarFlux; // 10.7cm/2800MHz
bool m_solarFluxesValid; bool m_solarFluxesValid;
int m_solarFluxes[8]; // Frequency (MHz), flux density (sfu) int m_solarFluxes[8]; // Frequency (MHz), flux density (sfu)
const int m_solarFluxFrequencies[8] = {245, 410, 610, 1415, 2695, 4995, 8800, 15400}; const int m_solarFluxFrequencies[8] = {245, 410, 610, 1415, 2695, 4995, 8800, 15400};
// Sky temperature
QList<QImage> m_images; QList<QImage> m_images;
QList<FITS> m_temps; QList<FITS> m_temps;
FITS m_spectralIndex; FITS m_spectralIndex;
// Galactic line of sight
QList<QPixmap> m_milkyWayImages;
GraphicsViewZoom* m_zoom;
QList<QGraphicsPixmapItem *> m_milkyWayItems;
QGraphicsLineItem* m_lineOfSight;
explicit StarTrackerGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *feature, QWidget* parent = nullptr); explicit StarTrackerGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *feature, QWidget* parent = nullptr);
virtual ~StarTrackerGUI(); virtual ~StarTrackerGUI();
@ -111,6 +121,8 @@ private:
void plotElevationPolarChart(); void plotElevationPolarChart();
void plotSkyTemperatureChart(); void plotSkyTemperatureChart();
void plotSolarFluxChart(); void plotSolarFluxChart();
void plotGalacticLineOfSight();
void createGalacticLineOfSightScene();
void plotChart(); void plotChart();
void removeAllAxes(); void removeAllAxes();
double convertSolarFluxUnits(double sfu); double convertSolarFluxUnits(double sfu);
@ -121,6 +133,7 @@ private:
void raDecChanged(); void raDecChanged();
void updateChartSubSelect(); void updateChartSubSelect();
void updateSolarFlux(bool all); void updateSolarFlux(bool all);
void updateGalacticCoords();
void leaveEvent(QEvent*); void leaveEvent(QEvent*);
void enterEvent(QEvent*); void enterEvent(QEvent*);
@ -151,6 +164,8 @@ private slots:
void autoUpdateSolarFlux(); void autoUpdateSolarFlux();
void on_downloadSolarFlux_clicked(); void on_downloadSolarFlux_clicked();
void on_darkTheme_clicked(bool checked); void on_darkTheme_clicked(bool checked);
void on_zoomIn_clicked();
void on_zoomOut_clicked();
void networkManagerFinished(QNetworkReply *reply); void networkManagerFinished(QNetworkReply *reply);
void downloadFinished(const QString& filename, bool success); void downloadFinished(const QString& filename, bool success);
}; };

View File

@ -67,44 +67,15 @@
</property> </property>
<item> <item>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="6" column="2"> <item row="7" column="1">
<widget class="QLabel" name="beamwidthLabel"> <widget class="QLineEdit" name="rightAscension">
<property name="text">
<string>Beamwidth</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="timeLabel">
<property name="text">
<string>Time</string>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QLabel" name="declinationLabel">
<property name="text">
<string>Dec</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QSpinBox" name="frequency">
<property name="toolTip"> <property name="toolTip">
<string>Observation frequency (MHz)</string> <string>Right Ascension of the target object.
This can be specified as a decimal (E.g. 12.23) or in hours, minutes and seconds (E.g. 12h05m10.2s or 12 05 10.2)</string>
</property> </property>
<property name="minimum">
<number>50</number>
</property>
<property name="maximum">
<number>100000</number>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="azimuthtLabel">
<property name="text"> <property name="text">
<string>Azimuth</string> <string>23h59m59.59s</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -115,153 +86,43 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="2" column="2">
<widget class="QLabel" name="lstLabel"> <widget class="QLabel" name="longitudeLabel">
<property name="text"> <property name="text">
<string>LST</string> <string>Longitude</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="2"> <item row="2" column="0">
<widget class="QLabel" name="elevationLabel"> <widget class="QLabel" name="latitudeLabel">
<property name="text"> <property name="text">
<string>Elevation</string> <string>Latitude</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0" colspan="4"> <item row="6" column="2">
<layout class="QHBoxLayout" name="buttonLayout"> <widget class="QLabel" name="beamwidthLabel">
<item>
<widget class="ButtonSwitch" name="startStop">
<property name="toolTip">
<string>Start/stop tracking</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/play.png</normaloff>
<normalon>:/stop.png</normalon>:/play.png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="viewOnMap">
<property name="toolTip">
<string>Find target on the map</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/gridpolar.png</normaloff>:/gridpolar.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="downloadSolarFlux">
<property name="toolTip">
<string>Download Solar flux density data</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="startracker.qrc">
<normaloff>:/startracker/startracker/sun-button-24.png</normaloff>:/startracker/startracker/sun-button-24.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="useMyPosition">
<property name="toolTip">
<string>Set latitude, longitude and height from My Position in SDRangel preferences</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/import.png</normaloff>:/import.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="displaySettings">
<property name="toolTip">
<string>Show settings dialog</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/listing.png</normaloff>:/listing.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item row="8" column="3">
<widget class="DMSSpinBox" name="elevation" native="true">
<property name="toolTip">
<string>Elevation in degrees to the target from the observation point</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="lst">
<property name="toolTip">
<string>Local sidereal time for selected date, time and longitude</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="3">
<widget class="QLineEdit" name="declination">
<property name="toolTip">
<string>Declination of the target object
This can be specified as a decimal (E.g. 34.23) or in degrees, minutes and seconds (E.g. 34d12m10.2s, 34d12'10.2&quot; 34 12 10.2)</string>
</property>
<property name="text"> <property name="text">
<string>-90d59'59.59&quot;</string> <string>Beamwidth</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="3"> <item row="2" column="1">
<widget class="QDoubleSpinBox" name="beamwidth"> <widget class="QDoubleSpinBox" name="latitude">
<property name="toolTip"> <property name="toolTip">
<string>Antenna half power (-3dB) beamwidth (degrees)</string> <string>Latitude in decimal degrees (North positive) of observation point / antenna location</string>
</property> </property>
<property name="decimals"> <property name="decimals">
<number>0</number> <number>6</number>
</property> </property>
<property name="minimum"> <property name="minimum">
<double>1.000000000000000</double> <double>-90.000000000000000</double>
</property> </property>
<property name="maximum"> <property name="maximum">
<double>360.000000000000000</double> <double>90.000000000000000</double>
</property> </property>
<property name="value"> <property name="value">
<double>25.000000000000000</double> <double>-90.000000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
@ -353,34 +214,13 @@ This can be specified as a decimal (E.g. 34.23) or in degrees, minutes and secon
</item> </item>
</layout> </layout>
</item> </item>
<item row="3" column="1"> <item row="4" column="1">
<widget class="QComboBox" name="dateTimeSelect"> <widget class="QLineEdit" name="lst">
<property name="toolTip"> <property name="toolTip">
<string>Select time to calculate target's position at</string> <string>Local sidereal time for selected date, time and longitude</string>
</property> </property>
<item> <property name="readOnly">
<property name="text"> <bool>true</bool>
<string>Now</string>
</property>
</item>
<item>
<property name="text">
<string>Custom</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="latitudeLabel">
<property name="text">
<string>Latitude</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="frequencyLabel">
<property name="text">
<string>Frequency</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -397,39 +237,10 @@ This can be specified as a decimal (E.g. 34.23) or in degrees, minutes and secon
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="3"> <item row="8" column="3">
<widget class="QLineEdit" name="solarFlux"> <widget class="DMSSpinBox" name="elevation" native="true">
<property name="toolTip"> <property name="toolTip">
<string>Solar flux density</string> <string>Elevation in degrees to the target from the observation point</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="targetLabel">
<property name="text">
<string>Target</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLineEdit" name="rightAscension">
<property name="toolTip">
<string>Right Ascension of the target object.
This can be specified as a decimal (E.g. 12.23) or in hours, minutes and seconds (E.g. 12h05m10.2s or 12 05 10.2)</string>
</property>
<property name="text">
<string>23h59m59.59s</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="longitudeLabel">
<property name="text">
<string>Longitude</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -452,29 +263,159 @@ This can be specified as a decimal (E.g. 12.23) or in hours, minutes and seconds
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="2"> <item row="6" column="0">
<widget class="QLabel" name="solarFluxLabel"> <widget class="QLabel" name="frequencyLabel">
<property name="text"> <property name="text">
<string>Solar Flux</string> <string>Frequency</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="6" column="1">
<widget class="QDoubleSpinBox" name="latitude"> <widget class="QSpinBox" name="frequency">
<property name="toolTip"> <property name="toolTip">
<string>Latitude in decimal degrees (North positive) of observation point / antenna location</string> <string>Observation frequency (MHz)</string>
</property>
<property name="decimals">
<number>6</number>
</property> </property>
<property name="minimum"> <property name="minimum">
<double>-90.000000000000000</double> <number>50</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<double>90.000000000000000</double> <number>100000</number>
</property> </property>
<property name="value"> </widget>
<double>-90.000000000000000</double> </item>
<item row="4" column="0">
<widget class="QLabel" name="lstLabel">
<property name="text">
<string>LST</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="targetLabel">
<property name="text">
<string>Target</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="azimuthtLabel">
<property name="text">
<string>Azimuth</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="4">
<layout class="QHBoxLayout" name="buttonLayout">
<item>
<widget class="ButtonSwitch" name="startStop">
<property name="toolTip">
<string>Start/stop tracking</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/play.png</normaloff>
<normalon>:/stop.png</normalon>:/play.png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="viewOnMap">
<property name="toolTip">
<string>Find target on the map</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/gridpolar.png</normaloff>:/gridpolar.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="downloadSolarFlux">
<property name="toolTip">
<string>Download Solar flux density data</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="startracker.qrc">
<normaloff>:/startracker/startracker/sun-button-24.png</normaloff>:/startracker/startracker/sun-button-24.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="useMyPosition">
<property name="toolTip">
<string>Set latitude, longitude and height from My Position in SDRangel preferences</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/import.png</normaloff>:/import.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="displaySettings">
<property name="toolTip">
<string>Show settings dialog</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/listing.png</normaloff>:/listing.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="dateTimeSelect">
<property name="toolTip">
<string>Select time to calculate target's position at</string>
</property>
<item>
<property name="text">
<string>Now</string>
</property>
</item>
<item>
<property name="text">
<string>Custom</string>
</property>
</item>
</widget>
</item>
<item row="4" column="3">
<widget class="QLineEdit" name="solarFlux">
<property name="toolTip">
<string>Solar flux density</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
@ -485,6 +426,107 @@ This can be specified as a decimal (E.g. 12.23) or in hours, minutes and seconds
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="3">
<widget class="QDoubleSpinBox" name="beamwidth">
<property name="toolTip">
<string>Antenna half power (-3dB) beamwidth (degrees)</string>
</property>
<property name="decimals">
<number>0</number>
</property>
<property name="minimum">
<double>1.000000000000000</double>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>
<property name="value">
<double>25.000000000000000</double>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QLabel" name="declinationLabel">
<property name="text">
<string>Dec</string>
</property>
</widget>
</item>
<item row="7" column="3">
<widget class="QLineEdit" name="declination">
<property name="toolTip">
<string>Declination of the target object
This can be specified as a decimal (E.g. 34.23) or in degrees, minutes and seconds (E.g. 34d12m10.2s, 34d12'10.2&quot; 34 12 10.2)</string>
</property>
<property name="text">
<string>-90d59'59.59&quot;</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QLabel" name="solarFluxLabel">
<property name="text">
<string>Solar Flux</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="timeLabel">
<property name="text">
<string>Time</string>
</property>
</widget>
</item>
<item row="8" column="2">
<widget class="QLabel" name="elevationLabel">
<property name="text">
<string>Elevation</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="galacticLatitudeLabel">
<property name="font">
<font>
<family>Liberation Sans</family>
<pointsize>9</pointsize>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>b</string>
</property>
</widget>
</item>
<item row="9" column="2">
<widget class="QLabel" name="galacticLongitudeLabel">
<property name="font">
<font>
<family>Liberation Sans</family>
<pointsize>9</pointsize>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>l</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="DMSSpinBox" name="galacticLatitude" native="true">
<property name="toolTip">
<string>Galactic latitude in degrees</string>
</property>
</widget>
</item>
<item row="9" column="3">
<widget class="DMSSpinBox" name="galacticLongitude" native="true">
<property name="toolTip">
<string>Galactic longitude in degrees (positive Eastward from galactic center)</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>
@ -493,7 +535,7 @@ This can be specified as a decimal (E.g. 12.23) or in hours, minutes and seconds
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>10</x>
<y>220</y> <y>250</y>
<width>318</width> <width>318</width>
<height>268</height> <height>268</height>
</rect> </rect>
@ -513,7 +555,7 @@ This can be specified as a decimal (E.g. 12.23) or in hours, minutes and seconds
<property name="windowTitle"> <property name="windowTitle">
<string>Plots</string> <string>Plots</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0"> <layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0,0">
<property name="spacing"> <property name="spacing">
<number>2</number> <number>2</number>
</property> </property>
@ -551,6 +593,11 @@ This can be specified as a decimal (E.g. 12.23) or in hours, minutes and seconds
<string>Sky temperature</string> <string>Sky temperature</string>
</property> </property>
</item> </item>
<item>
<property name="text">
<string>Galactic line of sight</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item> <item>
@ -574,6 +621,40 @@ This can be specified as a decimal (E.g. 12.23) or in hours, minutes and seconds
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QToolButton" name="zoomIn">
<property name="toolTip">
<string>Zoom in</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/zoomin.png</normaloff>:/zoomin.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="zoomOut">
<property name="toolTip">
<string>Zoom out</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/zoomout.png</normaloff>:/zoomout.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>
@ -586,6 +667,16 @@ This can be specified as a decimal (E.g. 12.23) or in hours, minutes and seconds
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QGraphicsView" name="image">
<property name="minimumSize">
<size>
<width>300</width>
<height>250</height>
</size>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>
@ -638,7 +729,10 @@ This can be specified as a decimal (E.g. 12.23) or in hours, minutes and seconds
<tabstop>chartSelect</tabstop> <tabstop>chartSelect</tabstop>
<tabstop>chartSubSelect</tabstop> <tabstop>chartSubSelect</tabstop>
<tabstop>darkTheme</tabstop> <tabstop>darkTheme</tabstop>
<tabstop>zoomIn</tabstop>
<tabstop>zoomOut</tabstop>
<tabstop>chart</tabstop> <tabstop>chart</tabstop>
<tabstop>image</tabstop>
</tabstops> </tabstops>
<resources> <resources>
<include location="../../../sdrgui/resources/res.qrc"/> <include location="../../../sdrgui/resources/res.qrc"/>

View File

@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/startracker/">
<file>startracker/milkyway.png</file>
<file>startracker/milkywayannotated.png</file>
</qresource>
</RCC>

View File

@ -45,6 +45,7 @@ set(sdrgui_SOURCES
gui/glshadertvarray.cpp gui/glshadertvarray.cpp
gui/glspectrum.cpp gui/glspectrum.cpp
gui/glspectrumgui.cpp gui/glspectrumgui.cpp
gui/graphicsviewzoom.cpp
gui/httpdownloadmanagergui.cpp gui/httpdownloadmanagergui.cpp
gui/indicator.cpp gui/indicator.cpp
gui/levelmeter.cpp gui/levelmeter.cpp
@ -131,6 +132,7 @@ set(sdrgui_HEADERS
gui/glshadertextured.h gui/glshadertextured.h
gui/glspectrum.h gui/glspectrum.h
gui/glspectrumgui.h gui/glspectrumgui.h
gui/graphicsviewzoom.h
gui/httpdownloadmanagergui.h gui/httpdownloadmanagergui.h
gui/indicator.h gui/indicator.h
gui/levelmeter.h gui/levelmeter.h

View File

@ -0,0 +1,85 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2021 Jon Beniston, M7RCE //
// //
// 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/>. //
///////////////////////////////////////////////////////////////////////////////////
#include <QMouseEvent>
#include <QApplication>
#include <QScrollBar>
#include <qmath.h>
#include "graphicsviewzoom.h"
GraphicsViewZoom::GraphicsViewZoom(QGraphicsView* view) :
QObject(view),
m_view(view),
m_modifiers(Qt::NoModifier),
m_zoomFactorBase(1.0015)
{
m_view->viewport()->installEventFilter(this);
m_view->setMouseTracking(true);
}
void GraphicsViewZoom::gentleZoom(double factor)
{
m_view->scale(factor, factor);
m_view->centerOn(m_targetScenePos);
QPointF deltaViewportPos = m_targetViewportPos - QPointF(m_view->viewport()->width() / 2.0,
m_view->viewport()->height() / 2.0);
QPointF viewportCenter = m_view->mapFromScene(m_targetScenePos) - deltaViewportPos;
m_view->centerOn(m_view->mapToScene(viewportCenter.toPoint()));
emit zoomed();
}
void GraphicsViewZoom::setModifiers(Qt::KeyboardModifiers modifiers)
{
m_modifiers = modifiers;
}
void GraphicsViewZoom::setZoomFactorBase(double value)
{
m_zoomFactorBase = value;
}
bool GraphicsViewZoom::eventFilter(QObject *object, QEvent *event)
{
if (event->type() == QEvent::MouseMove)
{
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
QPointF delta = m_targetViewportPos - mouseEvent->pos();
if (qAbs(delta.x()) > 5 || qAbs(delta.y()) > 5)
{
m_targetViewportPos = mouseEvent->pos();
m_targetScenePos = m_view->mapToScene(mouseEvent->pos());
}
}
else if (event->type() == QEvent::Wheel)
{
QWheelEvent* wheelEvent = static_cast<QWheelEvent*>(event);
if (QApplication::keyboardModifiers() == m_modifiers)
{
if (wheelEvent->orientation() == Qt::Vertical)
{
double angle = wheelEvent->angleDelta().y();
double factor = qPow(m_zoomFactorBase, angle);
gentleZoom(factor);
return true;
}
}
}
Q_UNUSED(object)
return false;
}

View File

@ -0,0 +1,48 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2021 Jon Beniston, M7RCE //
// //
// 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 SDRGUI_GUI_GRAPHICSVIEWZOOM_H
#define SDRGUI_GUI_GRAPHICSVIEWZOOM_H
#include <QObject>
#include <QGraphicsView>
#include "export.h"
// GraphicsView that allows scroll wheel to be used for zoom
// https://stackoverflow.com/questions/19113532/qgraphicsview-zooming-in-and-out-under-mouse-position-using-mouse-wheel
class SDRGUI_API GraphicsViewZoom : public QObject {
Q_OBJECT
public:
GraphicsViewZoom(QGraphicsView* view);
void gentleZoom(double factor);
void setModifiers(Qt::KeyboardModifiers modifiers);
void setZoomFactorBase(double value);
private:
QGraphicsView* m_view;
Qt::KeyboardModifiers m_modifiers;
double m_zoomFactorBase;
QPointF m_targetScenePos, m_targetViewportPos;
bool eventFilter(QObject* object, QEvent* event);
signals:
void zoomed();
};
#endif // SDRGUI_GUI_GRAPHICSVIEWZOOM_H

View File

@ -107,6 +107,8 @@
<file>load.png</file> <file>load.png</file>
<file>keyboard.png</file> <file>keyboard.png</file>
<file>kill.png</file> <file>kill.png</file>
<file>zoomin.png</file>
<file>zoomout.png</file>
<file>LiberationMono-Regular.ttf</file> <file>LiberationMono-Regular.ttf</file>
<file>LiberationSans-Regular.ttf</file> <file>LiberationSans-Regular.ttf</file>
</qresource> </qresource>

BIN
sdrgui/resources/zoomin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 392 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B