Star Tracker updates.

Plot Sun and Moon on sky temperature chart.
Plot markers on Galactic line-of-sight chart.
Create animations from Galactic line-of-sight chart.
Allow weather at antenna location to be downloaded from openweathermap.org
Allow target to be entered as Galactic longitude / latitude.
Add azimuth and elevation offsets to support scans around targets.
Add S7, S8 and S9 targets.
Refactor some code from GUI to main plugin, so computed values can be used in other plugins.
This commit is contained in:
Jon Beniston 2021-10-12 11:07:56 +01:00
parent c623f337d2
commit cddc8c9b83
57 changed files with 7621 additions and 765 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 642 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 804 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

View File

@ -6,6 +6,9 @@ set(startracker_SOURCES
startrackerplugin.cpp
startrackerworker.cpp
startrackerwebapiadapter.cpp
startracker150mhzfits.qrc
startracker408mhzfits.qrc
startracker1420mhzfits.qrc
)
set(startracker_HEADERS

View File

@ -38,11 +38,13 @@ Pressing this button displays a settings dialog, that allows you to set:
* The epoch used when entering RA and Dec. This can be either J2000 (which is used for most catalogues) or JNOW which is the current date and time.
* The units used for the display of the calculated azimuth and elevation. This can be either degrees, minutes and seconds or decimal degrees.
* Whether to correct for atmospheric refraction. You can choose either no correction, the Saemundsson algorithm, typically used for optical astronomy or the more accurate Positional Astronomy Library calculation, which can be used for >250MHz radio frequencies or light. Note that there is only a very minor difference between the two.
* Air pressure in millibars for use in refraction correction.
* Air temperature in degrees Celsius for use in refraction correction.
* Relative humidity in % for use in refraction correction.
* Height above sea level in metres for use in refraction correction.
* Temperature lapse rate in Kelvin per kilometre for use in refraction correction.
* API key for openweathermap.org which is used to download real-time weather (Air temperature, pressure and humidity) for the specified latitude (6) and longitude (7).
* How often to download weather (in minutes).
* Air pressure in millibars. This value can be automatically updated from OpenWeatherMap.
* Air temperature in degrees Celsius. This value can be automatically updated from OpenWeatherMap.
* Relative humidity in %. This value can be automatically updated from OpenWeatherMap.
* Height above sea level in metres of the observation point (anntenna location).
* Temperature lapse rate in Kelvin per kilometre.
* What data to display for the Solar flux measurement. Data can be selected from 2800 from DRAO or a number of different frequencies from Learmonth. Also, the Learmonth data can be linearly interpolated to the observation frequency set in the main window.
* The units to display the solar flux in, either Solar Flux Units, Jansky or Wm^-2Hz-1. 1 sfu equals 10,000 Jansky or 10^-22 Wm^-2Hz-1.
* The update period in seconds, which controls how frequently azimuth and elevation are re-calculated.
@ -78,7 +80,7 @@ Select a target object to track from the list.
To manually enter RA (right ascension) and Dec (declination) of an unlisted target, select Custom RA/Dec.
To allow Stellarium to set the RA and Dec, select Custom RA/Dec, and ensure the Stellarium Server option is checked in the Star Tracker Settings dialog.
| Target | Type | Details | Flux density (Jy) |
| Target | Type | Details | Flux density (Jy) or Temperature (K) |
|------------------|-------------------|------------------------------------------------|---------------------------------------------
| Sun | Star | Targets our Sun | 10k-10M (50MHz), 500k-10M (1.4GHz) |
| Moon | Moon | Targets our Moon | 2 (50MHz), 1000 (1.4GHz) |
@ -91,12 +93,17 @@ To allow Stellarium to set the RA and Dec, select Custom RA/Dec, and ensure the
| Virgo A (M87) | Galaxy | | 2635 (50MHz), 1209 (150MHz), 212 (1.4GHz) |
| Custom RA/Dec | | Manually enter RA and Dec | |
| Custom Az/El | | Manually enter azimuth and elevation | |
| Custom l/b | | Manually enter Galactic longitude and latitude | |
| S7 | HI | IAU secondary calibration region (l=132,b=-1) | Tb=100 peak |
| S8 | HI | IAU primary calibration region (l=207,b=-15) | Tb=72 peak |
| S9 | HI | IAU secondary calibration region (l=356,b=-4) | Tb=85 peak |
References:
* ATNF Pulsar Catalogue - https://www.atnf.csiro.au/research/pulsar/psrcat/
* Cassiopeia A, Cygnus A, Taurus A, and Virgo A at ultra-low radio frequencies - https://research.chalmers.se/publication/516438/file/516438_Fulltext.pdf
* Repeating Jansky - https://www.gb.nrao.edu/~fghigo/JanskyAntenna/RepeatingJansky_memo10.pdf
* Studies of four regions for use as standards in 21CM observations - http://articles.adsabs.harvard.edu/pdf/1973A%26AS....8..505W
<h3>12: Frequency</h3>
@ -110,33 +117,45 @@ Enter the half power (-3dB) beamwidth of your antenna. This value is used for sk
When target is set to Custom RA/Dec, you can specify the right ascension in hours of the target object. This can be specified as a decimal (E.g. 12.23, from 0 to 24) or in hours, minutes and seconds (E.g. 12h05m10.2s or 12 05 10.2). Whether the epoch is J2000 or JNOW can be set in the Star Tracker Settings dialog.
When target is set to Custom Az/El, this will display the corresponding right ascension.
When target is set to Custom Az/El or Custom l/b, this will display the corresponding right ascension.
<h3>15: Declination</h3>
When target is set to Custom RA/Dec, you can specify the declination in degrees of the target object. This can be specified as a decimal (E.g. 34.6, from -90.0 to 90.0) or in degrees, minutes and seconds (E.g. 34d12m5.6s, 34d12'5.6" 34 12 5.6). Whether the epoch is J2000 or JNOW can be set in the Star Tracker Settings dialog.
When target is set to Custom Az/El, this will display the corresponding declination.
When target is set to Custom Az/El or Custom l/b, this will display the corresponding declination.
<h3>16: Azimuth</h3>
When target is set to Custom Az/El, you specify the azimuth in degrees of the target object. The corresponding RA/Dec will be calculated and displayed.
When target is set to Custom Az/El, you specify the azimuth in degrees of the target object. The corresponding RA/Dec and l/b will be calculated and displayed.
For all other target settings, this displays the calculated azimuth (angle in degrees, clockwise from North) to the object.
<h3>17: Elevation</h3>
When target is set to Custom Az/El, you specify the elevation in degrees of the target object. The corresponding RA/Dec will be calculated and displayed.
When target is set to Custom Az/El, you specify the elevation in degrees of the target object. The corresponding RA/Dec and l/b will be calculated and displayed.
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>
<h3>18: Az Offset</h3>
Displays the calculated galactic latitude (angle in degrees, positive to the North of the galactic plane) to the object.
An offset in degrees that is added to the computed target azimuth.
<h3>19: l - Galactic longitude</h3>
<h3>19: El Offset</h3>
Displays the calculated galactic longitude (angle in degrees, Eastward from the galactic centre) to the object.
An offset in degrees that is added to the computed target elevation.
<h3>20: l - Galactic Longitude</h3>
When the target is set to Custom l/b, you specify the galactic longitude (angle in degrees, Eastward from the galactic centre) of the target object.
For all other target settings, this sisplays the calculated galactic longitude to the object.
<h3>21: b - Galactic Latitude</h3>
When the target is set to Custom l/b, you specify the galactic lattitude (angle in degrees) of the target object.
For all other target settings, displays the calculated galactic latitude to the object.
<h2>Plots</h2>
@ -169,6 +188,8 @@ This temperature is therefore valid for a beamwidth of less than 1 degree.
The Star Tracker plugin can also estimate a sky temperature based on the user entered observation frequency and beamwidth.
To see this figure, which will be typically lower than the above, select one of the last two temperature maps from the right hand combo box.
The position of the Sun and Moon can also be drawn on the chart. Note that the sky temperature estimate does not take these in to account.
<h3>Drift scan path</h3>
When the target (11) is set to Custom Az/El and the Sky temperature plot is displayed, a curve showing the drift scan path over a 24 hour period will be displayed.
@ -193,6 +214,18 @@ Two images of the Milky Way are availble: a purely graphical image and one annot
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.
<h4>Spiral Arm Animations</h4>
When used with the Radio Astronomy plugin, markers corresponding to the position of HI clouds calculated from a marker on the spectrogram, can be plotted to display the estimated position of the cloud.
An animated PNG file can then be created from multiple plots to show how the markers follow the positions of Milky Way's spiral arms as galactic longitude is varied.
This process requires a marker to be placed on a peak in the spectrogram and then the ![add to animation](../../../doc/img/StarTracker_add_to_animation.png) button to be pressed to add the current plot to the animation.
The process then repeats, by selecting the next measurement at a different longitude in the spectrogram and marking the appropriate peak, and then adding it to the animation.
When all frames have been added, the animation can be saved to a PNG file by pressing ![save animation](../../../doc/img/StarTracker_save_animation.png).
To start a new animation, press ![clear animation](../../../doc/img/StarTracker_clear_animation.png).
![StarTracker spiral arm](../../../doc/img/StarTracker_spiral_arm.png)
<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.
@ -241,7 +274,7 @@ Solar radio flux measurements at 245, 410, 610, 1415, 2695, 4995, 8800 and 15400
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, iconsphere and Erik Madsen, from the Noun Project Noun Project: https://thenounproject.com/
Icons are by Freepik from Flaticon https://www.flaticon.com/

View File

@ -25,14 +25,20 @@
#include "SWGFeatureReport.h"
#include "SWGFeatureActions.h"
#include "SWGDeviceState.h"
#include "SWGStarTrackerDisplaySettings.h"
#include "dsp/dspengine.h"
#include "util/weather.h"
#include "util/units.h"
#include "maincore.h"
#include "startrackerreport.h"
#include "startrackerworker.h"
#include "startracker.h"
MESSAGE_CLASS_DEFINITION(StarTracker::MsgConfigureStarTracker, Message)
MESSAGE_CLASS_DEFINITION(StarTracker::MsgStartStop, Message)
MESSAGE_CLASS_DEFINITION(StarTracker::MsgSetSolarFlux, Message)
const char* const StarTracker::m_featureIdURI = "sdrangel.feature.startracker";
const char* const StarTracker::m_featureId = "StarTracker";
@ -45,8 +51,17 @@ StarTracker::StarTracker(WebAPIAdapterInterface *webAPIAdapterInterface) :
m_worker = new StarTrackerWorker(this, webAPIAdapterInterface);
m_state = StIdle;
m_errorMessage = "StarTracker error";
connect(&m_updatePipesTimer, SIGNAL(timeout()), this, SLOT(updatePipes()));
m_updatePipesTimer.start(1000);
m_networkManager = new QNetworkAccessManager();
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
m_weather = nullptr;
m_solarFlux = 0.0f;
// Unfortunately, can't seem to access resources in static global constructor
m_temps.append(new FITS(":/startracker/startracker/150mhz_ra_dec.fits"));
m_temps.append(new FITS(":/startracker/startracker/408mhz_ra_dec.fits"));
m_temps.append(new FITS(":/startracker/startracker/1420mhz_ra_dec.fits"));
m_spectralIndex = new FITS(":/startracker/startracker/408mhz_ra_dec_spectral_index.fits");
}
StarTracker::~StarTracker()
@ -58,6 +73,13 @@ StarTracker::~StarTracker()
}
delete m_worker;
if (m_weather)
{
disconnect(m_weather, &Weather::weatherUpdated, this, &StarTracker::weatherUpdated);
delete m_weather;
}
qDeleteAll(m_temps);
delete m_spectralIndex;
}
void StarTracker::start()
@ -71,8 +93,8 @@ void StarTracker::start()
m_state = ok ? StRunning : StError;
m_thread.start();
StarTrackerWorker::MsgConfigureStarTrackerWorker *msg = StarTrackerWorker::MsgConfigureStarTrackerWorker::create(m_settings, true);
m_worker->getInputMessageQueue()->push(msg);
m_worker->getInputMessageQueue()->push(StarTrackerWorker::MsgConfigureStarTrackerWorker::create(m_settings, true));
m_worker->getInputMessageQueue()->push(MsgSetSolarFlux::create(m_solarFlux));
}
void StarTracker::stop()
@ -107,12 +129,52 @@ bool StarTracker::handleMessage(const Message& cmd)
return true;
}
else if (MsgSetSolarFlux::match(cmd))
{
MsgSetSolarFlux& msg = (MsgSetSolarFlux&) cmd;
m_solarFlux = msg.getFlux();
m_worker->getInputMessageQueue()->push(new MsgSetSolarFlux(msg));
return true;
}
else if (MainCore::MsgStarTrackerDisplaySettings::match(cmd))
{
MainCore::MsgStarTrackerDisplaySettings& settings = (MainCore::MsgStarTrackerDisplaySettings&) cmd;
if (m_guiMessageQueue) {
m_guiMessageQueue->push(new MainCore::MsgStarTrackerDisplaySettings(settings));
}
return true;
}
else if (MainCore::MsgStarTrackerDisplayLoSSettings::match(cmd))
{
MainCore::MsgStarTrackerDisplayLoSSettings& settings = (MainCore::MsgStarTrackerDisplayLoSSettings&) cmd;
if (m_guiMessageQueue) {
m_guiMessageQueue->push(new MainCore::MsgStarTrackerDisplayLoSSettings(settings));
}
return true;
}
else
{
return false;
}
}
void StarTracker::updatePipes()
{
QList<AvailablePipeSource> availablePipes = updateAvailablePipeSources("startracker.display", StarTrackerSettings::m_pipeTypes, StarTrackerSettings::m_pipeURIs, this);
if (availablePipes != m_availablePipes)
{
m_availablePipes = availablePipes;
if (getMessageQueueToGUI())
{
MsgReportPipes *msgToGUI = MsgReportPipes::create();
QList<AvailablePipeSource>& msgAvailablePipes = msgToGUI->getAvailablePipes();
msgAvailablePipes.append(availablePipes);
getMessageQueueToGUI()->push(msgToGUI);
}
}
}
QByteArray StarTracker::serialize() const
{
return m_settings.serialize();
@ -143,6 +205,10 @@ void StarTracker::applySettings(const StarTrackerSettings& settings, bool force)
<< " m_dec: " << settings.m_dec
<< " m_az: " << settings.m_az
<< " m_el: " << settings.m_el
<< " m_l: " << settings.m_l
<< " m_b: " << settings.m_b
<< " m_azOffset: " << settings.m_azOffset
<< " m_elOffset: " << settings.m_elOffset
<< " m_latitude: " << settings.m_latitude
<< " m_longitude: " << settings.m_longitude
<< " m_serverPort: " << settings.m_serverPort
@ -215,6 +281,52 @@ void StarTracker::applySettings(const StarTrackerSettings& settings, bool force)
if ((m_settings.m_rgbColor != settings.m_rgbColor) || force) {
reverseAPIKeys.append("rgbColor");
}
if ((m_settings.m_az != settings.m_az) || force) {
reverseAPIKeys.append("azimuth");
}
if ((m_settings.m_el != settings.m_el) || force) {
reverseAPIKeys.append("elevation");
}
if ((m_settings.m_l != settings.m_l) || force) {
reverseAPIKeys.append("l");
}
if ((m_settings.m_b != settings.m_b) || force) {
reverseAPIKeys.append("b");
}
if ((m_settings.m_azOffset != settings.m_azOffset) || force) {
reverseAPIKeys.append("azimuthOffset");
}
if ((m_settings.m_elOffset != settings.m_elOffset) || force) {
reverseAPIKeys.append("elevationOffset");
}
if ((m_settings.m_owmAPIKey != settings.m_owmAPIKey) || force)
{
if (m_weather)
{
disconnect(m_weather, &Weather::weatherUpdated, this, &StarTracker::weatherUpdated);
delete m_weather;
m_weather = nullptr;
}
if (!settings.m_owmAPIKey.isEmpty())
{
m_weather = Weather::create(settings.m_owmAPIKey);
if (m_weather) {
connect(m_weather, &Weather::weatherUpdated, this, &StarTracker::weatherUpdated);
}
}
}
if ( (m_settings.m_owmAPIKey != settings.m_owmAPIKey)
|| (m_settings.m_latitude != settings.m_latitude)
|| (m_settings.m_longitude != settings.m_longitude)
|| (m_settings.m_weatherUpdatePeriod != settings.m_weatherUpdatePeriod)
|| force)
{
if (m_weather) {
m_weather->getWeatherPeriodically(m_settings.m_latitude, m_settings.m_longitude, settings.m_weatherUpdatePeriod);
}
}
StarTrackerWorker::MsgConfigureStarTrackerWorker *msg = StarTrackerWorker::MsgConfigureStarTrackerWorker::create(
settings, force
@ -320,6 +432,13 @@ void StarTracker::webapiFormatFeatureSettings(
response.getStarTrackerSettings()->setReverseApiPort(settings.m_reverseAPIPort);
response.getStarTrackerSettings()->setReverseApiFeatureSetIndex(settings.m_reverseAPIFeatureSetIndex);
response.getStarTrackerSettings()->setReverseApiFeatureIndex(settings.m_reverseAPIFeatureIndex);
response.getStarTrackerSettings()->setAzimuth(settings.m_az);
response.getStarTrackerSettings()->setElevation(settings.m_el);
response.getStarTrackerSettings()->setL(settings.m_l);
response.getStarTrackerSettings()->setB(settings.m_b);
response.getStarTrackerSettings()->setAzimuthOffset(settings.m_azOffset);
response.getStarTrackerSettings()->setElevationOffset(settings.m_elOffset);
}
void StarTracker::webapiUpdateFeatureSettings(
@ -396,6 +515,24 @@ void StarTracker::webapiUpdateFeatureSettings(
if (featureSettingsKeys.contains("reverseAPIFeatureIndex")) {
settings.m_reverseAPIFeatureIndex = response.getStarTrackerSettings()->getReverseApiFeatureIndex();
}
if (featureSettingsKeys.contains("azimuth")) {
settings.m_az = response.getStarTrackerSettings()->getAzimuth();
}
if (featureSettingsKeys.contains("elevation")) {
settings.m_el = response.getStarTrackerSettings()->getElevation();
}
if (featureSettingsKeys.contains("l")) {
settings.m_l = response.getStarTrackerSettings()->getL();
}
if (featureSettingsKeys.contains("b")) {
settings.m_b = response.getStarTrackerSettings()->getB();
}
if (featureSettingsKeys.contains("azimuthOffset")) {
settings.m_azOffset = response.getStarTrackerSettings()->getAzimuthOffset();
}
if (featureSettingsKeys.contains("elevationOffset")) {
settings.m_elOffset = response.getStarTrackerSettings()->getElevationOffset();
}
}
void StarTracker::webapiReverseSendSettings(QList<QString>& featureSettingsKeys, const StarTrackerSettings& settings, bool force)
@ -463,6 +600,24 @@ void StarTracker::webapiReverseSendSettings(QList<QString>& featureSettingsKeys,
if (featureSettingsKeys.contains("rgbColor") || force) {
swgStarTrackerSettings->setRgbColor(settings.m_rgbColor);
}
if (featureSettingsKeys.contains("azimuth") || force) {
swgStarTrackerSettings->setAzimuth(settings.m_az);
}
if (featureSettingsKeys.contains("elevation") || force) {
swgStarTrackerSettings->setElevation(settings.m_el);
}
if (featureSettingsKeys.contains("l") || force) {
swgStarTrackerSettings->setL(settings.m_l);
}
if (featureSettingsKeys.contains("b") || force) {
swgStarTrackerSettings->setB(settings.m_b);
}
if (featureSettingsKeys.contains("azimuthOffset") || force) {
swgStarTrackerSettings->setAzimuthOffset(settings.m_azOffset);
}
if (featureSettingsKeys.contains("elevationOffset") || force) {
swgStarTrackerSettings->setElevationOffset(settings.m_elOffset);
}
QString channelSettingsURL = QString("http://%1:%2/sdrangel/featureset/%3/feature/%4/settings")
.arg(settings.m_reverseAPIAddress)
@ -504,3 +659,172 @@ void StarTracker::networkManagerFinished(QNetworkReply *reply)
reply->deleteLater();
}
void StarTracker::weatherUpdated(float temperature, float pressure, float humidity)
{
if (!isnan(temperature)) {
m_settings.m_temperature = temperature;
}
if (!isnan(pressure)) {
m_settings.m_pressure = pressure;
}
if (!isnan(humidity)) {
m_settings.m_humidity = humidity;
}
m_worker->getInputMessageQueue()->push(StarTrackerWorker::MsgConfigureStarTrackerWorker::create(m_settings, false));
if (m_guiMessageQueue) {
m_guiMessageQueue->push(MsgConfigureStarTracker::create(m_settings, false));
}
}
double StarTracker::applyBeam(const FITS *fits, double beamwidth, double ra, double dec, int& imgX, int& imgY) const
{
const double halfBeamwidth = beamwidth/2.0;
// Use cos^p(x) for approximation of radiation pattern
// (Essentially the same as Gaussian of exp(-4*ln(theta^2/beamwidth^2))
// (See a2 in https://arxiv.org/pdf/1812.10084.pdf for Elliptical equivalent))
// We have gain of 0dB (1) at 0 degrees, and -3dB (~0.5) at half-beamwidth degrees
// Find exponent that correponds to -3dB at that angle
double minus3dBLinear = pow(10.0, -3.0/10.0);
double p = log(minus3dBLinear)/log(cos(Units::degreesToRadians(halfBeamwidth)));
// Create an matrix with gain as a function of angle
double degreesPerPixelH = abs(fits->degreesPerPixelH());
double degreesPerPixelV = abs(fits->degreesPerPixelV());
int numberOfCoeffsH = ceil(beamwidth/degreesPerPixelH);
int numberOfCoeffsV = ceil(beamwidth/degreesPerPixelV);
if ((numberOfCoeffsH & 1) == 0) {
numberOfCoeffsH++;
}
if ((numberOfCoeffsV & 1) == 0) {
numberOfCoeffsV++;
}
double *beam = new double[numberOfCoeffsH*numberOfCoeffsV];
double sum = 0.0;
int y0 = numberOfCoeffsV/2;
int x0 = numberOfCoeffsH/2;
int nonZeroCount = 0;
for (int y = 0; y < numberOfCoeffsV; y++)
{
for (int x = 0; x < numberOfCoeffsH; x++)
{
double xp = (x - x0) * degreesPerPixelH;
double yp = (y - y0) * degreesPerPixelV;
double r = sqrt(xp*xp+yp*yp);
if (r < halfBeamwidth)
{
beam[y*numberOfCoeffsH+x] = pow(cos(Units::degreesToRadians(r)), p);
sum += beam[y*numberOfCoeffsH+x];
nonZeroCount++;
}
else
{
beam[y*numberOfCoeffsH+x] = 0.0;
}
}
}
// Get centre pixel coordinates
double centreX;
if (ra <= 12.0) {
centreX = (12.0 - ra) / 24.0;
} else {
centreX = (24 - ra + 12) / 24.0;
}
double centreY = (90.0-dec) / 180.0;
imgX = centreX * fits->width();
imgY = centreY * fits->height();
// Apply weighting to temperature data
double weightedSum = 0.0;
for (int y = 0; y < numberOfCoeffsV; y++)
{
for (int x = 0; x < numberOfCoeffsH; x++)
{
weightedSum += beam[y*numberOfCoeffsH+x] * fits->scaledWrappedValue(imgX + (x-x0), imgY + (y-y0));
}
}
// From: https://www.cv.nrao.edu/~sransom/web/Ch3.html
// The antenna temperature equals the source brightness temperature multiplied by the fraction of the beam solid angle filled by the source
// So we scale the sum by the total number of non-zero pixels (i.e. beam area)
// If we compare to some maps with different beamwidths here: https://www.cv.nrao.edu/~demerson/radiosky/sky_jun96.pdf
// The values we've computed are a bit higher..
double temp = weightedSum/nonZeroCount;
delete[] beam;
return temp;
}
bool StarTracker::calcSkyTemperature(double frequency, double beamwidth, double ra, double dec, double& temp) const
{
const FITS *fits;
int imgX, imgY;
if ((frequency >= 1.4e9) && (frequency <= 1.45e9))
{
// Adjust temperature from 1420MHz FITS file, just using beamwidth
fits = getTempFITS(2);
if (fits && fits->valid())
{
temp = applyBeam(fits, beamwidth, ra, dec, imgX, imgY);
return true;
}
else
{
qDebug() << "StarTracker::calcSkyTemperature: 1420MHz FITS temperature file not valid";
return false;
}
}
else
{
// Adjust temperature from 408MHz FITS file, taking in to account
// observation frequency and beamwidth
fits = getTempFITS(1);
if (fits && fits->valid())
{
double temp408 = applyBeam(fits, beamwidth, ra, dec, imgX, imgY);
// Scale according to frequency - CMB contribution constant
// Power law at low frequencies, with slight variation in spectral index
// See:
// Global Sky Model: https://ascl.net/1011.010
// An improved Model of Diffuse Galactic Radio Emission: https://arxiv.org/pdf/1605.04920.pdf
// A high-resolution self-consistent whole sky foreground model: https://arxiv.org/abs/1812.10084
// (De-striping:) Full sky study of diffuse Galactic emission at decimeter wavelength https://www.aanda.org/articles/aa/pdf/2003/42/aah4363.pdf
// Data here: http://cdsarc.u-strasbg.fr/viz-bin/cat/J/A+A/410/847
// LFmap: https://www.faculty.ece.vt.edu/swe/lwa/memo/lwa0111.pdf
double iso408 = 50 * pow(150e6/408e6, 2.75); // Extra-galactic isotropic in reference map at 408MHz
double isoT = 50 * pow(150e6/frequency, 2.75); // Extra-galactic isotropic at target frequency
double cmbT = 2.725; // Cosmic microwave backgroud;
double spectralIndex;
const FITS *spectralIndexFITS = getSpectralIndexFITS();
if (spectralIndexFITS && spectralIndexFITS->valid())
{
// See https://www.aanda.org/articles/aa/pdf/2003/42/aah4363.pdf
spectralIndex = spectralIndexFITS->scaledValue(imgX, imgY);
}
else
{
// See https://arxiv.org/abs/1812.10084 fig 2
if (frequency < 200e6) {
spectralIndex = 2.55;
} else if (frequency < 20e9) {
spectralIndex = 2.695;
} else {
spectralIndex = 3.1;
}
}
double galactic480 = temp408 - cmbT - iso408;
double galacticT = galactic480 * pow(408e6/frequency, spectralIndex); // Scale galactic contribution by frequency
temp = galacticT + cmbT + isoT; // Final temperature
return true;
}
else
{
qDebug() << "StarTracker::calcSkyTemperature: 408MHz FITS temperature file not valid";
return false;
}
}
}

View File

@ -21,9 +21,11 @@
#include <QThread>
#include <QNetworkRequest>
#include <QTimer>
#include "feature/feature.h"
#include "util/message.h"
#include "util/fits.h"
#include "startrackersettings.h"
@ -31,6 +33,7 @@ class WebAPIAdapterInterface;
class StarTrackerWorker;
class QNetworkAccessManager;
class QNetworkReply;
class Weather;
namespace SWGSDRangel {
class SWGDeviceState;
@ -81,6 +84,25 @@ public:
{ }
};
class MsgSetSolarFlux : public Message {
MESSAGE_CLASS_DECLARATION
public:
float getFlux() const { return m_flux; }
static MsgSetSolarFlux* create(float flux) {
return new MsgSetSolarFlux(flux);
}
protected:
float m_flux;
MsgSetSolarFlux(float flux) :
Message(),
m_flux(flux)
{ }
};
StarTracker(WebAPIAdapterInterface *webAPIAdapterInterface);
virtual ~StarTracker();
virtual void destroy() { delete this; }
@ -94,17 +116,17 @@ public:
virtual int webapiRun(bool run,
SWGSDRangel::SWGDeviceState& response,
QString& errorMessage);
QString& errorMessage) override;
virtual int webapiSettingsGet(
SWGSDRangel::SWGFeatureSettings& response,
QString& errorMessage);
QString& errorMessage) override;
virtual int webapiSettingsPutPatch(
bool force,
const QStringList& featureSettingsKeys,
SWGSDRangel::SWGFeatureSettings& response,
QString& errorMessage);
QString& errorMessage) override;
static void webapiFormatFeatureSettings(
SWGSDRangel::SWGFeatureSettings& response,
@ -115,6 +137,10 @@ public:
const QStringList& featureSettingsKeys,
SWGSDRangel::SWGFeatureSettings& response);
const FITS *getTempFITS(int index) const { return m_temps[index]; }
const FITS *getSpectralIndexFITS() const { return m_spectralIndex; }
bool calcSkyTemperature(double frequency, double beamwidth, double ra, double dec, double& temp) const;
static const char* const m_featureIdURI;
static const char* const m_featureId;
@ -125,14 +151,24 @@ private:
QNetworkAccessManager *m_networkManager;
QNetworkRequest m_networkRequest;
QList<AvailablePipeSource> m_availablePipes;
QTimer m_updatePipesTimer;
Weather *m_weather;
float m_solarFlux;
QList<FITS*> m_temps;
FITS *m_spectralIndex;
void start();
void stop();
void applySettings(const StarTrackerSettings& settings, bool force = false);
void webapiReverseSendSettings(QList<QString>& featureSettingsKeys, const StarTrackerSettings& settings, bool force);
double applyBeam(const FITS *fits, double beamwidth, double ra, double dec, int& imgX, int& imgY) const;
private slots:
void updatePipes();
void networkManagerFinished(QNetworkReply *reply);
void weatherUpdated(float temperature, float pressure, float humidity);
};
#endif // INCLUDE_FEATURE_STARTRACKER_H_

