1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-16 05:11:49 -05:00

Merge pull request #1778 from dforsi/feature/map

Feature/map
This commit is contained in:
Edouard Griffiths 2023-08-27 12:22:48 +02:00 committed by GitHub
commit 71d41b1420
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 64 additions and 22 deletions

View File

@ -19,24 +19,24 @@
// Beacon information from https://www.ncdxf.org/beacon/beaconlocations.html // Beacon information from https://www.ncdxf.org/beacon/beaconlocations.html
QList<IBPBeacon> IBPBeacon::m_beacons = { QList<IBPBeacon> IBPBeacon::m_beacons = {
IBPBeacon("4U1UN", "United Nations NY", "FN30AS", 0), IBPBeacon("United Nations", "4U1UN", "New York City", "FN30AS", 0),
IBPBeacon("VE8AT", "North Canada", "CP38GH", 10), IBPBeacon("Canada", "VE8AT", "Inuvik (NT)", "CP38GH", 10),
IBPBeacon("W6WX", "USA (CA)", "CM97BD", 20), IBPBeacon("United States", "W6WX", "Mt. Umunhum (CA)", "CM97BD", 20),
IBPBeacon("KH6RS", "Hawaii", "BL10TS", 30), IBPBeacon("Hawaii", "KH6RS", "Maui ", "BL10TS", 30),
IBPBeacon("ZL6B", "New Zealand", "RE78TW", 40), IBPBeacon("New Zealand", "ZL6B", "Masterton", "RE78TW", 40),
IBPBeacon("VK6RBP", "West Australia", "OF87AV", 50), IBPBeacon("Australia", "VK6RBP", "Rolystone (WA)", "OF87AV", 50),
IBPBeacon("JA2IGY", "Japan", "PM84JK", 60), IBPBeacon("Japan", "JA2IGY", "Mt. Asama", "PM84JK", 60),
IBPBeacon("RR9O", "Siberia", "NO14KX", 70), IBPBeacon("Russia", "RR9O", "Novosibirsk", "NO14KX", 70),
IBPBeacon("VR2B", "China", "OL72BG", 80), IBPBeacon("Hong Kong", "VR2B", "Hong Kong", "OL72BG", 80),
IBPBeacon("4S7B", "Sri Lanka", "MJ96WV", 90), IBPBeacon("Sri Lanka", "4S7B", "Colombo", "MJ96WV", 90),
IBPBeacon("ZS6DN", "South Africa", "KG33XI", 100), IBPBeacon("South Africa", "ZS6DN", "Pretoria", "KG33XI", 100),
IBPBeacon("5Z4B", "Kenya", "KI88HR", 110), IBPBeacon("Kenya", "5Z4B", "Kikuyu", "KI88HR", 110),
IBPBeacon("4X6TU", "Israel", "KM72JB", 120), IBPBeacon("Israel", "4X6TU", "Tel Aviv", "KM72JB", 120),
IBPBeacon("OH2B", "Finland", "KP20EH", 130), IBPBeacon("Finland", "OH2B", "Lohja", "KP20EH", 130),
IBPBeacon("CS3B", "Madeira", "IM12JT", 140), IBPBeacon("Madeira", "CS3B", "São Jorge", "IM12JT", 140),
IBPBeacon("LU4AA", "Argentina", "GF05TJ", 150), IBPBeacon("Argentina", "LU4AA", "Buenos Aires", "GF05TJ", 150),
IBPBeacon("OA4B", "Peru", "FH17MW", 160), IBPBeacon("Peru", "OA4B", "Lima", "FH17MW", 160),
IBPBeacon("YV5B", "Venezuela", "FJ69CC", 170) IBPBeacon("Venezuela", "YV5B", "Caracas", "FJ69CC", 170)
}; };
// The frequencies in MHz through which the IBP beacons rotate // The frequencies in MHz through which the IBP beacons rotate

View File

