From 423def0f87394f74c88649d0f1e1b6264b35798b Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Fri, 6 Sep 2024 14:57:05 +0700 Subject: [PATCH] Address review --- python/PyQt6/core/auto_generated/qgsmaplayerutils.sip.in | 1 + python/core/auto_generated/qgsmaplayerutils.sip.in | 1 + src/analysis/processing/qgsalgorithmrasterize.cpp | 2 +- src/analysis/processing/qgsalgorithmxyztiles.cpp | 2 +- src/core/qgsmaplayerutils.h | 2 ++ src/gui/qgsrasterlayersaveasdialog.cpp | 4 ++-- 6 files changed, 8 insertions(+), 4 deletions(-) diff --git a/python/PyQt6/core/auto_generated/qgsmaplayerutils.sip.in b/python/PyQt6/core/auto_generated/qgsmaplayerutils.sip.in index f6851ef30179..85246e6e4aee 100644 --- a/python/PyQt6/core/auto_generated/qgsmaplayerutils.sip.in +++ b/python/PyQt6/core/auto_generated/qgsmaplayerutils.sip.in @@ -9,6 +9,7 @@ + class QgsMapLayerUtils { %Docstring(signature="appended") diff --git a/python/core/auto_generated/qgsmaplayerutils.sip.in b/python/core/auto_generated/qgsmaplayerutils.sip.in index f6851ef30179..85246e6e4aee 100644 --- a/python/core/auto_generated/qgsmaplayerutils.sip.in +++ b/python/core/auto_generated/qgsmaplayerutils.sip.in @@ -9,6 +9,7 @@ + class QgsMapLayerUtils { %Docstring(signature="appended") diff --git a/src/analysis/processing/qgsalgorithmrasterize.cpp b/src/analysis/processing/qgsalgorithmrasterize.cpp index cbca69fe2544..05a92d4194c2 100644 --- a/src/analysis/processing/qgsalgorithmrasterize.cpp +++ b/src/analysis/processing/qgsalgorithmrasterize.cpp @@ -197,7 +197,7 @@ QVariantMap QgsRasterizeAlgorithm::processAlgorithm( const QVariantMap ¶mete } feedback->pushInfo( QStringLiteral( "%1" ).arg( totalTiles ) ); - if ( totalTiles > 5000 ) + if ( totalTiles > MAXIMUM_OPENSTREETMAP_TILES_FETCH ) { // Prevent bulk downloading of tiles from openstreetmap.org as per OSMF tile usage policy feedback->pushFormattedMessage( QObject::tr( "Layer %1 will be skipped as the algorithm leads to bulk downloading behavior which is prohibited by the %2OpenStreetMap Foundation tile usage policy%3" ).arg( rasterLayer->name(), QStringLiteral( "" ), QStringLiteral( "" ) ), diff --git a/src/analysis/processing/qgsalgorithmxyztiles.cpp b/src/analysis/processing/qgsalgorithmxyztiles.cpp index 4deca8a6fcad..787f55ef3509 100644 --- a/src/analysis/processing/qgsalgorithmxyztiles.cpp +++ b/src/analysis/processing/qgsalgorithmxyztiles.cpp @@ -189,7 +189,7 @@ bool QgsXyzTilesBaseAlgorithm::prepareAlgorithm( const QVariantMap ¶meters, void QgsXyzTilesBaseAlgorithm::checkLayersUsagePolicy( QgsProcessingFeedback *feedback ) { - if ( mTotalTiles > 5000 ) + if ( mTotalTiles > MAXIMUM_OPENSTREETMAP_TILES_FETCH ) { for ( QgsMapLayer *layer : std::as_const( mLayers ) ) { diff --git a/src/core/qgsmaplayerutils.h b/src/core/qgsmaplayerutils.h index 5606cbaa9ecc..d1bfe1e60448 100644 --- a/src/core/qgsmaplayerutils.h +++ b/src/core/qgsmaplayerutils.h @@ -17,6 +17,8 @@ #ifndef QGSMAPLAYERUTILS_H #define QGSMAPLAYERUTILS_H +#define MAXIMUM_OPENSTREETMAP_TILES_FETCH 5000 + #include "qgis_sip.h" #include "qgis_core.h" #include "qgis.h" diff --git a/src/gui/qgsrasterlayersaveasdialog.cpp b/src/gui/qgsrasterlayersaveasdialog.cpp index 83655f85ddf7..9dc98671c0e2 100644 --- a/src/gui/qgsrasterlayersaveasdialog.cpp +++ b/src/gui/qgsrasterlayersaveasdialog.cpp @@ -970,10 +970,10 @@ void QgsRasterLayerSaveAsDialog::accept() const int nbTilesHeight = std::ceil( nRows() / 256 ); int64_t totalTiles = static_cast( nbTilesWidth ) * nbTilesHeight; - if ( totalTiles > 5000 ) + if ( totalTiles > MAXIMUM_OPENSTREETMAP_TILES_FETCH ) { QMessageBox::warning( this, tr( "Save Raster Layer" ), - tr( "The number of OpenStreetMap tiles needed to produce the raster layer is too large and will leads to bulk downloading behavior which is prohibited by the %1OpenStreetMap Foundation tile usage policy%2." ).arg( QStringLiteral( "" ), QStringLiteral( "" ) ), + tr( "The number of OpenStreetMap tiles needed to produce the raster layer is too large and will lead to bulk downloading behavior which is prohibited by the %1OpenStreetMap Foundation tile usage policy%2." ).arg( QStringLiteral( "" ), QStringLiteral( "" ) ), QMessageBox::Ok ); return; }