View File

@ -14,5 +14,6 @@
<file>startracker/pulsar-32.png</file>
<file>startracker/sun-40.png</file>
<file>startracker/sun-button-24.png</file>
<file>startracker/moon-button-24.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

View File

@ -2,6 +2,5 @@
<qresource prefix="/startracker/">
<file>startracker/1420mhz_ra_dec.png</file>
<file>startracker/1420mhz_galactic.png</file>
<file>startracker/1420mhz_ra_dec.fits</file>
</qresource>
</RCC>

View File

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/startracker/">
<file>startracker/1420mhz_ra_dec.fits</file>
</qresource>
</RCC>

View File

@ -2,6 +2,5 @@
<qresource prefix="/startracker/">
<file>startracker/150mhz_ra_dec.png</file>
<file>startracker/150mhz_galactic.png</file>
<file>startracker/150mhz_ra_dec.fits</file>
</qresource>
</RCC>

View File

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/startracker/">
<file>startracker/150mhz_ra_dec.fits</file>
</qresource>
</RCC>

View File

@ -2,7 +2,6 @@
<qresource prefix="/startracker/">
<file>startracker/408mhz_ra_dec.png</file>
<file>startracker/408mhz_galactic.png</file>
<file>startracker/408mhz_ra_dec.fits</file>
<file>startracker/408mhz_ra_dec_spectral_index.fits</file>
</qresource>
</RCC>

View File

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/startracker/">
<file>startracker/408mhz_ra_dec.fits</file>
</qresource>
</RCC>

View File

