mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-02 06:04:39 -04:00
Change Street Map from WikiMedia to OpenStreetMap, as Wikimedia servers are no longer available. For #1709
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include <QGeoCoordinate>
|
||||
#include <QGeoCodingManager>
|
||||
#include <QGeoServiceProvider>
|
||||
#include <QSettings>
|
||||
|
||||
#ifdef QT_WEBENGINE_FOUND
|
||||
#include <QtWebEngineWidgets/QWebEngineView>
|
||||
@@ -213,6 +214,8 @@ MapGUI::MapGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *featur
|
||||
ui->map->setFormat(format);
|
||||
}
|
||||
|
||||
clearWikiMediaOSMCache();
|
||||
|
||||
m_osmPort = 0;
|
||||
m_templateServer = new OSMTemplateServer(thunderforestAPIKey(), maptilerAPIKey(), m_osmPort);
|
||||
|
||||
@@ -1106,6 +1109,31 @@ void MapGUI::clearOSMCache()
|
||||
}
|
||||
}
|
||||
|
||||
// Delete old cache if it might contain wikimedia OSM images before switch to using OSM directly
|
||||
// as the images are different
|
||||
void MapGUI::clearWikiMediaOSMCache()
|
||||
{
|
||||
QSettings settings;
|
||||
QString cacheCleared = "sdrangel.feature.map/cacheCleared";
|
||||
if (!settings.value(cacheCleared).toBool())
|
||||
{
|
||||
qDebug() << "MapGUI::clearWikiMediaOSMCache: Clearing cache";
|
||||
QDir dir(osmCachePath());
|
||||
if (dir.exists())
|
||||
{
|
||||
QStringList filenames = dir.entryList({"osm_100-l-1-*.png"});
|
||||
for (const auto& filename : filenames)
|
||||
{
|
||||
QFile file(dir.filePath(filename));
|
||||
if (!file.remove()) {
|
||||
qDebug() << "MapGUI::clearWikiMediaOSMCache: Failed to remove " << file;
|
||||
}
|
||||
}
|
||||
}
|
||||
settings.setValue(cacheCleared, true);
|
||||
}
|
||||
}
|
||||
|
||||
void MapGUI::applyMap2DSettings(bool reloadMap)
|
||||
{
|
||||
ui->map->setVisible(m_settings.m_map2DEnabled);
|
||||
|
||||
Reference in New Issue
Block a user