1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 09:48:45 -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->timeout->setValue(settings->m_removeTimeout);
ui->aircraftMinZoom->setValue(settings->m_aircraftMinZoom);
ui->airportRange->setValue(settings->m_airportRange);
ui->airportSize->setCurrentIndex((int)settings->m_airportMinimumSize);
ui->heliports->setChecked(settings->m_displayHeliports);
@ -61,6 +62,7 @@ ADSBDemodDisplayDialog::~ADSBDemodDisplayDialog()
void ADSBDemodDisplayDialog::accept()
{
m_settings->m_removeTimeout = ui->timeout->value();
m_settings->m_aircraftMinZoom = ui->aircraftMinZoom->value();
m_settings->m_airportRange = ui->airportRange->value();
m_settings->m_airportMinimumSize = (ADSBDemodSettings::AirportType)ui->airportSize->currentIndex();
m_settings->m_displayHeliports = ui->heliports->isChecked();

View File

@ -524,6 +524,23 @@
</property>
</widget>
</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>
</widget>
</item>

View File

@ -609,7 +609,9 @@ QVariant AirspaceModel::data(const QModelIndex &index, int role) const
}
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));
} else {
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)
{
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));
} else {
return QVariant::fromValue(QColor(0xff, 0x00, 0x00, 0x10));
@ -4215,7 +4219,7 @@ void ADSBDemodGUI::updateAirports()
if (airportInfo->m_type >= m_settings.m_airportMinimumSize)
{
// 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());
}
@ -4493,6 +4497,7 @@ void ADSBDemodGUI::applyMapSettings()
// Create the map using the specified provider
QQmlProperty::write(item, "smoothing", MainCore::instance()->getSettings().getMapSmoothing());
QQmlProperty::write(item, "aircraftMinZoomLevel", m_settings.m_aircraftMinZoom);
QQmlProperty::write(item, "mapProvider", m_settings.m_mapProvider);
QVariantMap parameters;
QString mapType;

View File

@ -90,7 +90,7 @@ void ADSBDemodSettings::resetToDefaults()
}
m_logFilename = "adsb_log.csv";
m_logEnabled = false;
m_airspaces = QStringList({"A", "D", "TMZ"});
m_airspaces = QStringList({"CTR"});
m_airspaceRange = 500.0f;
#ifdef LINUX
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_verboseModelMatching = false;
m_airfieldElevation = 0;
m_aircraftMinZoom = 11;
m_workspaceIndex = 0;
m_hidden = false;
}
@ -185,6 +186,7 @@ QByteArray ADSBDemodSettings::serialize() const
s.writeBool(61, m_hidden);
s.writeString(62, m_checkWXAPIKey);
s.writeString(63, m_mapProvider);
s.writeS32(64, m_aircraftMinZoom);
for (int i = 0; i < ADSBDEMOD_COLUMNS; 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.readBool(37, &m_logEnabled, false);
d.readString(38, &string, "A D TMZ");
d.readString(38, &string, "CTR");
m_airspaces = string.split(" ");
d.readFloat(39, &m_airspaceRange, 500.0f);
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.readString(62, &m_checkWXAPIKey, "");
d.readString(63, &m_mapProvider, "osm");
d.readS32(64, &m_aircraftMinZoom, 11);
#ifdef LINUX
if (m_mapProvider == "osm") {
m_mapProvider = "mapboxgl";

View File

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

View File

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