@ -30,6 +30,9 @@
#include <QtCharts/QDateTimeAxis>
#include <QtCharts/QValueAxis>
#include "SWGStarTrackerDisplaySettings.h"
#include "SWGStarTrackerDisplayLoSSettings.h"
#include "feature/featureuiset.h"
#include "feature/featurewebapiutils.h"
#include "gui/basicfeaturesettingsdialog.h"
@ -39,6 +42,8 @@
#include "device/deviceuiset.h"
#include "util/units.h"
#include "util/astronomy.h"
#include "util/interpolation.h"
#include "util/png.h"
#include "ui_startrackergui.h"
#include "startracker.h"
@ -46,18 +51,6 @@
#include "startrackerreport.h"
#include "startrackersettingsdialog.h"
// Linear extrapolation
static double extrapolate(double x0, double y0, double x1, double y1, double x)
{
return y0 + ((x-x0)/(x1-x0)) * (y1-y0);
}
// Linear interpolation
static double interpolate(double x0, double y0, double x1, double y1, double x)
{
return (y0*(x1-x) + y1*(x-x0)) / (x1-x0);
}
StarTrackerGUI* StarTrackerGUI::create(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *feature)
{
StarTrackerGUI* gui = new StarTrackerGUI(pluginAPI, featureUISet, feature);
@ -66,6 +59,7 @@ StarTrackerGUI* StarTrackerGUI::create(PluginAPI* pluginAPI, FeatureUISet *featu
void StarTrackerGUI::destroy()
{
qDeleteAll(m_lineOfSightMarkers);
delete this;
}
@ -121,13 +115,94 @@ bool StarTrackerGUI::handleMessage(const Message& message)
else if (StarTrackerReport::MsgReportRADec::match(message))
{
StarTrackerReport::MsgReportRADec& raDec = (StarTrackerReport::MsgReportRADec&) message;
m_settings.m_ra = Units::decimalHoursToHoursMinutesAndSeconds(raDec.getRA());
m_settings.m_dec = Units::decimalDegreesToDegreeMinutesAndSeconds(raDec.getDec());
ui->rightAscension->setText(m_settings.m_ra);
ui->declination->setText(m_settings.m_dec);
QString target = raDec.getTarget();
if (target == "target")
{
m_settings.m_ra = Units::decimalHoursToHoursMinutesAndSeconds(raDec.getRA());
m_settings.m_dec = Units::decimalDegreesToDegreeMinutesAndSeconds(raDec.getDec());
ui->rightAscension->setText(m_settings.m_ra);
ui->declination->setText(m_settings.m_dec);
}
else if (target == "sun")
{
m_sunRA = raDec.getRA();
m_sunDec = raDec.getDec();
}
else if (target == "moon")
{
m_moonRA = raDec.getRA();
m_moonDec = raDec.getDec();
}
raDecChanged();
return true;
}
else if (StarTrackerReport::MsgReportGalactic::match(message))
{
StarTrackerReport::MsgReportGalactic& galactic = (StarTrackerReport::MsgReportGalactic&) message;
blockApplySettings(true);
ui->galacticLongitude->setValue(galactic.getL());
ui->galacticLatitude->setValue(galactic.getB());
blockApplySettings(false);
return true;
}
else if (MainCore::MsgStarTrackerDisplaySettings::match(message))
{
if (m_settings.m_link)
{
MainCore::MsgStarTrackerDisplaySettings& settings = (MainCore::MsgStarTrackerDisplaySettings&) message;
SWGSDRangel::SWGStarTrackerDisplaySettings *swgSettings = settings.getSWGStarTrackerDisplaySettings();
ui->dateTimeSelect->setCurrentText("Custom");
QDateTime dt = QDateTime::fromString(*swgSettings->getDateTime(), Qt::ISODateWithMs);
ui->dateTime->setDateTime(dt);
ui->target->setCurrentText("Custom Az/El");
ui->azimuth->setValue(swgSettings->getAzimuth());
ui->elevation->setValue(swgSettings->getElevation());
}
return true;
}
else if (MainCore::MsgStarTrackerDisplayLoSSettings::match(message))
{
MainCore::MsgStarTrackerDisplayLoSSettings& settings = (MainCore::MsgStarTrackerDisplayLoSSettings&) message;
SWGSDRangel::SWGStarTrackerDisplayLoSSettings *swgSettings = settings.getSWGStarTrackerDisplayLoSSettings();
bool found = false;
for (int i = 0; i < m_lineOfSightMarkers.size(); i++)
{
if (m_lineOfSightMarkers[i]->m_name == swgSettings->getName())
{
if (swgSettings->getD() == 0.0)
{
// Delete
ui->image->scene()->removeItem(m_lineOfSightMarkers[i]->m_text);
delete m_lineOfSightMarkers[i]->m_text;
delete m_lineOfSightMarkers[i];
m_lineOfSightMarkers.removeAt(i);
}
else
{
// Update
m_lineOfSightMarkers[i]->m_l = swgSettings->getL();
m_lineOfSightMarkers[i]->m_b = swgSettings->getB();
m_lineOfSightMarkers[i]->m_d = swgSettings->getD();
plotGalacticMarker(m_lineOfSightMarkers[i]);
}
found = true;
break;
}
}
if (!found && (swgSettings->getD() != 0.0))
{
// Create new
LoSMarker* marker = new LoSMarker();
marker->m_name = *swgSettings->getName();
marker->m_l = swgSettings->getL();
marker->m_b = swgSettings->getB();
marker->m_d = swgSettings->getD();
marker->m_text = ui->image->scene()->addText(marker->m_name);
m_lineOfSightMarkers.append(marker);
plotGalacticMarker(marker);
}
return true;
}
return false;
}
@ -159,6 +234,7 @@ StarTrackerGUI::StarTrackerGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet,
m_lastFeatureState(0),
m_azElLineChart(nullptr),
m_azElPolarChart(nullptr),
m_solarFluxChart(nullptr),
m_networkManager(nullptr),
m_solarFlux(0.0),
m_solarFluxesValid(false),
@ -168,12 +244,12 @@ StarTrackerGUI::StarTrackerGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet,
QImage(":/startracker/startracker/408mhz_galactic.png"),
QImage(":/startracker/startracker/1420mhz_ra_dec.png"),
QImage(":/startracker/startracker/1420mhz_galactic.png")},
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_milkyWayImages{QPixmap(":/startracker/startracker/milkyway.png"),
QPixmap(":/startracker/startracker/milkywayannotated.png")}
QPixmap(":/startracker/startracker/milkywayannotated.png")},
m_sunRA(0.0),
m_sunDec(0.0),
m_moonRA(0.0),
m_moonDec(0.0)
{
ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose, true);
@ -197,8 +273,6 @@ StarTrackerGUI::StarTrackerGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet,
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("");
@ -211,16 +285,6 @@ StarTrackerGUI::StarTrackerGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet,
m_chart.layout()->setContentsMargins(0, 0, 0, 0);
m_chart.setMargins(QMargins(1, 1, 1, 1));
m_solarFluxChart.setTitle("");
m_solarFluxChart.legend()->hide();
m_solarFluxChart.addAxis(&m_chartSolarFluxXAxis, Qt::AlignBottom);
m_solarFluxChart.addAxis(&m_chartSolarFluxYAxis, Qt::AlignLeft);
m_solarFluxChart.layout()->setContentsMargins(0, 0, 0, 0);
m_solarFluxChart.setMargins(QMargins(1, 1, 1, 1));
m_chartSolarFluxXAxis.setTitleText(QString("Frequency (MHz)"));
m_chartSolarFluxXAxis.setMinorTickCount(-1);
m_chartSolarFluxYAxis.setTitleText(QString("Solar flux density (%1)").arg(solarFluxUnit()));
// Create axes that are static
m_skyTempGalacticLXAxis.setTitleText(QString("Galactic longitude (%1)").arg(QChar(0xb0)));
@ -260,6 +324,8 @@ StarTrackerGUI::StarTrackerGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet,
// Populate subchart menu
on_chartSelect_currentIndexChanged(0);
connect(&m_chart, SIGNAL(plotAreaChanged(QRectF)), this, SLOT(plotAreaChanged(QRectF)));
// Use My Position from preferences, if none set
if ((m_settings.m_latitude == 0.0) && (m_settings.m_longitude == 0.0))
on_useMyPosition_clicked();
@ -313,8 +379,13 @@ void StarTrackerGUI::displaySettings()
setWindowTitle(m_settings.m_title);
blockApplySettings(true);
ui->darkTheme->setChecked(m_settings.m_chartsDarkTheme);
m_solarFluxChart.setTheme(m_settings.m_chartsDarkTheme ? QChart::ChartThemeDark : QChart::ChartThemeLight);
if (m_solarFluxChart) {
m_solarFluxChart->setTheme(m_settings.m_chartsDarkTheme ? QChart::ChartThemeDark : QChart::ChartThemeLight);
}
m_chart.setTheme(m_settings.m_chartsDarkTheme ? QChart::ChartThemeDark : QChart::ChartThemeLight);
ui->drawSun->setChecked(m_settings.m_drawSunOnSkyTempChart);
ui->drawMoon->setChecked(m_settings.m_drawMoonOnSkyTempChart);
ui->link->setChecked(m_settings.m_link);
ui->latitude->setValue(m_settings.m_latitude);
ui->longitude->setValue(m_settings.m_longitude);
ui->target->setCurrentIndex(ui->target->findText(m_settings.m_target));
@ -322,17 +393,27 @@ void StarTrackerGUI::displaySettings()
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);
ui->azimuthOffset->setValue(m_settings.m_azOffset);
ui->elevationOffset->setValue(m_settings.m_elOffset);
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")
{
ui->azimuth->setValue(m_settings.m_az);
ui->elevation->setValue(m_settings.m_el);
}
else if ( (m_settings.m_target == "Custom l/b")
|| (m_settings.m_target == "S7")
|| (m_settings.m_target == "S8")
|| (m_settings.m_target == "S9")
)
{
ui->galacticLatitude->setValue(m_settings.m_b);
ui->galacticLongitude->setValue(m_settings.m_l);
}
if (m_settings.m_dateTime == "")
{
ui->dateTimeSelect->setCurrentIndex(0);
@ -417,21 +498,10 @@ 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();
}
@ -439,7 +509,6 @@ void StarTrackerGUI::on_declination_editingFinished()
{
m_settings.m_dec = ui->declination->text();
applySettings();
updateGalacticCoords();
plotChart();
}
@ -457,6 +526,34 @@ void StarTrackerGUI::on_elevation_valueChanged(double value)
plotChart();
}
void StarTrackerGUI::on_azimuthOffset_valueChanged(double value)
{
m_settings.m_azOffset = value;
applySettings();
plotChart();
}
void StarTrackerGUI::on_elevationOffset_valueChanged(double value)
{
m_settings.m_elOffset = value;
applySettings();
plotChart();
}
void StarTrackerGUI::on_galacticLatitude_valueChanged(double value)
{
m_settings.m_b = value;
applySettings();
plotChart();
}
void StarTrackerGUI::on_galacticLongitude_valueChanged(double value)
{
m_settings.m_l = value;
applySettings();
plotChart();
}
void StarTrackerGUI::updateForTarget()
{
if (m_settings.m_target == "Sun")
@ -478,6 +575,21 @@ void StarTrackerGUI::updateForTarget()
ui->rightAscension->setReadOnly(false);
ui->declination->setReadOnly(false);
}
else if (m_settings.m_target == "S7")
{
ui->galacticLatitude->setValue(-1.0);
ui->galacticLongitude->setValue(132.0);
}
else if (m_settings.m_target == "S8")
{
ui->galacticLatitude->setValue(-15.0);
ui->galacticLongitude->setValue(207.0);
}
else if (m_settings.m_target == "S9")
{
ui->galacticLatitude->setValue(-4.0);
ui->galacticLongitude->setValue(356.0);
}
else
{
ui->rightAscension->setReadOnly(true);
@ -607,6 +719,12 @@ void StarTrackerGUI::applySettings(bool force)
}
}
void StarTrackerGUI::on_link_clicked(bool checked)
{
m_settings.m_link = checked;
applySettings();
}
void StarTrackerGUI::on_useMyPosition_clicked(bool checked)
{
(void) checked;
@ -691,7 +809,6 @@ void StarTrackerGUI::plotChart()
void StarTrackerGUI::raDecChanged()
{
updateGalacticCoords();
if (ui->chartSelect->currentIndex() == 2) {
plotSkyTemperatureChart();
} else if (ui->chartSelect->currentIndex() == 3) {
@ -724,13 +841,28 @@ void StarTrackerGUI::plotSolarFluxChart()
{
ui->chart->setVisible(true);
ui->image->setVisible(false);
ui->drawSun->setVisible(false);
ui->drawMoon->setVisible(false);
ui->darkTheme->setVisible(true);
ui->zoomIn->setVisible(false);
ui->zoomOut->setVisible(false);
ui->addAnimationFrame->setVisible(false);
ui->clearAnimation->setVisible(false);
ui->saveAnimation->setVisible(false);
QChart *oldChart = m_solarFluxChart;
m_solarFluxChart = new QChart();
m_solarFluxChart.removeAllSeries();
if (m_solarFluxesValid)
{
m_solarFluxChart->setTitle("");
m_solarFluxChart->legend()->hide();
m_solarFluxChart->layout()->setContentsMargins(0, 0, 0, 0);
m_solarFluxChart->setMargins(QMargins(1, 1, 1, 1));
m_solarFluxChart->setTheme(m_settings.m_chartsDarkTheme ? QChart::ChartThemeDark : QChart::ChartThemeLight);
double maxValue = -std::numeric_limits<double>::infinity();
double minValue = std::numeric_limits<double>::infinity();
QLineSeries *series = new QLineSeries();
@ -744,30 +876,50 @@ void StarTrackerGUI::plotSolarFluxChart()
series->setPointLabelsVisible(true);
series->setPointLabelsFormat("@yPoint");
series->setPointLabelsClipping(false);
m_solarFluxChart.addSeries(series);
series->attachAxis(&m_chartSolarFluxXAxis);
series->attachAxis(&m_chartSolarFluxYAxis);
m_solarFluxChart->addSeries(series);
QLogValueAxis *chartSolarFluxXAxis = new QLogValueAxis();
QValueAxis *chartSolarFluxYAxis = new QValueAxis();
chartSolarFluxXAxis->setTitleText(QString("Frequency (MHz)"));
chartSolarFluxXAxis->setMinorTickCount(-1);
chartSolarFluxYAxis->setTitleText(QString("Solar flux density (%1)").arg(solarFluxUnit()));
chartSolarFluxYAxis->setMinorTickCount(-1);
if (m_settings.m_solarFluxUnits == StarTrackerSettings::SFU)
{
m_chartSolarFluxYAxis.setLabelFormat("%d");
m_chartSolarFluxYAxis.setRange(0.0, ((((int)maxValue)+99)/100)*100);
chartSolarFluxYAxis->setLabelFormat("%d");
chartSolarFluxYAxis->setRange(0.0, ((((int)maxValue)+99)/100)*100);
}
else if (m_settings.m_solarFluxUnits == StarTrackerSettings::JANSKY)
{
m_chartSolarFluxYAxis.setLabelFormat("%.2g");
m_chartSolarFluxYAxis.setRange(0, ((((int)maxValue)+999999)/100000)*100000);
chartSolarFluxYAxis->setLabelFormat("%.2g");
chartSolarFluxYAxis->setRange(0, ((((int)maxValue)+999999)/100000)*100000);
}
else
{
m_chartSolarFluxYAxis.setLabelFormat("%.2g");
m_chartSolarFluxYAxis.setRange(minValue, maxValue);
chartSolarFluxYAxis->setLabelFormat("%.2g");
// Bug in QtCharts for values < ~1e-12 https://bugreports.qt.io/browse/QTBUG-95304
// Set range to 0-1 here, then real range after axis have been attached
chartSolarFluxYAxis->setRange(0.0, 1.0);
}
m_solarFluxChart->addAxis(chartSolarFluxXAxis, Qt::AlignBottom);
m_solarFluxChart->addAxis(chartSolarFluxYAxis, Qt::AlignLeft);
series->attachAxis(chartSolarFluxXAxis);
series->attachAxis(chartSolarFluxYAxis);
if (m_settings.m_solarFluxUnits == StarTrackerSettings::WATTS_M_HZ) {
chartSolarFluxYAxis->setRange(minValue, maxValue);
}
}
else
m_solarFluxChart.setTitle("Press download Solar flux density data to view");
ui->chart->setChart(&m_solarFluxChart);
// m_chart.setPlotAreaBackgroundVisible(false);
// disconnect(&m_chart, SIGNAL(plotAreaChanged(QRectF)), this, SLOT(plotAreaChanged(QRectF)));
m_solarFluxChart->setTitle("Press download Solar flux density data to view");
ui->chart->setChart(m_solarFluxChart);
delete oldChart;
}
QList<QLineSeries*> StarTrackerGUI::createDriftScan(bool galactic)
@ -913,9 +1065,14 @@ void StarTrackerGUI::plotGalacticLineOfSight()
// Draw top-down image of Milky Way
ui->chart->setVisible(false);
ui->image->setVisible(true);
ui->drawSun->setVisible(false);
ui->drawMoon->setVisible(false);
ui->darkTheme->setVisible(false);
ui->zoomIn->setVisible(true);
ui->zoomOut->setVisible(true);
ui->addAnimationFrame->setVisible(true);
ui->clearAnimation->setVisible(true);
ui->saveAnimation->setVisible(true);
// Select which Milky Way image to show
int imageIdx = ui->chartSubSelect->currentIndex();
@ -946,6 +1103,15 @@ void StarTrackerGUI::plotGalacticLineOfSight()
m_lineOfSight->setLine(sun.x(), sun.y(), point.x(), -point.y());
}
void StarTrackerGUI::plotGalacticMarker(LoSMarker* marker)
{
QPointF sun(511, 708); // Location of Sun on Milky Way image
double pixelsPerKPC = 564.0/22.995; // 75,000ly = 23kpc
QTransform rotation = QTransform().translate(sun.x(), -sun.y()).rotate(marker->m_l).translate(-sun.x(), sun.y()); // Flip Y
QPointF point = rotation.map(QPointF(511, -sun.y() + pixelsPerKPC*marker->m_d));
marker->m_text->setPos(point.x(), -point.y());
}
void StarTrackerGUI::on_zoomIn_clicked()
{
m_zoom->gentleZoom(1.25);
@ -956,13 +1122,58 @@ void StarTrackerGUI::on_zoomOut_clicked()
m_zoom->gentleZoom(0.75);
}
void StarTrackerGUI::on_addAnimationFrame_clicked()
{
QImage image(ui->image->size(), QImage::Format_ARGB32);
image.fill(Qt::black);
QPainter painter(&image);
ui->image->render(&painter);
m_animationImages.append(image);
ui->saveAnimation->setEnabled(true);
ui->clearAnimation->setEnabled(true);
}
void StarTrackerGUI::on_clearAnimation_clicked()
{
m_animationImages.clear();
ui->saveAnimation->setEnabled(false);
ui->clearAnimation->setEnabled(false);
}
void StarTrackerGUI::on_saveAnimation_clicked()
{
// Get filename of animation file
QFileDialog fileDialog(nullptr, "Select file to save animation to", "", "*.png");
fileDialog.setAcceptMode(QFileDialog::AcceptSave);
if (fileDialog.exec())
{
QStringList fileNames = fileDialog.selectedFiles();
if (fileNames.size() > 0)
{
APNG apng(m_animationImages.size());
for (int i = 0; i < m_animationImages.size(); i++) {
apng.addImage(m_animationImages[i]);
}
if (!apng.save(fileNames[0])) {
QMessageBox::critical(this, "Star Tracker", QString("Failed to write to file %1").arg(fileNames[0]));
}
}
}
}
void StarTrackerGUI::plotSkyTemperatureChart()
{
ui->chart->setVisible(true);
ui->image->setVisible(false);
ui->drawSun->setVisible(true);
ui->drawMoon->setVisible(true);
ui->darkTheme->setVisible(false);
ui->zoomIn->setVisible(false);
ui->zoomOut->setVisible(false);
ui->addAnimationFrame->setVisible(false);
ui->clearAnimation->setVisible(false);
ui->saveAnimation->setVisible(false);
bool galactic = (ui->chartSubSelect->currentIndex() & 1) == 1;
@ -998,133 +1209,22 @@ void StarTrackerGUI::plotSkyTemperatureChart()
int idx = ui->chartSubSelect->currentIndex();
if ((idx == 6) || (idx == 7))
{
// Adjust temperature from 408MHz FITS file, taking in to account
// observation frequency and beamwidth
FITS *fits = &m_temps[1];
if (fits->valid())
double temp;
if (m_starTracker->calcSkyTemperature(m_settings.m_frequency, m_settings.m_beamwidth, ra, dec, temp))
{
const double beamwidth = m_settings.m_beamwidth;
const double halfBeamwidth = beamwidth/2.0;
// Use cos^p(x) for approximation of radiation pattern
// (Essentially the same as Gaussian of exp(-4*ln(theta^2/beamwidth^2))
// (See a2 in https://arxiv.org/pdf/1812.10084.pdf for Elliptical equivalent))
// We have gain of 0dB (1) at 0 degrees, and -3dB (~0.5) at half-beamwidth degrees
// Find exponent that correponds to -3dB at that angle
double minus3dBLinear = pow(10.0, -3.0/10.0);
double p = log(minus3dBLinear)/log(cos(Units::degreesToRadians(halfBeamwidth)));
// Create an matrix with gain as a function of angle
double degreesPerPixelH = abs(fits->degreesPerPixelH());
double degreesPerPixelV = abs(fits->degreesPerPixelV());
int numberOfCoeffsH = ceil(beamwidth/degreesPerPixelH);
int numberOfCoeffsV = ceil(beamwidth/degreesPerPixelV);
if ((numberOfCoeffsH & 1) == 0) {
numberOfCoeffsH++;
}
if ((numberOfCoeffsV & 1) == 0) {
numberOfCoeffsV++;
}
double *beam = new double[numberOfCoeffsH*numberOfCoeffsV];
double sum = 0.0;
int y0 = numberOfCoeffsV/2;
int x0 = numberOfCoeffsH/2;
int nonZeroCount = 0;
for (int y = 0; y < numberOfCoeffsV; y++)
{
for (int x = 0; x < numberOfCoeffsH; x++)
{
double xp = (x - x0) * degreesPerPixelH;
double yp = (y - y0) * degreesPerPixelV;
double r = sqrt(xp*xp+yp*yp);
if (r < halfBeamwidth)
{
beam[y*numberOfCoeffsH+x] = pow(cos(Units::degreesToRadians(r)), p);
sum += beam[y*numberOfCoeffsH+x];
nonZeroCount++;
}
else
{
beam[y*numberOfCoeffsH+x] = 0.0;
}
}
}
// Get centre pixel coordinates
double centreX;
if (ra <= 12.0) {
centreX = (12.0 - ra) / 24.0;
} else {
centreX = (24 - ra + 12) / 24.0;
}
double centreY = (90.0-dec) / 180.0;
int imgX = centreX * fits->width();
int imgY = centreY * fits->height();
// Apply weighting to temperature data
double weightedSum = 0.0;
for (int y = 0; y < numberOfCoeffsV; y++)
{
for (int x = 0; x < numberOfCoeffsH; x++)
{
weightedSum += beam[y*numberOfCoeffsH+x] * fits->scaledWrappedValue(imgX + (x-x0), imgY + (y-y0));
}
}
// From: https://www.cv.nrao.edu/~sransom/web/Ch3.html
// The antenna temperature equals the source brightness temperature multiplied by the fraction of the beam solid angle filled by the source
// So we scale the sum by the total number of non-zero pixels (i.e. beam area)
// If we compare to some maps with different beamwidths here: https://www.cv.nrao.edu/~demerson/radiosky/sky_jun96.pdf
// The values we've computed are a bit higher..
double temp408 = weightedSum/nonZeroCount;
// Scale according to frequency - CMB contribution constant
// Power law at low frequencies, with slight variation in spectral index
// See:
// Global Sky Model: https://ascl.net/1011.010
// An improved Model of Diffuse Galactic Radio Emission: https://arxiv.org/pdf/1605.04920.pdf
// A high-resolution self-consistent whole sky foreground model: https://arxiv.org/abs/1812.10084
// (De-striping:) Full sky study of diffuse Galactic emission at decimeter wavelength https://www.aanda.org/articles/aa/pdf/2003/42/aah4363.pdf
// Data here: http://cdsarc.u-strasbg.fr/viz-bin/cat/J/A+A/410/847
// LFmap: https://www.faculty.ece.vt.edu/swe/lwa/memo/lwa0111.pdf
double iso408 = 50 * pow(150e6/408e6, 2.75); // Extra-galactic isotropic in reference map at 408MHz
double isoT = 50 * pow(150e6/m_settings.m_frequency, 2.75); // Extra-galactic isotropic at target frequency
double cmbT = 2.725; // Cosmic microwave backgroud;
double spectralIndex;
if (m_spectralIndex.valid())
{
// See https://www.aanda.org/articles/aa/pdf/2003/42/aah4363.pdf
spectralIndex = m_spectralIndex.scaledValue(imgX, imgY);
}
else
{
// See https://arxiv.org/abs/1812.10084 fig 2
if (m_settings.m_frequency < 200e6) {
spectralIndex = 2.55;
} else if (m_settings.m_frequency < 20e9) {
spectralIndex = 2.695;
} else {
spectralIndex = 3.1;
}
}
double galactic480 = temp408 - cmbT - iso408;
double galacticT = galactic480 * pow(408e6/m_settings.m_frequency, spectralIndex); // Scale galactic contribution by frequency
double temp = galacticT + cmbT + isoT; // Final temperature
series->setPointLabelsVisible(true);
series->setPointLabelsColor(Qt::red);
series->setPointLabelsFormat(QString("%1 K").arg(std::round(temp)));
// Scale marker size by beamwidth
markerSize = std::max((int)round(beamWidth * degPerPixel), 5);
delete[] beam;
}
else
qDebug() << "StarTrackerGUI::plotSkyTemperatureChart: FITS temperature file not valid";
}
else
{
// Read temperature from selected FITS file at target RA/Dec
QImage *img = &m_images[idx];
FITS *fits = &m_temps[idx/2];
const FITS *fits = m_starTracker->getTempFITS(idx/2);
double x;
if (ra <= 12.0) {
x = (12.0 - ra) / 24.0;
@ -1147,6 +1247,10 @@ void StarTrackerGUI::plotSkyTemperatureChart()
series->setPointLabelsColor(Qt::red);
series->setPointLabelsFormat(QString("%1 K").arg(std::round(temp)));
}
else
{
qDebug() << "FITS not valid";
}
// Temperature from just one pixel, but need to make marker visbile
markerSize = 5;
@ -1155,19 +1259,72 @@ void StarTrackerGUI::plotSkyTemperatureChart()
series->setColor(getSeriesColor(0));
m_chart.setTitle("");
// We want scatter to be on top of line, but same color even when no drift line
// We want scatter (for the beam) to be on top of line, but same color even when other series
for (int i = 0; i < lineSeries.length(); i++) {
m_chart.addSeries(lineSeries[i]);
}
// Draw Sun on chart if requested
QScatterSeries *sunSeries = nullptr;
if (m_settings.m_drawSunOnSkyTempChart)
{
sunSeries = new QScatterSeries();
mapRaDec(m_sunRA, m_sunDec, galactic, x, y);
sunSeries->append(x, y);
sunSeries->setMarkerSize((int)std::max(std::round(0.53 * degPerPixel), 5.0));
sunSeries->setColor(Qt::yellow);
sunSeries->setBorderColor(Qt::yellow);
if (m_settings.m_target != "Sun") // Avoid labels on top of each other
{
sunSeries->setPointLabelsVisible(true);
sunSeries->setPointLabelsColor(Qt::red);
sunSeries->setPointLabelsFormat("Sun");
}
m_chart.addSeries(sunSeries);
}
// Draw moon on chart if requested
QScatterSeries *moonSeries = nullptr;
if (m_settings.m_drawMoonOnSkyTempChart)
{
moonSeries = new QScatterSeries();
mapRaDec(m_moonRA, m_moonDec, galactic, x, y);
moonSeries->append(x, y);
moonSeries->setMarkerSize((int)std::max(std::round(0.53 * degPerPixel), 5.0));
moonSeries->setColor(qRgb(150, 150, 150));
moonSeries->setBorderColor(qRgb(150, 150, 150));
if (m_settings.m_target != "Moon") // Avoid labels on top of each other
{
moonSeries->setPointLabelsVisible(true);
moonSeries->setPointLabelsColor(Qt::red);
moonSeries->setPointLabelsFormat("Moon");
}
m_chart.addSeries(moonSeries);
}
m_chart.addSeries(series);
if (galactic)
{
m_chart.addAxis(&m_skyTempGalacticLXAxis, Qt::AlignBottom);
series->attachAxis(&m_skyTempGalacticLXAxis);
if (sunSeries) {
sunSeries->attachAxis(&m_skyTempGalacticLXAxis);
}
if (moonSeries) {
moonSeries->attachAxis(&m_skyTempGalacticLXAxis);
}
m_skyTempYAxis.setTitleText(QString("Galactic latitude (%1)").arg(QChar(0xb0)));
m_chart.addAxis(&m_skyTempYAxis, Qt::AlignLeft);
series->attachAxis(&m_skyTempYAxis);
if (sunSeries) {
sunSeries->attachAxis(&m_skyTempYAxis);
}
if (moonSeries) {
moonSeries->attachAxis(&m_skyTempYAxis);
}
for (int i = 0; i < lineSeries.length(); i++)
{
@ -1179,10 +1336,22 @@ void StarTrackerGUI::plotSkyTemperatureChart()
{
m_chart.addAxis(&m_skyTempRAXAxis, Qt::AlignBottom);
series->attachAxis(&m_skyTempRAXAxis);
if (sunSeries) {
sunSeries->attachAxis(&m_skyTempRAXAxis);
}
if (moonSeries) {
moonSeries->attachAxis(&m_skyTempRAXAxis);
}
m_skyTempYAxis.setTitleText(QString("Declination (%1)").arg(QChar(0xb0)));
m_chart.addAxis(&m_skyTempYAxis, Qt::AlignLeft);
series->attachAxis(&m_skyTempYAxis);
if (sunSeries) {
sunSeries->attachAxis(&m_skyTempYAxis);
}
if (moonSeries) {
moonSeries->attachAxis(&m_skyTempYAxis);
}
for (int i = 0; i < lineSeries.length(); i++)
{
@ -1192,7 +1361,6 @@ void StarTrackerGUI::plotSkyTemperatureChart()
}
ui->chart->setChart(&m_chart);
plotAreaChanged(m_chart.plotArea());
connect(&m_chart, SIGNAL(plotAreaChanged(QRectF)), this, SLOT(plotAreaChanged(QRectF)));
}
void StarTrackerGUI::plotAreaChanged(const QRectF &plotArea)
@ -1237,9 +1405,14 @@ void StarTrackerGUI::plotElevationLineChart()
{
ui->chart->setVisible(true);
ui->image->setVisible(false);
ui->drawSun->setVisible(false);
ui->drawMoon->setVisible(false);
ui->darkTheme->setVisible(true);
ui->zoomIn->setVisible(false);
ui->zoomOut->setVisible(false);
ui->addAnimationFrame->setVisible(false);
ui->clearAnimation->setVisible(false);
ui->saveAnimation->setVisible(false);
QChart *oldChart = m_azElLineChart;
@ -1360,9 +1533,14 @@ void StarTrackerGUI::plotElevationPolarChart()
{
ui->chart->setVisible(true);
ui->image->setVisible(false);
ui->drawSun->setVisible(false);
ui->drawMoon->setVisible(false);
ui->darkTheme->setVisible(true);
ui->zoomIn->setVisible(false);
ui->zoomOut->setVisible(false);
ui->addAnimationFrame->setVisible(false);
ui->clearAnimation->setVisible(false);
ui->saveAnimation->setVisible(false);
QChart *oldChart = m_azElPolarChart;
@ -1484,7 +1662,7 @@ void StarTrackerGUI::plotElevationPolarChart()
qreal el = polarSeries->at(i).y();
if ((prevAz > 270.0) && (az <= 90.0))
{
double elMid = interpolate(prevAz, prevEl, az+360.0, el, 360.0);
double elMid = Interpolation::interpolate(prevAz, prevEl, az+360.0, el, 360.0);
s->append(360.0, elMid);
series.append(new QLineSeries());
s = series.last();
@ -1494,7 +1672,7 @@ void StarTrackerGUI::plotElevationPolarChart()
}
else if ((prevAz <= 90.0) && (az > 270.0))
{
double elMid = interpolate(prevAz, prevEl, az-360.0, el, 0.0);
double elMid = Interpolation::interpolate(prevAz, prevEl, az-360.0, el, 0.0);
s->append(0.0, elMid);
series.append(new QLineSeries());
s = series.last();
@ -1638,14 +1816,59 @@ QString StarTrackerGUI::solarFluxUnit()
return "";
}
// Calculate solar flux at given frequency in SFU
double StarTrackerGUI::calcSolarFlux(double freqMhz)
{
if (m_solarFluxesValid)
{
double solarFlux;
const int fluxes = sizeof(m_solarFluxFrequencies)/sizeof(*m_solarFluxFrequencies);
int i;
for (i = 0; i < fluxes; i++)
{
if (freqMhz < m_solarFluxFrequencies[i])
break;
}
if (i == 0)
{
solarFlux = Interpolation::extrapolate((double)m_solarFluxFrequencies[0], (double)m_solarFluxes[0],
(double)m_solarFluxFrequencies[1], (double)m_solarFluxes[1],
freqMhz
);
}
else if (i == fluxes)
{
solarFlux = Interpolation::extrapolate((double)m_solarFluxFrequencies[fluxes-2], (double)m_solarFluxes[fluxes-2],
(double)m_solarFluxFrequencies[fluxes-1], (double)m_solarFluxes[fluxes-1],
freqMhz
);
}
else
{
solarFlux = Interpolation::interpolate((double)m_solarFluxFrequencies[i-1], (double)m_solarFluxes[i-1],
(double)m_solarFluxFrequencies[i], (double)m_solarFluxes[i],
freqMhz
);
}
return solarFlux;
}
else
{
return 0.0;
}
}
void StarTrackerGUI::displaySolarFlux()
{
if (((m_settings.m_solarFluxData == StarTrackerSettings::DRAO_2800) && (m_solarFlux == 0.0))
|| ((m_settings.m_solarFluxData != StarTrackerSettings::DRAO_2800) && !m_solarFluxesValid))
{
ui->solarFlux->setText("");
}
else
{
double solarFlux;
double freqMhz = m_settings.m_frequency/1000000.0;
if (m_settings.m_solarFluxData == StarTrackerSettings::DRAO_2800)
{
solarFlux = m_solarFlux;
@ -1653,35 +1876,7 @@ void StarTrackerGUI::displaySolarFlux()
}
else if (m_settings.m_solarFluxData == StarTrackerSettings::TARGET_FREQ)
{
double freqMhz = m_settings.m_frequency/1000000.0;
const int fluxes = sizeof(m_solarFluxFrequencies)/sizeof(*m_solarFluxFrequencies);
int i;
for (i = 0; i < fluxes; i++)
{
if (freqMhz < m_solarFluxFrequencies[i])
break;
}
if (i == 0)
{
solarFlux = extrapolate(m_solarFluxFrequencies[0], m_solarFluxes[0],
m_solarFluxFrequencies[1], m_solarFluxes[1],
freqMhz
);
}
else if (i == fluxes)
{
solarFlux = extrapolate(m_solarFluxFrequencies[fluxes-2], m_solarFluxes[fluxes-2],
m_solarFluxFrequencies[fluxes-1], m_solarFluxes[fluxes-1],
freqMhz
);
}
else
{
solarFlux = interpolate(m_solarFluxFrequencies[i-1], m_solarFluxes[i-1],
m_solarFluxFrequencies[i], m_solarFluxes[i],
freqMhz
);
}
solarFlux = calcSolarFlux(freqMhz);
ui->solarFlux->setToolTip(QString("Solar flux density interpolated to %1 MHz").arg(freqMhz));
}
else
@ -1692,6 +1887,9 @@ void StarTrackerGUI::displaySolarFlux()
}
ui->solarFlux->setText(QString("%1 %2").arg(convertSolarFluxUnits(solarFlux)).arg(solarFluxUnit()));
ui->solarFlux->setCursorPosition(0);
// Calculate value at target frequency in Jy for Radio Astronomy plugin
m_starTracker->getInputMessageQueue()->push(StarTracker::MsgSetSolarFlux::create(Units::solarFluxUnitsToJansky(calcSolarFlux(freqMhz))));
}
}
@ -1707,7 +1905,8 @@ bool StarTrackerGUI::readSolarFlux()
QString string(bytes);
// HHMMSS 245 410 610 1415 2695 4995 8800 15400 Mhz
// 000000 000019 000027 000037 000056 000073 000116 000202 000514 sfu
QRegExp re("([0-9]{2})([0-9]{2})([0-9]{2}) ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+)");
// Occasionally, file will contain ////// in a column, presumably to indicate no data
QRegExp re("([0-9]{2})([0-9]{2})([0-9]{2}) ([0-9\\/]+) ([0-9\\/]+) ([0-9\\/]+) ([0-9\\/]+) ([0-9\\/]+) ([0-9\\/]+) ([0-9\\/]+) ([0-9\\/]+)");
if (re.indexIn(string) != -1)
{
for (int i = 0; i < 8; i++)
@ -1717,6 +1916,8 @@ bool StarTrackerGUI::readSolarFlux()
plotChart();
return true;
}
else
qDebug() << "StarTrackerGUI::readSolarFlux: No match for " << string;
}
}
else
@ -1764,7 +1965,7 @@ void StarTrackerGUI::updateSolarFlux(bool all)
{
QDate today = QDateTime::currentDateTimeUtc().date();
QString solarFluxFile = getSolarFluxFilename();
if (m_dlm.confirmDownload(solarFluxFile, nullptr, 1))
if (m_dlm.confirmDownload(solarFluxFile, nullptr, 0))
{
QString urlString = QString("https://www.sws.bom.gov.au/Category/World Data Centre/Data Display and Download/Solar Radio/station/learmonth/SRD/%1/L%2.SRD")
.arg(today.year()).arg(today.toString("yyMMdd"));
@ -1791,12 +1992,28 @@ void StarTrackerGUI::on_downloadSolarFlux_clicked()
void StarTrackerGUI::on_darkTheme_clicked(bool checked)
{
m_settings.m_chartsDarkTheme = checked;
m_solarFluxChart.setTheme(m_settings.m_chartsDarkTheme ? QChart::ChartThemeDark : QChart::ChartThemeLight);
if (m_solarFluxChart) {
m_solarFluxChart->setTheme(m_settings.m_chartsDarkTheme ? QChart::ChartThemeDark : QChart::ChartThemeLight);
}
m_chart.setTheme(m_settings.m_chartsDarkTheme ? QChart::ChartThemeDark : QChart::ChartThemeLight);
plotChart();
applySettings();
}
void StarTrackerGUI::on_drawSun_clicked(bool checked)
{
m_settings.m_drawSunOnSkyTempChart = checked;
plotChart();
applySettings();
}
void StarTrackerGUI::on_drawMoon_clicked(bool checked)
{
m_settings.m_drawMoonOnSkyTempChart = checked;
plotChart();
applySettings();
}
void StarTrackerGUI::downloadFinished(const QString& filename, bool success)
{
(void) filename;

View File

@ -47,6 +47,15 @@ using namespace QtCharts;
class StarTrackerGUI : public FeatureGUI {
Q_OBJECT
struct LoSMarker {
QString m_name;
float m_l;
float m_b;
float m_d;
QGraphicsTextItem* m_text;
};
public:
static StarTrackerGUI* create(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *feature);
virtual void destroy();
@ -80,9 +89,7 @@ private:
QCategoryAxis m_skyTempRAXAxis;
QValueAxis m_skyTempYAxis;
QChart m_solarFluxChart;
QLogValueAxis m_chartSolarFluxXAxis;
QValueAxis m_chartSolarFluxYAxis;
QChart *m_solarFluxChart;
QNetworkAccessManager *m_networkManager;
QNetworkRequest m_networkRequest;
@ -96,14 +103,22 @@ private:
// Sky temperature
QList<QImage> m_images;
QList<FITS> m_temps;
FITS m_spectralIndex;
// Galactic line of sight
QList<QPixmap> m_milkyWayImages;
GraphicsViewZoom* m_zoom;
QList<QGraphicsPixmapItem *> m_milkyWayItems;
QGraphicsLineItem* m_lineOfSight;
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;
explicit StarTrackerGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *feature, QWidget* parent = nullptr);
virtual ~StarTrackerGUI();
@ -123,17 +138,18 @@ private:
void plotSolarFluxChart();
void plotGalacticLineOfSight();
void createGalacticLineOfSightScene();
void plotGalacticMarker(LoSMarker* marker);
void plotChart();
void removeAllAxes();
double convertSolarFluxUnits(double sfu);
QString solarFluxUnit();
double calcSolarFlux(double freqMhz);
void displaySolarFlux();
QString getSolarFluxFilename();
bool readSolarFlux();
void raDecChanged();
void updateChartSubSelect();
void updateSolarFlux(bool all);
void updateGalacticCoords();
void leaveEvent(QEvent*);
void enterEvent(QEvent*);
@ -143,6 +159,7 @@ private slots:
void onWidgetRolled(QWidget* widget, bool rollDown);
void handleInputMessages();
void on_startStop_toggled(bool checked);
void on_link_clicked(bool checked=false);
void on_useMyPosition_clicked(bool checked=false);
void on_latitude_valueChanged(double value);
void on_longitude_valueChanged(double value);
@ -150,6 +167,10 @@ private slots:
void on_declination_editingFinished();
void on_azimuth_valueChanged(double value);
void on_elevation_valueChanged(double value);
void on_azimuthOffset_valueChanged(double value);
void on_elevationOffset_valueChanged(double value);
void on_galacticLatitude_valueChanged(double value);
void on_galacticLongitude_valueChanged(double value);
void on_frequency_valueChanged(int value);
void on_beamwidth_valueChanged(double value);
void on_target_currentTextChanged(const QString &text);
@ -166,6 +187,11 @@ private slots:
void on_darkTheme_clicked(bool checked);
void on_zoomIn_clicked();
void on_zoomOut_clicked();
void on_addAnimationFrame_clicked();
void on_clearAnimation_clicked();
void on_saveAnimation_clicked();
void on_drawSun_clicked(bool checked);
void on_drawMoon_clicked(bool checked);
void networkManagerFinished(QNetworkReply *reply);
void downloadFinished(const QString& filename, bool success);
};

View File

@ -43,7 +43,7 @@
<x>10</x>
<y>10</y>
<width>321</width>
<height>201</height>
<height>251</height>
</rect>
</property>
<property name="windowTitle">
@ -67,22 +67,90 @@
</property>
<item>
<layout class="QGridLayout" name="gridLayout">
<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>
<item row="10" 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>23h59m59.59s</string>
<string>l</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="rightAscensionLabel">
<item row="8" column="1">
<widget class="DMSSpinBox" name="azimuth" native="true">
<property name="toolTip">
<string>Azimuth in degrees to the target from the observation point</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="timeLabel">
<property name="text">
<string>RA</string>
<string>Time</string>
</property>
</widget>
</item>
<item row="9" column="3">
<widget class="QDoubleSpinBox" name="elevationOffset">
<property name="toolTip">
<string>Offset in degrees to add to calculated target elevation</string>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>-180.000000000000000</double>
</property>
<property name="maximum">
<double>180.000000000000000</double>
</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="8" column="2">
<widget class="QLabel" name="elevationLabel">
<property name="text">
<string>Elevation</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="3">
<widget class="QDoubleSpinBox" name="beamwidth">
<property name="toolTip">
<string>Antenna half power (-3dB) beamwidth (degrees)</string>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>0.100000000000000</double>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>
<property name="value">
<double>25.000000000000000</double>
</property>
</widget>
</item>
@ -93,39 +161,6 @@ This can be specified as a decimal (E.g. 12.23) or in hours, minutes and seconds
</property>
</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="2">
<widget class="QLabel" name="beamwidthLabel">
<property name="text">
<string>Beamwidth</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="latitude">
<property name="toolTip">
<string>Latitude in decimal degrees (North positive) of observation point / antenna location</string>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="minimum">
<double>-90.000000000000000</double>
</property>
<property name="maximum">
<double>90.000000000000000</double>
</property>
<property name="value">
<double>-90.000000000000000</double>
</property>
</widget>
</item>
<item row="5" column="1" colspan="3">
<layout class="QHBoxLayout" name="targetLayout">
<item>
@ -197,6 +232,26 @@ This can be specified as a decimal (E.g. 12.23) or in hours, minutes and seconds
<string>Custom Az/El</string>
</property>
</item>
<item>
<property name="text">
<string>Custom l/b</string>
</property>
</item>
<item>
<property name="text">
<string>S7</string>
</property>
</item>
<item>
<property name="text">
<string>S8</string>
</property>
</item>
<item>
<property name="text">
<string>S9</string>
</property>
</item>
</widget>
</item>
<item>
@ -214,52 +269,10 @@ This can be specified as a decimal (E.g. 12.23) or in hours, minutes and seconds
</item>
</layout>
</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="3" column="2" colspan="2">
<widget class="WrappingDateTimeEdit" name="dateTime">
<property name="toolTip">
<string>Date and time to use when calculating target's position</string>
</property>
<property name="displayFormat">
<string>dd/MM/yyyy HH:mm:ss</string>
</property>
<property name="calendarPopup">
<bool>true</bool>
</property>
</widget>
</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="2" column="3">
<widget class="QDoubleSpinBox" name="longitude">
<property name="toolTip">
<string>Longitude in decimal degress (East positive) of observation point / antenna location</string>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="minimum">
<double>-180.000000000000000</double>
</property>
<property name="maximum">
<double>180.000000000000000</double>
</property>
<property name="value">
<double>-180.000000000000000</double>
<item row="4" column="2">
<widget class="QLabel" name="solarFluxLabel">
<property name="text">
<string>Solar Flux</string>
</property>
</widget>
</item>
@ -270,19 +283,6 @@ This can be specified as a decimal (E.g. 12.23) or in hours, minutes and seconds
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QSpinBox" name="frequency">
<property name="toolTip">
<string>Observation frequency (MHz)</string>
</property>
<property name="minimum">
<number>50</number>
</property>
<property name="maximum">
<number>100000</number>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="lstLabel">
<property name="text">
@ -290,6 +290,30 @@ This can be specified as a decimal (E.g. 12.23) or in hours, minutes and seconds
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="azimuthtLabel">
<property name="text">
<string>Azimuth</string>
</property>
</widget>
</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="3">
<widget class="QLineEdit" name="solarFlux">
<property name="toolTip">
<string>Solar flux density</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="targetLabel">
<property name="text">
@ -297,10 +321,15 @@ This can be specified as a decimal (E.g. 12.23) or in hours, minutes and seconds
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="azimuthtLabel">
<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>Azimuth</string>
<string>23h59m59.59s</string>
</property>
</widget>
</item>
@ -334,6 +363,20 @@ This can be specified as a decimal (E.g. 12.23) or in hours, minutes and seconds
</property>
</spacer>
</item>
<item>
<widget class="ButtonSwitch" name="link">
<property name="toolTip">
<string>Link display to Radio Astronomy channel</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/link.png</normaloff>:/link.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="viewOnMap">
<property name="toolTip">
@ -392,6 +435,133 @@ This can be specified as a decimal (E.g. 12.23) or in hours, minutes and seconds
</item>
</layout>
</item>
<item row="7" column="0">
<widget class="QLabel" name="rightAscensionLabel">
<property name="text">
<string>RA</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="9" column="1">
<widget class="QDoubleSpinBox" name="azimuthOffset">
<property name="toolTip">
<string>Offset in degrees to added to calculated target azimuth</string>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>-360.000000000000000</double>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QLabel" name="beamwidthLabel">
<property name="text">
<string>Beamwidth</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="latitude">
<property name="toolTip">
<string>Latitude in decimal degrees (North positive) of observation point / antenna location</string>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="minimum">
<double>-90.000000000000000</double>
</property>
<property name="maximum">
<double>90.000000000000000</double>
</property>
<property name="value">
<double>-90.000000000000000</double>
</property>
</widget>
</item>
<item row="10" column="3">
<widget class="DMSSpinBox" name="galacticLatitude" native="true">
<property name="toolTip">
<string>Galactic latitude in degrees</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QSpinBox" name="frequency">
<property name="toolTip">
<string>Observation frequency (MHz)</string>
</property>
<property name="minimum">
<number>50</number>
</property>
<property name="maximum">
<number>100000</number>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="azimuithOffsetLabel">
<property name="text">
<string>Az Offset</string>
</property>
</widget>
</item>
<item row="3" column="2" colspan="2">
<widget class="WrappingDateTimeEdit" name="dateTime">
<property name="toolTip">
<string>Date and time to use when calculating target's position</string>
</property>
<property name="displayFormat">
<string>dd/MM/yyyy HH:mm:ss</string>
</property>
<property name="calendarPopup">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QDoubleSpinBox" name="longitude">
<property name="toolTip">
<string>Longitude in decimal degress (East positive) of observation point / antenna location</string>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="minimum">
<double>-180.000000000000000</double>
</property>
<property name="maximum">
<double>180.000000000000000</double>
</property>
<property name="value">
<double>-180.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="latitudeLabel">
<property name="text">
<string>Latitude</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="dateTimeSelect">
<property name="toolTip">
@ -409,84 +579,22 @@ This can be specified as a decimal (E.g. 12.23) or in hours, minutes and seconds
</item>
</widget>
</item>
<item row="4" column="3">
<widget class="QLineEdit" name="solarFlux">
<item row="9" column="2">
<widget class="QLabel" name="elevationOffsetLabel">
<property name="text">
<string>El Offset</string>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="DMSSpinBox" name="galacticLongitude" native="true">
<property name="toolTip">
<string>Solar flux density</string>
</property>
<property name="readOnly">
<bool>true</bool>
<string>Galactic longitude in degrees (positive Eastward from galactic center)</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="DMSSpinBox" name="azimuth" native="true">
<property name="toolTip">
<string>Azimuth in degrees to the target from the observation point</string>
</property>
</widget>
</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">
<item row="10" column="2">
<widget class="QLabel" name="galacticLongitudeLabel">
<property name="font">
<font>
<family>Liberation Sans</family>
@ -499,34 +607,6 @@ This can be specified as a decimal (E.g. 34.23) or in degrees, minutes and secon
</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>
</item>
</layout>
@ -535,7 +615,7 @@ This can be specified as a decimal (E.g. 34.23) or in degrees, minutes and secon
<property name="geometry">
<rect>
<x>10</x>
<y>250</y>
<y>280</y>
<width>318</width>
<height>268</height>
</rect>
@ -603,6 +683,91 @@ This can be specified as a decimal (E.g. 34.23) or in degrees, minutes and secon
<item>
<widget class="QComboBox" name="chartSubSelect"/>
</item>
<item>
<widget class="QToolButton" name="drawMoon">
<property name="toolTip">
<string>Draw Moon</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="startracker.qrc">
<normaloff>:/startracker/startracker/moon-button-24.png</normaloff>:/startracker/startracker/moon-button-24.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="drawSun">
<property name="toolTip">
<string>Draw Sun</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>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="addAnimationFrame">
<property name="toolTip">
<string>Add current image to animation</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/plusw.png</normaloff>:/plusw.png</iconset>
</property>
<property name="checkable">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="saveAnimation">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Save animation to a .png file</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/camera.png</normaloff>:/camera.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="clearAnimation">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Clear current animation</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/bin.png</normaloff>:/bin.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="darkTheme">
<property name="toolTip">
@ -726,6 +891,8 @@ This can be specified as a decimal (E.g. 34.23) or in degrees, minutes and secon
<tabstop>beamwidth</tabstop>
<tabstop>rightAscension</tabstop>
<tabstop>declination</tabstop>
<tabstop>azimuthOffset</tabstop>
<tabstop>elevationOffset</tabstop>
<tabstop>chartSelect</tabstop>
<tabstop>chartSubSelect</tabstop>
<tabstop>darkTheme</tabstop>

View File

@ -30,7 +30,7 @@
const PluginDescriptor StarTrackerPlugin::m_pluginDescriptor = {
StarTracker::m_featureId,
QStringLiteral("Star Tracker"),
QStringLiteral("6.15.0"),
QStringLiteral("6.16.7"),
QStringLiteral("(c) Jon Beniston, M7RCE"),
QStringLiteral("https://github.com/f4exb/sdrangel"),
true,

View File

@ -59,20 +59,47 @@ public:
public:
double getRA() const { return m_ra; }
double getDec() const { return m_dec; }
QString getTarget() const { return m_target; }
static MsgReportRADec* create(double ra, double dec)
static MsgReportRADec* create(double ra, double dec, const QString& target)
{
return new MsgReportRADec(ra, dec);
return new MsgReportRADec(ra, dec, target);
}
private:
double m_ra;
double m_dec;
QString m_target; // "target", "sun" or "moon"
MsgReportRADec(double ra, double dec) :
MsgReportRADec(double ra, double dec, const QString& target) :
Message(),
m_ra(ra),
m_dec(dec)
m_dec(dec),
m_target(target)
{
}
};
class MsgReportGalactic : public Message {
MESSAGE_CLASS_DECLARATION
public:
double getL() const { return m_l; }
double getB() const { return m_b; }
static MsgReportGalactic* create(double l, double b)
{
return new MsgReportGalactic(l, b);
}
private:
double m_l;
double m_b;
MsgReportGalactic(double l, double b) :
Message(),
m_l(l),
m_b(b)
{
}
};

View File

@ -23,6 +23,14 @@
#include "startrackersettings.h"
const QStringList StarTrackerSettings::m_pipeTypes = {
QStringLiteral("RadioAstronomy")
};
const QStringList StarTrackerSettings::m_pipeURIs = {
QStringLiteral("sdrangel.channel.radioastronomy")
};
StarTrackerSettings::StarTrackerSettings()
{
resetToDefaults();
@ -64,6 +72,15 @@ void StarTrackerSettings::resetToDefaults()
m_reverseAPIFeatureIndex = 0;
m_az = 0.0;
m_el = 0.0;
m_l = 0.0;
m_b = 0.0;
m_azOffset = 0.0;
m_elOffset = 0.0;
m_link = false;
m_owmAPIKey = "";
m_weatherUpdatePeriod = 60;
m_drawSunOnSkyTempChart = true;
m_drawMoonOnSkyTempChart = true;
}
QByteArray StarTrackerSettings::serialize() const
@ -104,6 +121,15 @@ QByteArray StarTrackerSettings::serialize() const
s.writeBool(32, m_chartsDarkTheme);
s.writeDouble(33, m_az);
s.writeDouble(34, m_el);
s.writeDouble(35, m_l);
s.writeDouble(36, m_b);
s.writeBool(37, m_link);
s.writeString(38, m_owmAPIKey);
s.writeS32(39, m_weatherUpdatePeriod);
s.writeDouble(40, m_azOffset);
s.writeDouble(41, m_elOffset);
s.writeBool(42, m_drawSunOnSkyTempChart);
s.writeBool(43, m_drawMoonOnSkyTempChart);
return s.final();
}
@ -175,6 +201,18 @@ bool StarTrackerSettings::deserialize(const QByteArray& data)
d.readDouble(33, &m_az, 0.0);
d.readDouble(34, &m_el, 0.0);
d.readDouble(35, &m_l, 0.0);
d.readDouble(36, &m_b, 0.0);
d.readBool(37, &m_link, false);
d.readString(38, &m_owmAPIKey, "");
d.readS32(39, &m_weatherUpdatePeriod, 60);
d.readDouble(40, &m_azOffset, 0.0);
d.readDouble(41, &m_elOffset, 0.0);
d.readBool(42, &m_drawSunOnSkyTempChart, true);
d.readBool(43, &m_drawMoonOnSkyTempChart, true);
return true;
}

View File

@ -41,7 +41,7 @@ struct StarTrackerSettings
double m_heightAboveSeaLevel; // In metres
double m_temperatureLapseRate; // In K/km
double m_frequency; // Observation frequency in Hz
double m_beamwidth; // Beamwidth in degrees
double m_beamwidth; // Halfpower beamwidth in degrees
uint16_t m_serverPort;
bool m_enableServer; // Enable Stellarium server
enum AzElUnits {DMS, DM, D, Decimal} m_azElUnits; // This needs to match DMSSpinBox::DisplayUnits
@ -60,13 +60,25 @@ struct StarTrackerSettings
uint16_t m_reverseAPIPort;
uint16_t m_reverseAPIFeatureSetIndex;
uint16_t m_reverseAPIFeatureIndex;
double m_az; // Azimuth for Custom Az/El
double m_el; // Elevation for Custom Az/El
double m_az; // Azimuth for Custom Az/El
double m_el; // Elevation for Custom Az/El
double m_l; // Galactic longitude for Custom l/b
double m_b; // Galactic lattiude for Custom l/b
bool m_link; // Link settings to Radio Astronomy plugin
QString m_owmAPIKey; // API key for openweathermap.org
int m_weatherUpdatePeriod; // Time in minutes between weather updates
double m_azOffset;
double m_elOffset;
bool m_drawSunOnSkyTempChart;
bool m_drawMoonOnSkyTempChart;
StarTrackerSettings();
void resetToDefaults();
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
static const QStringList m_pipeTypes;
static const QStringList m_pipeURIs;
};
#endif // INCLUDE_FEATURE_STARTRACKERSETTINGS_H_

View File

@ -31,6 +31,8 @@ StarTrackerSettingsDialog::StarTrackerSettingsDialog(StarTrackerSettings *settin
ui->serverPort->setValue(settings->m_serverPort);
ui->enableServer->setChecked(settings->m_enableServer);
ui->refraction->setCurrentIndex(ui->refraction->findText(settings->m_refraction));
ui->owmAPIKey->setText(settings->m_owmAPIKey);
ui->weatherUpdatePeriod->setValue(settings->m_weatherUpdatePeriod);
ui->pressure->setValue(settings->m_pressure);
ui->temperature->setValue(settings->m_temperature);
ui->humidity->setValue(settings->m_humidity);
@ -40,7 +42,6 @@ StarTrackerSettingsDialog::StarTrackerSettingsDialog(StarTrackerSettings *settin
ui->solarFluxUnits->setCurrentIndex((int)settings->m_solarFluxUnits);
ui->drawSunOnMap->setChecked(settings->m_drawSunOnMap);
ui->drawMoonOnMap->setChecked(settings->m_drawMoonOnMap);
ui->drawStarOnMap->setChecked(settings->m_drawStarOnMap);
}
StarTrackerSettingsDialog::~StarTrackerSettingsDialog()
@ -56,6 +57,8 @@ void StarTrackerSettingsDialog::accept()
m_settings->m_serverPort = (uint16_t)ui->serverPort->value();
m_settings->m_enableServer = ui->enableServer->isChecked();
m_settings->m_refraction = ui->refraction->currentText();
m_settings->m_owmAPIKey = ui->owmAPIKey->text();
m_settings->m_weatherUpdatePeriod = ui->weatherUpdatePeriod->value();
m_settings->m_pressure = ui->pressure->value();
m_settings->m_temperature = ui->temperature->value();
m_settings->m_humidity = ui->humidity->value();

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>496</width>
<height>491</height>
<width>569</width>
<height>535</height>
</rect>
</property>
<property name="font">
@ -23,215 +23,6 @@
<item>
<widget class="QGroupBox" name="groupBox">
<layout class="QGridLayout" name="gridLayout">
<item row="10" column="1">
<widget class="QDoubleSpinBox" name="updatePeriod">
<property name="toolTip">
<string>Enter the time in seconds between each calculation of the target's position</string>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="temperature">
<property name="toolTip">
<string>Air temperature in degrees Celsius, for use in atmospheric refraction correction</string>
</property>
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="azElUnitsLabel">
<property name="text">
<string>Azimuth and elevation units</string>
</property>
</widget>
</item>
<item row="16" column="0">
<widget class="QCheckBox" name="drawStarOnMap">
<property name="text">
<string>Draw target star on map</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="pressure">
<property name="toolTip">
<string>Air pressure in millibars, for use in atmospheric refraction correction</string>
</property>
<property name="maximum">
<double>2000.000000000000000</double>
</property>
<property name="singleStep">
<double>1.000000000000000</double>
</property>
<property name="value">
<double>1010.000000000000000</double>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="heightLabel">
<property name="text">
<string>Height above sea level (m)</string>
</property>
</widget>
</item>
<item row="15" column="0">
<widget class="QCheckBox" name="drawMoonOnMap">
<property name="text">
<string>Draw Moon on map</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QComboBox" name="solarFluxUnits">
<property name="toolTip">
<string>Units to use for the display of the Solar flux density</string>
</property>
<item>
<property name="text">
<string>Solar flux units (sfu)</string>
</property>
</item>
<item>
<property name="text">
<string>Jansky (Jy)</string>
</property>
</item>
<item>
<property name="text">
<string>Watts per square metre per hertz (W m^-2 Hz-1)</string>
</property>
</item>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="updatePeriodLabel">
<property name="text">
<string>Update period (s)</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QSpinBox" name="height">
<property name="toolTip">
<string>Height of observation/antenna location above sea level in metres</string>
</property>
<property name="minimum">
<number>-1000</number>
</property>
<property name="maximum">
<number>20000</number>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QSpinBox" name="humidity">
<property name="toolTip">
<string>Relative humidity in %</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>80</number>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="solarFluxUnitsLabel">
<property name="text">
<string>Solar flux density units</string>
</property>
</widget>
</item>
<item row="17" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="14" column="0">
<widget class="QCheckBox" name="drawSunOnMap">
<property name="text">
<string>Draw Sun on map</string>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QSpinBox" name="serverPort">
<property name="toolTip">
<string>Stellarium telescope server IP port number</string>
</property>
<property name="minimum">
<number>1024</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>10001</number>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="serverPortLabel">
<property name="text">
<string>Stellarium server port</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="epochLabel">
<property name="text">
<string>Epoch for RA &amp; Dec</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="temperatureLapseRateLabel">
<property name="toolTip">
<string>Temperature lapse rate (K/m)</string>
</property>
<property name="text">
<string>Temperature lapse rate (K/km)</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="pressureLabel">
<property name="text">
<string>Air pressure (mb)</string>
</property>
</widget>
</item>
<item row="13" column="0">
<widget class="QCheckBox" name="enableServer">
<property name="toolTip">
<string>Enable Stellarium server which allows RA and Dec to be sent to and from Stellarium</string>
</property>
<property name="text">
<string>Stellarium server</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="epoch">
<property name="toolTip">
@ -249,31 +40,140 @@
</item>
</widget>
</item>
<item row="7" column="1">
<widget class="QDoubleSpinBox" name="temperatureLapseRate">
<property name="decimals">
<number>3</number>
<item row="15" column="0">
<widget class="QCheckBox" name="enableServer">
<property name="toolTip">
<string>Enable Stellarium server which allows RA and Dec to be sent to and from Stellarium</string>
</property>
<property name="maximum">
<double>100.000000000000000</double>
</property>
<property name="value">
<double>6.490000000000000</double>
<property name="text">
<string>Stellarium server</string>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QLabel" name="pressureLabel">
<property name="text">
<string>Air pressure (mb)</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QSpinBox" name="humidity">
<property name="toolTip">
<string>Relative humidity in %</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>80</number>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="temperatureLapseRateLabel">
<property name="toolTip">
<string>Temperature lapse rate (K/m)</string>
</property>
<property name="text">
<string>Temperature lapse rate (K/km)</string>
</property>
</widget>
</item>
<item row="17" column="0">
<widget class="QCheckBox" name="drawMoonOnMap">
<property name="text">
<string>Draw Moon on map</string>
</property>
</widget>
</item>
<item row="16" column="0">
<widget class="QCheckBox" name="drawSunOnMap">
<property name="text">
<string>Draw Sun on map</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="temperatureLabel">
<property name="text">
<string>Air temperature (C)</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="humidityLabel">
<property name="text">
<string>Humidity (%)</string>
<item row="5" column="1">
<widget class="QDoubleSpinBox" name="pressure">
<property name="toolTip">
<string>Air pressure in millibars, for use in atmospheric refraction correction</string>
</property>
<property name="maximum">
<double>2000.000000000000000</double>
</property>
<property name="singleStep">
<double>1.000000000000000</double>
</property>
<property name="value">
<double>1010.000000000000000</double>
</property>
</widget>
</item>
<item row="20" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="18" column="0">
<widget class="QCheckBox" name="drawStarOnMap">
<property name="text">
<string>Draw target star on map</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="weatherUpdatePeriodLabel">
<property name="text">
<string>Weather update period (min)</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="solarFluxDataLabel">
<property name="text">
<string>Solar flux density data</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="refraction">
<property name="toolTip">
<string>Atmospheric refraction correction</string>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>Saemundsson</string>
</property>
</item>
<item>
<property name="text">
<string>Positional Astronomy Library</string>
</property>
</item>
</widget>
</item>
<item row="1" column="1">
@ -306,6 +206,42 @@
</item>
</widget>
</item>
<item row="6" column="1">
<widget class="QSpinBox" name="temperature">
<property name="toolTip">
<string>Air temperature in degrees Celsius, for use in atmospheric refraction correction</string>
</property>
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="solarFluxUnitsLabel">
<property name="text">
<string>Solar flux density units</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QDoubleSpinBox" name="temperatureLapseRate">
<property name="decimals">
<number>3</number>
</property>
<property name="maximum">
<double>100.000000000000000</double>
</property>
<property name="value">
<double>6.490000000000000</double>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="refractionLabel">
<property name="text">
@ -313,39 +249,134 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="refraction">
<item row="11" column="1">
<widget class="QComboBox" name="solarFluxUnits">
<property name="toolTip">
<string>Atmospheric refraction correction</string>
</property>
<property name="currentIndex">
<number>0</number>
<string>Units to use for the display of the Solar flux density</string>
</property>
<item>
<property name="text">
<string>None</string>
<string>Solar flux units (sfu)</string>
</property>
</item>
<item>
<property name="text">
<string>Saemundsson</string>
<string>Jansky (Jy)</string>
</property>
</item>
<item>
<property name="text">
<string>Positional Astronomy Library</string>
<string>Watts per square metre per hertz (W m^-2 Hz-1)</string>
</property>
</item>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="solarFluxDataLabel">
<widget class="QLabel" name="heightLabel">
<property name="text">
<string>Solar flux density data</string>
<string>Height above sea level (m)</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="owmAPIKey">
<property name="toolTip">
<string>API key from openweathermap.org to download real-time weather</string>
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QLabel" name="serverPortLabel">
<property name="text">
<string>Stellarium server port</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="epochLabel">
<property name="text">
<string>Epoch for RA &amp; Dec</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="azElUnitsLabel">
<property name="text">
<string>Azimuth and elevation units</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="owmAPIKeyLabel">
<property name="text">
<string>OpenWeatherMap API Key</string>
</property>
</widget>
</item>
<item row="14" column="1">
<widget class="QSpinBox" name="serverPort">
<property name="toolTip">
<string>Stellarium telescope server IP port number</string>
</property>
<property name="minimum">
<number>1024</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>10001</number>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QDoubleSpinBox" name="updatePeriod">
<property name="toolTip">
<string>Enter the time in seconds between each calculation of the target's position</string>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="updatePeriodLabel">
<property name="text">
<string>Update period (s)</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="weatherUpdatePeriod">
<property name="toolTip">
<string>Enter the time in minutes between each weather update</string>
</property>
<property name="maximum">
<number>100000</number>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="humidityLabel">
<property name="text">
<string>Humidity (%)</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QSpinBox" name="height">
<property name="toolTip">
<string>Height of observation/antenna location above sea level in metres</string>
</property>
<property name="minimum">
<number>-1000</number>
</property>
<property name="maximum">
<number>20000</number>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QComboBox" name="solarFluxData">
<property name="toolTip">
<string>Select frequency at which to display Solar flux density data for</string>
@ -421,11 +452,14 @@
<tabstop>epoch</tabstop>
<tabstop>azElUnits</tabstop>
<tabstop>refraction</tabstop>
<tabstop>owmAPIKey</tabstop>
<tabstop>weatherUpdatePeriod</tabstop>
<tabstop>pressure</tabstop>
<tabstop>temperature</tabstop>
<tabstop>humidity</tabstop>
<tabstop>height</tabstop>
<tabstop>temperatureLapseRate</tabstop>
<tabstop>solarFluxData</tabstop>
<tabstop>solarFluxUnits</tabstop>
<tabstop>updatePeriod</tabstop>
<tabstop>serverPort</tabstop>

View File

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/startracker/">
<file>startracker/408mhz_ra_dec_spectral_index.fits</file>
</qresource>
</RCC>

View File

@ -28,6 +28,7 @@
#include "SWGTargetAzimuthElevation.h"
#include "SWGMapItem.h"
#include "SWGStarTrackerTarget.h"
#include "webapi/webapiadapterinterface.h"
#include "webapi/webapiutils.h"
@ -42,6 +43,7 @@
MESSAGE_CLASS_DEFINITION(StarTrackerWorker::MsgConfigureStarTrackerWorker, Message)
MESSAGE_CLASS_DEFINITION(StarTrackerReport::MsgReportAzAl, Message)
MESSAGE_CLASS_DEFINITION(StarTrackerReport::MsgReportRADec, Message)
MESSAGE_CLASS_DEFINITION(StarTrackerReport::MsgReportGalactic, Message)
StarTrackerWorker::StarTrackerWorker(StarTracker* starTracker, WebAPIAdapterInterface *webAPIAdapterInterface) :
m_starTracker(starTracker),
@ -51,7 +53,8 @@ StarTrackerWorker::StarTrackerWorker(StarTracker* starTracker, WebAPIAdapterInte
m_running(false),
m_mutex(QMutex::Recursive),
m_tcpServer(nullptr),
m_clientConnection(nullptr)
m_clientConnection(nullptr),
m_solarFlux(0.0f)
{
connect(&m_pollTimer, SIGNAL(timeout()), this, SLOT(update()));
}
@ -107,6 +110,12 @@ bool StarTrackerWorker::handleMessage(const Message& cmd)
applySettings(cfg.getSettings(), cfg.getForce());
return true;
}
else if (StarTracker::MsgSetSolarFlux::match(cmd))
{
StarTracker::MsgSetSolarFlux& msg = (StarTracker::MsgSetSolarFlux&) cmd;
m_solarFlux = msg.getFlux();
return true;
}
else
{
return false;
@ -125,15 +134,27 @@ void StarTrackerWorker::applySettings(const StarTrackerSettings& settings, bool
<< " m_updatePeriod: " << settings.m_updatePeriod
<< " force: " << force;
if ((m_settings.m_target != settings.m_target)
if ( (m_settings.m_ra != settings.m_ra)
|| (m_settings.m_dec != settings.m_dec)
|| (m_settings.m_latitude != settings.m_latitude)
|| (m_settings.m_longitude != settings.m_longitude)
|| (m_settings.m_target != settings.m_target)
|| (m_settings.m_dateTime != settings.m_dateTime)
|| (m_settings.m_refraction != settings.m_refraction)
|| (m_settings.m_pressure != settings.m_pressure)
|| (m_settings.m_temperature != settings.m_temperature)
|| (m_settings.m_ra != settings.m_ra)
|| (m_settings.m_dec != settings.m_dec) || force)
|| (m_settings.m_humidity != settings.m_humidity)
|| (m_settings.m_heightAboveSeaLevel != settings.m_heightAboveSeaLevel)
|| (m_settings.m_temperatureLapseRate != settings.m_temperatureLapseRate)
|| (m_settings.m_frequency != settings.m_frequency)
|| (m_settings.m_beamwidth != settings.m_beamwidth)
|| (m_settings.m_az != settings.m_az)
|| (m_settings.m_el != settings.m_el)
|| (m_settings.m_l != settings.m_l)
|| (m_settings.m_b != settings.m_b)
|| (m_settings.m_azOffset != settings.m_azOffset)
|| (m_settings.m_elOffset != settings.m_elOffset)
|| force)
{
// Recalculate immediately
QTimer::singleShot(1, this, &StarTrackerWorker::update);
@ -283,8 +304,9 @@ void StarTrackerWorker::readStellariumCommand()
qDebug() << "StarTrackerWorker: New target from Stellarum: " << m_settings.m_ra << " " << m_settings.m_dec;
// Forward to GUI for display
if (getMessageQueueToGUI())
getMessageQueueToGUI()->push(StarTrackerReport::MsgReportRADec::create(raDeg, decDeg));
if (getMessageQueueToGUI()) {
getMessageQueueToGUI()->push(StarTrackerReport::MsgReportRADec::create(raDeg, decDeg, "target"));
}
}
else
{
@ -345,7 +367,7 @@ void StarTrackerWorker::writeStellariumTarget(double ra, double dec)
}
void StarTrackerWorker::updateRaDec(RADec rd, QDateTime dt)
void StarTrackerWorker::updateRaDec(RADec rd, QDateTime dt, bool lbTarget)
{
RADec rdJ2000;
double jd;
@ -356,14 +378,15 @@ void StarTrackerWorker::updateRaDec(RADec rd, QDateTime dt)
// Send to Stellarium
writeStellariumTarget(rdJ2000.ra, rdJ2000.dec);
// Send to GUI
if (m_settings.m_target == "Sun" || m_settings.m_target == "Moon")
if (m_settings.m_target == "Sun" || m_settings.m_target == "Moon" || (m_settings.m_target == "Custom Az/El") || lbTarget)
{
if (getMessageQueueToGUI())
{
if (m_settings.m_jnow)
getMessageQueueToGUI()->push(StarTrackerReport::MsgReportRADec::create(rd.ra, rd.dec));
else
getMessageQueueToGUI()->push(StarTrackerReport::MsgReportRADec::create(rdJ2000.ra, rdJ2000.dec));
if (m_settings.m_jnow) {
getMessageQueueToGUI()->push(StarTrackerReport::MsgReportRADec::create(rd.ra, rd.dec, "target"));
} else {
getMessageQueueToGUI()->push(StarTrackerReport::MsgReportRADec::create(rdJ2000.ra, rdJ2000.dec, "target"));
}
}
}
}
@ -372,8 +395,7 @@ void StarTrackerWorker::removeFromMap(QString id)
{
MessagePipes& messagePipes = MainCore::instance()->getMessagePipes();
QList<MessageQueue*> *mapMessageQueues = messagePipes.getMessageQueues(m_starTracker, "mapitems");
if (mapMessageQueues)
{
if (mapMessageQueues) {
sendToMap(mapMessageQueues, id, "", "", 0.0, 0.0);
}
}
@ -438,30 +460,41 @@ void StarTrackerWorker::update()
{
AzAlt aa, sunAA, moonAA;
RADec rd, sunRD, moonRD;
double l, b;
bool lbTarget = false;
QDateTime dt;
// Get date and time to calculate position at
if (m_settings.m_dateTime == "")
if (m_settings.m_dateTime == "") {
dt = QDateTime::currentDateTime();
else
} else {
dt = QDateTime::fromString(m_settings.m_dateTime, Qt::ISODateWithMs);
}
// Calculate position
if ((m_settings.m_target == "Sun") || (m_settings.m_drawSunOnMap))
if ((m_settings.m_target == "Sun") || m_settings.m_drawSunOnMap || m_settings.m_drawSunOnSkyTempChart)
{
Astronomy::sunPosition(sunAA, sunRD, m_settings.m_latitude, m_settings.m_longitude, dt);
if ((m_settings.m_target == "Moon") || (m_settings.m_drawMoonOnMap))
getMessageQueueToGUI()->push(StarTrackerReport::MsgReportRADec::create(sunRD.ra, sunRD.dec, "sun"));
}
if ((m_settings.m_target == "Moon") || m_settings.m_drawMoonOnMap || m_settings.m_drawMoonOnSkyTempChart)
{
Astronomy::moonPosition(moonAA, moonRD, m_settings.m_latitude, m_settings.m_longitude, dt);
getMessageQueueToGUI()->push(StarTrackerReport::MsgReportRADec::create(moonRD.ra, moonRD.dec, "moon"));
}
if (m_settings.m_target == "Sun")
{
rd = sunRD;
aa = sunAA;
rd = sunRD;
aa = sunAA;
Astronomy::equatorialToGalactic(rd.ra, rd.dec, l, b);
}
else if (m_settings.m_target == "Moon")
{
rd = moonRD;
aa = moonAA;
rd = moonRD;
aa = moonAA;
Astronomy::equatorialToGalactic(rd.ra, rd.dec, l, b);
}
else if (m_settings.m_target == "Custom Az/El")
{
@ -469,6 +502,26 @@ void StarTrackerWorker::update()
aa.alt = m_settings.m_el;
aa.az = m_settings.m_az;
rd = Astronomy::azAltToRaDec(aa, m_settings.m_latitude, m_settings.m_longitude, dt);
// Precess RA/DEC from Jnow to J2000
RADec rd2000 = Astronomy::precess(rd, Astronomy::julianDate(dt), Astronomy::jd_j2000());
// Convert to l/b
Astronomy::equatorialToGalactic(rd2000.ra, rd2000.dec, l, b);
if (!m_settings.m_jnow) {
rd = rd2000;
}
}
else if ( (m_settings.m_target == "Custom l/b")
|| (m_settings.m_target == "S7")
|| (m_settings.m_target == "S8")
|| (m_settings.m_target == "S9")
)
{
// Convert l/b to RA/Dec, then Alt/Az
l = m_settings.m_l;
b = m_settings.m_b;
Astronomy::galacticToEquatorial(l, b, rd.ra, rd.dec);
aa = Astronomy::raDecToAzAlt(rd, m_settings.m_latitude, m_settings.m_longitude, dt, !m_settings.m_jnow);
lbTarget = true;
}
else
{
@ -476,8 +529,9 @@ void StarTrackerWorker::update()
rd.ra = Astronomy::raToDecimal(m_settings.m_ra);
rd.dec = Astronomy::decToDecimal(m_settings.m_dec);
aa = Astronomy::raDecToAzAlt(rd, m_settings.m_latitude, m_settings.m_longitude, dt, !m_settings.m_jnow);
Astronomy::equatorialToGalactic(rd.ra, rd.dec, l, b);
}
updateRaDec(rd, dt);
updateRaDec(rd, dt, lbTarget);
// Adjust for refraction
if (m_settings.m_refraction == "Positional Astronomy Library")
@ -485,48 +539,100 @@ void StarTrackerWorker::update()
aa.alt += Astronomy::refractionPAL(aa.alt, m_settings.m_pressure, m_settings.m_temperature, m_settings.m_humidity,
m_settings.m_frequency, m_settings.m_latitude, m_settings.m_heightAboveSeaLevel,
m_settings.m_temperatureLapseRate);
if (aa.alt > 90.0)
if (aa.alt > 90.0) {
aa.alt = 90.0f;
}
}
else if (m_settings.m_refraction == "Saemundsson")
{
aa.alt += Astronomy::refractionSaemundsson(aa.alt, m_settings.m_pressure, m_settings.m_temperature);
if (aa.alt > 90.0)
if (aa.alt > 90.0) {
aa.alt = 90.0f;
}
}
// Add user-adjustment
aa.alt += m_settings.m_elOffset;
aa.az += m_settings.m_azOffset;
// Send to GUI
if (getMessageQueueToGUI())
{
if (m_settings.m_target == "Custom Az/El") {
getMessageQueueToGUI()->push(StarTrackerReport::MsgReportRADec::create(rd.ra, rd.dec));
} else {
// MsgReportRADec sent in updateRaDec()
if (m_settings.m_target != "Custom Az/El") {
getMessageQueueToGUI()->push(StarTrackerReport::MsgReportAzAl::create(aa.az, aa.alt));
}
if (!lbTarget) {
getMessageQueueToGUI()->push(StarTrackerReport::MsgReportGalactic::create(l, b));
}
}
// Send Az/El to Rotator Controllers
MessagePipes& messagePipes = MainCore::instance()->getMessagePipes();
QList<MessageQueue*> *mapMessageQueues = messagePipes.getMessageQueues(m_starTracker, "target");
if (mapMessageQueues)
{
QList<MessageQueue*>::iterator it = mapMessageQueues->begin();
QList<MessageQueue*>* messageQueues;
for (; it != mapMessageQueues->end(); ++it)
// Send Az/El to Rotator Controllers
// Unless we're receiving settings to display from a Radio Astronomy plugins
if (!m_settings.m_link)
{
messageQueues = messagePipes.getMessageQueues(m_starTracker, "target");
if (messageQueues)
{
SWGSDRangel::SWGTargetAzimuthElevation *swgTarget = new SWGSDRangel::SWGTargetAzimuthElevation();
swgTarget->setName(new QString(m_settings.m_target));
swgTarget->setAzimuth(aa.az);
swgTarget->setElevation(aa.alt);
(*it)->push(MainCore::MsgTargetAzimuthElevation::create(m_starTracker, swgTarget));
QList<MessageQueue*>::iterator it = messageQueues->begin();
for (; it != messageQueues->end(); ++it)
{
SWGSDRangel::SWGTargetAzimuthElevation *swgTarget = new SWGSDRangel::SWGTargetAzimuthElevation();
swgTarget->setName(new QString(m_settings.m_target));
swgTarget->setAzimuth(aa.az);
swgTarget->setElevation(aa.alt);
(*it)->push(MainCore::MsgTargetAzimuthElevation::create(m_starTracker, swgTarget));
}
}
}
// Send Az/El, RA/Dec and Galactic b/l to Radio Astronomy plugins
// Unless we're receiving settings to display from a Radio Astronomy plugins
if (!m_settings.m_link)
{
messageQueues = messagePipes.getMessageQueues(m_starTracker, "startracker.target");
if (messageQueues)
{
QList<MessageQueue*>::iterator it = messageQueues->begin();
for (; it != messageQueues->end(); ++it)
{
SWGSDRangel::SWGStarTrackerTarget *swgTarget = new SWGSDRangel::SWGStarTrackerTarget();
swgTarget->setName(new QString(m_settings.m_target));
swgTarget->setAzimuth(aa.az);
swgTarget->setElevation(aa.alt);
swgTarget->setRa(rd.ra);
swgTarget->setDec(rd.dec);
swgTarget->setB(b);
swgTarget->setL(l);
swgTarget->setSolarFlux(m_solarFlux);
swgTarget->setAirTemperature(m_settings.m_temperature);
double temp;
m_starTracker->calcSkyTemperature(m_settings.m_frequency, m_settings.m_beamwidth, rd.ra, rd.dec, temp);
swgTarget->setSkyTemperature(temp);
swgTarget->setHpbw(m_settings.m_beamwidth);
// Calculate velocities
double vRot = Astronomy::earthRotationVelocity(rd, m_settings.m_latitude, m_settings.m_longitude, dt);
swgTarget->setEarthRotationVelocity(vRot);
double vOrbit = Astronomy::earthOrbitVelocityBCRS(rd,dt);
swgTarget->setEarthOrbitVelocityBcrs(vOrbit);
double vLSRK = Astronomy::sunVelocityLSRK(rd);
swgTarget->setSunVelocityLsr(vLSRK);
double vCorr = vRot + vOrbit + vLSRK;
(*it)->push(MainCore::MsgStarTrackerTarget::create(m_starTracker, swgTarget));
}
}
}
// Send to Map
if (m_settings.m_drawSunOnMap || m_settings.m_drawMoonOnMap || m_settings.m_drawStarOnMap)
{
mapMessageQueues = messagePipes.getMessageQueues(m_starTracker, "mapitems");
if (mapMessageQueues)
messageQueues = messagePipes.getMessageQueues(m_starTracker, "mapitems");
if (messageQueues)
{
// Different between GMST(Lst at Greenwich) and RA
double lst = Astronomy::localSiderealTime(dt, 0.0);
@ -537,7 +643,7 @@ void StarTrackerWorker::update()
{
sunLongitude = Astronomy::lstAndRAToLongitude(lst, sunRD.ra);
sunLatitude = sunRD.dec;
sendToMap(mapMessageQueues, "Sun", "qrc:///startracker/startracker/sun-40.png", "Sun", sunLatitude, sunLongitude);
sendToMap(messageQueues, "Sun", "qrc:///startracker/startracker/sun-40.png", "Sun", sunLatitude, sunLongitude);
}
if (m_settings.m_drawMoonOnMap)
{
@ -545,7 +651,7 @@ void StarTrackerWorker::update()
double moonLatitude = moonRD.dec;
double moonRotation;
QString phase = moonPhase(sunLongitude, moonLongitude, m_settings.m_latitude, moonRotation);
sendToMap(mapMessageQueues, "Moon", QString("qrc:///startracker/startracker/moon-%1-32").arg(phase), "Moon",
sendToMap(messageQueues, "Moon", QString("qrc:///startracker/startracker/moon-%1-32").arg(phase), "Moon",
moonLatitude, moonLongitude, moonRotation);
}
if ((m_settings.m_drawStarOnMap) && (m_settings.m_target != "Sun") && (m_settings.m_target != "Moon"))
@ -553,7 +659,7 @@ void StarTrackerWorker::update()
double starLongitude = Astronomy::lstAndRAToLongitude(lst, rd.ra);
double starLatitude = rd.dec;
QString text = m_settings.m_target.startsWith("Custom") ? "Star" : m_settings.m_target;
sendToMap(mapMessageQueues, "Star", "qrc:///startracker/startracker/pulsar-32.png", text, starLatitude, starLongitude);
sendToMap(messageQueues, "Star", "qrc:///startracker/startracker/pulsar-32.png", text, starLatitude, starLongitude);
}
}
}

View File

@ -85,12 +85,13 @@ private:
QTimer m_pollTimer;
QTcpServer *m_tcpServer;
QTcpSocket *m_clientConnection;
float m_solarFlux;
bool handleMessage(const Message& cmd);
void applySettings(const StarTrackerSettings& settings, bool force = false);
void restartServer(bool enabled, uint32_t port);
MessageQueue *getMessageQueueToGUI() { return m_msgQueueToGUI; }
void updateRaDec(RADec rd, QDateTime dt);
void updateRaDec(RADec rd, QDateTime dt, bool lbTarget);
void writeStellariumTarget(double ra, double dec);
void removeFromMap(QString id);
void sendToMap(QList<MessageQueue*> *mapMessageQueues, QString id, QString image, QString text, double lat, double lon, double rotation=0.0);

View File

@ -198,6 +198,7 @@ set(sdrbase_SOURCES
util/message.cpp
util/messagequeue.cpp
util/morse.cpp
util/png.cpp
util/prettyprint.cpp
util/rtpsink.cpp
util/syncmessenger.cpp
@ -209,6 +210,7 @@ set(sdrbase_SOURCES
util/units.cpp
util/timeutil.cpp
util/visa.cpp
util/weather.cpp
plugin/plugininterface.cpp
plugin/pluginapi.cpp
@ -406,6 +408,7 @@ set(sdrbase_HEADERS
util/messagequeue.h
util/morse.h
util/movingaverage.h
util/png.h
util/prettyprint.h
util/rtpsink.h
util/syncmessenger.h
@ -417,6 +420,7 @@ set(sdrbase_HEADERS
util/units.h
util/timeutil.h
util/visa.h
util/weather.h
webapi/webapiadapter.h
webapi/webapiadapterbase.h

View File

@ -54,6 +54,9 @@ MESSAGE_CLASS_DEFINITION(MainCore::MsgChannelDemodQuery, Message)
MESSAGE_CLASS_DEFINITION(MainCore::MsgMapItem, Message)
MESSAGE_CLASS_DEFINITION(MainCore::MsgPacket, Message)
MESSAGE_CLASS_DEFINITION(MainCore::MsgTargetAzimuthElevation, Message)
MESSAGE_CLASS_DEFINITION(MainCore::MsgStarTrackerTarget, Message)
MESSAGE_CLASS_DEFINITION(MainCore::MsgStarTrackerDisplaySettings, Message)
MESSAGE_CLASS_DEFINITION(MainCore::MsgStarTrackerDisplayLoSSettings, Message)
MainCore::MainCore()
{

View File

@ -47,6 +47,9 @@ namespace SWGSDRangel
class SWGChannelSettings;
class SWGMapItem;
class SWGTargetAzimuthElevation;
class SWGStarTrackerTarget;
class SWGStarTrackerDisplaySettings;
class SWGStarTrackerDisplayLoSSettings;
}
class SDRBASE_API MainCore
@ -622,6 +625,77 @@ public:
{ }
};
// Messages between Star Tracker and Radio Astronomy plugins
class SDRBASE_API MsgStarTrackerTarget : public Message {
MESSAGE_CLASS_DECLARATION
public:
const PipeEndPoint *getPipeSource() const { return m_pipeSource; }
SWGSDRangel::SWGStarTrackerTarget *getSWGStarTrackerTarget() const { return m_swgStarTrackerTarget; }
static MsgStarTrackerTarget* create(const PipeEndPoint *pipeSource, SWGSDRangel::SWGStarTrackerTarget *swgStarTrackerTarget)
{
return new MsgStarTrackerTarget(pipeSource, swgStarTrackerTarget);
}
private:
const PipeEndPoint *m_pipeSource;
SWGSDRangel::SWGStarTrackerTarget *m_swgStarTrackerTarget;
MsgStarTrackerTarget(const PipeEndPoint *pipeSource, SWGSDRangel::SWGStarTrackerTarget *swgStarTrackerTarget) :
Message(),
m_pipeSource(pipeSource),
m_swgStarTrackerTarget(swgStarTrackerTarget)
{ }
};
class SDRBASE_API MsgStarTrackerDisplaySettings : public Message {
MESSAGE_CLASS_DECLARATION
public:
const PipeEndPoint *getPipeSource() const { return m_pipeSource; }
SWGSDRangel::SWGStarTrackerDisplaySettings *getSWGStarTrackerDisplaySettings() const { return m_swgStarTrackerDisplaySettings; }
static MsgStarTrackerDisplaySettings* create(const PipeEndPoint *pipeSource, SWGSDRangel::SWGStarTrackerDisplaySettings *swgStarTrackerDisplaySettings)
{
return new MsgStarTrackerDisplaySettings(pipeSource, swgStarTrackerDisplaySettings);
}
private:
const PipeEndPoint *m_pipeSource;
SWGSDRangel::SWGStarTrackerDisplaySettings *m_swgStarTrackerDisplaySettings;
MsgStarTrackerDisplaySettings(const PipeEndPoint *pipeSource, SWGSDRangel::SWGStarTrackerDisplaySettings *swgStarTrackerDisplaySettings) :
Message(),
m_pipeSource(pipeSource),
m_swgStarTrackerDisplaySettings(swgStarTrackerDisplaySettings)
{ }
};
class SDRBASE_API MsgStarTrackerDisplayLoSSettings : public Message {
MESSAGE_CLASS_DECLARATION
public:
const PipeEndPoint *getPipeSource() const { return m_pipeSource; }
SWGSDRangel::SWGStarTrackerDisplayLoSSettings *getSWGStarTrackerDisplayLoSSettings() const { return m_swgStarTrackerDisplayLoSSettings; }
static MsgStarTrackerDisplayLoSSettings* create(const PipeEndPoint *pipeSource, SWGSDRangel::SWGStarTrackerDisplayLoSSettings *swgStarTrackerDisplayLoSSettings)
{
return new MsgStarTrackerDisplayLoSSettings(pipeSource, swgStarTrackerDisplayLoSSettings);
}
private:
const PipeEndPoint *m_pipeSource;
SWGSDRangel::SWGStarTrackerDisplayLoSSettings *m_swgStarTrackerDisplayLoSSettings;
MsgStarTrackerDisplayLoSSettings(const PipeEndPoint *pipeSource, SWGSDRangel::SWGStarTrackerDisplayLoSSettings *swgStarTrackerDisplayLoSSettings) :
Message(),
m_pipeSource(pipeSource),
m_swgStarTrackerDisplayLoSSettings(swgStarTrackerDisplayLoSSettings)
{ }
};
MainCore();

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@
#include "export.h"
class QDateTime;
#include <QDateTime>
// Right ascension and declination
struct SDRBASE_API RADec {
@ -39,6 +39,7 @@ class SDRBASE_API Astronomy {
public:
static double julianDate(int year, int month, int day, int hours, int minutes, int seconds);
static double julianDate(QDateTime dt);
static double modifiedJulianDate(QDateTime dt);
static double jd_j2000(void);
static double jd_b1950(void);
@ -64,9 +65,27 @@ public:
static void equatorialToGalactic(double ra, double dec, double& l, double& b);
static void northGalacticPoleJ2000(double& ra, double& dec);
static void galacticToEquatorial(double l, double b, double& ra, double& dec);
static double dopplerToVelocity(double f, double f0);
static double velocityToDoppler(double v, double f0);
static double earthRotationVelocity(RADec rd, double latitude, double longitude, QDateTime dt);
static double earthOrbitVelocityBCRS(RADec rd, QDateTime dt);
static double sunVelocityLSRK(RADec rd);
static double observerVelocityLSRK(RADec rd, double latitude, double longitude, QDateTime dt);
static double noisePowerdBm(double temp, double bw);
static double noiseTemp(double dBm, double bw);
protected:
static double modulo(double a, double b);
static const double m_boltzmann;
static const double m_hydrogenLineFrequency;
static const double m_hydroxylLineFrequency;
static const double m_deuteriumLineFrequency;
static const double m_speedOfLight;
static const double m_hydrogenMass;
};
#endif // INCLUDE_ASTRONOMY_H

View File

@ -29,6 +29,10 @@ FITS::FITS(QString resourceName) :
m_valid(false)
{
QResource m_res(resourceName);
if (!m_res.isValid()) {
qWarning() << "FITS: - " << resourceName << " is not a valid resource";
return;
}
int m_headerSize = 2880;
qint64 m_fileSize;
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
@ -111,7 +115,7 @@ FITS::FITS(QString resourceName) :
m_valid = true;
}
float FITS::value(int x, int y)
float FITS::value(int x, int y) const
{
int offset = m_dataStart + (m_height-1-y) * m_width * m_bytesPerPixel + x * m_bytesPerPixel;
const uchar *data = (const uchar *)m_data.data();
@ -146,18 +150,18 @@ float FITS::value(int x, int y)
}
}
float FITS::scaledValue(int x, int y)
float FITS::scaledValue(int x, int y) const
{
float v = value(x, y);
return v * m_uintScale;
}
int FITS::mod(int a, int b)
int FITS::mod(int a, int b) const
{
return a - b * floor(a/(double)b);
}
float FITS::scaledWrappedValue(int x, int y)
float FITS::scaledWrappedValue(int x, int y) const
{
float v = value(mod(x, m_width), mod(y, m_height));
return v * m_uintScale;

View File

@ -48,19 +48,19 @@ public:
FITS(QString resourceName);
float value(int x, int y);
float scaledValue(int x, int y);
float scaledWrappedValue(int x, int y);
float value(int x, int y) const;
float scaledValue(int x, int y) const;
float scaledWrappedValue(int x, int y) const;
double degreesPerPixelH() { return m_cdelta1; }
double degreesPerPixelV() { return m_cdelta2; }
int width() { return m_width; }
int height() { return m_height; }
bool valid() { return m_valid; }
double degreesPerPixelH() const { return m_cdelta1; }
double degreesPerPixelV() const { return m_cdelta2; }
int width() const { return m_width; }
int height() const { return m_height; }
bool valid() const { return m_valid; }
protected:
int mod(int a, int b);
int mod(int a, int b) const;
};
#endif // INCLUDE_UTIL_FITS_H

311
sdrbase/util/png.cpp Normal file
View File

@ -0,0 +1,311 @@
///////////////////////////////////////////////////////////////////////////////////
// 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 "png.h"
#include <QDebug>
#include <QString>
#include <QBuffer>
#include <QFile>
PNG::PNG()
{
}
PNG::PNG(QByteArray data) :
m_bytes(data),
m_width(0),
m_height(0)
{
int idx = findChunk("IHDR");
if (idx >= 0)
{
m_width = getInt(idx + 8);
m_height = getInt(idx + 12);
}
else
{
qDebug() << "PNG: No IHDR found";
}
}
void PNG::appendSignature()
{
m_bytes.append(m_signature);
}
void PNG::appendEnd()
{
QByteArray ba;
appendChunk("IEND", ba);
}
void PNG::appendChunk(const char *type, QByteArray chunk)
{
appendInt(chunk.size());
appendInt(typeStringToInt(type));
m_bytes.append(chunk);
appendInt(crc(type, chunk)); // CRC type and data, but not length
}
void PNG::append(QByteArray data)
{
m_bytes.append(data);
}
void PNG::appendInt(QByteArray& ba, quint32 value)
{
// Network byte order
ba.append((value >> 24) & 0xff);
ba.append((value >> 16) & 0xff);
ba.append((value >> 8) & 0xff);
ba.append((value) & 0xff);
}
void PNG::appendShort(QByteArray& ba, quint16 value)
{
// Network byte order
ba.append((value >> 8) & 0xff);
ba.append((value) & 0xff);
}
void PNG::appendInt(quint32 value)
{
appendInt(m_bytes, value);
}
qint32 PNG::getInt(int index)
{
qint32 v = 0;
for (int i = 0; i < 4; i++) {
v |= (m_bytes[index+i] & 0xff) << ((3-i)*8);
}
return v;
}
qint32 PNG::crc(const char *type, const QByteArray data)
{
m_crc.init();
m_crc.calculate((const uint8_t *)type, 4);
m_crc.calculate((const uint8_t *)data.data(), data.size());
return m_crc.get();
}
qint32 PNG::typeStringToInt(const char *header)
{
quint32 v = 0;
for (int i = 0; i < 4; i++) {
v |= header[i] << ((3-i)*8);
}
return v;
}
QString PNG::intToTypeString(quint32 type)
{
QString s;
for (int i = 0; i < 4; i++)
{
char c = (type >> ((3-i)*8)) & 0xff;
s.append(c);
}
return s;
}
// Animation control chunk for APNGs (loops=0 is infinite)
void PNG::appendacTL(int frames, quint32 loops)
{
QByteArray ba;
appendInt(ba, frames);
appendInt(ba, loops);
appendChunk("acTL", ba);
}
// Frame control chunk for APNGs
void PNG::appendfcTL(quint32 seqNo, quint32 width, quint32 height, int fps, quint32 xOffset, quint32 yOffset)
{
QByteArray ba;
appendInt(ba, seqNo);
appendInt(ba, width);
appendInt(ba, height);
appendInt(ba, xOffset);
appendInt(ba, yOffset);
appendShort(ba, 1);
appendShort(ba, fps);
ba.append((char)0); // No disposal
ba.append((char)0); // Overwrite previous image
appendChunk("fcTL", ba);
}
// Animation frame data
void PNG::appendfdAT(quint32 seqNo, const QByteArray& data)
{
QByteArray ba;
appendInt(ba, seqNo);
ba.append(data);
appendChunk("fdAT", ba);
}
QByteArray PNG::data()
{
return m_bytes;
}
bool PNG::checkSignature()
{
return m_bytes.startsWith(m_signature);
}
int PNG::findChunk(const char *type, int startIndex)
{
if ((startIndex == 0) && !checkSignature())
{
qDebug() << "PNG::findChunk - PNG signature not found";
return -1;
}
int i = startIndex == 0 ? m_signature.size() : startIndex;
qint32 typeInt = typeStringToInt(type);
while (i < m_bytes.size())
{
qint32 chunkType = getInt(i+4);
if (typeInt == chunkType) {
return i;
}
qint32 length = getInt(i);
i += 12 + length;
}
return -1;
}
// Get chunk including length, type data and CRC
QByteArray PNG::getChunk(const char *type)
{
int start = findChunk(type);
if (start >= 0)
{
quint32 length = getInt(start);
return m_bytes.mid(start, length + 12);
}
return QByteArray();
}
// Get all chunks with same type
QByteArray PNG::getChunks(const char *type)
{
int start = 0;
QByteArray bytes;
while ((start = findChunk(type, start)) != -1)
{
quint32 length = getInt(start);
QByteArray chunk = m_bytes.mid(start, length + 12);
bytes.append(chunk);
start += chunk.size();
}
return bytes;
}
// Get data from chunk
QList<QByteArray> PNG::getChunkData(const char *type)
{
int start = 0;
QList<QByteArray> chunks;
while ((start = findChunk(type, start)) != -1)
{
quint32 length = getInt(start);
QByteArray chunk = m_bytes.mid(start + 8, length);
chunks.append(chunk);
start += length + 12;
}
return chunks;
}
quint32 PNG::getWidth() const
{
return m_width;
}
quint32 PNG::getHeight() const
{
return m_height;
}
bool APNG::addImage(const QImage& image, int fps)
{
if (!m_ended)
{
QByteArray ba;
QBuffer buffer(&ba);
buffer.open(QIODevice::ReadWrite);
if (image.save(&buffer, "PNG"))
{
PNG pngIn(ba);
if (m_frame == 0)
{
m_png.append(pngIn.getChunk("IHDR"));
m_png.appendacTL(m_frames);
m_png.appendfcTL(m_seqNo++, pngIn.getWidth(), pngIn.getHeight(), fps);
// PNGs can contain multiple IDAT chunks, typically each limited to 8kB
m_png.append(pngIn.getChunks("IDAT"));
}
else
{
m_png.appendfcTL(m_seqNo++, pngIn.getWidth(), pngIn.getHeight(), fps);
QList<QByteArray> data = pngIn.getChunkData("IDAT");
for (int i = 0; i < data.size(); i++) {
m_png.appendfdAT(m_seqNo++, data[i]);
}
}
m_frame++;
return true;
}
else
{
qDebug() << "APNG::addImage - Failed to save image to PNG";
return false;
}
}
else
{
qDebug() << "APNG::addImage - Call to addImage after IEND added";
return false;
}
}
bool APNG::save(const QString& fileName)
{
if (!m_ended)
{
if (m_frame != m_frames) {
qDebug() << "APNG::save - " << m_frame << " frames added out of expected " << m_frames;
}
m_png.appendEnd();
m_ended = true;
}
QFile animFile(fileName);
if (animFile.open(QIODevice::WriteOnly | QIODevice::Truncate))
{
animFile.write(m_png.data());
animFile.close();
return true;
}
else
{
return false;
}
}

96
sdrbase/util/png.h Normal file
View File

@ -0,0 +1,96 @@
///////////////////////////////////////////////////////////////////////////////////
// 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 INCLUDE_PNG_H
#define INCLUDE_PNG_H
#include <QByteArray>
#include <QImage>
#include "export.h"
#include "util/crc.h"
// PNG (Portable Network Graphics) utility code
// Contains just enough functionality to support assembling APNG files (Animated PNGs)
// from multiple PNGs (which can be created using Qt)
class SDRBASE_API PNG {
public:
PNG();
PNG(QByteArray data);
void appendSignature();
void appendEnd();
void appendChunk(const char *type, QByteArray chunk);
void append(QByteArray data);
void appendInt(QByteArray& ba, quint32 value);
void appendShort(QByteArray& ba, quint16 value);
void appendInt(quint32 value);
qint32 getInt(int index);
qint32 crc(const char *type, const QByteArray data);
qint32 typeStringToInt(const char *header);
QString intToTypeString(quint32 type);
void appendacTL(int frames, quint32 loops=0);
void appendfcTL(quint32 seqNo, quint32 width, quint32 height, int fps, quint32 xOffset=0, quint32 yOffset=0);
void appendfdAT(quint32 seqNo, const QByteArray& data);
QByteArray data();
bool checkSignature();
int findChunk(const char *type, int startIndex=0);
QByteArray getChunk(const char *type);
QByteArray getChunks(const char *type);
QList<QByteArray> getChunkData(const char *type);
quint32 getWidth() const;
quint32 getHeight() const;
private:
QByteArray m_signature = QByteArrayLiteral("\x89\x50\x4e\x47\x0d\x0a\x1a\x0a");
QByteArray m_bytes;
crc32 m_crc;
quint32 m_width;
quint32 m_height;
};
// Animated PNG
class SDRBASE_API APNG {
public:
APNG(int frames) :
m_frames(frames),
m_frame(0),
m_seqNo(0),
m_ended(false)
{
m_png.appendSignature();
}
bool addImage(const QImage& image, int fps=5);
bool save(const QString& fileName);
private:
PNG m_png;
int m_frames; //!< Total number of frames in animation
int m_frame; //!< Current frame number
int m_seqNo; //!< Chunk sequence number
bool m_ended; //!< IEND chunk has added
};
#endif // INCLUDE_PNG_H

140
sdrbase/util/weather.cpp Normal file
View File

@ -0,0 +1,140 @@
///////////////////////////////////////////////////////////////////////////////////
// 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 "weather.h"
#include <QDebug>
#include <QUrl>
#include <QUrlQuery>
#include <QNetworkReply>
#include <QJsonDocument>
#include <QJsonObject>
Weather::Weather()
{
connect(&m_timer, &QTimer::timeout, this, &Weather::update);
}
Weather* Weather::create(const QString& apiKey, const QString& service)
{
if (service == "openweathermap.org")
{
if (!apiKey.isEmpty())
{
return new OpenWeatherMap(apiKey);
}
else
{
qDebug() << "Weather::connect: An API key is required for: " << service;
return nullptr;
}
}
else
{
qDebug() << "Weather::connect: Unsupported service: " << service;
return nullptr;
}
}
void Weather::getWeatherPeriodically(float latitude, float longitude, int periodInMins)
{
m_latitude = latitude;
m_longitude = longitude;
m_timer.setInterval(periodInMins*60*1000);
m_timer.start();
update();
}
void Weather::update()
{
getWeather(m_latitude, m_longitude);
}
OpenWeatherMap::OpenWeatherMap(const QString& apiKey) :
m_apiKey(apiKey)
{
m_networkManager = new QNetworkAccessManager();
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(handleReply(QNetworkReply*)));
}
OpenWeatherMap::~OpenWeatherMap()
{
disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(handleReply(QNetworkReply*)));
delete m_networkManager;
}
void OpenWeatherMap::getWeather(float latitude, float longitude)
{
QUrl url(QString("http://api.openweathermap.org/data/2.5/weather"));
QUrlQuery query;
query.addQueryItem("lat", QString::number(latitude));
query.addQueryItem("lon", QString::number(longitude));
query.addQueryItem("mode", "json");
query.addQueryItem("units", "metric");
query.addQueryItem("appid", m_apiKey);
url.setQuery(query);
QNetworkReply *reply = m_networkManager->get(QNetworkRequest(url));
}
void OpenWeatherMap::handleReply(QNetworkReply* reply)
{
if (reply)
{
if (!reply->error())
{
QJsonDocument document = QJsonDocument::fromJson(reply->readAll());
if (document.isObject())
{
QJsonObject obj = document.object();
if (obj.contains(QStringLiteral("main")))
{
QJsonValue val = obj.value(QStringLiteral("main"));
QJsonObject mainObj = val.toObject();
float temp = NAN, pressure = NAN, humidity = NAN;
if (mainObj.contains(QStringLiteral("temp"))) {
temp = mainObj.value(QStringLiteral("temp")).toDouble();
}
if (mainObj.contains(QStringLiteral("pressure"))) {
pressure = mainObj.value(QStringLiteral("pressure")).toDouble();
}
if (mainObj.contains(QStringLiteral("humidity"))) {
humidity = mainObj.value(QStringLiteral("humidity")).toDouble();
}
emit weatherUpdated(temp, pressure, humidity);
}
else
{
qDebug() << "OpenWeatherMap::handleReply: Object doesn't contain a main: " << obj;
}
}
else
{
qDebug() << "OpenWeatherMap::handleReply: Document is not an object: " << document;
}
}
else
{
qDebug() << "OpenWeatherMap::handleReply: error: " << reply->error();
}
reply->deleteLater();
}
else
{
qDebug() << "OpenWeatherMap::handleReply: reply is null";
}
}

76
sdrbase/util/weather.h Normal file
View File

@ -0,0 +1,76 @@
///////////////////////////////////////////////////////////////////////////////////
// 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 INCLUDE_WEATHER_H
#define INCLUDE_WEATHER_H
#include <QtCore>
#include <QTimer>
#include "export.h"
class QNetworkAccessManager;
class QNetworkReply;
// Weather API wrapper
// Allows temperature, pressure and humidity to be obtained for a given latitude and longitude
// Currently supports openweathermap.org
class SDRBASE_API Weather : public QObject
{
Q_OBJECT
protected:
Weather();
public:
static Weather* create(const QString& apiKey, const QString& service="openweathermap.org");
virtual void getWeather(float latitude, float longitude) = 0;
void getWeatherPeriodically(float latitude, float longitude, int periodInMins);
public slots:
void update();
signals:
void weatherUpdated(float temperature, float pressure, float humidity); // Called when new data available. If no value is available, parameter will be NAN
private:
QTimer m_timer; // Timer for periodic updates
float m_latitude; // Saved latitude for periodic updates
float m_longitude; // Saved longitude for periodic updates
};
class SDRBASE_API OpenWeatherMap : public Weather {
Q_OBJECT
public:
OpenWeatherMap(const QString& apiKey);
~OpenWeatherMap();
virtual void getWeather(float latitude, float longitude) override;
private:
QString m_apiKey;
QNetworkAccessManager *m_networkManager;
public slots:
void handleReply(QNetworkReply* reply);
};
#endif /* INCLUDE_WEATHER_H */

View File

@ -10,6 +10,30 @@ StarTrackerSettings:
dec:
description: "Declination of custom target"
type: string
azimuth:
description: "Azimuth of custom target"
type: number
format: float
elevation:
description: "Elevation of custom target"
type: number
format: float
l:
description: "Galactic longitude of custom target"
type: number
format: float
b:
description: "Galactic latitude of custom target"
type: number
format: float
azimuthOffset:
description: "Offset to add to computed azimuth of target"
type: number
format: float
elevationOffset:
description: "Offset to add to computed elevation of target"
type: number
format: float
latitude:
description: "Latitude in decimal degrees (North positive) of observation/antenna location"
type: number
@ -85,3 +109,95 @@ StarTrackerSettings:
type: integer
reverseAPIFeatureIndex:
type: integer
StarTrackerTarget:
description: "Star Tracker target. Sent to startracker.target message queue for other plugins to use."
properties:
name:
descrption: "The name of the target"
type: string
azimuth:
descrption: "The azimuth angle in degrees to the target"
type: number
format: float
elevation:
descrption: "The elevation angle in degrees to the target"
type: number
format: float
ra:
description: "Right ascension of target"
type: number
format: float
dec:
description: "Declination of target"
type: number
format: float
b:
descrption: "Galactic latitude in degrees"
type: number
format: float
l:
descrption: "Galactic longitude in degrees"
type: number
format: float
earthRotationVelocity:
description: "Velocity towards target at observation location due to rotation of the Earth"
type: number
format: float
earthOrbitVelocityBCRS:
description: "Velocity towards target due to Earth's orbit of Sun relative to barycentric reference frame"
type: number
format: float
sunVelocityLSR:
description: "Velocity of Sun towards target relative to local standard of rest"
type: number
format: float
solarFlux:
description: "Solar flux"
type: number
format: float
airTemperature:
description: "Surface air temperature in degrees celsius at antenna location"
type: number
format: float
skyTemperature:
description: "Sky temperature (CMB+Galactic noise) in Kelvin towards the target"
type: number
format: float
hpbw:
description: "Half-power beam width in degrees"
type: number
format: float
StarTrackerDisplaySettings:
description: "Settings to display in Star Tracker. Can be sent by other plugins to startracker.display message queue."
properties:
dateTime:
description: "Date and time of observation. ISO 8601 extended format: yyyy-MM-ddTHH:mm:ss with Z suffix for UTC. Empty string for current time."
type: string
azimuth:
descrption: "The azimuth angle in degrees to the target"
type: number
format: float
elevation:
descrption: "The elevation angle in degrees to the target"
type: number
format: float
StarTrackerDisplayLoSSettings:
description: "Details of object to display in Star Tracker line-of-sight view. Can be sent by other plugins to startracker.display message queue"
properties:
name:
type: string
b:
descrption: "Galactic latitude in degrees"
type: number
format: float
l:
descrption: "Galactic longitude in degrees"
type: number
format: float
d:
descrption: "Distance to object from Sun in kpc"
type: number
format: float

View File

@ -0,0 +1,179 @@
/**
* SDRangel
* This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time ---
*
* OpenAPI spec version: 6.0.0
* Contact: f4exb06@gmail.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
#include "SWGStarTrackerDisplayLoSSettings.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGStarTrackerDisplayLoSSettings::SWGStarTrackerDisplayLoSSettings(QString* json) {
init();
this->fromJson(*json);
}
SWGStarTrackerDisplayLoSSettings::SWGStarTrackerDisplayLoSSettings() {
name = nullptr;
m_name_isSet = false;
b = 0.0f;
m_b_isSet = false;
l = 0.0f;
m_l_isSet = false;
d = 0.0f;
m_d_isSet = false;
}
SWGStarTrackerDisplayLoSSettings::~SWGStarTrackerDisplayLoSSettings() {
this->cleanup();
}
void
SWGStarTrackerDisplayLoSSettings::init() {
name = new QString("");
m_name_isSet = false;
b = 0.0f;
m_b_isSet = false;
l = 0.0f;
m_l_isSet = false;
d = 0.0f;
m_d_isSet = false;
}
void
SWGStarTrackerDisplayLoSSettings::cleanup() {
if(name != nullptr) {
delete name;
}
}
SWGStarTrackerDisplayLoSSettings*
SWGStarTrackerDisplayLoSSettings::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGStarTrackerDisplayLoSSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&name, pJson["name"], "QString", "QString");
::SWGSDRangel::setValue(&b, pJson["b"], "float", "");
::SWGSDRangel::setValue(&l, pJson["l"], "float", "");
::SWGSDRangel::setValue(&d, pJson["d"], "float", "");
}
QString
SWGStarTrackerDisplayLoSSettings::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes);
}
QJsonObject*
SWGStarTrackerDisplayLoSSettings::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(name != nullptr && *name != QString("")){
toJsonValue(QString("name"), name, obj, QString("QString"));
}
if(m_b_isSet){
obj->insert("b", QJsonValue(b));
}
if(m_l_isSet){
obj->insert("l", QJsonValue(l));
}
if(m_d_isSet){
obj->insert("d", QJsonValue(d));
}
return obj;
}
QString*
SWGStarTrackerDisplayLoSSettings::getName() {
return name;
}
void
SWGStarTrackerDisplayLoSSettings::setName(QString* name) {
this->name = name;
this->m_name_isSet = true;
}
float
SWGStarTrackerDisplayLoSSettings::getB() {
return b;
}
void
SWGStarTrackerDisplayLoSSettings::setB(float b) {
this->b = b;
this->m_b_isSet = true;
}
float
SWGStarTrackerDisplayLoSSettings::getL() {
return l;
}
void
SWGStarTrackerDisplayLoSSettings::setL(float l) {
this->l = l;
this->m_l_isSet = true;
}
float
SWGStarTrackerDisplayLoSSettings::getD() {
return d;
}
void
SWGStarTrackerDisplayLoSSettings::setD(float d) {
this->d = d;
this->m_d_isSet = true;
}
bool
SWGStarTrackerDisplayLoSSettings::isSet(){
bool isObjectUpdated = false;
do{
if(name && *name != QString("")){
isObjectUpdated = true; break;
}
if(m_b_isSet){
isObjectUpdated = true; break;
}
if(m_l_isSet){
isObjectUpdated = true; break;
}
if(m_d_isSet){
isObjectUpdated = true; break;
}
}while(false);
return isObjectUpdated;
}
}

View File

@ -0,0 +1,77 @@
/**
* SDRangel
* This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time ---
*
* OpenAPI spec version: 6.0.0
* Contact: f4exb06@gmail.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
/*
* SWGStarTrackerDisplayLoSSettings.h
*
* Details of object to display in Star Tracker line-of-sight view. Can be sent by other plugins to startracker.display message queue
*/
#ifndef SWGStarTrackerDisplayLoSSettings_H_
#define SWGStarTrackerDisplayLoSSettings_H_
#include <QJsonObject>
#include <QString>
#include "SWGObject.h"
#include "export.h"
namespace SWGSDRangel {
class SWG_API SWGStarTrackerDisplayLoSSettings: public SWGObject {
public:
SWGStarTrackerDisplayLoSSettings();
SWGStarTrackerDisplayLoSSettings(QString* json);
virtual ~SWGStarTrackerDisplayLoSSettings();
void init();
void cleanup();
virtual QString asJson () override;
virtual QJsonObject* asJsonObject() override;
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGStarTrackerDisplayLoSSettings* fromJson(QString &jsonString) override;
QString* getName();
void setName(QString* name);
float getB();
void setB(float b);
float getL();
void setL(float l);
float getD();
void setD(float d);
virtual bool isSet() override;
private:
QString* name;
bool m_name_isSet;
float b;
bool m_b_isSet;
float l;
bool m_l_isSet;
float d;
bool m_d_isSet;
};
}
#endif /* SWGStarTrackerDisplayLoSSettings_H_ */

View File

@ -0,0 +1,179 @@
/**
* SDRangel
* This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time ---
*
* OpenAPI spec version: 6.0.0
* Contact: f4exb06@gmail.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
#include "SWGStarTrackerDisplayLoSSettings_2.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGStarTrackerDisplayLoSSettings_2::SWGStarTrackerDisplayLoSSettings_2(QString* json) {
init();
this->fromJson(*json);
}
SWGStarTrackerDisplayLoSSettings_2::SWGStarTrackerDisplayLoSSettings_2() {
name = nullptr;
m_name_isSet = false;
b = 0.0f;
m_b_isSet = false;
l = 0.0f;
m_l_isSet = false;
d = 0.0f;
m_d_isSet = false;
}
SWGStarTrackerDisplayLoSSettings_2::~SWGStarTrackerDisplayLoSSettings_2() {
this->cleanup();
}
void
SWGStarTrackerDisplayLoSSettings_2::init() {
name = new QString("");
m_name_isSet = false;
b = 0.0f;
m_b_isSet = false;
l = 0.0f;
m_l_isSet = false;
d = 0.0f;
m_d_isSet = false;
}
void
SWGStarTrackerDisplayLoSSettings_2::cleanup() {
if(name != nullptr) {
delete name;
}
}
SWGStarTrackerDisplayLoSSettings_2*
SWGStarTrackerDisplayLoSSettings_2::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGStarTrackerDisplayLoSSettings_2::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&name, pJson["name"], "QString", "QString");
::SWGSDRangel::setValue(&b, pJson["b"], "float", "");
::SWGSDRangel::setValue(&l, pJson["l"], "float", "");
::SWGSDRangel::setValue(&d, pJson["d"], "float", "");
}
QString
SWGStarTrackerDisplayLoSSettings_2::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes);
}
QJsonObject*
SWGStarTrackerDisplayLoSSettings_2::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(name != nullptr && *name != QString("")){
toJsonValue(QString("name"), name, obj, QString("QString"));
}
if(m_b_isSet){
obj->insert("b", QJsonValue(b));
}
if(m_l_isSet){
obj->insert("l", QJsonValue(l));
}
if(m_d_isSet){
obj->insert("d", QJsonValue(d));
}
return obj;
}
QString*
SWGStarTrackerDisplayLoSSettings_2::getName() {
return name;
}
void
SWGStarTrackerDisplayLoSSettings_2::setName(QString* name) {
this->name = name;
this->m_name_isSet = true;
}
float
SWGStarTrackerDisplayLoSSettings_2::getB() {
return b;
}
void
SWGStarTrackerDisplayLoSSettings_2::setB(float b) {
this->b = b;
this->m_b_isSet = true;
}
float
SWGStarTrackerDisplayLoSSettings_2::getL() {
return l;
}
void
SWGStarTrackerDisplayLoSSettings_2::setL(float l) {
this->l = l;
this->m_l_isSet = true;
}
float
SWGStarTrackerDisplayLoSSettings_2::getD() {
return d;
}
void
SWGStarTrackerDisplayLoSSettings_2::setD(float d) {
this->d = d;
this->m_d_isSet = true;
}
bool
SWGStarTrackerDisplayLoSSettings_2::isSet(){
bool isObjectUpdated = false;
do{
if(name && *name != QString("")){
isObjectUpdated = true; break;
}
if(m_b_isSet){
isObjectUpdated = true; break;
}
if(m_l_isSet){
isObjectUpdated = true; break;
}
if(m_d_isSet){
isObjectUpdated = true; break;
}
}while(false);
return isObjectUpdated;
}
}

View File

@ -0,0 +1,77 @@
/**
* SDRangel
* This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time ---
*
* OpenAPI spec version: 6.0.0
* Contact: f4exb06@gmail.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
/*
* SWGStarTrackerDisplayLoSSettings_2.h
*
* Details of object to display in Star Tracker line-of-sight view. Can be sent by other plugins to startracker.display message queue
*/
#ifndef SWGStarTrackerDisplayLoSSettings_2_H_
#define SWGStarTrackerDisplayLoSSettings_2_H_
#include <QJsonObject>
#include <QString>
#include "SWGObject.h"
#include "export.h"
namespace SWGSDRangel {
class SWG_API SWGStarTrackerDisplayLoSSettings_2: public SWGObject {
public:
SWGStarTrackerDisplayLoSSettings_2();
SWGStarTrackerDisplayLoSSettings_2(QString* json);
virtual ~SWGStarTrackerDisplayLoSSettings_2();
void init();
void cleanup();
virtual QString asJson () override;
virtual QJsonObject* asJsonObject() override;
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGStarTrackerDisplayLoSSettings_2* fromJson(QString &jsonString) override;
QString* getName();
void setName(QString* name);
float getB();
void setB(float b);
float getL();
void setL(float l);
float getD();
void setD(float d);
virtual bool isSet() override;
private:
QString* name;
bool m_name_isSet;
float b;
bool m_b_isSet;
float l;
bool m_l_isSet;
float d;
bool m_d_isSet;
};
}
#endif /* SWGStarTrackerDisplayLoSSettings_2_H_ */

View File

@ -0,0 +1,156 @@
/**
* SDRangel
* This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time ---
*
* OpenAPI spec version: 6.0.0
* Contact: f4exb06@gmail.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
#include "SWGStarTrackerDisplaySettings.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGStarTrackerDisplaySettings::SWGStarTrackerDisplaySettings(QString* json) {
init();
this->fromJson(*json);
}
SWGStarTrackerDisplaySettings::SWGStarTrackerDisplaySettings() {
date_time = nullptr;
m_date_time_isSet = false;
azimuth = 0.0f;
m_azimuth_isSet = false;
elevation = 0.0f;
m_elevation_isSet = false;
}
SWGStarTrackerDisplaySettings::~SWGStarTrackerDisplaySettings() {
this->cleanup();
}
void
SWGStarTrackerDisplaySettings::init() {
date_time = new QString("");
m_date_time_isSet = false;
azimuth = 0.0f;
m_azimuth_isSet = false;
elevation = 0.0f;
m_elevation_isSet = false;
}
void
SWGStarTrackerDisplaySettings::cleanup() {
if(date_time != nullptr) {
delete date_time;
}
}
SWGStarTrackerDisplaySettings*
SWGStarTrackerDisplaySettings::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGStarTrackerDisplaySettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&date_time, pJson["dateTime"], "QString", "QString");
::SWGSDRangel::setValue(&azimuth, pJson["azimuth"], "float", "");
::SWGSDRangel::setValue(&elevation, pJson["elevation"], "float", "");
}
QString
SWGStarTrackerDisplaySettings::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes);
}
QJsonObject*
SWGStarTrackerDisplaySettings::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(date_time != nullptr && *date_time != QString("")){
toJsonValue(QString("dateTime"), date_time, obj, QString("QString"));
}
if(m_azimuth_isSet){
obj->insert("azimuth", QJsonValue(azimuth));
}
if(m_elevation_isSet){
obj->insert("elevation", QJsonValue(elevation));
}
return obj;
}
QString*
SWGStarTrackerDisplaySettings::getDateTime() {
return date_time;
}
void
SWGStarTrackerDisplaySettings::setDateTime(QString* date_time) {
this->date_time = date_time;
this->m_date_time_isSet = true;
}
float
SWGStarTrackerDisplaySettings::getAzimuth() {
return azimuth;
}
void
SWGStarTrackerDisplaySettings::setAzimuth(float azimuth) {
this->azimuth = azimuth;
this->m_azimuth_isSet = true;
}
float
SWGStarTrackerDisplaySettings::getElevation() {
return elevation;
}
void
SWGStarTrackerDisplaySettings::setElevation(float elevation) {
this->elevation = elevation;
this->m_elevation_isSet = true;
}
bool
SWGStarTrackerDisplaySettings::isSet(){
bool isObjectUpdated = false;
do{
if(date_time && *date_time != QString("")){
isObjectUpdated = true; break;
}
if(m_azimuth_isSet){
isObjectUpdated = true; break;
}
if(m_elevation_isSet){
isObjectUpdated = true; break;
}
}while(false);
return isObjectUpdated;
}
}

View File

@ -0,0 +1,71 @@
/**
* SDRangel
* This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time ---
*
* OpenAPI spec version: 6.0.0
* Contact: f4exb06@gmail.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
/*
* SWGStarTrackerDisplaySettings.h
*
* Settings to display in Star Tracker. Can be sent by other plugins to startracker.display message queue.
*/
#ifndef SWGStarTrackerDisplaySettings_H_
#define SWGStarTrackerDisplaySettings_H_
#include <QJsonObject>
#include <QString>
#include "SWGObject.h"
#include "export.h"
namespace SWGSDRangel {
class SWG_API SWGStarTrackerDisplaySettings: public SWGObject {
public:
SWGStarTrackerDisplaySettings();
SWGStarTrackerDisplaySettings(QString* json);
virtual ~SWGStarTrackerDisplaySettings();
void init();
void cleanup();
virtual QString asJson () override;
virtual QJsonObject* asJsonObject() override;
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGStarTrackerDisplaySettings* fromJson(QString &jsonString) override;
QString* getDateTime();
void setDateTime(QString* date_time);
float getAzimuth();
void setAzimuth(float azimuth);
float getElevation();
void setElevation(float elevation);
virtual bool isSet() override;
private:
QString* date_time;
bool m_date_time_isSet;
float azimuth;
bool m_azimuth_isSet;
float elevation;
bool m_elevation_isSet;
};
}
#endif /* SWGStarTrackerDisplaySettings_H_ */

View File

@ -0,0 +1,156 @@
/**
* SDRangel
* This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time ---
*
* OpenAPI spec version: 6.0.0
* Contact: f4exb06@gmail.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
#include "SWGStarTrackerDisplaySettings_2.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGStarTrackerDisplaySettings_2::SWGStarTrackerDisplaySettings_2(QString* json) {
init();
this->fromJson(*json);
}
SWGStarTrackerDisplaySettings_2::SWGStarTrackerDisplaySettings_2() {
date_time = nullptr;
m_date_time_isSet = false;
azimuth = 0.0f;
m_azimuth_isSet = false;
elevation = 0.0f;
m_elevation_isSet = false;
}
SWGStarTrackerDisplaySettings_2::~SWGStarTrackerDisplaySettings_2() {
this->cleanup();
}
void
SWGStarTrackerDisplaySettings_2::init() {
date_time = new QString("");
m_date_time_isSet = false;
azimuth = 0.0f;
m_azimuth_isSet = false;
elevation = 0.0f;
m_elevation_isSet = false;
}
void
SWGStarTrackerDisplaySettings_2::cleanup() {
if(date_time != nullptr) {
delete date_time;
}
}
SWGStarTrackerDisplaySettings_2*
SWGStarTrackerDisplaySettings_2::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGStarTrackerDisplaySettings_2::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&date_time, pJson["dateTime"], "QString", "QString");
::SWGSDRangel::setValue(&azimuth, pJson["azimuth"], "float", "");
::SWGSDRangel::setValue(&elevation, pJson["elevation"], "float", "");
}
QString
SWGStarTrackerDisplaySettings_2::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes);
}
QJsonObject*
SWGStarTrackerDisplaySettings_2::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(date_time != nullptr && *date_time != QString("")){
toJsonValue(QString("dateTime"), date_time, obj, QString("QString"));
}
if(m_azimuth_isSet){
obj->insert("azimuth", QJsonValue(azimuth));
}
if(m_elevation_isSet){
obj->insert("elevation", QJsonValue(elevation));
}
return obj;
}
QString*
SWGStarTrackerDisplaySettings_2::getDateTime() {
return date_time;
}
void
SWGStarTrackerDisplaySettings_2::setDateTime(QString* date_time) {
this->date_time = date_time;
this->m_date_time_isSet = true;
}
float
SWGStarTrackerDisplaySettings_2::getAzimuth() {
return azimuth;
}
void
SWGStarTrackerDisplaySettings_2::setAzimuth(float azimuth) {
this->azimuth = azimuth;
this->m_azimuth_isSet = true;
}
float
SWGStarTrackerDisplaySettings_2::getElevation() {
return elevation;
}
void
SWGStarTrackerDisplaySettings_2::setElevation(float elevation) {
this->elevation = elevation;
this->m_elevation_isSet = true;
}
bool
SWGStarTrackerDisplaySettings_2::isSet(){
bool isObjectUpdated = false;
do{
if(date_time && *date_time != QString("")){
isObjectUpdated = true; break;
}
if(m_azimuth_isSet){
isObjectUpdated = true; break;
}
if(m_elevation_isSet){
isObjectUpdated = true; break;
}
}while(false);
return isObjectUpdated;
}
}

View File

@ -0,0 +1,71 @@
/**
* SDRangel
* This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time ---
*
* OpenAPI spec version: 6.0.0
* Contact: f4exb06@gmail.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
/*
* SWGStarTrackerDisplaySettings_2.h
*
* Settings to display in Star Tracker. Can be sent by other plugins to startracker.display message queue.
*/
#ifndef SWGStarTrackerDisplaySettings_2_H_
#define SWGStarTrackerDisplaySettings_2_H_
#include <QJsonObject>
#include <QString>
#include "SWGObject.h"
#include "export.h"
namespace SWGSDRangel {
class SWG_API SWGStarTrackerDisplaySettings_2: public SWGObject {
public:
SWGStarTrackerDisplaySettings_2();
SWGStarTrackerDisplaySettings_2(QString* json);
virtual ~SWGStarTrackerDisplaySettings_2();
void init();
void cleanup();
virtual QString asJson () override;
virtual QJsonObject* asJsonObject() override;
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGStarTrackerDisplaySettings_2* fromJson(QString &jsonString) override;
QString* getDateTime();
void setDateTime(QString* date_time);
float getAzimuth();
void setAzimuth(float azimuth);
float getElevation();
void setElevation(float elevation);
virtual bool isSet() override;
private:
QString* date_time;
bool m_date_time_isSet;
float azimuth;
bool m_azimuth_isSet;
float elevation;
bool m_elevation_isSet;
};
}
#endif /* SWGStarTrackerDisplaySettings_2_H_ */

View File

@ -34,6 +34,18 @@ SWGStarTrackerSettings::SWGStarTrackerSettings() {
m_ra_isSet = false;
dec = nullptr;
m_dec_isSet = false;
azimuth = 0.0f;
m_azimuth_isSet = false;
elevation = 0.0f;
m_elevation_isSet = false;
l = 0.0f;
m_l_isSet = false;
b = 0.0f;
m_b_isSet = false;
azimuth_offset = 0.0f;
m_azimuth_offset_isSet = false;
elevation_offset = 0.0f;
m_elevation_offset_isSet = false;
latitude = 0.0f;
m_latitude_isSet = false;
longitude = 0.0f;
@ -96,6 +108,18 @@ SWGStarTrackerSettings::init() {
m_ra_isSet = false;
dec = new QString("");
m_dec_isSet = false;
azimuth = 0.0f;
m_azimuth_isSet = false;
elevation = 0.0f;
m_elevation_isSet = false;
l = 0.0f;
m_l_isSet = false;
b = 0.0f;
m_b_isSet = false;
azimuth_offset = 0.0f;
m_azimuth_offset_isSet = false;
elevation_offset = 0.0f;
m_elevation_offset_isSet = false;
latitude = 0.0f;
m_latitude_isSet = false;
longitude = 0.0f;
@ -159,6 +183,12 @@ SWGStarTrackerSettings::cleanup() {
}
if(date_time != nullptr) {
delete date_time;
}
@ -210,6 +240,18 @@ SWGStarTrackerSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&dec, pJson["dec"], "QString", "QString");
::SWGSDRangel::setValue(&azimuth, pJson["azimuth"], "float", "");
::SWGSDRangel::setValue(&elevation, pJson["elevation"], "float", "");
::SWGSDRangel::setValue(&l, pJson["l"], "float", "");
::SWGSDRangel::setValue(&b, pJson["b"], "float", "");
::SWGSDRangel::setValue(&azimuth_offset, pJson["azimuthOffset"], "float", "");
::SWGSDRangel::setValue(&elevation_offset, pJson["elevationOffset"], "float", "");
::SWGSDRangel::setValue(&latitude, pJson["latitude"], "float", "");
::SWGSDRangel::setValue(&longitude, pJson["longitude"], "float", "");
@ -283,6 +325,24 @@ SWGStarTrackerSettings::asJsonObject() {
if(dec != nullptr && *dec != QString("")){
toJsonValue(QString("dec"), dec, obj, QString("QString"));
}
if(m_azimuth_isSet){
obj->insert("azimuth", QJsonValue(azimuth));
}
if(m_elevation_isSet){
obj->insert("elevation", QJsonValue(elevation));
}
if(m_l_isSet){
obj->insert("l", QJsonValue(l));
}
if(m_b_isSet){
obj->insert("b", QJsonValue(b));
}
if(m_azimuth_offset_isSet){
obj->insert("azimuthOffset", QJsonValue(azimuth_offset));
}
if(m_elevation_offset_isSet){
obj->insert("elevationOffset", QJsonValue(elevation_offset));
}
if(m_latitude_isSet){
obj->insert("latitude", QJsonValue(latitude));
}
@ -389,6 +449,66 @@ SWGStarTrackerSettings::setDec(QString* dec) {
this->m_dec_isSet = true;
}
float
SWGStarTrackerSettings::getAzimuth() {
return azimuth;
}
void
SWGStarTrackerSettings::setAzimuth(float azimuth) {
this->azimuth = azimuth;
this->m_azimuth_isSet = true;
}
float
SWGStarTrackerSettings::getElevation() {
return elevation;
}
void
SWGStarTrackerSettings::setElevation(float elevation) {
this->elevation = elevation;
this->m_elevation_isSet = true;
}
float
SWGStarTrackerSettings::getL() {
return l;
}
void
SWGStarTrackerSettings::setL(float l) {
this->l = l;
this->m_l_isSet = true;
}
float
SWGStarTrackerSettings::getB() {
return b;
}
void
SWGStarTrackerSettings::setB(float b) {
this->b = b;
this->m_b_isSet = true;
}
float
SWGStarTrackerSettings::getAzimuthOffset() {
return azimuth_offset;
}
void
SWGStarTrackerSettings::setAzimuthOffset(float azimuth_offset) {
this->azimuth_offset = azimuth_offset;
this->m_azimuth_offset_isSet = true;
}
float
SWGStarTrackerSettings::getElevationOffset() {
return elevation_offset;
}
void
SWGStarTrackerSettings::setElevationOffset(float elevation_offset) {
this->elevation_offset = elevation_offset;
this->m_elevation_offset_isSet = true;
}
float
SWGStarTrackerSettings::getLatitude() {
return latitude;
@ -643,6 +763,24 @@ SWGStarTrackerSettings::isSet(){
if(dec && *dec != QString("")){
isObjectUpdated = true; break;
}
if(m_azimuth_isSet){
isObjectUpdated = true; break;
}
if(m_elevation_isSet){
isObjectUpdated = true; break;
}
if(m_l_isSet){
isObjectUpdated = true; break;
}
if(m_b_isSet){
isObjectUpdated = true; break;
}
if(m_azimuth_offset_isSet){
isObjectUpdated = true; break;
}
if(m_elevation_offset_isSet){
isObjectUpdated = true; break;
}
if(m_latitude_isSet){
isObjectUpdated = true; break;
}

View File

@ -51,6 +51,24 @@ public:
QString* getDec();
void setDec(QString* dec);
float getAzimuth();
void setAzimuth(float azimuth);
float getElevation();
void setElevation(float elevation);
float getL();
void setL(float l);
float getB();
void setB(float b);
float getAzimuthOffset();
void setAzimuthOffset(float azimuth_offset);
float getElevationOffset();
void setElevationOffset(float elevation_offset);
float getLatitude();
void setLatitude(float latitude);
@ -136,6 +154,24 @@ private:
QString* dec;
bool m_dec_isSet;
float azimuth;
bool m_azimuth_isSet;
float elevation;
bool m_elevation_isSet;
float l;
bool m_l_isSet;
float b;
bool m_b_isSet;
float azimuth_offset;
bool m_azimuth_offset_isSet;
float elevation_offset;
bool m_elevation_offset_isSet;
float latitude;
bool m_latitude_isSet;

View File

@ -0,0 +1,409 @@
/**
* SDRangel
* This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time ---
*
* OpenAPI spec version: 6.0.0
* Contact: f4exb06@gmail.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
#include "SWGStarTrackerTarget.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGStarTrackerTarget::SWGStarTrackerTarget(QString* json) {
init();
this->fromJson(*json);
}
SWGStarTrackerTarget::SWGStarTrackerTarget() {
name = nullptr;
m_name_isSet = false;
azimuth = 0.0f;
m_azimuth_isSet = false;
elevation = 0.0f;
m_elevation_isSet = false;
ra = 0.0f;
m_ra_isSet = false;
dec = 0.0f;
m_dec_isSet = false;
b = 0.0f;
m_b_isSet = false;
l = 0.0f;
m_l_isSet = false;
earth_rotation_velocity = 0.0f;
m_earth_rotation_velocity_isSet = false;
earth_orbit_velocity_bcrs = 0.0f;
m_earth_orbit_velocity_bcrs_isSet = false;
sun_velocity_lsr = 0.0f;
m_sun_velocity_lsr_isSet = false;
solar_flux = 0.0f;
m_solar_flux_isSet = false;
air_temperature = 0.0f;
m_air_temperature_isSet = false;
sky_temperature = 0.0f;
m_sky_temperature_isSet = false;
hpbw = 0.0f;
m_hpbw_isSet = false;
}
SWGStarTrackerTarget::~SWGStarTrackerTarget() {
this->cleanup();
}
void
SWGStarTrackerTarget::init() {
name = new QString("");
m_name_isSet = false;
azimuth = 0.0f;
m_azimuth_isSet = false;
elevation = 0.0f;
m_elevation_isSet = false;
ra = 0.0f;
m_ra_isSet = false;
dec = 0.0f;
m_dec_isSet = false;
b = 0.0f;
m_b_isSet = false;
l = 0.0f;
m_l_isSet = false;
earth_rotation_velocity = 0.0f;
m_earth_rotation_velocity_isSet = false;
earth_orbit_velocity_bcrs = 0.0f;
m_earth_orbit_velocity_bcrs_isSet = false;
sun_velocity_lsr = 0.0f;
m_sun_velocity_lsr_isSet = false;
solar_flux = 0.0f;
m_solar_flux_isSet = false;
air_temperature = 0.0f;
m_air_temperature_isSet = false;
sky_temperature = 0.0f;
m_sky_temperature_isSet = false;
hpbw = 0.0f;
m_hpbw_isSet = false;
}
void
SWGStarTrackerTarget::cleanup() {
if(name != nullptr) {
delete name;
}
}
SWGStarTrackerTarget*
SWGStarTrackerTarget::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGStarTrackerTarget::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&name, pJson["name"], "QString", "QString");
::SWGSDRangel::setValue(&azimuth, pJson["azimuth"], "float", "");
::SWGSDRangel::setValue(&elevation, pJson["elevation"], "float", "");
::SWGSDRangel::setValue(&ra, pJson["ra"], "float", "");
::SWGSDRangel::setValue(&dec, pJson["dec"], "float", "");
::SWGSDRangel::setValue(&b, pJson["b"], "float", "");
::SWGSDRangel::setValue(&l, pJson["l"], "float", "");
::SWGSDRangel::setValue(&earth_rotation_velocity, pJson["earthRotationVelocity"], "float", "");
::SWGSDRangel::setValue(&earth_orbit_velocity_bcrs, pJson["earthOrbitVelocityBCRS"], "float", "");
::SWGSDRangel::setValue(&sun_velocity_lsr, pJson["sunVelocityLSR"], "float", "");
::SWGSDRangel::setValue(&solar_flux, pJson["solarFlux"], "float", "");
::SWGSDRangel::setValue(&air_temperature, pJson["airTemperature"], "float", "");
::SWGSDRangel::setValue(&sky_temperature, pJson["skyTemperature"], "float", "");
::SWGSDRangel::setValue(&hpbw, pJson["hpbw"], "float", "");
}
QString
SWGStarTrackerTarget::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes);
}
QJsonObject*
SWGStarTrackerTarget::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(name != nullptr && *name != QString("")){
toJsonValue(QString("name"), name, obj, QString("QString"));
}
if(m_azimuth_isSet){
obj->insert("azimuth", QJsonValue(azimuth));
}
if(m_elevation_isSet){
obj->insert("elevation", QJsonValue(elevation));
}
if(m_ra_isSet){
obj->insert("ra", QJsonValue(ra));
}
if(m_dec_isSet){
obj->insert("dec", QJsonValue(dec));
}
if(m_b_isSet){
obj->insert("b", QJsonValue(b));
}
if(m_l_isSet){
obj->insert("l", QJsonValue(l));
}
if(m_earth_rotation_velocity_isSet){
obj->insert("earthRotationVelocity", QJsonValue(earth_rotation_velocity));
}
if(m_earth_orbit_velocity_bcrs_isSet){
obj->insert("earthOrbitVelocityBCRS", QJsonValue(earth_orbit_velocity_bcrs));
}
if(m_sun_velocity_lsr_isSet){
obj->insert("sunVelocityLSR", QJsonValue(sun_velocity_lsr));
}
if(m_solar_flux_isSet){
obj->insert("solarFlux", QJsonValue(solar_flux));
}
if(m_air_temperature_isSet){
obj->insert("airTemperature", QJsonValue(air_temperature));
}
if(m_sky_temperature_isSet){
obj->insert("skyTemperature", QJsonValue(sky_temperature));
}
if(m_hpbw_isSet){
obj->insert("hpbw", QJsonValue(hpbw));
}
return obj;
}
QString*
SWGStarTrackerTarget::getName() {
return name;
}
void
SWGStarTrackerTarget::setName(QString* name) {
this->name = name;
this->m_name_isSet = true;
}
float
SWGStarTrackerTarget::getAzimuth() {
return azimuth;
}
void
SWGStarTrackerTarget::setAzimuth(float azimuth) {
this->azimuth = azimuth;
this->m_azimuth_isSet = true;
}
float
SWGStarTrackerTarget::getElevation() {
return elevation;
}
void
SWGStarTrackerTarget::setElevation(float elevation) {
this->elevation = elevation;
this->m_elevation_isSet = true;
}
float
SWGStarTrackerTarget::getRa() {
return ra;
}
void
SWGStarTrackerTarget::setRa(float ra) {
this->ra = ra;
this->m_ra_isSet = true;
}
float
SWGStarTrackerTarget::getDec() {
return dec;
}
void
SWGStarTrackerTarget::setDec(float dec) {
this->dec = dec;
this->m_dec_isSet = true;
}
float
SWGStarTrackerTarget::getB() {
return b;
}
void
SWGStarTrackerTarget::setB(float b) {
this->b = b;
this->m_b_isSet = true;
}
float
SWGStarTrackerTarget::getL() {
return l;
}
void
SWGStarTrackerTarget::setL(float l) {
this->l = l;
this->m_l_isSet = true;
}
float
SWGStarTrackerTarget::getEarthRotationVelocity() {
return earth_rotation_velocity;
}
void
SWGStarTrackerTarget::setEarthRotationVelocity(float earth_rotation_velocity) {
this->earth_rotation_velocity = earth_rotation_velocity;
this->m_earth_rotation_velocity_isSet = true;
}
float
SWGStarTrackerTarget::getEarthOrbitVelocityBcrs() {
return earth_orbit_velocity_bcrs;
}
void
SWGStarTrackerTarget::setEarthOrbitVelocityBcrs(float earth_orbit_velocity_bcrs) {
this->earth_orbit_velocity_bcrs = earth_orbit_velocity_bcrs;
this->m_earth_orbit_velocity_bcrs_isSet = true;
}
float
SWGStarTrackerTarget::getSunVelocityLsr() {
return sun_velocity_lsr;
}
void
SWGStarTrackerTarget::setSunVelocityLsr(float sun_velocity_lsr) {
this->sun_velocity_lsr = sun_velocity_lsr;
this->m_sun_velocity_lsr_isSet = true;
}
float
SWGStarTrackerTarget::getSolarFlux() {
return solar_flux;
}
void
SWGStarTrackerTarget::setSolarFlux(float solar_flux) {
this->solar_flux = solar_flux;
this->m_solar_flux_isSet = true;
}
float
SWGStarTrackerTarget::getAirTemperature() {
return air_temperature;
}
void
SWGStarTrackerTarget::setAirTemperature(float air_temperature) {
this->air_temperature = air_temperature;
this->m_air_temperature_isSet = true;
}
float
SWGStarTrackerTarget::getSkyTemperature() {
return sky_temperature;
}
void
SWGStarTrackerTarget::setSkyTemperature(float sky_temperature) {
this->sky_temperature = sky_temperature;
this->m_sky_temperature_isSet = true;
}
float
SWGStarTrackerTarget::getHpbw() {
return hpbw;
}
void
SWGStarTrackerTarget::setHpbw(float hpbw) {
this->hpbw = hpbw;
this->m_hpbw_isSet = true;
}
bool
SWGStarTrackerTarget::isSet(){
bool isObjectUpdated = false;
do{
if(name && *name != QString("")){
isObjectUpdated = true; break;
}
if(m_azimuth_isSet){
isObjectUpdated = true; break;
}
if(m_elevation_isSet){
isObjectUpdated = true; break;
}
if(m_ra_isSet){
isObjectUpdated = true; break;
}
if(m_dec_isSet){
isObjectUpdated = true; break;
}
if(m_b_isSet){
isObjectUpdated = true; break;
}
if(m_l_isSet){
isObjectUpdated = true; break;
}
if(m_earth_rotation_velocity_isSet){
isObjectUpdated = true; break;
}
if(m_earth_orbit_velocity_bcrs_isSet){
isObjectUpdated = true; break;
}
if(m_sun_velocity_lsr_isSet){
isObjectUpdated = true; break;
}
if(m_solar_flux_isSet){
isObjectUpdated = true; break;
}
if(m_air_temperature_isSet){
isObjectUpdated = true; break;
}
if(m_sky_temperature_isSet){
isObjectUpdated = true; break;
}
if(m_hpbw_isSet){
isObjectUpdated = true; break;
}
}while(false);
return isObjectUpdated;
}
}

View File

@ -0,0 +1,137 @@
/**
* SDRangel
* This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time ---
*
* OpenAPI spec version: 6.0.0
* Contact: f4exb06@gmail.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
/*
* SWGStarTrackerTarget.h
*
* Star Tracker target. Sent to startracker.target message queue for other plugins to use.
*/
#ifndef SWGStarTrackerTarget_H_
#define SWGStarTrackerTarget_H_
#include <QJsonObject>
#include <QString>
#include "SWGObject.h"
#include "export.h"
namespace SWGSDRangel {
class SWG_API SWGStarTrackerTarget: public SWGObject {
public:
SWGStarTrackerTarget();
SWGStarTrackerTarget(QString* json);
virtual ~SWGStarTrackerTarget();
void init();
void cleanup();
virtual QString asJson () override;
virtual QJsonObject* asJsonObject() override;
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGStarTrackerTarget* fromJson(QString &jsonString) override;
QString* getName();
void setName(QString* name);
float getAzimuth();
void setAzimuth(float azimuth);
float getElevation();
void setElevation(float elevation);
float getRa();
void setRa(float ra);
float getDec();
void setDec(float dec);
float getB();
void setB(float b);
float getL();
void setL(float l);
float getEarthRotationVelocity();
void setEarthRotationVelocity(float earth_rotation_velocity);
float getEarthOrbitVelocityBcrs();
void setEarthOrbitVelocityBcrs(float earth_orbit_velocity_bcrs);
float getSunVelocityLsr();
void setSunVelocityLsr(float sun_velocity_lsr);
float getSolarFlux();
void setSolarFlux(float solar_flux);
float getAirTemperature();
void setAirTemperature(float air_temperature);
float getSkyTemperature();
void setSkyTemperature(float sky_temperature);
float getHpbw();
void setHpbw(float hpbw);
virtual bool isSet() override;
private:
QString* name;
bool m_name_isSet;
float azimuth;
bool m_azimuth_isSet;
float elevation;
bool m_elevation_isSet;
float ra;
bool m_ra_isSet;
float dec;
bool m_dec_isSet;
float b;
bool m_b_isSet;
float l;
bool m_l_isSet;
float earth_rotation_velocity;
bool m_earth_rotation_velocity_isSet;
float earth_orbit_velocity_bcrs;
bool m_earth_orbit_velocity_bcrs_isSet;
float sun_velocity_lsr;
bool m_sun_velocity_lsr_isSet;
float solar_flux;
bool m_solar_flux_isSet;
float air_temperature;
bool m_air_temperature_isSet;
float sky_temperature;
bool m_sky_temperature_isSet;
float hpbw;
bool m_hpbw_isSet;
};
}
#endif /* SWGStarTrackerTarget_H_ */

View File

@ -0,0 +1,409 @@
/**
* SDRangel
* This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time ---
*
* OpenAPI spec version: 6.0.0
* Contact: f4exb06@gmail.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
#include "SWGStarTrackerTarget_2.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGStarTrackerTarget_2::SWGStarTrackerTarget_2(QString* json) {
init();
this->fromJson(*json);
}
SWGStarTrackerTarget_2::SWGStarTrackerTarget_2() {
name = nullptr;
m_name_isSet = false;
azimuth = 0.0f;
m_azimuth_isSet = false;
elevation = 0.0f;
m_elevation_isSet = false;
ra = 0.0f;
m_ra_isSet = false;
dec = 0.0f;
m_dec_isSet = false;
b = 0.0f;
m_b_isSet = false;
l = 0.0f;
m_l_isSet = false;
earth_rotation_velocity = 0.0f;
m_earth_rotation_velocity_isSet = false;
earth_orbit_velocity_bcrs = 0.0f;
m_earth_orbit_velocity_bcrs_isSet = false;
sun_velocity_lsr = 0.0f;
m_sun_velocity_lsr_isSet = false;
solar_flux = 0.0f;
m_solar_flux_isSet = false;
air_temperature = 0.0f;
m_air_temperature_isSet = false;
sky_temperature = 0.0f;
m_sky_temperature_isSet = false;
hpbw = 0.0f;
m_hpbw_isSet = false;
}
SWGStarTrackerTarget_2::~SWGStarTrackerTarget_2() {
this->cleanup();
}
void
SWGStarTrackerTarget_2::init() {
name = new QString("");
m_name_isSet = false;
azimuth = 0.0f;
m_azimuth_isSet = false;
elevation = 0.0f;
m_elevation_isSet = false;
ra = 0.0f;
m_ra_isSet = false;
dec = 0.0f;
m_dec_isSet = false;
b = 0.0f;
m_b_isSet = false;
l = 0.0f;
m_l_isSet = false;
earth_rotation_velocity = 0.0f;
m_earth_rotation_velocity_isSet = false;
earth_orbit_velocity_bcrs = 0.0f;
m_earth_orbit_velocity_bcrs_isSet = false;
sun_velocity_lsr = 0.0f;
m_sun_velocity_lsr_isSet = false;
solar_flux = 0.0f;
m_solar_flux_isSet = false;
air_temperature = 0.0f;
m_air_temperature_isSet = false;
sky_temperature = 0.0f;
m_sky_temperature_isSet = false;
hpbw = 0.0f;
m_hpbw_isSet = false;
}
void
SWGStarTrackerTarget_2::cleanup() {
if(name != nullptr) {
delete name;
}
}
SWGStarTrackerTarget_2*
SWGStarTrackerTarget_2::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGStarTrackerTarget_2::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&name, pJson["name"], "QString", "QString");
::SWGSDRangel::setValue(&azimuth, pJson["azimuth"], "float", "");
::SWGSDRangel::setValue(&elevation, pJson["elevation"], "float", "");
::SWGSDRangel::setValue(&ra, pJson["ra"], "float", "");
::SWGSDRangel::setValue(&dec, pJson["dec"], "float", "");
::SWGSDRangel::setValue(&b, pJson["b"], "float", "");
::SWGSDRangel::setValue(&l, pJson["l"], "float", "");
::SWGSDRangel::setValue(&earth_rotation_velocity, pJson["earthRotationVelocity"], "float", "");
::SWGSDRangel::setValue(&earth_orbit_velocity_bcrs, pJson["earthOrbitVelocityBCRS"], "float", "");
::SWGSDRangel::setValue(&sun_velocity_lsr, pJson["sunVelocityLSR"], "float", "");
::SWGSDRangel::setValue(&solar_flux, pJson["solarFlux"], "float", "");
::SWGSDRangel::setValue(&air_temperature, pJson["airTemperature"], "float", "");
::SWGSDRangel::setValue(&sky_temperature, pJson["skyTemperature"], "float", "");
::SWGSDRangel::setValue(&hpbw, pJson["hpbw"], "float", "");
}
QString
SWGStarTrackerTarget_2::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes);
}
QJsonObject*
SWGStarTrackerTarget_2::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(name != nullptr && *name != QString("")){
toJsonValue(QString("name"), name, obj, QString("QString"));
}
if(m_azimuth_isSet){
obj->insert("azimuth", QJsonValue(azimuth));
}
if(m_elevation_isSet){
obj->insert("elevation", QJsonValue(elevation));
}
if(m_ra_isSet){
obj->insert("ra", QJsonValue(ra));
}
if(m_dec_isSet){
obj->insert("dec", QJsonValue(dec));
}
if(m_b_isSet){
obj->insert("b", QJsonValue(b));
}
if(m_l_isSet){
obj->insert("l", QJsonValue(l));
}
if(m_earth_rotation_velocity_isSet){
obj->insert("earthRotationVelocity", QJsonValue(earth_rotation_velocity));
}
if(m_earth_orbit_velocity_bcrs_isSet){
obj->insert("earthOrbitVelocityBCRS", QJsonValue(earth_orbit_velocity_bcrs));
}
if(m_sun_velocity_lsr_isSet){
obj->insert("sunVelocityLSR", QJsonValue(sun_velocity_lsr));
}
if(m_solar_flux_isSet){
obj->insert("solarFlux", QJsonValue(solar_flux));
}
if(m_air_temperature_isSet){
obj->insert("airTemperature", QJsonValue(air_temperature));
}
if(m_sky_temperature_isSet){
obj->insert("skyTemperature", QJsonValue(sky_temperature));
}
if(m_hpbw_isSet){
obj->insert("hpbw", QJsonValue(hpbw));
}
return obj;
}
QString*
SWGStarTrackerTarget_2::getName() {
return name;
}
void
SWGStarTrackerTarget_2::setName(QString* name) {
this->name = name;
this->m_name_isSet = true;
}
float
SWGStarTrackerTarget_2::getAzimuth() {
return azimuth;
}
void
SWGStarTrackerTarget_2::setAzimuth(float azimuth) {
this->azimuth = azimuth;
this->m_azimuth_isSet = true;
}
float
SWGStarTrackerTarget_2::getElevation() {
return elevation;
}
void
SWGStarTrackerTarget_2::setElevation(float elevation) {
this->elevation = elevation;
this->m_elevation_isSet = true;
}
float
SWGStarTrackerTarget_2::getRa() {
return ra;
}
void
SWGStarTrackerTarget_2::setRa(float ra) {
this->ra = ra;
this->m_ra_isSet = true;
}
float
SWGStarTrackerTarget_2::getDec() {
return dec;
}
void
SWGStarTrackerTarget_2::setDec(float dec) {
this->dec = dec;
this->m_dec_isSet = true;
}
float
SWGStarTrackerTarget_2::getB() {
return b;
}
void
SWGStarTrackerTarget_2::setB(float b) {
this->b = b;
this->m_b_isSet = true;
}
float
SWGStarTrackerTarget_2::getL() {
return l;
}
void
SWGStarTrackerTarget_2::setL(float l) {
this->l = l;
this->m_l_isSet = true;
}
float
SWGStarTrackerTarget_2::getEarthRotationVelocity() {
return earth_rotation_velocity;
}
void
SWGStarTrackerTarget_2::setEarthRotationVelocity(float earth_rotation_velocity) {
this->earth_rotation_velocity = earth_rotation_velocity;
this->m_earth_rotation_velocity_isSet = true;
}
float
SWGStarTrackerTarget_2::getEarthOrbitVelocityBcrs() {
return earth_orbit_velocity_bcrs;
}
void
SWGStarTrackerTarget_2::setEarthOrbitVelocityBcrs(float earth_orbit_velocity_bcrs) {
this->earth_orbit_velocity_bcrs = earth_orbit_velocity_bcrs;
this->m_earth_orbit_velocity_bcrs_isSet = true;
}
float
SWGStarTrackerTarget_2::getSunVelocityLsr() {
return sun_velocity_lsr;
}
void
SWGStarTrackerTarget_2::setSunVelocityLsr(float sun_velocity_lsr) {
this->sun_velocity_lsr = sun_velocity_lsr;
this->m_sun_velocity_lsr_isSet = true;
}
float
SWGStarTrackerTarget_2::getSolarFlux() {
return solar_flux;
}
void
SWGStarTrackerTarget_2::setSolarFlux(float solar_flux) {
this->solar_flux = solar_flux;
this->m_solar_flux_isSet = true;
}
float
SWGStarTrackerTarget_2::getAirTemperature() {
return air_temperature;
}
void
SWGStarTrackerTarget_2::setAirTemperature(float air_temperature) {
this->air_temperature = air_temperature;
this->m_air_temperature_isSet = true;
}
float
SWGStarTrackerTarget_2::getSkyTemperature() {
return sky_temperature;
}
void
SWGStarTrackerTarget_2::setSkyTemperature(float sky_temperature) {
this->sky_temperature = sky_temperature;
this->m_sky_temperature_isSet = true;
}
float
SWGStarTrackerTarget_2::getHpbw() {
return hpbw;
}
void
SWGStarTrackerTarget_2::setHpbw(float hpbw) {
this->hpbw = hpbw;
this->m_hpbw_isSet = true;
}
bool
SWGStarTrackerTarget_2::isSet(){
bool isObjectUpdated = false;
do{
if(name && *name != QString("")){
isObjectUpdated = true; break;
}
if(m_azimuth_isSet){
isObjectUpdated = true; break;
}
if(m_elevation_isSet){
isObjectUpdated = true; break;
}
if(m_ra_isSet){
isObjectUpdated = true; break;
}
if(m_dec_isSet){
isObjectUpdated = true; break;
}
if(m_b_isSet){
isObjectUpdated = true; break;
}
if(m_l_isSet){
isObjectUpdated = true; break;
}
if(m_earth_rotation_velocity_isSet){
isObjectUpdated = true; break;
}
if(m_earth_orbit_velocity_bcrs_isSet){
isObjectUpdated = true; break;
}
if(m_sun_velocity_lsr_isSet){
isObjectUpdated = true; break;
}
if(m_solar_flux_isSet){
isObjectUpdated = true; break;
}
if(m_air_temperature_isSet){
isObjectUpdated = true; break;
}
if(m_sky_temperature_isSet){
isObjectUpdated = true; break;
}
if(m_hpbw_isSet){
isObjectUpdated = true; break;
}
}while(false);
return isObjectUpdated;
}
}

View File

@ -0,0 +1,137 @@
/**
* SDRangel
* This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time ---
*
* OpenAPI spec version: 6.0.0
* Contact: f4exb06@gmail.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
/*
* SWGStarTrackerTarget_2.h
*
* Star Tracker target. Sent to startracker.target message queue for other plugins to use.
*/
#ifndef SWGStarTrackerTarget_2_H_
#define SWGStarTrackerTarget_2_H_
#include <QJsonObject>
#include <QString>
#include "SWGObject.h"
#include "export.h"
namespace SWGSDRangel {
class SWG_API SWGStarTrackerTarget_2: public SWGObject {
public:
SWGStarTrackerTarget_2();
SWGStarTrackerTarget_2(QString* json);
virtual ~SWGStarTrackerTarget_2();
void init();
void cleanup();
virtual QString asJson () override;
virtual QJsonObject* asJsonObject() override;
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGStarTrackerTarget_2* fromJson(QString &jsonString) override;
QString* getName();
void setName(QString* name);
float getAzimuth();
void setAzimuth(float azimuth);
float getElevation();
void setElevation(float elevation);
float getRa();
void setRa(float ra);
float getDec();
void setDec(float dec);
float getB();
void setB(float b);
float getL();
void setL(float l);
float getEarthRotationVelocity();
void setEarthRotationVelocity(float earth_rotation_velocity);
float getEarthOrbitVelocityBcrs();
void setEarthOrbitVelocityBcrs(float earth_orbit_velocity_bcrs);
float getSunVelocityLsr();
void setSunVelocityLsr(float sun_velocity_lsr);
float getSolarFlux();
void setSolarFlux(float solar_flux);
float getAirTemperature();
void setAirTemperature(float air_temperature);
float getSkyTemperature();
void setSkyTemperature(float sky_temperature);
float getHpbw();
void setHpbw(float hpbw);
virtual bool isSet() override;
private:
QString* name;
bool m_name_isSet;
float azimuth;
bool m_azimuth_isSet;
float elevation;
bool m_elevation_isSet;
float ra;
bool m_ra_isSet;
float dec;
bool m_dec_isSet;
float b;
bool m_b_isSet;
float l;
bool m_l_isSet;
float earth_rotation_velocity;
bool m_earth_rotation_velocity_isSet;
float earth_orbit_velocity_bcrs;
bool m_earth_orbit_velocity_bcrs_isSet;
float sun_velocity_lsr;
bool m_sun_velocity_lsr_isSet;
float solar_flux;
bool m_solar_flux_isSet;
float air_temperature;
bool m_air_temperature_isSet;
float sky_temperature;
bool m_sky_temperature_isSet;
float hpbw;
bool m_hpbw_isSet;
};
}
#endif /* SWGStarTrackerTarget_2_H_ */