From e42ebd5220b729f61fe18a58e9bb8e624fd352a5 Mon Sep 17 00:00:00 2001 From: leonardosimovic Date: Wed, 26 Jul 2023 10:12:28 +0200 Subject: [PATCH] refactor(AirmapElevationProvider): rename to CopernicusElevationProvider --- src/QmlControls/QGroundControlQmlGlobal.h | 4 ++-- src/QtLocationPlugin/ElevationMapProvider.cpp | 8 ++++---- src/QtLocationPlugin/ElevationMapProvider.h | 5 ++--- src/QtLocationPlugin/QGCMapTileSet.cpp | 2 +- src/QtLocationPlugin/QGCMapUrlEngine.cpp | 6 +++--- src/QtLocationPlugin/QGCMapUrlEngine.h | 4 ++-- src/QtLocationPlugin/QMLControl/QGCMapEngineManager.cc | 2 +- src/Terrain/TerrainQuery.cc | 2 +- 8 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/QmlControls/QGroundControlQmlGlobal.h b/src/QmlControls/QGroundControlQmlGlobal.h index af4387ebfeb2..1a54275ad939 100644 --- a/src/QmlControls/QGroundControlQmlGlobal.h +++ b/src/QmlControls/QGroundControlQmlGlobal.h @@ -209,8 +209,8 @@ class QGroundControlQmlGlobal : public QGCTool bool hasMAVLinkInspector () { return true; } #endif - QString elevationProviderName () { return UrlFactory::kOnlineElevationProviderKey; } - QString elevationProviderNotice () { return UrlFactory::kOnlineElevationProviderNotice; } + QString elevationProviderName () { return UrlFactory::kCopernicusElevationProviderKey; } + QString elevationProviderNotice () { return UrlFactory::kCopernicusElevationProviderNotice; } bool singleFirmwareSupport (); bool singleVehicleSupport (); diff --git a/src/QtLocationPlugin/ElevationMapProvider.cpp b/src/QtLocationPlugin/ElevationMapProvider.cpp index b14741dcfeda..851f162eca6f 100644 --- a/src/QtLocationPlugin/ElevationMapProvider.cpp +++ b/src/QtLocationPlugin/ElevationMapProvider.cpp @@ -18,18 +18,18 @@ ElevationProvider::ElevationProvider(const QString& imageFormat, quint32 average : MapProvider(QStringLiteral("https://terrain-ce.suite.auterion.com/"), imageFormat, averageSize, mapType, parent) {} //----------------------------------------------------------------------------- -int AirmapElevationProvider::long2tileX(const double lon, const int z) const { +int CopernicusElevationProvider::long2tileX(const double lon, const int z) const { Q_UNUSED(z) return static_cast(floor((lon + 180.0) / TerrainTile::tileSizeDegrees)); } //----------------------------------------------------------------------------- -int AirmapElevationProvider::lat2tileY(const double lat, const int z) const { +int CopernicusElevationProvider::lat2tileY(const double lat, const int z) const { Q_UNUSED(z) return static_cast(floor((lat + 90.0) / TerrainTile::tileSizeDegrees)); } -QString AirmapElevationProvider::_getURL(const int x, const int y, const int zoom, QNetworkAccessManager* networkManager) { +QString CopernicusElevationProvider::_getURL(const int x, const int y, const int zoom, QNetworkAccessManager* networkManager) { Q_UNUSED(networkManager) Q_UNUSED(zoom) return QString("https://terrain-ce.suite.auterion.com/api/v1/carpet?points=%1,%2,%3,%4") @@ -39,7 +39,7 @@ QString AirmapElevationProvider::_getURL(const int x, const int y, const int zoo .arg(static_cast(x + 1) * TerrainTile::tileSizeDegrees - 180.0); } -QGCTileSet AirmapElevationProvider::getTileCount(const int zoom, const double topleftLon, +QGCTileSet CopernicusElevationProvider::getTileCount(const int zoom, const double topleftLon, const double topleftLat, const double bottomRightLon, const double bottomRightLat) const { QGCTileSet set; diff --git a/src/QtLocationPlugin/ElevationMapProvider.h b/src/QtLocationPlugin/ElevationMapProvider.h index ce2cbea7345d..842056918ac5 100644 --- a/src/QtLocationPlugin/ElevationMapProvider.h +++ b/src/QtLocationPlugin/ElevationMapProvider.h @@ -24,10 +24,10 @@ class ElevationProvider : public MapProvider { // ----------------------------------------------------------- // Airmap Elevation -class AirmapElevationProvider : public ElevationProvider { +class CopernicusElevationProvider : public ElevationProvider { Q_OBJECT public: - AirmapElevationProvider(QObject* parent = nullptr) + CopernicusElevationProvider(QObject* parent = nullptr) : ElevationProvider(QStringLiteral("bin"), AVERAGE_AIRMAP_ELEV_SIZE, QGeoMapType::StreetMap, parent) {} @@ -42,4 +42,3 @@ class AirmapElevationProvider : public ElevationProvider { protected: QString _getURL(const int x, const int y, const int zoom, QNetworkAccessManager* networkManager) override; }; - diff --git a/src/QtLocationPlugin/QGCMapTileSet.cpp b/src/QtLocationPlugin/QGCMapTileSet.cpp index 3ccd4e853a01..0e18f5374668 100644 --- a/src/QtLocationPlugin/QGCMapTileSet.cpp +++ b/src/QtLocationPlugin/QGCMapTileSet.cpp @@ -287,7 +287,7 @@ QGCCachedTileSet::_networkReplyFinished() qCDebug(QGCCachedTileSetLog) << "Tile fetched" << hash; QByteArray image = reply->readAll(); QString type = getQGCMapEngine()->hashToType(hash); - if (type == UrlFactory::kOnlineElevationProviderKey) { + if (type == UrlFactory::kCopernicusElevationProviderKey) { image = TerrainTile::serializeFromAirMapJson(image); } QString format = getQGCMapEngine()->urlFactory()->getImageFormat(type, image); diff --git a/src/QtLocationPlugin/QGCMapUrlEngine.cpp b/src/QtLocationPlugin/QGCMapUrlEngine.cpp index a19df29f7b9b..7f4cbfd02b5f 100644 --- a/src/QtLocationPlugin/QGCMapUrlEngine.cpp +++ b/src/QtLocationPlugin/QGCMapUrlEngine.cpp @@ -32,8 +32,8 @@ QGC_LOGGING_CATEGORY(QGCMapUrlEngineLog, "QGCMapUrlEngineLog") #include #include -const char* UrlFactory::kOnlineElevationProviderKey = "Copernicus Elevation"; -const char* UrlFactory::kOnlineElevationProviderNotice = "© Airbus Defence and Space GmbH"; +const char* UrlFactory::kCopernicusElevationProviderKey = "Copernicus Elevation"; +const char* UrlFactory::kCopernicusElevationProviderNotice = "© Airbus Defence and Space GmbH"; //----------------------------------------------------------------------------- UrlFactory::UrlFactory() : _timeout(5 * 1000) { @@ -78,7 +78,7 @@ UrlFactory::UrlFactory() : _timeout(5 * 1000) { _providersTable["VWorld Street Map"] = new VWorldStreetMapProvider(this); _providersTable["VWorld Satellite Map"] = new VWorldSatMapProvider(this); - _providersTable[kOnlineElevationProviderKey] = new AirmapElevationProvider(this); + _providersTable[kCopernicusElevationProviderKey] = new CopernicusElevationProvider(this); _providersTable["Japan-GSI Contour"] = new JapanStdMapProvider(this); _providersTable["Japan-GSI Seamless"] = new JapanSeamlessMapProvider(this); diff --git a/src/QtLocationPlugin/QGCMapUrlEngine.h b/src/QtLocationPlugin/QGCMapUrlEngine.h index f3688a8abb7f..8d3535c84ac0 100644 --- a/src/QtLocationPlugin/QGCMapUrlEngine.h +++ b/src/QtLocationPlugin/QGCMapUrlEngine.h @@ -29,8 +29,8 @@ class UrlFactory : public QObject { Q_OBJECT public: - static const char* kOnlineElevationProviderKey; - static const char* kOnlineElevationProviderNotice; + static const char* kCopernicusElevationProviderKey; + static const char* kCopernicusElevationProviderNotice; UrlFactory (); ~UrlFactory (); diff --git a/src/QtLocationPlugin/QMLControl/QGCMapEngineManager.cc b/src/QtLocationPlugin/QMLControl/QGCMapEngineManager.cc index dc66bf7312c5..ec4fe2dae674 100644 --- a/src/QtLocationPlugin/QMLControl/QGCMapEngineManager.cc +++ b/src/QtLocationPlugin/QMLControl/QGCMapEngineManager.cc @@ -28,7 +28,7 @@ QGC_LOGGING_CATEGORY(QGCMapEngineManagerLog, "QGCMapEngineManagerLog") static const char* kQmlOfflineMapKeyName = "QGCOfflineMap"; -static const auto kElevationMapType = UrlFactory::kOnlineElevationProviderKey; +static const auto kElevationMapType = UrlFactory::kCopernicusElevationProviderKey; //----------------------------------------------------------------------------- QGCMapEngineManager::QGCMapEngineManager(QGCApplication* app, QGCToolbox* toolbox) diff --git a/src/Terrain/TerrainQuery.cc b/src/Terrain/TerrainQuery.cc index 2e4dcbb5ca1c..42edfb6a432f 100644 --- a/src/Terrain/TerrainQuery.cc +++ b/src/Terrain/TerrainQuery.cc @@ -32,7 +32,7 @@ QGC_LOGGING_CATEGORY(TerrainQueryVerboseLog, "TerrainQueryVerboseLog") Q_GLOBAL_STATIC(TerrainAtCoordinateBatchManager, _TerrainAtCoordinateBatchManager) Q_GLOBAL_STATIC(TerrainTileManager, _terrainTileManager) -static const auto kMapType = UrlFactory::kOnlineElevationProviderKey; +static const auto kMapType = UrlFactory::kCopernicusElevationProviderKey; TerrainAirMapQuery::TerrainAirMapQuery(QObject* parent) : TerrainQueryInterface(parent)