1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-23 00:18:37 -05:00

ADS-B: Add aircraft min zoom setting. Default to only displaying CTR airspace.

This commit is contained in:
Jon Beniston 2023-02-16 12:20:31 +00:00
parent 63cba7e7d8
commit f807b45df3
6 changed files with 39 additions and 7 deletions

View File

@ -29,6 +29,7 @@ ADSBDemodDisplayDialog::ADSBDemodDisplayDialog(ADSBDemodSettings *settings, QWid
{ {
ui->setupUi(this); ui->setupUi(this);
ui->timeout->setValue(settings->m_removeTimeout); ui->timeout->setValue(settings->m_removeTimeout);
ui->aircraftMinZoom->setValue(settings->m_aircraftMinZoom);
ui->airportRange->setValue(settings->m_airportRange); ui->airportRange->setValue(settings->m_airportRange);
ui->airportSize->setCurrentIndex((int)settings->m_airportMinimumSize); ui->airportSize->setCurrentIndex((int)settings->m_airportMinimumSize);
ui->heliports->setChecked(settings->m_displayHeliports); ui->heliports->setChecked(settings->m_displayHeliports);
@ -61,6 +62,7 @@ ADSBDemodDisplayDialog::~ADSBDemodDisplayDialog()
void ADSBDemodDisplayDialog::accept() void ADSBDemodDisplayDialog::accept()
{ {
m_settings->m_removeTimeout = ui->timeout->value(); m_settings->m_removeTimeout = ui->timeout->value();
m_settings->m_aircraftMinZoom = ui->aircraftMinZoom->value();
m_settings->m_airportRange = ui->airportRange->value(); m_settings->m_airportRange = ui->airportRange->value();
m_settings->m_airportMinimumSize = (ADSBDemodSettings::AirportType)ui->airportSize->currentIndex(); m_settings->m_airportMinimumSize = (ADSBDemodSettings::AirportType)ui->airportSize->currentIndex();
m_settings->m_displayHeliports = ui->heliports->isChecked(); m_settings->m_displayHeliports = ui->heliports->isChecked();

View File

@ -524,6 +524,23 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0">
<widget class="QLabel" name="aircraftMinZoomLabel">
<property name="text">
<string>Scale aircraft minimum zoom level</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="aircraftMinZoom">
<property name="toolTip">
<string>When map zoom (0 min zoom - 15 max zoom) is higher than this value, aircraft icon size will be scaled</string>
</property>
<property name="maximum">
<number>15</number>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View File

@ -609,7 +609,9 @@ QVariant AirspaceModel::data(const QModelIndex &index, int role) const
} }
else if (role == AirspaceModel::airspaceBorderColorRole) else if (role == AirspaceModel::airspaceBorderColorRole)
{ {
if (m_airspaces[row]->m_category == "D") { if ((m_airspaces[row]->m_category == "D")
|| (m_airspaces[row]->m_category == "G")
|| (m_airspaces[row]->m_category == "CTR")) {
return QVariant::fromValue(QColor(0x00, 0x00, 0xff, 0x00)); return QVariant::fromValue(QColor(0x00, 0x00, 0xff, 0x00));
} else { } else {
return QVariant::fromValue(QColor(0xff, 0x00, 0x00, 0x00)); return QVariant::fromValue(QColor(0xff, 0x00, 0x00, 0x00));
@ -617,7 +619,9 @@ QVariant AirspaceModel::data(const QModelIndex &index, int role) const
} }
else if (role == AirspaceModel::airspaceFillColorRole) else if (role == AirspaceModel::airspaceFillColorRole)
{ {
if (m_airspaces[row]->m_category == "D") { if ((m_airspaces[row]->m_category == "D")
|| (m_airspaces[row]->m_category == "G")
|| (m_airspaces[row]->m_category == "CTR")) {
return QVariant::fromValue(QColor(0x00, 0x00, 0xff, 0x10)); return QVariant::fromValue(QColor(0x00, 0x00, 0xff, 0x10));
} else { } else {
return QVariant::fromValue(QColor(0xff, 0x00, 0x00, 0x10)); return QVariant::fromValue(QColor(0xff, 0x00, 0x00, 0x10));
@ -4215,7 +4219,7 @@ void ADSBDemodGUI::updateAirports()
if (airportInfo->m_type >= m_settings.m_airportMinimumSize) if (airportInfo->m_type >= m_settings.m_airportMinimumSize)
{ {
// Only display heliports if enabled // Only display heliports if enabled
if (m_settings.m_displayHeliports || (airportInfo->m_type != ADSBDemodSettings::AirportType::Heliport)) if (m_settings.m_displayHeliports || (airportInfo->m_type != AirportInformation::AirportType::Heliport))
{ {
m_airportModel.addAirport(airportInfo, azEl.getAzimuth(), azEl.getElevation(), azEl.getDistance()); m_airportModel.addAirport(airportInfo, azEl.getAzimuth(), azEl.getElevation(), azEl.getDistance());
} }
@ -4493,6 +4497,7 @@ void ADSBDemodGUI::applyMapSettings()
// Create the map using the specified provider // Create the map using the specified provider
QQmlProperty::write(item, "smoothing", MainCore::instance()->getSettings().getMapSmoothing()); QQmlProperty::write(item, "smoothing", MainCore::instance()->getSettings().getMapSmoothing());
QQmlProperty::write(item, "aircraftMinZoomLevel", m_settings.m_aircraftMinZoom);
QQmlProperty::write(item, "mapProvider", m_settings.m_mapProvider); QQmlProperty::write(item, "mapProvider", m_settings.m_mapProvider);
QVariantMap parameters; QVariantMap parameters;
QString mapType; QString mapType;

View File

@ -90,7 +90,7 @@ void ADSBDemodSettings::resetToDefaults()
} }
m_logFilename = "adsb_log.csv"; m_logFilename = "adsb_log.csv";
m_logEnabled = false; m_logEnabled = false;
m_airspaces = QStringList({"A", "D", "TMZ"}); m_airspaces = QStringList({"CTR"});
m_airspaceRange = 500.0f; m_airspaceRange = 500.0f;
#ifdef LINUX #ifdef LINUX
m_mapProvider = "mapboxgl"; // osm maps do not work in some versions of Linux https://github.com/f4exb/sdrangel/issues/1169 & 1369 m_mapProvider = "mapboxgl"; // osm maps do not work in some versions of Linux https://github.com/f4exb/sdrangel/issues/1169 & 1369
@ -102,6 +102,7 @@ void ADSBDemodSettings::resetToDefaults()
m_displayPhotos = true; m_displayPhotos = true;
m_verboseModelMatching = false; m_verboseModelMatching = false;
m_airfieldElevation = 0; m_airfieldElevation = 0;
m_aircraftMinZoom = 11;
m_workspaceIndex = 0; m_workspaceIndex = 0;
m_hidden = false; m_hidden = false;
} }
@ -185,6 +186,7 @@ QByteArray ADSBDemodSettings::serialize() const
s.writeBool(61, m_hidden); s.writeBool(61, m_hidden);
s.writeString(62, m_checkWXAPIKey); s.writeString(62, m_checkWXAPIKey);
s.writeString(63, m_mapProvider); s.writeString(63, m_mapProvider);
s.writeS32(64, m_aircraftMinZoom);
for (int i = 0; i < ADSBDEMOD_COLUMNS; i++) { for (int i = 0; i < ADSBDEMOD_COLUMNS; i++) {
s.writeS32(100 + i, m_columnIndexes[i]); s.writeS32(100 + i, m_columnIndexes[i]);
@ -277,7 +279,7 @@ bool ADSBDemodSettings::deserialize(const QByteArray& data)
d.readString(36, &m_logFilename, "adsb_log.csv"); d.readString(36, &m_logFilename, "adsb_log.csv");
d.readBool(37, &m_logEnabled, false); d.readBool(37, &m_logEnabled, false);
d.readString(38, &string, "A D TMZ"); d.readString(38, &string, "CTR");
m_airspaces = string.split(" "); m_airspaces = string.split(" ");
d.readFloat(39, &m_airspaceRange, 500.0f); d.readFloat(39, &m_airspaceRange, 500.0f);
d.readS32(40, (int *)&m_mapType, (int)AVIATION_LIGHT); d.readS32(40, (int *)&m_mapType, (int)AVIATION_LIGHT);
@ -316,6 +318,7 @@ bool ADSBDemodSettings::deserialize(const QByteArray& data)
d.readBool(61, &m_hidden, false); d.readBool(61, &m_hidden, false);
d.readString(62, &m_checkWXAPIKey, ""); d.readString(62, &m_checkWXAPIKey, "");
d.readString(63, &m_mapProvider, "osm"); d.readString(63, &m_mapProvider, "osm");
d.readS32(64, &m_aircraftMinZoom, 11);
#ifdef LINUX #ifdef LINUX
if (m_mapProvider == "osm") { if (m_mapProvider == "osm") {
m_mapProvider = "mapboxgl"; m_mapProvider = "mapboxgl";

View File

@ -186,6 +186,7 @@ struct ADSBDemodSettings
Serializable *m_rollupState; Serializable *m_rollupState;
bool m_verboseModelMatching; bool m_verboseModelMatching;
int m_airfieldElevation; //!< QFE in ft so aircraft takeoff/land from correct position int m_airfieldElevation; //!< QFE in ft so aircraft takeoff/land from correct position
int m_aircraftMinZoom;
ADSBDemodSettings(); ADSBDemodSettings();
void resetToDefaults(); void resetToDefaults();

View File

@ -8,6 +8,7 @@ import QtGraphicalEffects 1.12
Item { Item {
id: qmlMap id: qmlMap
property int aircraftZoomLevel: 11 property int aircraftZoomLevel: 11
property int aircraftMinZoomLevel: 11
property int airportZoomLevel: 11 property int airportZoomLevel: 11
property string mapProvider: "osm" property string mapProvider: "osm"
property variant mapPtr property variant mapPtr
@ -104,13 +105,16 @@ Item {
} }
onZoomLevelChanged: { onZoomLevelChanged: {
if (zoomLevel > aircraftMinZoomLevel) {
aircraftZoomLevel = zoomLevel
} else {
aircraftZoomLevel = aircraftMinZoomLevel
}
if (zoomLevel > 11) { if (zoomLevel > 11) {
station.zoomLevel = zoomLevel station.zoomLevel = zoomLevel
aircraftZoomLevel = zoomLevel
airportZoomLevel = zoomLevel airportZoomLevel = zoomLevel
} else { } else {
station.zoomLevel = 11 station.zoomLevel = 11
aircraftZoomLevel = 11
airportZoomLevel = 11 airportZoomLevel = 11
} }
} }