@ -28,6 +28,7 @@
struct IBPBeacon { struct IBPBeacon {
QString m_dxEntity;
QString m_callsign; QString m_callsign;
QString m_location; QString m_location;
QString m_locator; QString m_locator;
@ -35,7 +36,8 @@ struct IBPBeacon {
float m_latitude; float m_latitude;
float m_longitude; float m_longitude;
IBPBeacon(const QString& callsign, const QString& location, const QString& locator, int offset) : IBPBeacon(const QString& dxEntity, const QString& callsign, const QString& location, const QString& locator, int offset) :
m_dxEntity(dxEntity),
m_callsign(callsign), m_callsign(callsign),
m_location(location), m_location(location),
m_locator(locator), m_locator(locator),
@ -48,6 +50,7 @@ struct IBPBeacon {
{ {
QStringList list; QStringList list;
list.append("IBP Beacon"); list.append("IBP Beacon");
list.append(QString("DX Entity: %1").arg(m_dxEntity));
list.append(QString("Callsign: %1").arg(m_callsign)); list.append(QString("Callsign: %1").arg(m_callsign));
list.append(QString("Frequency: 14.1, 18.11, 21.15, 24.93, 28.2 MHz")); list.append(QString("Frequency: 14.1, 18.11, 21.15, 24.93, 28.2 MHz"));
list.append(QString("Power: 100 Watts ERP")); list.append(QString("Power: 100 Watts ERP"));

View File

@ -57,8 +57,10 @@ void MapBeaconDialog::updateTable()
freq->setText(beacon->getFrequencyText()); freq->setText(beacon->getFrequencyText());
freq->setData(Qt::UserRole, beacon->m_frequency); freq->setData(Qt::UserRole, beacon->m_frequency);
ui->beacons->setItem(row, BEACON_COL_FREQUENCY, freq); ui->beacons->setItem(row, BEACON_COL_FREQUENCY, freq);
ui->beacons->item(row, BEACON_COL_FREQUENCY)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
ui->beacons->setItem(row, BEACON_COL_LOCATION, new QTableWidgetItem(beacon->m_locator)); ui->beacons->setItem(row, BEACON_COL_LOCATION, new QTableWidgetItem(beacon->m_locator));
ui->beacons->setItem(row, BEACON_COL_POWER, new QTableWidgetItem(beacon->m_power)); ui->beacons->setItem(row, BEACON_COL_POWER, new QTableWidgetItem(beacon->m_power));
ui->beacons->item(row, BEACON_COL_POWER)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
ui->beacons->setItem(row, BEACON_COL_POLARIZATION, new QTableWidgetItem(beacon->m_polarization)); ui->beacons->setItem(row, BEACON_COL_POLARIZATION, new QTableWidgetItem(beacon->m_polarization));
ui->beacons->setItem(row, BEACON_COL_PATTERN, new QTableWidgetItem(beacon->m_pattern)); ui->beacons->setItem(row, BEACON_COL_PATTERN, new QTableWidgetItem(beacon->m_pattern));
ui->beacons->setItem(row, BEACON_COL_KEY, new QTableWidgetItem(beacon->m_key)); ui->beacons->setItem(row, BEACON_COL_KEY, new QTableWidgetItem(beacon->m_key));
@ -66,11 +68,14 @@ void MapBeaconDialog::updateTable()
azEl.setTarget(beacon->m_latitude, beacon->m_longitude, beacon->m_altitude); azEl.setTarget(beacon->m_latitude, beacon->m_longitude, beacon->m_altitude);
azEl.calculate(); azEl.calculate();
ui->beacons->setItem(row, BEACON_COL_AZIMUTH, new QTableWidgetItem(QString("%1").arg(round(azEl.getAzimuth())))); ui->beacons->setItem(row, BEACON_COL_AZIMUTH, new QTableWidgetItem(QString("%1").arg(round(azEl.getAzimuth()))));
ui->beacons->item(row, BEACON_COL_AZIMUTH)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
ui->beacons->setItem(row, BEACON_COL_ELEVATION, new QTableWidgetItem(QString("%1").arg(round(azEl.getElevation())))); ui->beacons->setItem(row, BEACON_COL_ELEVATION, new QTableWidgetItem(QString("%1").arg(round(azEl.getElevation()))));
ui->beacons->item(row, BEACON_COL_ELEVATION)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
int km = round(azEl.getDistance()/1000); int km = round(azEl.getDistance()/1000);
QTableWidgetItem *dist = new QTableWidgetItem(); QTableWidgetItem *dist = new QTableWidgetItem();
dist->setData(Qt::DisplayRole, km); dist->setData(Qt::DisplayRole, km);
ui->beacons->setItem(row, BEACON_COL_DISTANCE, dist); ui->beacons->setItem(row, BEACON_COL_DISTANCE, dist);
ui->beacons->item(row, BEACON_COL_DISTANCE)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
row++; row++;
} }
} }

View File

@ -156,12 +156,12 @@
</column> </column>
<column> <column>
<property name="text"> <property name="text">
<string>Azimuth</string> <string>Azimuth (°)</string>
</property> </property>
</column> </column>
<column> <column>
<property name="text"> <property name="text">
<string>Elevation</string> <string>Elevation (°)</string>
</property> </property>
</column> </column>
<column> <column>

View File

@ -38,9 +38,11 @@ MapIBPBeaconDialog::MapIBPBeaconDialog(MapGUI *gui, QWidget* parent) :
ui->beacons->setItem(row, IBP_BEACON_COL_FREQUENCY, new QTableWidgetItem(QString::number(IBPBeacon::m_frequencies[row], 'f', 3))); ui->beacons->setItem(row, IBP_BEACON_COL_FREQUENCY, new QTableWidgetItem(QString::number(IBPBeacon::m_frequencies[row], 'f', 3)));
ui->beacons->setItem(row, IBP_BEACON_COL_CALLSIGN, new QTableWidgetItem("")); ui->beacons->setItem(row, IBP_BEACON_COL_CALLSIGN, new QTableWidgetItem(""));
ui->beacons->setItem(row, IBP_BEACON_COL_LOCATION, new QTableWidgetItem("")); ui->beacons->setItem(row, IBP_BEACON_COL_LOCATION, new QTableWidgetItem(""));
ui->beacons->setItem(row, IBP_BEACON_COL_DX_ENTITY, new QTableWidgetItem(""));
ui->beacons->setItem(row, IBP_BEACON_COL_AZIMUTH, new QTableWidgetItem("")); ui->beacons->setItem(row, IBP_BEACON_COL_AZIMUTH, new QTableWidgetItem(""));
ui->beacons->setItem(row, IBP_BEACON_COL_DISTANCE, new QTableWidgetItem("")); ui->beacons->setItem(row, IBP_BEACON_COL_DISTANCE, new QTableWidgetItem(""));
} }
resizeTable();
updateTable(QTime::currentTime()); updateTable(QTime::currentTime());
} }
@ -49,6 +51,21 @@ MapIBPBeaconDialog::~MapIBPBeaconDialog()
delete ui; delete ui;
} }
// Fill table with a row of dummy data that will size the columns nicely
void MapIBPBeaconDialog::resizeTable(void)
{
int row = ui->beacons->rowCount();
ui->beacons->setRowCount(row + 1);
ui->beacons->setItem(row, IBP_BEACON_COL_FREQUENCY, new QTableWidgetItem("12.345"));
ui->beacons->setItem(row, IBP_BEACON_COL_CALLSIGN, new QTableWidgetItem("12345"));
ui->beacons->setItem(row, IBP_BEACON_COL_LOCATION, new QTableWidgetItem("1234567890123456"));
ui->beacons->setItem(row, IBP_BEACON_COL_DX_ENTITY, new QTableWidgetItem("1234567890123456"));
ui->beacons->setItem(row, IBP_BEACON_COL_AZIMUTH, new QTableWidgetItem("-123"));
ui->beacons->setItem(row, IBP_BEACON_COL_DISTANCE, new QTableWidgetItem("12345"));
ui->beacons->resizeColumnsToContents();
ui->beacons->removeRow(row);
}
void MapIBPBeaconDialog::updateTable(QTime time) void MapIBPBeaconDialog::updateTable(QTime time)
{ {
AzEl azEl = *m_gui->getAzEl(); AzEl azEl = *m_gui->getAzEl();
@ -58,15 +75,19 @@ void MapIBPBeaconDialog::updateTable(QTime time)
for (int row = 0; row < IBPBeacon::m_frequencies.size(); row++) for (int row = 0; row < IBPBeacon::m_frequencies.size(); row++)
{ {
ui->beacons->item(row, IBP_BEACON_COL_FREQUENCY)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
ui->beacons->item(row, IBP_BEACON_COL_CALLSIGN)->setText(IBPBeacon::m_beacons[index].m_callsign); ui->beacons->item(row, IBP_BEACON_COL_CALLSIGN)->setText(IBPBeacon::m_beacons[index].m_callsign);
ui->beacons->item(row, IBP_BEACON_COL_LOCATION)->setText(IBPBeacon::m_beacons[index].m_location); ui->beacons->item(row, IBP_BEACON_COL_LOCATION)->setText(IBPBeacon::m_beacons[index].m_location);
ui->beacons->item(row, IBP_BEACON_COL_DX_ENTITY)->setText(IBPBeacon::m_beacons[index].m_dxEntity);
// Calculate azimuth and distance to beacon // Calculate azimuth and distance to beacon
azEl.setTarget(IBPBeacon::m_beacons[index].m_latitude, IBPBeacon::m_beacons[index].m_longitude, 0.0); azEl.setTarget(IBPBeacon::m_beacons[index].m_latitude, IBPBeacon::m_beacons[index].m_longitude, 0.0);
azEl.calculate(); azEl.calculate();
ui->beacons->item(row, IBP_BEACON_COL_AZIMUTH)->setData(Qt::DisplayRole, round(azEl.getAzimuth())); ui->beacons->item(row, IBP_BEACON_COL_AZIMUTH)->setData(Qt::DisplayRole, round(azEl.getAzimuth()));
ui->beacons->item(row, IBP_BEACON_COL_AZIMUTH)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
int km = round(azEl.getDistance()/1000); int km = round(azEl.getDistance()/1000);
ui->beacons->item(row, IBP_BEACON_COL_DISTANCE)->setData(Qt::DisplayRole, km); ui->beacons->item(row, IBP_BEACON_COL_DISTANCE)->setData(Qt::DisplayRole, km);
ui->beacons->item(row, IBP_BEACON_COL_DISTANCE)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
index--; index--;
if (index < 0) { if (index < 0) {

View File

@ -45,10 +45,13 @@ private:
QTimer m_timer; QTimer m_timer;
Ui::MapIBPBeaconDialog* ui; Ui::MapIBPBeaconDialog* ui;
void resizeTable(void);
enum BeaconCol { enum BeaconCol {
IBP_BEACON_COL_FREQUENCY, IBP_BEACON_COL_FREQUENCY,
IBP_BEACON_COL_CALLSIGN, IBP_BEACON_COL_CALLSIGN,
IBP_BEACON_COL_LOCATION, IBP_BEACON_COL_LOCATION,
IBP_BEACON_COL_DX_ENTITY,
IBP_BEACON_COL_AZIMUTH, IBP_BEACON_COL_AZIMUTH,
IBP_BEACON_COL_DISTANCE IBP_BEACON_COL_DISTANCE
}; };

View File

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>584</width> <width>590</width>
<height>311</height> <height>311</height>
</rect> </rect>
</property> </property>
@ -89,6 +89,11 @@
<string>Location</string> <string>Location</string>
</property> </property>
</column> </column>
<column>
<property name="text">
<string>DX Entity</string>
</property>
</column>
<column> <column>
<property name="text"> <property name="text">
<string>Azimuth (°)</string> <string>Azimuth (°)</string>

View File

@ -52,16 +52,21 @@ void MapRadioTimeDialog::updateTable()
freq->setText(QString("%1").arg(transmitters[i].m_frequency/1000.0)); freq->setText(QString("%1").arg(transmitters[i].m_frequency/1000.0));
freq->setData(Qt::UserRole, transmitters[i].m_frequency); freq->setData(Qt::UserRole, transmitters[i].m_frequency);
ui->transmitters->setItem(row, TRANSMITTER_COL_FREQUENCY, freq); ui->transmitters->setItem(row, TRANSMITTER_COL_FREQUENCY, freq);
ui->transmitters->item(row, TRANSMITTER_COL_FREQUENCY)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
ui->transmitters->setItem(row, TRANSMITTER_COL_LOCATION, new QTableWidgetItem(QString("%1,%2").arg(transmitters[i].m_latitude).arg(transmitters[i].m_longitude))); ui->transmitters->setItem(row, TRANSMITTER_COL_LOCATION, new QTableWidgetItem(QString("%1,%2").arg(transmitters[i].m_latitude).arg(transmitters[i].m_longitude)));
ui->transmitters->setItem(row, TRANSMITTER_COL_POWER, new QTableWidgetItem(QString("%1").arg(transmitters[i].m_power))); ui->transmitters->setItem(row, TRANSMITTER_COL_POWER, new QTableWidgetItem(QString("%1").arg(transmitters[i].m_power)));
ui->transmitters->item(row, TRANSMITTER_COL_POWER)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
azEl.setTarget(transmitters[i].m_latitude, transmitters[i].m_longitude, 1.0); azEl.setTarget(transmitters[i].m_latitude, transmitters[i].m_longitude, 1.0);
azEl.calculate(); azEl.calculate();
ui->transmitters->setItem(row, TRANSMITTER_COL_AZIMUTH, new QTableWidgetItem(QString("%1").arg(round(azEl.getAzimuth())))); ui->transmitters->setItem(row, TRANSMITTER_COL_AZIMUTH, new QTableWidgetItem(QString("%1").arg(round(azEl.getAzimuth()))));
ui->transmitters->item(row, TRANSMITTER_COL_AZIMUTH)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
ui->transmitters->setItem(row, TRANSMITTER_COL_ELEVATION, new QTableWidgetItem(QString("%1").arg(round(azEl.getElevation())))); ui->transmitters->setItem(row, TRANSMITTER_COL_ELEVATION, new QTableWidgetItem(QString("%1").arg(round(azEl.getElevation()))));
ui->transmitters->item(row, TRANSMITTER_COL_ELEVATION)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
int km = round(azEl.getDistance()/1000); int km = round(azEl.getDistance()/1000);
QTableWidgetItem *dist = new QTableWidgetItem(); QTableWidgetItem *dist = new QTableWidgetItem();
dist->setData(Qt::DisplayRole, km); dist->setData(Qt::DisplayRole, km);
ui->transmitters->setItem(row, TRANSMITTER_COL_DISTANCE, dist); ui->transmitters->setItem(row, TRANSMITTER_COL_DISTANCE, dist);
ui->transmitters->item(row, TRANSMITTER_COL_DISTANCE)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
row++; row++;
} }
ui->transmitters->setSortingEnabled(true); ui->transmitters->setSortingEnabled(true);