Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/map #1778

Merged
merged 6 commits into from
Aug 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions plugins/feature/map/ibpbeacon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,24 @@

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

// The frequencies in MHz through which the IBP beacons rotate
Expand Down
5 changes: 4 additions & 1 deletion plugins/feature/map/ibpbeacon.h
srcejon marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@

struct IBPBeacon {

QString m_dxEntity;
QString m_callsign;
QString m_location;
QString m_locator;
int m_offset; // Time offset in seconds
float m_latitude;
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_location(location),
m_locator(locator),
Expand All @@ -48,6 +50,7 @@ struct IBPBeacon {
{
QStringList list;
list.append("IBP Beacon");
list.append(QString("DX Entity: %1").arg(m_dxEntity));
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("Power: 100 Watts ERP"));
Expand Down
5 changes: 5 additions & 0 deletions plugins/feature/map/mapbeacondialog.cpp
srcejon marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,25 @@ void MapBeaconDialog::updateTable()
freq->setText(beacon->getFrequencyText());
freq->setData(Qt::UserRole, beacon->m_frequency);
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_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_PATTERN, new QTableWidgetItem(beacon->m_pattern));
ui->beacons->setItem(row, BEACON_COL_KEY, new QTableWidgetItem(beacon->m_key));
ui->beacons->setItem(row, BEACON_COL_MGM, new QTableWidgetItem(beacon->m_mgm));
azEl.setTarget(beacon->m_latitude, beacon->m_longitude, beacon->m_altitude);
azEl.calculate();
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->item(row, BEACON_COL_ELEVATION)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
int km = round(azEl.getDistance()/1000);
QTableWidgetItem *dist = new QTableWidgetItem();
dist->setData(Qt::DisplayRole, km);
ui->beacons->setItem(row, BEACON_COL_DISTANCE, dist);
ui->beacons->item(row, BEACON_COL_DISTANCE)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
row++;
}
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/feature/map/mapbeacondialog.ui
srcejon marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,12 @@
</column>
<column>
<property name="text">
<string>Azimuth</string>
<string>Azimuth (°)</string>
</property>
</column>
<column>
<property name="text">
<string>Elevation</string>
<string>Elevation (°)</string>
</property>
</column>
<column>
Expand Down
21 changes: 21 additions & 0 deletions plugins/feature/map/mapibpbeacondialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_CALLSIGN, 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_DISTANCE, new QTableWidgetItem(""));
}
resizeTable();
updateTable(QTime::currentTime());
}

Expand All @@ -49,6 +51,21 @@ MapIBPBeaconDialog::~MapIBPBeaconDialog()
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)
{
AzEl azEl = *m_gui->getAzEl();
Expand All @@ -58,15 +75,19 @@ void MapIBPBeaconDialog::updateTable(QTime time)

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_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
azEl.setTarget(IBPBeacon::m_beacons[index].m_latitude, IBPBeacon::m_beacons[index].m_longitude, 0.0);
azEl.calculate();
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);
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--;
if (index < 0) {
Expand Down
3 changes: 3 additions & 0 deletions plugins/feature/map/mapibpbeacondialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,13 @@ private slots:
QTimer m_timer;
Ui::MapIBPBeaconDialog* ui;

void resizeTable(void);

enum BeaconCol {
IBP_BEACON_COL_FREQUENCY,
IBP_BEACON_COL_CALLSIGN,
IBP_BEACON_COL_LOCATION,
IBP_BEACON_COL_DX_ENTITY,
IBP_BEACON_COL_AZIMUTH,
IBP_BEACON_COL_DISTANCE
};
Expand Down
7 changes: 6 additions & 1 deletion plugins/feature/map/mapibpbeacondialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>584</width>
<width>590</width>
<height>311</height>
</rect>
</property>
Expand Down Expand Up @@ -89,6 +89,11 @@
<string>Location</string>
</property>
</column>
<column>
<property name="text">
<string>DX Entity</string>
</property>
</column>
<column>
<property name="text">
<string>Azimuth (°)</string>
Expand Down
5 changes: 5 additions & 0 deletions plugins/feature/map/mapradiotimedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,21 @@ void MapRadioTimeDialog::updateTable()
freq->setText(QString("%1").arg(transmitters[i].m_frequency/1000.0));
freq->setData(Qt::UserRole, transmitters[i].m_frequency);
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_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.calculate();
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->item(row, TRANSMITTER_COL_ELEVATION)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
int km = round(azEl.getDistance()/1000);
QTableWidgetItem *dist = new QTableWidgetItem();
dist->setData(Qt::DisplayRole, km);
ui->transmitters->setItem(row, TRANSMITTER_COL_DISTANCE, dist);
ui->transmitters->item(row, TRANSMITTER_COL_DISTANCE)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
row++;
}
ui->transmitters->setSortingEnabled(true);
Expand Down