diff --git a/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.cpp b/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.cpp index 3feb1b2c4..b2e645fd2 100644 --- a/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.cpp +++ b/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.cpp @@ -47,7 +47,6 @@ 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); @@ -81,7 +80,6 @@ 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 657c9eb0b..417ba074e 100644 --- a/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.ui +++ b/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.ui @@ -119,7 +119,7 @@ - Type of map to display (for osm maps) + Type of map to display @@ -524,20 +524,6 @@ - - - - Mapbox API key - - - - - - - mapbox.com API key for mapboxgl maps - - - @@ -557,7 +543,6 @@ units mapProvider mapType - mapBoxAPIKey airportSize heliports airportRange diff --git a/plugins/channelrx/demodadsb/adsbdemodgui.cpp b/plugins/channelrx/demodadsb/adsbdemodgui.cpp index c51729115..80f1c865f 100644 --- a/plugins/channelrx/demodadsb/adsbdemodgui.cpp +++ b/plugins/channelrx/demodadsb/adsbdemodgui.cpp @@ -3626,6 +3626,8 @@ void ADSBDemodGUI::applyMapSettings() // Create the map using the specified provider QQmlProperty::write(item, "mapProvider", m_settings.m_mapProvider); QVariantMap parameters; + QString mapType; + if (m_settings.m_mapProvider == "osm") { // Use our repo, so we can append API key and redefine transmit maps @@ -3638,27 +3640,39 @@ void ADSBDemodGUI::applyMapSettings() if (!dir.exists()) { dir.mkpath(cachePath); } + switch (m_settings.m_mapType) + { + case ADSBDemodSettings::AVIATION_LIGHT: + mapType = "Transit Map"; + break; + case ADSBDemodSettings::AVIATION_DARK: + mapType = "Night Transit Map"; + break; + case ADSBDemodSettings::STREET: + mapType = "Street Map"; + break; + case ADSBDemodSettings::SATELLITE: + mapType = "Satellite Map"; + break; + } } else if (m_settings.m_mapProvider == "mapboxgl") { - parameters["mapboxgl.access_token"] = m_settings.m_mapBoxAPIKey; - } - - QString mapType; // Only for osm maps - switch (m_settings.m_mapType) - { - case ADSBDemodSettings::AVIATION_LIGHT: - mapType = "Transit Map"; - break; - case ADSBDemodSettings::AVIATION_DARK: - mapType = "Night Transit Map"; - break; - case ADSBDemodSettings::STREET: - mapType = "Street Map"; - break; - case ADSBDemodSettings::SATELLITE: - mapType = "Satellite Map"; - break; + switch (m_settings.m_mapType) + { + case ADSBDemodSettings::AVIATION_LIGHT: + mapType = "mapbox://styles/mapbox/light-v9"; + break; + case ADSBDemodSettings::AVIATION_DARK: + mapType = "mapbox://styles/mapbox/dark-v9"; + break; + case ADSBDemodSettings::STREET: + mapType = "mapbox://styles/mapbox/streets-v10"; + break; + case ADSBDemodSettings::SATELLITE: + mapType = "mapbox://styles/mapbox/satellite-v9"; + break; + } } QVariant retVal; diff --git a/plugins/channelrx/demodadsb/adsbdemodsettings.cpp b/plugins/channelrx/demodadsb/adsbdemodsettings.cpp index d02a31743..f6b7ebba4 100644 --- a/plugins/channelrx/demodadsb/adsbdemodsettings.cpp +++ b/plugins/channelrx/demodadsb/adsbdemodsettings.cpp @@ -98,7 +98,6 @@ void ADSBDemodSettings::resetToDefaults() m_mapProvider = "osm"; #endif m_mapType = AVIATION_LIGHT; - m_mapBoxAPIKey = ""; m_displayNavAids = true; m_displayPhotos = true; m_verboseModelMatching = false; @@ -186,7 +185,6 @@ QByteArray ADSBDemodSettings::serialize() const 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]); @@ -322,7 +320,6 @@ bool ADSBDemodSettings::deserialize(const QByteArray& data) #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 1eab03b09..dc9fa0a65 100644 --- a/plugins/channelrx/demodadsb/adsbdemodsettings.h +++ b/plugins/channelrx/demodadsb/adsbdemodsettings.h @@ -161,8 +161,7 @@ struct ADSBDemodSettings AVIATION_DARK, STREET, SATELLITE - } m_mapType; //!< For osm maps - QString m_mapBoxAPIKey; + } m_mapType; bool m_displayNavAids; bool m_displayPhotos; Serializable *m_rollupState; diff --git a/plugins/channelrx/demodadsb/map/map.qml b/plugins/channelrx/demodadsb/map/map.qml index b4e3459d8..32b01947d 100644 --- a/plugins/channelrx/demodadsb/map/map.qml +++ b/plugins/channelrx/demodadsb/map/map.qml @@ -118,7 +118,7 @@ Item { activeMapType = supportedMapTypes[i] } } - lightIcons = requestedMapType == "Night Transit Map" + lightIcons = (requestedMapType == "Night Transit Map") || (requestedMapType == "mapbox://styles/mapbox/dark-v9") } } diff --git a/plugins/channelrx/demodadsb/readme.md b/plugins/channelrx/demodadsb/readme.md index ed1fc43c5..0f7375de5 100644 --- a/plugins/channelrx/demodadsb/readme.md +++ b/plugins/channelrx/demodadsb/readme.md @@ -75,9 +75,8 @@ 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 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 map provider. This can be osm for OpenStreetMaps or mapboxgl for Mapbox. 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, due to a bug in Qt. +* 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 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.