mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 10:05:46 -05:00
ADS-B: Support different map types for mapboxgl
This commit is contained in:
parent
90fe976d9a
commit
8a7113be19
@ -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();
|
||||
|
@ -119,7 +119,7 @@
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="mapType">
|
||||
<property name="toolTip">
|
||||
<string>Type of map to display (for osm maps)</string>
|
||||
<string>Type of map to display</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
@ -524,20 +524,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="mapBoxAPIKeyLabel">
|
||||
<property name="text">
|
||||
<string>Mapbox API key</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="mapBoxAPIKey">
|
||||
<property name="toolTip">
|
||||
<string>mapbox.com API key for mapboxgl maps</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -557,7 +543,6 @@
|
||||
<tabstop>units</tabstop>
|
||||
<tabstop>mapProvider</tabstop>
|
||||
<tabstop>mapType</tabstop>
|
||||
<tabstop>mapBoxAPIKey</tabstop>
|
||||
<tabstop>airportSize</tabstop>
|
||||
<tabstop>heliports</tabstop>
|
||||
<tabstop>airportRange</tabstop>
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -118,7 +118,7 @@ Item {
|
||||
activeMapType = supportedMapTypes[i]
|
||||
}
|
||||
}
|
||||
lightIcons = requestedMapType == "Night Transit Map"
|
||||
lightIcons = (requestedMapType == "Night Transit Map") || (requestedMapType == "mapbox://styles/mapbox/dark-v9")
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user