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->airspaceRange->setValue(settings->m_airspaceRange);
|
||||||
ui->mapProvider->setCurrentText(settings->m_mapProvider);
|
ui->mapProvider->setCurrentText(settings->m_mapProvider);
|
||||||
ui->mapType->setCurrentIndex((int)settings->m_mapType);
|
ui->mapType->setCurrentIndex((int)settings->m_mapType);
|
||||||
ui->mapBoxAPIKey->setText(settings->m_mapBoxAPIKey);
|
|
||||||
ui->navAids->setChecked(settings->m_displayNavAids);
|
ui->navAids->setChecked(settings->m_displayNavAids);
|
||||||
ui->photos->setChecked(settings->m_displayPhotos);
|
ui->photos->setChecked(settings->m_displayPhotos);
|
||||||
ui->verboseModelMatching->setChecked(settings->m_verboseModelMatching);
|
ui->verboseModelMatching->setChecked(settings->m_verboseModelMatching);
|
||||||
@ -81,7 +80,6 @@ void ADSBDemodDisplayDialog::accept()
|
|||||||
m_settings->m_airspaceRange = ui->airspaceRange->value();
|
m_settings->m_airspaceRange = ui->airspaceRange->value();
|
||||||
m_settings->m_mapProvider = ui->mapProvider->currentText();
|
m_settings->m_mapProvider = ui->mapProvider->currentText();
|
||||||
m_settings->m_mapType = (ADSBDemodSettings::MapType)ui->mapType->currentIndex();
|
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_displayNavAids = ui->navAids->isChecked();
|
||||||
m_settings->m_displayPhotos = ui->photos->isChecked();
|
m_settings->m_displayPhotos = ui->photos->isChecked();
|
||||||
m_settings->m_verboseModelMatching = ui->verboseModelMatching->isChecked();
|
m_settings->m_verboseModelMatching = ui->verboseModelMatching->isChecked();
|
||||||
|
@ -119,7 +119,7 @@
|
|||||||
<item row="2" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QComboBox" name="mapType">
|
<widget class="QComboBox" name="mapType">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Type of map to display (for osm maps)</string>
|
<string>Type of map to display</string>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -524,20 +524,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -557,7 +543,6 @@
|
|||||||
<tabstop>units</tabstop>
|
<tabstop>units</tabstop>
|
||||||
<tabstop>mapProvider</tabstop>
|
<tabstop>mapProvider</tabstop>
|
||||||
<tabstop>mapType</tabstop>
|
<tabstop>mapType</tabstop>
|
||||||
<tabstop>mapBoxAPIKey</tabstop>
|
|
||||||
<tabstop>airportSize</tabstop>
|
<tabstop>airportSize</tabstop>
|
||||||
<tabstop>heliports</tabstop>
|
<tabstop>heliports</tabstop>
|
||||||
<tabstop>airportRange</tabstop>
|
<tabstop>airportRange</tabstop>
|
||||||
|
@ -3626,6 +3626,8 @@ void ADSBDemodGUI::applyMapSettings()
|
|||||||
// Create the map using the specified provider
|
// Create the map using the specified provider
|
||||||
QQmlProperty::write(item, "mapProvider", m_settings.m_mapProvider);
|
QQmlProperty::write(item, "mapProvider", m_settings.m_mapProvider);
|
||||||
QVariantMap parameters;
|
QVariantMap parameters;
|
||||||
|
QString mapType;
|
||||||
|
|
||||||
if (m_settings.m_mapProvider == "osm")
|
if (m_settings.m_mapProvider == "osm")
|
||||||
{
|
{
|
||||||
// Use our repo, so we can append API key and redefine transmit maps
|
// Use our repo, so we can append API key and redefine transmit maps
|
||||||
@ -3638,27 +3640,39 @@ void ADSBDemodGUI::applyMapSettings()
|
|||||||
if (!dir.exists()) {
|
if (!dir.exists()) {
|
||||||
dir.mkpath(cachePath);
|
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")
|
else if (m_settings.m_mapProvider == "mapboxgl")
|
||||||
{
|
{
|
||||||
parameters["mapboxgl.access_token"] = m_settings.m_mapBoxAPIKey;
|
switch (m_settings.m_mapType)
|
||||||
}
|
{
|
||||||
|
case ADSBDemodSettings::AVIATION_LIGHT:
|
||||||
QString mapType; // Only for osm maps
|
mapType = "mapbox://styles/mapbox/light-v9";
|
||||||
switch (m_settings.m_mapType)
|
break;
|
||||||
{
|
case ADSBDemodSettings::AVIATION_DARK:
|
||||||
case ADSBDemodSettings::AVIATION_LIGHT:
|
mapType = "mapbox://styles/mapbox/dark-v9";
|
||||||
mapType = "Transit Map";
|
break;
|
||||||
break;
|
case ADSBDemodSettings::STREET:
|
||||||
case ADSBDemodSettings::AVIATION_DARK:
|
mapType = "mapbox://styles/mapbox/streets-v10";
|
||||||
mapType = "Night Transit Map";
|
break;
|
||||||
break;
|
case ADSBDemodSettings::SATELLITE:
|
||||||
case ADSBDemodSettings::STREET:
|
mapType = "mapbox://styles/mapbox/satellite-v9";
|
||||||
mapType = "Street Map";
|
break;
|
||||||
break;
|
}
|
||||||
case ADSBDemodSettings::SATELLITE:
|
|
||||||
mapType = "Satellite Map";
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant retVal;
|
QVariant retVal;
|
||||||
|
@ -98,7 +98,6 @@ void ADSBDemodSettings::resetToDefaults()
|
|||||||
m_mapProvider = "osm";
|
m_mapProvider = "osm";
|
||||||
#endif
|
#endif
|
||||||
m_mapType = AVIATION_LIGHT;
|
m_mapType = AVIATION_LIGHT;
|
||||||
m_mapBoxAPIKey = "";
|
|
||||||
m_displayNavAids = true;
|
m_displayNavAids = true;
|
||||||
m_displayPhotos = true;
|
m_displayPhotos = true;
|
||||||
m_verboseModelMatching = false;
|
m_verboseModelMatching = false;
|
||||||
@ -186,7 +185,6 @@ 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.writeString(64, m_mapBoxAPIKey);
|
|
||||||
|
|
||||||
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]);
|
||||||
@ -322,7 +320,6 @@ bool ADSBDemodSettings::deserialize(const QByteArray& data)
|
|||||||
#else
|
#else
|
||||||
d.readString(63, &m_mapProvider, "osm");
|
d.readString(63, &m_mapProvider, "osm");
|
||||||
#endif
|
#endif
|
||||||
d.readString(64, &m_mapBoxAPIKey, "");
|
|
||||||
|
|
||||||
for (int i = 0; i < ADSBDEMOD_COLUMNS; i++) {
|
for (int i = 0; i < ADSBDEMOD_COLUMNS; i++) {
|
||||||
d.readS32(100 + i, &m_columnIndexes[i], i);
|
d.readS32(100 + i, &m_columnIndexes[i], i);
|
||||||
|
@ -161,8 +161,7 @@ struct ADSBDemodSettings
|
|||||||
AVIATION_DARK,
|
AVIATION_DARK,
|
||||||
STREET,
|
STREET,
|
||||||
SATELLITE
|
SATELLITE
|
||||||
} m_mapType; //!< For osm maps
|
} m_mapType;
|
||||||
QString m_mapBoxAPIKey;
|
|
||||||
bool m_displayNavAids;
|
bool m_displayNavAids;
|
||||||
bool m_displayPhotos;
|
bool m_displayPhotos;
|
||||||
Serializable *m_rollupState;
|
Serializable *m_rollupState;
|
||||||
|
@ -118,7 +118,7 @@ Item {
|
|||||||
activeMapType = supportedMapTypes[i]
|
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:
|
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 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 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, 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.
|
* 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.
|
||||||
* 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.
|
* 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.
|
* 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.
|
* 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