diff --git a/doc/img/StarTracker_milkyway.png b/doc/img/StarTracker_milkyway.png new file mode 100644 index 000000000..617fee138 Binary files /dev/null and b/doc/img/StarTracker_milkyway.png differ diff --git a/doc/img/StarTracker_milkywayannotated.png b/doc/img/StarTracker_milkywayannotated.png new file mode 100644 index 000000000..3f1c2a2d8 Binary files /dev/null and b/doc/img/StarTracker_milkywayannotated.png differ diff --git a/doc/img/StarTracker_plugin.png b/doc/img/StarTracker_plugin.png index b5ab9c137..8cde7899f 100644 Binary files a/doc/img/StarTracker_plugin.png and b/doc/img/StarTracker_plugin.png differ diff --git a/doc/img/StarTracker_skytemp.png b/doc/img/StarTracker_skytemp.png index 5e10dae47..f809639c7 100644 Binary files a/doc/img/StarTracker_skytemp.png and b/doc/img/StarTracker_skytemp.png differ diff --git a/doc/img/StarTracker_skytemp_galactic.png b/doc/img/StarTracker_skytemp_galactic.png new file mode 100644 index 000000000..ef2d06f2a Binary files /dev/null and b/doc/img/StarTracker_skytemp_galactic.png differ diff --git a/plugins/feature/startracker/CMakeLists.txt b/plugins/feature/startracker/CMakeLists.txt index 9ab287a54..7b121ebbe 100644 --- a/plugins/feature/startracker/CMakeLists.txt +++ b/plugins/feature/startracker/CMakeLists.txt @@ -32,6 +32,7 @@ if(NOT SERVER_MODE) startracker150mhz.qrc startracker408mhz.qrc startracker1420mhz.qrc + startrackermilkyway.qrc ) set(startracker_HEADERS ${startracker_HEADERS} diff --git a/plugins/feature/startracker/readme.md b/plugins/feature/startracker/readme.md index bd3db7958..f16931ea8 100644 --- a/plugins/feature/startracker/readme.md +++ b/plugins/feature/startracker/readme.md @@ -3,11 +3,13 @@

Introduction

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. -The overhead position of the Sun, Moon and selected star can be displayed on the Map Feature. -It can display local Sidereal time, solar flux density and sky temperature. -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 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. +* The overhead position of the Sun, Moon and selected star can be displayed on the Map Feature. +* 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.

Settings

@@ -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. +

18: b - Galactic latitude

+ +Displays the calculated galactic latitude (angle in degrees, positive to the North of the galactic plane) to the object. + +

19: l - Galactic longitude

+ +Displays the calculated galactic longitude (angle in degrees, Eastward from the galactic centre) to the object. +

Plots

Light or dark theme

@@ -150,7 +160,7 @@ The Solar flux vs frequency plot, shows the solar flux density data from the Lea

Sky temperature

-![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. 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. 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. +

Galactic line of sight

+ +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. +

Map

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 +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 Freepik from Flaticon https://www.flaticon.com/ diff --git a/plugins/feature/startracker/startracker/milkyway.png b/plugins/feature/startracker/startracker/milkyway.png new file mode 100644 index 000000000..58abf083f Binary files /dev/null and b/plugins/feature/startracker/startracker/milkyway.png differ diff --git a/plugins/feature/startracker/startracker/milkywayannotated.png b/plugins/feature/startracker/startracker/milkywayannotated.png new file mode 100644 index 000000000..c1494ae0c Binary files /dev/null and b/plugins/feature/startracker/startracker/milkywayannotated.png differ diff --git a/plugins/feature/startracker/startrackergui.cpp b/plugins/feature/startracker/startrackergui.cpp index 0f0be1689..2ecc7b719 100644 --- a/plugins/feature/startracker/startrackergui.cpp +++ b/plugins/feature/startracker/startrackergui.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -33,6 +34,7 @@ #include "feature/featurewebapiutils.h" #include "gui/basicfeaturesettingsdialog.h" #include "gui/dmsspinbox.h" +#include "gui/graphicsviewzoom.h" #include "mainwindow.h" #include "device/deviceuiset.h" #include "util/units.h" @@ -169,7 +171,9 @@ StarTrackerGUI::StarTrackerGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, m_temps{FITS(":/startracker/startracker/150mhz_ra_dec.fits"), FITS(":/startracker/startracker/408mhz_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); 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))); ui->azimuth->setRange(0, 360.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 m_chart.legend()->hide(); @@ -280,6 +290,8 @@ StarTrackerGUI::StarTrackerGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, connect(&m_solarFluxTimer, SIGNAL(timeout()), this, SLOT(autoUpdateSolarFlux())); m_solarFluxTimer.start(1000*60*60*24); // Update every 24hours autoUpdateSolarFlux(); + + createGalacticLineOfSightScene(); } StarTrackerGUI::~StarTrackerGUI() @@ -307,10 +319,13 @@ void StarTrackerGUI::displaySettings() ui->target->setCurrentIndex(ui->target->findText(m_settings.m_target)); ui->azimuth->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") { ui->rightAscension->setText(m_settings.m_ra); ui->declination->setText(m_settings.m_dec); + updateGalacticCoords(); } else if (m_settings.m_target == "Custom Az/El") { @@ -401,10 +416,21 @@ void StarTrackerGUI::on_longitude_valueChanged(double value) 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() { m_settings.m_ra = ui->rightAscension->text(); applySettings(); + updateGalacticCoords(); plotChart(); } @@ -412,6 +438,7 @@ void StarTrackerGUI::on_declination_editingFinished() { m_settings.m_dec = ui->declination->text(); applySettings(); + updateGalacticCoords(); plotChart(); } @@ -602,6 +629,8 @@ void StarTrackerGUI::on_displaySettings_clicked() applySettings(); ui->elevation->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(); if (ui->chartSelect->currentIndex() == 1) plotChart(); @@ -639,21 +668,34 @@ void StarTrackerGUI::plotChart() { if (ui->chartSelect->currentIndex() == 0) { - if (ui->chartSubSelect->currentIndex() == 0) + if (ui->chartSubSelect->currentIndex() == 0) { plotElevationLineChart(); - else + } else { plotElevationPolarChart(); + } } else if (ui->chartSelect->currentIndex() == 1) + { plotSolarFluxChart(); + } else if (ui->chartSelect->currentIndex() == 2) + { plotSkyTemperatureChart(); + } + else if (ui->chartSelect->currentIndex() == 3) + { + plotGalacticLineOfSight(); + } } void StarTrackerGUI::raDecChanged() { - if (ui->chartSelect->currentIndex() == 2) + updateGalacticCoords(); + if (ui->chartSelect->currentIndex() == 2) { plotSkyTemperatureChart(); + } else if (ui->chartSelect->currentIndex() == 3) { + plotGalacticLineOfSight(); + } } void StarTrackerGUI::on_frequency_valueChanged(int value) @@ -679,6 +721,12 @@ void StarTrackerGUI::on_beamwidth_valueChanged(double value) 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(); 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() { + 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; m_chart.removeAllSeries(); @@ -1072,10 +1203,13 @@ void StarTrackerGUI::plotAreaChanged(const QRectF &plotArea) // Scale the image to fit plot area int imageIdx = ui->chartSubSelect->currentIndex(); - if (imageIdx == 6) + if (imageIdx == -1) { + return; + } else if (imageIdx == 6) { imageIdx = 2; - else if (imageIdx == 7) + } else if (imageIdx == 7) { imageIdx = 3; + } QImage image = m_images[imageIdx].scaled(QSize(width, height), Qt::IgnoreAspectRatio); QImage translated(viewW, viewH, QImage::Format_ARGB32); translated.fill(Qt::white); @@ -1100,6 +1234,12 @@ void StarTrackerGUI::removeAllAxes() // Plot target elevation angle over the day 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; m_azElLineChart = new QChart(); @@ -1217,6 +1357,12 @@ void StarTrackerGUI::plotElevationLineChart() // Plot target elevation angle over the day 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; m_azElPolarChart = new QPolarChart(); @@ -1448,6 +1594,11 @@ void StarTrackerGUI::on_chartSelect_currentIndexChanged(int index) ui->chartSubSelect->setCurrentIndex(2); updateChartSubSelect(); } + else if (index == 3) + { + ui->chartSubSelect->addItem("Milky Way"); + ui->chartSubSelect->addItem("Milky Way annotated"); + } ui->chartSubSelect->blockSignals(oldState); plotChart(); } diff --git a/plugins/feature/startracker/startrackergui.h b/plugins/feature/startracker/startrackergui.h index 394d58e98..122378677 100644 --- a/plugins/feature/startracker/startrackergui.h +++ b/plugins/feature/startracker/startrackergui.h @@ -36,6 +36,8 @@ class FeatureUISet; class StarTracker; class QNetworkAccessManager; class QNetworkReply; +class GraphicsViewZoom; +class QGraphicsPixmapItem; namespace Ui { class StarTrackerGUI; @@ -86,15 +88,23 @@ private: QNetworkRequest m_networkRequest; HttpDownloadManagerGUI m_dlm; + // Solar flux plot 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}; + // Sky temperature QList m_images; QList m_temps; FITS m_spectralIndex; + // Galactic line of sight + QList m_milkyWayImages; + GraphicsViewZoom* m_zoom; + QList m_milkyWayItems; + QGraphicsLineItem* m_lineOfSight; + explicit StarTrackerGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *feature, QWidget* parent = nullptr); virtual ~StarTrackerGUI(); @@ -111,6 +121,8 @@ private: void plotElevationPolarChart(); void plotSkyTemperatureChart(); void plotSolarFluxChart(); + void plotGalacticLineOfSight(); + void createGalacticLineOfSightScene(); void plotChart(); void removeAllAxes(); double convertSolarFluxUnits(double sfu); @@ -121,6 +133,7 @@ private: void raDecChanged(); void updateChartSubSelect(); void updateSolarFlux(bool all); + void updateGalacticCoords(); void leaveEvent(QEvent*); void enterEvent(QEvent*); @@ -151,6 +164,8 @@ private slots: void autoUpdateSolarFlux(); void on_downloadSolarFlux_clicked(); void on_darkTheme_clicked(bool checked); + void on_zoomIn_clicked(); + void on_zoomOut_clicked(); void networkManagerFinished(QNetworkReply *reply); void downloadFinished(const QString& filename, bool success); }; diff --git a/plugins/feature/startracker/startrackergui.ui b/plugins/feature/startracker/startrackergui.ui index 40c0bf88c..7bc3a8900 100644 --- a/plugins/feature/startracker/startrackergui.ui +++ b/plugins/feature/startracker/startrackergui.ui @@ -67,44 +67,15 @@ - - - - Beamwidth - - - - - - - Time - - - - - - - Dec - - - - - + + - Observation frequency (MHz) + 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) - - 50 - - - 100000 - - - - - - Azimuth + 23h59m59.59s @@ -115,153 +86,43 @@ - - + + - LST + Longitude - - + + - Elevation + Latitude - - - - - - Start/stop tracking - - - - - - - :/play.png - :/stop.png:/play.png - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Find target on the map - - - - - - - :/gridpolar.png:/gridpolar.png - - - - - - - Download Solar flux density data - - - - - - - :/startracker/startracker/sun-button-24.png:/startracker/startracker/sun-button-24.png - - - - - - - Set latitude, longitude and height from My Position in SDRangel preferences - - - - - - - :/import.png:/import.png - - - - - - - Show settings dialog - - - - - - - :/listing.png:/listing.png - - - - - - - - - Elevation in degrees to the target from the observation point - - - - - - - Local sidereal time for selected date, time and longitude - - - true - - - - - - - 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" 34 12 10.2) - + + - -90d59'59.59" + Beamwidth - - + + - Antenna half power (-3dB) beamwidth (degrees) + Latitude in decimal degrees (North positive) of observation point / antenna location - 0 + 6 - 1.000000000000000 + -90.000000000000000 - 360.000000000000000 + 90.000000000000000 - 25.000000000000000 + -90.000000000000000 @@ -353,34 +214,13 @@ This can be specified as a decimal (E.g. 34.23) or in degrees, minutes and secon - - + + - Select time to calculate target's position at + Local sidereal time for selected date, time and longitude - - - Now - - - - - Custom - - - - - - - - Latitude - - - - - - - Frequency + + true @@ -397,39 +237,10 @@ This can be specified as a decimal (E.g. 34.23) or in degrees, minutes and secon - - + + - Solar flux density - - - true - - - - - - - Target - - - - - - - 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) - - - 23h59m59.59s - - - - - - - Longitude + Elevation in degrees to the target from the observation point @@ -452,29 +263,159 @@ This can be specified as a decimal (E.g. 12.23) or in hours, minutes and seconds - - + + - Solar Flux + Frequency - - + + - Latitude in decimal degrees (North positive) of observation point / antenna location - - - 6 + Observation frequency (MHz) - -90.000000000000000 + 50 - 90.000000000000000 + 100000 - - -90.000000000000000 + + + + + + LST + + + + + + + Target + + + + + + + Azimuth + + + + + + + + + Start/stop tracking + + + + + + + :/play.png + :/stop.png:/play.png + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Find target on the map + + + + + + + :/gridpolar.png:/gridpolar.png + + + + + + + Download Solar flux density data + + + + + + + :/startracker/startracker/sun-button-24.png:/startracker/startracker/sun-button-24.png + + + + + + + Set latitude, longitude and height from My Position in SDRangel preferences + + + + + + + :/import.png:/import.png + + + + + + + Show settings dialog + + + + + + + :/listing.png:/listing.png + + + + + + + + + Select time to calculate target's position at + + + + Now + + + + + Custom + + + + + + + + Solar flux density + + + true @@ -485,6 +426,107 @@ This can be specified as a decimal (E.g. 12.23) or in hours, minutes and seconds + + + + Antenna half power (-3dB) beamwidth (degrees) + + + 0 + + + 1.000000000000000 + + + 360.000000000000000 + + + 25.000000000000000 + + + + + + + Dec + + + + + + + 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" 34 12 10.2) + + + -90d59'59.59" + + + + + + + Solar Flux + + + + + + + Time + + + + + + + Elevation + + + + + + + + Liberation Sans + 9 + true + + + + b + + + + + + + + Liberation Sans + 9 + true + + + + l + + + + + + + Galactic latitude in degrees + + + + + + + Galactic longitude in degrees (positive Eastward from galactic center) + + + @@ -493,7 +535,7 @@ This can be specified as a decimal (E.g. 12.23) or in hours, minutes and seconds 10 - 220 + 250 318 268 @@ -513,7 +555,7 @@ This can be specified as a decimal (E.g. 12.23) or in hours, minutes and seconds Plots - + 2 @@ -551,6 +593,11 @@ This can be specified as a decimal (E.g. 12.23) or in hours, minutes and seconds Sky temperature + + + Galactic line of sight + + @@ -574,6 +621,40 @@ This can be specified as a decimal (E.g. 12.23) or in hours, minutes and seconds + + + + Zoom in + + + + + + + :/zoomin.png:/zoomin.png + + + true + + + + + + + Zoom out + + + + + + + :/zoomout.png:/zoomout.png + + + true + + + @@ -586,6 +667,16 @@ This can be specified as a decimal (E.g. 12.23) or in hours, minutes and seconds + + + + + 300 + 250 + + + + @@ -638,7 +729,10 @@ This can be specified as a decimal (E.g. 12.23) or in hours, minutes and seconds chartSelect chartSubSelect darkTheme + zoomIn + zoomOut chart + image diff --git a/plugins/feature/startracker/startrackermilkyway.qrc b/plugins/feature/startracker/startrackermilkyway.qrc new file mode 100644 index 000000000..dc5a6174c --- /dev/null +++ b/plugins/feature/startracker/startrackermilkyway.qrc @@ -0,0 +1,6 @@ + + + startracker/milkyway.png + startracker/milkywayannotated.png + + diff --git a/sdrgui/CMakeLists.txt b/sdrgui/CMakeLists.txt index bb807f9b6..6b6c5ae02 100644 --- a/sdrgui/CMakeLists.txt +++ b/sdrgui/CMakeLists.txt @@ -45,6 +45,7 @@ set(sdrgui_SOURCES gui/glshadertvarray.cpp gui/glspectrum.cpp gui/glspectrumgui.cpp + gui/graphicsviewzoom.cpp gui/httpdownloadmanagergui.cpp gui/indicator.cpp gui/levelmeter.cpp @@ -131,6 +132,7 @@ set(sdrgui_HEADERS gui/glshadertextured.h gui/glspectrum.h gui/glspectrumgui.h + gui/graphicsviewzoom.h gui/httpdownloadmanagergui.h gui/indicator.h gui/levelmeter.h diff --git a/sdrgui/gui/graphicsviewzoom.cpp b/sdrgui/gui/graphicsviewzoom.cpp new file mode 100644 index 000000000..29b317abf --- /dev/null +++ b/sdrgui/gui/graphicsviewzoom.cpp @@ -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 . // +/////////////////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#include + +#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(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(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; +} diff --git a/sdrgui/gui/graphicsviewzoom.h b/sdrgui/gui/graphicsviewzoom.h new file mode 100644 index 000000000..7751b4454 --- /dev/null +++ b/sdrgui/gui/graphicsviewzoom.h @@ -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 . // +/////////////////////////////////////////////////////////////////////////////////// + +#ifndef SDRGUI_GUI_GRAPHICSVIEWZOOM_H +#define SDRGUI_GUI_GRAPHICSVIEWZOOM_H + +#include +#include + +#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 diff --git a/sdrgui/resources/res.qrc b/sdrgui/resources/res.qrc index ba5b32884..c426baebb 100644 --- a/sdrgui/resources/res.qrc +++ b/sdrgui/resources/res.qrc @@ -107,6 +107,8 @@ load.png keyboard.png kill.png + zoomin.png + zoomout.png LiberationMono-Regular.ttf LiberationSans-Regular.ttf diff --git a/sdrgui/resources/zoomin.png b/sdrgui/resources/zoomin.png new file mode 100644 index 000000000..420ff1cf4 Binary files /dev/null and b/sdrgui/resources/zoomin.png differ diff --git a/sdrgui/resources/zoomout.png b/sdrgui/resources/zoomout.png new file mode 100644 index 000000000..cc3ec2840 Binary files /dev/null and b/sdrgui/resources/zoomout.png differ