diff --git a/doc/img/ADSBDemod_plugin_displaysettings.png b/doc/img/ADSBDemod_plugin_displaysettings.png index 3738aa3e5..40148fb4b 100644 Binary files a/doc/img/ADSBDemod_plugin_displaysettings.png and b/doc/img/ADSBDemod_plugin_displaysettings.png differ diff --git a/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.cpp b/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.cpp index cf9ce77ae..3feb1b2c4 100644 --- a/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.cpp +++ b/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.cpp @@ -45,7 +45,9 @@ ADSBDemodDisplayDialog::ADSBDemodDisplayDialog(ADSBDemodSettings *settings, QWid } } ui->airspaceRange->setValue(settings->m_airspaceRange); + ui->mapProvider->setCurrentText(settings->m_mapProvider); ui->mapType->setCurrentIndex((int)settings->m_mapType); + ui->mapBoxAPIKey->setText(settings->m_mapBoxAPIKey); ui->navAids->setChecked(settings->m_displayNavAids); ui->photos->setChecked(settings->m_displayPhotos); ui->verboseModelMatching->setChecked(settings->m_verboseModelMatching); @@ -77,7 +79,9 @@ void ADSBDemodDisplayDialog::accept() } } m_settings->m_airspaceRange = ui->airspaceRange->value(); + m_settings->m_mapProvider = ui->mapProvider->currentText(); m_settings->m_mapType = (ADSBDemodSettings::MapType)ui->mapType->currentIndex(); + m_settings->m_mapBoxAPIKey = ui->mapBoxAPIKey->text(); m_settings->m_displayNavAids = ui->navAids->isChecked(); m_settings->m_displayPhotos = ui->photos->isChecked(); m_settings->m_verboseModelMatching = ui->verboseModelMatching->isChecked(); diff --git a/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.ui b/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.ui index 77b6a0f0c..657c9eb0b 100644 --- a/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.ui +++ b/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.ui @@ -7,7 +7,7 @@ 0 0 417 - 714 + 742 @@ -22,70 +22,7 @@ - - - - Select a font for the table - - - Select... - - - - - - - Log 3D model matching information - - - - - - - Resize columns after adding aircraft - - - - - - - The units to use for altitude, speed and climb rate - - - - ft, kn, ft/min - - - - - m, kph, m/s - - - - - - - - Sets the minimum airport size that will be displayed on the map - - - - Small - - - - - Medium - - - - - Large - - - - - + Barometric altitude reported by aircraft when on airfield surface @@ -101,42 +38,14 @@ - - - - Airspace display distance (km) - - - - - - - aviationstack.com API key for accessing flight information - - - - - - - avaitionstack API key - - - - - - - Units - - - - + Display NAVAIDs - + Download and display photos of highlighted aircraft @@ -146,23 +55,7 @@ - - - - - 0 - 0 - - - - Display demodulator statistics - - - - - - - + Resize the columns in the table after an aircraft is added to it @@ -172,17 +65,7 @@ - - - - Displays airports within the specified distance in kilometres from My Position - - - 20000 - - - - + Log information about how aircraft are matched to 3D models @@ -192,7 +75,7 @@ - + Displays airspace within the specified distance in kilometres from My Position @@ -202,14 +85,14 @@ - - + + - Map type + Display demodulator statistics - + Display NAVAIDs such as VORs and NDBs @@ -219,38 +102,24 @@ - - + + - Display demodulator statistics + Map type - - - - Table font - - - - + Airport display distance (km) - - - - Display aircraft photos - - - - + - Type of map to display + Type of map to display (for osm maps) @@ -274,7 +143,200 @@ - + + + + Display airports with size + + + + + + + Aircraft timeout (s) + + + + + + + CheckWX API key + + + + + + + Display heliports + + + + + + + How long in seconds after not receiving any frames will an aircraft be removed from the table and map + + + 1000000 + + + + + + + Select a font for the table + + + Select... + + + + + + + Log 3D model matching information + + + + + + + Resize columns after adding aircraft + + + + + + + The units to use for altitude, speed and climb rate + + + + ft, kn, ft/min + + + + + m, kph, m/s + + + + + + + + Sets the minimum airport size that will be displayed on the map + + + + Small + + + + + Medium + + + + + Large + + + + + + + + Mapping service + + + + osm + + + + + mapboxgl + + + + + + + + Airspace display distance (km) + + + + + + + aviationstack.com API key for accessing flight information + + + + + + + avaitionstack API key + + + + + + + Map provider + + + + + + + Units + + + + + + + + 0 + 0 + + + + Display demodulator statistics + + + + + + + + + + Displays airports within the specified distance in kilometres from My Position + + + 20000 + + + + + + + Table font + + + + + + + Display aircraft photos + + + + Airspace categories to display @@ -431,21 +493,14 @@ - - - - Display airports with size + + + + checkwxapi.com API key for accessing airport weather (METARs) - - - - Aircraft timeout (s) - - - - + When checked, heliports are displayed on the map @@ -455,48 +510,31 @@ - - - - Display heliports - - - - - - - How long in seconds after not receiving any frames will an aircraft be removed from the table and map - - - 1000000 - - - - + Airfield barometric altitude (ft) - + Airspaces to display - - + + - CheckWX API key + Mapbox API key - - + + - checkwxapi.com API key for accessing airport weather (METARs) + mapbox.com API key for mapboxgl maps @@ -517,7 +555,9 @@ units + mapProvider mapType + mapBoxAPIKey airportSize heliports airportRange diff --git a/plugins/channelrx/demodadsb/adsbdemodgui.cpp b/plugins/channelrx/demodadsb/adsbdemodgui.cpp index df89ec5c5..b9259d771 100644 --- a/plugins/channelrx/demodadsb/adsbdemodgui.cpp +++ b/plugins/channelrx/demodadsb/adsbdemodgui.cpp @@ -3624,20 +3624,27 @@ void ADSBDemodGUI::applyMapSettings() } // Create the map using the specified provider - QQmlProperty::write(item, "mapProvider", "osm"); + QQmlProperty::write(item, "mapProvider", m_settings.m_mapProvider); QVariantMap parameters; - // Use our repo, so we can append API key and redefine transmit maps - parameters["osm.mapping.providersrepository.address"] = QString("http://127.0.0.1:%1/").arg(m_osmPort); - // Use ADS-B specific cache, as we use different transmit maps - QString cachePath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/QtLocation/5.8/tiles/osm/sdrangel_adsb"; - parameters["osm.mapping.cache.directory"] = cachePath; - // On Linux, we need to create the directory - QDir dir(cachePath); - if (!dir.exists()) { - dir.mkpath(cachePath); + if (m_settings.m_mapProvider == "osm") + { + // Use our repo, so we can append API key and redefine transmit maps + parameters["osm.mapping.providersrepository.address"] = QString("http://127.0.0.1:%1/").arg(m_osmPort); + // Use ADS-B specific cache, as we use different transmit maps + QString cachePath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/QtLocation/5.8/tiles/osm/sdrangel_adsb"; + parameters["osm.mapping.cache.directory"] = cachePath; + // On Linux, we need to create the directory + QDir dir(cachePath); + if (!dir.exists()) { + dir.mkpath(cachePath); + } + } + else if (m_settings.m_mapProvider == "mapboxgl") + { + parameters["mapboxgl.access_token"] = m_settings.m_mapBoxAPIKey; } - QString mapType; + QString mapType; // Only for osm maps switch (m_settings.m_mapType) { case ADSBDemodSettings::AVIATION_LIGHT: diff --git a/plugins/channelrx/demodadsb/adsbdemodsettings.cpp b/plugins/channelrx/demodadsb/adsbdemodsettings.cpp index f506e01e9..d02a31743 100644 --- a/plugins/channelrx/demodadsb/adsbdemodsettings.cpp +++ b/plugins/channelrx/demodadsb/adsbdemodsettings.cpp @@ -92,7 +92,13 @@ void ADSBDemodSettings::resetToDefaults() m_logEnabled = false; m_airspaces = QStringList({"A", "D", "TMZ"}); m_airspaceRange = 500.0f; +#if QT_VERSION == QT_VERSION_CHECK(5, 15, 3) + m_mapProvider = "mapboxgl"; // osm maps do not work in Qt 5.15.3 - https://github.com/f4exb/sdrangel/issues/1169 +#else + m_mapProvider = "osm"; +#endif m_mapType = AVIATION_LIGHT; + m_mapBoxAPIKey = ""; m_displayNavAids = true; m_displayPhotos = true; m_verboseModelMatching = false; @@ -179,6 +185,8 @@ QByteArray ADSBDemodSettings::serialize() const s.writeBlob(60, m_geometryBytes); s.writeBool(61, m_hidden); s.writeString(62, m_checkWXAPIKey); + s.writeString(63, m_mapProvider); + s.writeString(64, m_mapBoxAPIKey); for (int i = 0; i < ADSBDEMOD_COLUMNS; i++) { s.writeS32(100 + i, m_columnIndexes[i]); @@ -309,6 +317,12 @@ bool ADSBDemodSettings::deserialize(const QByteArray& data) d.readBlob(60, &m_geometryBytes); d.readBool(61, &m_hidden, false); d.readString(62, &m_checkWXAPIKey, ""); +#if QT_VERSION == QT_VERSION_CHECK(5, 15, 3) + d.readString(63, &m_mapProvider, "mapboxgl"); // osm maps do not work in Qt 5.15.3 - https://github.com/f4exb/sdrangel/issues/1169 +#else + d.readString(63, &m_mapProvider, "osm"); +#endif + d.readString(64, &m_mapBoxAPIKey, ""); for (int i = 0; i < ADSBDEMOD_COLUMNS; i++) { d.readS32(100 + i, &m_columnIndexes[i], i); diff --git a/plugins/channelrx/demodadsb/adsbdemodsettings.h b/plugins/channelrx/demodadsb/adsbdemodsettings.h index 33f237bf5..1eab03b09 100644 --- a/plugins/channelrx/demodadsb/adsbdemodsettings.h +++ b/plugins/channelrx/demodadsb/adsbdemodsettings.h @@ -155,12 +155,14 @@ struct ADSBDemodSettings QStringList m_airspaces; //!< Airspace names to display float m_airspaceRange; //!< How far away we display airspace (mkm) + QString m_mapProvider; enum MapType { AVIATION_LIGHT, //!< White map with no place names AVIATION_DARK, STREET, SATELLITE - } m_mapType; + } m_mapType; //!< For osm maps + QString m_mapBoxAPIKey; bool m_displayNavAids; bool m_displayPhotos; Serializable *m_rollupState; diff --git a/plugins/channelrx/demodadsb/readme.md b/plugins/channelrx/demodadsb/readme.md index 3ce087429..ed1fc43c5 100644 --- a/plugins/channelrx/demodadsb/readme.md +++ b/plugins/channelrx/demodadsb/readme.md @@ -75,7 +75,9 @@ Clicking this will download the [OpenAIP](https://www.openaip.net/) airspace and Clicking the Display Settings button will open the Display Settings dialog, which allows you to choose: * The units for altitude, speed and vertical climb rate. These can be either ft (feet), kn (knots) and ft/min (feet per minute), or m (metres), kph (kilometers per hour) and m/s (metres per second). -* The type of map that will be displayed. This can either be a light or dark aviation map (with no place names to reduce clutter), a street map or satellite imagery. +* The map provider. This can be osm for OpenStreetMaps or mapboxgl for Mabbox. mapboxgl is not supported on Windows. mapboxgl should be used on Linux with Qt 5.15.3, as osm maps will cause SDRangel to hang with this specific version of Qt. +* The type of map that will be displayed, when the map provider is osm. This can either be a light or dark aviation map (with no place names to reduce clutter), a street map or satellite imagery. +* A [Mapbox](https://www.mapbox.com/) API key, as required to use mapboxgl map provider. * The minimum size airport that will be displayed on the map: small, medium or large. Use small to display GA airfields, medium for regional airports and large for international airports. * Whether or not to display heliports. * The distance (in kilometres), from the location set under Preferences > My Position, at which airports will be displayed on the map. Displaying too many airports will slow down drawing of the map.