diff --git a/python/PyQt6/core/auto_additions/qgis.py b/python/PyQt6/core/auto_additions/qgis.py index 0f7bddbcebc87..55bbabee5ea5c 100644 --- a/python/PyQt6/core/auto_additions/qgis.py +++ b/python/PyQt6/core/auto_additions/qgis.py @@ -2716,20 +2716,66 @@ # monkey patching scoped based enum QgsRasterPipe.ResampleFilter = Qgis.RasterResamplingStage.ResampleFilter QgsRasterPipe.ResampleFilter.is_monkey_patched = True -QgsRasterPipe.ResampleFilter.__doc__ = "" +QgsRasterPipe.ResampleFilter.__doc__ = "Resampling occurs in ResamplingFilter" QgsRasterPipe.Provider = Qgis.RasterResamplingStage.Provider QgsRasterPipe.Provider.is_monkey_patched = True -QgsRasterPipe.Provider.__doc__ = "" +QgsRasterPipe.Provider.__doc__ = "Resampling occurs in Provider" Qgis.RasterResamplingStage.__doc__ = """Stage at which raster resampling occurs. .. versionadded:: 3.22 -* ``ResampleFilter``: -* ``Provider``: +* ``ResampleFilter``: Resampling occurs in ResamplingFilter +* ``Provider``: Resampling occurs in Provider """ # -- Qgis.RasterResamplingStage.baseClass = Qgis +QgsRasterDataProvider.ResamplingMethod = Qgis.RasterResamplingMethod +# monkey patching scoped based enum +QgsRasterDataProvider.Nearest = Qgis.RasterResamplingMethod.Nearest +QgsRasterDataProvider.Nearest.is_monkey_patched = True +QgsRasterDataProvider.Nearest.__doc__ = "Nearest-neighbour resampling" +QgsRasterDataProvider.Bilinear = Qgis.RasterResamplingMethod.Bilinear +QgsRasterDataProvider.Bilinear.is_monkey_patched = True +QgsRasterDataProvider.Bilinear.__doc__ = "Bilinear (2x2 kernel) resampling" +QgsRasterDataProvider.Cubic = Qgis.RasterResamplingMethod.Cubic +QgsRasterDataProvider.Cubic.is_monkey_patched = True +QgsRasterDataProvider.Cubic.__doc__ = "Cubic Convolution Approximation (4x4 kernel) resampling" +QgsRasterDataProvider.CubicSpline = Qgis.RasterResamplingMethod.CubicSpline +QgsRasterDataProvider.CubicSpline.is_monkey_patched = True +QgsRasterDataProvider.CubicSpline.__doc__ = "Cubic B-Spline Approximation (4x4 kernel)" +QgsRasterDataProvider.Lanczos = Qgis.RasterResamplingMethod.Lanczos +QgsRasterDataProvider.Lanczos.is_monkey_patched = True +QgsRasterDataProvider.Lanczos.__doc__ = "Lanczos windowed sinc interpolation (6x6 kernel)" +QgsRasterDataProvider.Average = Qgis.RasterResamplingMethod.Average +QgsRasterDataProvider.Average.is_monkey_patched = True +QgsRasterDataProvider.Average.__doc__ = "Average resampling" +QgsRasterDataProvider.Mode = Qgis.RasterResamplingMethod.Mode +QgsRasterDataProvider.Mode.is_monkey_patched = True +QgsRasterDataProvider.Mode.__doc__ = "Mode (selects the value which appears most often of all the sampled points)" +QgsRasterDataProvider.Gauss = Qgis.RasterResamplingMethod.Gauss +QgsRasterDataProvider.Gauss.is_monkey_patched = True +QgsRasterDataProvider.Gauss.__doc__ = "Gauss blurring" +Qgis.RasterResamplingMethod.__doc__ = """Resampling method for raster provider-level resampling. + +.. note:: + + Prior to QGIS 3.42 this was available as :py:class:`QgsRasterDataProvider`.ResamplingMethod + +.. versionadded:: 3.42 + +* ``Nearest``: Nearest-neighbour resampling +* ``Bilinear``: Bilinear (2x2 kernel) resampling +* ``Cubic``: Cubic Convolution Approximation (4x4 kernel) resampling +* ``CubicSpline``: Cubic B-Spline Approximation (4x4 kernel) +* ``Lanczos``: Lanczos windowed sinc interpolation (6x6 kernel) +* ``Average``: Average resampling +* ``Mode``: Mode (selects the value which appears most often of all the sampled points) +* ``Gauss``: Gauss blurring + +""" +# -- +Qgis.RasterResamplingMethod.baseClass = Qgis # monkey patching scoped based enum Qgis.RasterRendererFlag.InternalLayerOpacityHandling.__doc__ = "The renderer internally handles the raster layer's opacity, so the default layer level opacity handling should not be applied." Qgis.RasterRendererFlag.UseNoDataForOutOfRangePixels.__doc__ = "Out of range pixels (eg those values outside of the rendered map's z range filter) should be set using additional nodata values instead of additional transparency values \n.. versionadded:: 3.38" diff --git a/python/PyQt6/core/auto_additions/qgsrasterdataprovider.py b/python/PyQt6/core/auto_additions/qgsrasterdataprovider.py index 1eaa7562ff060..d5e07960fbd0d 100644 --- a/python/PyQt6/core/auto_additions/qgsrasterdataprovider.py +++ b/python/PyQt6/core/auto_additions/qgsrasterdataprovider.py @@ -1,30 +1,6 @@ # The following has been generated automatically from src/core/raster/qgsrasterdataprovider.h QgsRasterDataProvider.TransformImageToLayer = QgsRasterDataProvider.TransformType.TransformImageToLayer QgsRasterDataProvider.TransformLayerToImage = QgsRasterDataProvider.TransformType.TransformLayerToImage -# monkey patching scoped based enum -QgsRasterDataProvider.ResamplingMethod.Nearest.__doc__ = "Nearest-neighbour resampling" -QgsRasterDataProvider.ResamplingMethod.Bilinear.__doc__ = "Bilinear (2x2 kernel) resampling" -QgsRasterDataProvider.ResamplingMethod.Cubic.__doc__ = "Cubic Convolution Approximation (4x4 kernel) resampling" -QgsRasterDataProvider.ResamplingMethod.CubicSpline.__doc__ = "Cubic B-Spline Approximation (4x4 kernel)" -QgsRasterDataProvider.ResamplingMethod.Lanczos.__doc__ = "Lanczos windowed sinc interpolation (6x6 kernel)" -QgsRasterDataProvider.ResamplingMethod.Average.__doc__ = "Average resampling" -QgsRasterDataProvider.ResamplingMethod.Mode.__doc__ = "Mode (selects the value which appears most often of all the sampled points)" -QgsRasterDataProvider.ResamplingMethod.Gauss.__doc__ = "Gauss blurring" -QgsRasterDataProvider.ResamplingMethod.__doc__ = """Resampling method for provider-level resampling. - -.. versionadded:: 3.16 - -* ``Nearest``: Nearest-neighbour resampling -* ``Bilinear``: Bilinear (2x2 kernel) resampling -* ``Cubic``: Cubic Convolution Approximation (4x4 kernel) resampling -* ``CubicSpline``: Cubic B-Spline Approximation (4x4 kernel) -* ``Lanczos``: Lanczos windowed sinc interpolation (6x6 kernel) -* ``Average``: Average resampling -* ``Mode``: Mode (selects the value which appears most often of all the sampled points) -* ``Gauss``: Gauss blurring - -""" -# -- try: QgsImageFetcher.__attribute_docs__ = {'finish': 'Emitted when the download completes\n\n:param legend: The downloaded legend image\n', 'progress': 'Emitted to report progress\n', 'error': 'Emitted when an error occurs\n'} QgsImageFetcher.__signal_arguments__ = {'finish': ['legend: QImage'], 'progress': ['received: int', 'total: int'], 'error': ['msg: str']} diff --git a/python/PyQt6/core/auto_generated/qgis.sip.in b/python/PyQt6/core/auto_generated/qgis.sip.in index ce406a2621637..5f6754db4bf54 100644 --- a/python/PyQt6/core/auto_generated/qgis.sip.in +++ b/python/PyQt6/core/auto_generated/qgis.sip.in @@ -828,10 +828,20 @@ The development version enum class RasterResamplingStage /BaseType=IntEnum/ { - //! Resampling occurs in ResamplingFilter ResampleFilter, - //! Resampling occurs in Provider - Provider + Provider, + }; + + enum class RasterResamplingMethod /BaseType=IntEnum/ + { + Nearest, + Bilinear, + Cubic, + CubicSpline, + Lanczos, + Average, + Mode, + Gauss }; enum class RasterRendererFlag /BaseType=IntFlag/ diff --git a/python/PyQt6/core/auto_generated/raster/qgsrasterdataprovider.sip.in b/python/PyQt6/core/auto_generated/raster/qgsrasterdataprovider.sip.in index 58ebc0c3b1fa8..2426d7e986a02 100644 --- a/python/PyQt6/core/auto_generated/raster/qgsrasterdataprovider.sip.in +++ b/python/PyQt6/core/auto_generated/raster/qgsrasterdataprovider.sip.in @@ -627,19 +627,7 @@ Returns whether provider-level resampling is enabled. .. versionadded:: 3.16 %End - enum class ResamplingMethod - { - Nearest, - Bilinear, - Cubic, - CubicSpline, - Lanczos, - Average, - Mode, - Gauss - }; - - virtual bool setZoomedInResamplingMethod( ResamplingMethod method ); + virtual bool setZoomedInResamplingMethod( Qgis::RasterResamplingMethod method ); %Docstring Set resampling method to apply for zoomed-in operations. @@ -648,14 +636,14 @@ Set resampling method to apply for zoomed-in operations. .. versionadded:: 3.16 %End - ResamplingMethod zoomedInResamplingMethod() const; + Qgis::RasterResamplingMethod zoomedInResamplingMethod() const; %Docstring Returns resampling method for zoomed-in operations. .. versionadded:: 3.16 %End - virtual bool setZoomedOutResamplingMethod( ResamplingMethod method ); + virtual bool setZoomedOutResamplingMethod( Qgis::RasterResamplingMethod method ); %Docstring Set resampling method to apply for zoomed-out operations. @@ -664,7 +652,7 @@ Set resampling method to apply for zoomed-out operations. .. versionadded:: 3.16 %End - ResamplingMethod zoomedOutResamplingMethod() const; + Qgis::RasterResamplingMethod zoomedOutResamplingMethod() const; %Docstring Returns resampling method for zoomed-out operations. diff --git a/python/core/auto_additions/qgis.py b/python/core/auto_additions/qgis.py index c9cc2dce34190..fcfb3401a36cf 100644 --- a/python/core/auto_additions/qgis.py +++ b/python/core/auto_additions/qgis.py @@ -2686,20 +2686,66 @@ # monkey patching scoped based enum QgsRasterPipe.ResampleFilter = Qgis.RasterResamplingStage.ResampleFilter QgsRasterPipe.ResampleFilter.is_monkey_patched = True -QgsRasterPipe.ResampleFilter.__doc__ = "" +QgsRasterPipe.ResampleFilter.__doc__ = "Resampling occurs in ResamplingFilter" QgsRasterPipe.Provider = Qgis.RasterResamplingStage.Provider QgsRasterPipe.Provider.is_monkey_patched = True -QgsRasterPipe.Provider.__doc__ = "" +QgsRasterPipe.Provider.__doc__ = "Resampling occurs in Provider" Qgis.RasterResamplingStage.__doc__ = """Stage at which raster resampling occurs. .. versionadded:: 3.22 -* ``ResampleFilter``: -* ``Provider``: +* ``ResampleFilter``: Resampling occurs in ResamplingFilter +* ``Provider``: Resampling occurs in Provider """ # -- Qgis.RasterResamplingStage.baseClass = Qgis +QgsRasterDataProvider.ResamplingMethod = Qgis.RasterResamplingMethod +# monkey patching scoped based enum +QgsRasterDataProvider.Nearest = Qgis.RasterResamplingMethod.Nearest +QgsRasterDataProvider.Nearest.is_monkey_patched = True +QgsRasterDataProvider.Nearest.__doc__ = "Nearest-neighbour resampling" +QgsRasterDataProvider.Bilinear = Qgis.RasterResamplingMethod.Bilinear +QgsRasterDataProvider.Bilinear.is_monkey_patched = True +QgsRasterDataProvider.Bilinear.__doc__ = "Bilinear (2x2 kernel) resampling" +QgsRasterDataProvider.Cubic = Qgis.RasterResamplingMethod.Cubic +QgsRasterDataProvider.Cubic.is_monkey_patched = True +QgsRasterDataProvider.Cubic.__doc__ = "Cubic Convolution Approximation (4x4 kernel) resampling" +QgsRasterDataProvider.CubicSpline = Qgis.RasterResamplingMethod.CubicSpline +QgsRasterDataProvider.CubicSpline.is_monkey_patched = True +QgsRasterDataProvider.CubicSpline.__doc__ = "Cubic B-Spline Approximation (4x4 kernel)" +QgsRasterDataProvider.Lanczos = Qgis.RasterResamplingMethod.Lanczos +QgsRasterDataProvider.Lanczos.is_monkey_patched = True +QgsRasterDataProvider.Lanczos.__doc__ = "Lanczos windowed sinc interpolation (6x6 kernel)" +QgsRasterDataProvider.Average = Qgis.RasterResamplingMethod.Average +QgsRasterDataProvider.Average.is_monkey_patched = True +QgsRasterDataProvider.Average.__doc__ = "Average resampling" +QgsRasterDataProvider.Mode = Qgis.RasterResamplingMethod.Mode +QgsRasterDataProvider.Mode.is_monkey_patched = True +QgsRasterDataProvider.Mode.__doc__ = "Mode (selects the value which appears most often of all the sampled points)" +QgsRasterDataProvider.Gauss = Qgis.RasterResamplingMethod.Gauss +QgsRasterDataProvider.Gauss.is_monkey_patched = True +QgsRasterDataProvider.Gauss.__doc__ = "Gauss blurring" +Qgis.RasterResamplingMethod.__doc__ = """Resampling method for raster provider-level resampling. + +.. note:: + + Prior to QGIS 3.42 this was available as :py:class:`QgsRasterDataProvider`.ResamplingMethod + +.. versionadded:: 3.42 + +* ``Nearest``: Nearest-neighbour resampling +* ``Bilinear``: Bilinear (2x2 kernel) resampling +* ``Cubic``: Cubic Convolution Approximation (4x4 kernel) resampling +* ``CubicSpline``: Cubic B-Spline Approximation (4x4 kernel) +* ``Lanczos``: Lanczos windowed sinc interpolation (6x6 kernel) +* ``Average``: Average resampling +* ``Mode``: Mode (selects the value which appears most often of all the sampled points) +* ``Gauss``: Gauss blurring + +""" +# -- +Qgis.RasterResamplingMethod.baseClass = Qgis # monkey patching scoped based enum Qgis.RasterRendererFlag.InternalLayerOpacityHandling.__doc__ = "The renderer internally handles the raster layer's opacity, so the default layer level opacity handling should not be applied." Qgis.RasterRendererFlag.UseNoDataForOutOfRangePixels.__doc__ = "Out of range pixels (eg those values outside of the rendered map's z range filter) should be set using additional nodata values instead of additional transparency values \n.. versionadded:: 3.38" diff --git a/python/core/auto_additions/qgsrasterdataprovider.py b/python/core/auto_additions/qgsrasterdataprovider.py index e618c31873671..86845d12e1e8d 100644 --- a/python/core/auto_additions/qgsrasterdataprovider.py +++ b/python/core/auto_additions/qgsrasterdataprovider.py @@ -1,28 +1,4 @@ # The following has been generated automatically from src/core/raster/qgsrasterdataprovider.h -# monkey patching scoped based enum -QgsRasterDataProvider.ResamplingMethod.Nearest.__doc__ = "Nearest-neighbour resampling" -QgsRasterDataProvider.ResamplingMethod.Bilinear.__doc__ = "Bilinear (2x2 kernel) resampling" -QgsRasterDataProvider.ResamplingMethod.Cubic.__doc__ = "Cubic Convolution Approximation (4x4 kernel) resampling" -QgsRasterDataProvider.ResamplingMethod.CubicSpline.__doc__ = "Cubic B-Spline Approximation (4x4 kernel)" -QgsRasterDataProvider.ResamplingMethod.Lanczos.__doc__ = "Lanczos windowed sinc interpolation (6x6 kernel)" -QgsRasterDataProvider.ResamplingMethod.Average.__doc__ = "Average resampling" -QgsRasterDataProvider.ResamplingMethod.Mode.__doc__ = "Mode (selects the value which appears most often of all the sampled points)" -QgsRasterDataProvider.ResamplingMethod.Gauss.__doc__ = "Gauss blurring" -QgsRasterDataProvider.ResamplingMethod.__doc__ = """Resampling method for provider-level resampling. - -.. versionadded:: 3.16 - -* ``Nearest``: Nearest-neighbour resampling -* ``Bilinear``: Bilinear (2x2 kernel) resampling -* ``Cubic``: Cubic Convolution Approximation (4x4 kernel) resampling -* ``CubicSpline``: Cubic B-Spline Approximation (4x4 kernel) -* ``Lanczos``: Lanczos windowed sinc interpolation (6x6 kernel) -* ``Average``: Average resampling -* ``Mode``: Mode (selects the value which appears most often of all the sampled points) -* ``Gauss``: Gauss blurring - -""" -# -- try: QgsImageFetcher.__attribute_docs__ = {'finish': 'Emitted when the download completes\n\n:param legend: The downloaded legend image\n', 'progress': 'Emitted to report progress\n', 'error': 'Emitted when an error occurs\n'} QgsImageFetcher.__signal_arguments__ = {'finish': ['legend: QImage'], 'progress': ['received: int', 'total: int'], 'error': ['msg: str']} diff --git a/python/core/auto_generated/qgis.sip.in b/python/core/auto_generated/qgis.sip.in index 2f9afc37d003c..42f53eeb27308 100644 --- a/python/core/auto_generated/qgis.sip.in +++ b/python/core/auto_generated/qgis.sip.in @@ -828,10 +828,20 @@ The development version enum class RasterResamplingStage { - //! Resampling occurs in ResamplingFilter ResampleFilter, - //! Resampling occurs in Provider - Provider + Provider, + }; + + enum class RasterResamplingMethod + { + Nearest, + Bilinear, + Cubic, + CubicSpline, + Lanczos, + Average, + Mode, + Gauss }; enum class RasterRendererFlag diff --git a/python/core/auto_generated/raster/qgsrasterdataprovider.sip.in b/python/core/auto_generated/raster/qgsrasterdataprovider.sip.in index ee34a4777952a..fba67d93fe2a2 100644 --- a/python/core/auto_generated/raster/qgsrasterdataprovider.sip.in +++ b/python/core/auto_generated/raster/qgsrasterdataprovider.sip.in @@ -627,19 +627,7 @@ Returns whether provider-level resampling is enabled. .. versionadded:: 3.16 %End - enum class ResamplingMethod - { - Nearest, - Bilinear, - Cubic, - CubicSpline, - Lanczos, - Average, - Mode, - Gauss - }; - - virtual bool setZoomedInResamplingMethod( ResamplingMethod method ); + virtual bool setZoomedInResamplingMethod( Qgis::RasterResamplingMethod method ); %Docstring Set resampling method to apply for zoomed-in operations. @@ -648,14 +636,14 @@ Set resampling method to apply for zoomed-in operations. .. versionadded:: 3.16 %End - ResamplingMethod zoomedInResamplingMethod() const; + Qgis::RasterResamplingMethod zoomedInResamplingMethod() const; %Docstring Returns resampling method for zoomed-in operations. .. versionadded:: 3.16 %End - virtual bool setZoomedOutResamplingMethod( ResamplingMethod method ); + virtual bool setZoomedOutResamplingMethod( Qgis::RasterResamplingMethod method ); %Docstring Set resampling method to apply for zoomed-out operations. @@ -664,7 +652,7 @@ Set resampling method to apply for zoomed-out operations. .. versionadded:: 3.16 %End - ResamplingMethod zoomedOutResamplingMethod() const; + Qgis::RasterResamplingMethod zoomedOutResamplingMethod() const; %Docstring Returns resampling method for zoomed-out operations. diff --git a/src/core/providers/gdal/qgsgdalprovider.cpp b/src/core/providers/gdal/qgsgdalprovider.cpp index d91fd8ac6213e..e9a399fbaac90 100644 --- a/src/core/providers/gdal/qgsgdalprovider.cpp +++ b/src/core/providers/gdal/qgsgdalprovider.cpp @@ -755,18 +755,18 @@ bool QgsGdalProvider::canDoResampling( if ( resamplingFactor < 1 ) { // upsampling - return mZoomedInResamplingMethod != QgsRasterDataProvider::ResamplingMethod::Nearest; + return mZoomedInResamplingMethod != Qgis::RasterResamplingMethod::Nearest; } if ( resamplingFactor < 1.1 ) { // very close to nominal resolution ==> check compatibility of zoom-in or zoom-out resampler with what GDAL can do - return mZoomedInResamplingMethod != QgsRasterDataProvider::ResamplingMethod::Nearest || - mZoomedOutResamplingMethod != QgsRasterDataProvider::ResamplingMethod::Nearest; + return mZoomedInResamplingMethod != Qgis::RasterResamplingMethod::Nearest || + mZoomedOutResamplingMethod != Qgis::RasterResamplingMethod::Nearest; } // if no zoom out resampling, exit now - if ( mZoomedOutResamplingMethod == QgsRasterDataProvider::ResamplingMethod::Nearest ) + if ( mZoomedOutResamplingMethod == Qgis::RasterResamplingMethod::Nearest ) { return false; } @@ -795,40 +795,40 @@ bool QgsGdalProvider::canDoResampling( return false; } -static GDALRIOResampleAlg getGDALResamplingAlg( QgsGdalProvider::ResamplingMethod method ) +static GDALRIOResampleAlg getGDALResamplingAlg( Qgis::RasterResamplingMethod method ) { GDALRIOResampleAlg eResampleAlg = GRIORA_NearestNeighbour; switch ( method ) { - case QgsGdalProvider::ResamplingMethod::Nearest: + case Qgis::RasterResamplingMethod::Nearest: eResampleAlg = GRIORA_NearestNeighbour; break; - case QgsGdalProvider::ResamplingMethod::Bilinear: + case Qgis::RasterResamplingMethod::Bilinear: eResampleAlg = GRIORA_Bilinear; break; - case QgsGdalProvider::ResamplingMethod::Cubic: + case Qgis::RasterResamplingMethod::Cubic: eResampleAlg = GRIORA_Cubic; break; - case QgsRasterDataProvider::ResamplingMethod::CubicSpline: + case Qgis::RasterResamplingMethod::CubicSpline: eResampleAlg = GRIORA_CubicSpline; break; - case QgsRasterDataProvider::ResamplingMethod::Lanczos: + case Qgis::RasterResamplingMethod::Lanczos: eResampleAlg = GRIORA_Lanczos; break; - case QgsRasterDataProvider::ResamplingMethod::Average: + case Qgis::RasterResamplingMethod::Average: eResampleAlg = GRIORA_Average; break; - case QgsRasterDataProvider::ResamplingMethod::Mode: + case Qgis::RasterResamplingMethod::Mode: eResampleAlg = GRIORA_Mode; break; - case QgsRasterDataProvider::ResamplingMethod::Gauss: + case Qgis::RasterResamplingMethod::Gauss: eResampleAlg = GRIORA_Gauss; break; } @@ -981,7 +981,7 @@ bool QgsGdalProvider::readBlock( int bandNo, QgsRectangle const &reqExtent, int GDALRasterIOExtraArg sExtraArg; INIT_RASTERIO_EXTRA_ARG( sExtraArg ); - ResamplingMethod method; + Qgis::RasterResamplingMethod method; if ( resamplingFactor < 1 ) { method = mZoomedInResamplingMethod; @@ -989,7 +989,7 @@ bool QgsGdalProvider::readBlock( int bandNo, QgsRectangle const &reqExtent, int else if ( resamplingFactor < 1.1 ) { // very close to nominal resolution ==> use either zoomed out resampler or zoomed in resampler - if ( mZoomedOutResamplingMethod != ResamplingMethod::Nearest ) + if ( mZoomedOutResamplingMethod != Qgis::RasterResamplingMethod::Nearest ) method = mZoomedOutResamplingMethod; else method = mZoomedInResamplingMethod; @@ -1037,7 +1037,7 @@ bool QgsGdalProvider::readBlock( int bandNo, QgsRectangle const &reqExtent, int // (too much downsampling compared to the allowed maximum resampling factor), // so fallback to something replicating QgsRasterResampleFilter behavior else if ( mProviderResamplingEnabled && - mZoomedOutResamplingMethod != QgsRasterDataProvider::ResamplingMethod::Nearest && + mZoomedOutResamplingMethod != Qgis::RasterResamplingMethod::Nearest && resamplingFactor > 1 ) { // Do the resampling in two steps: diff --git a/src/core/providers/gdal/qgsgdalprovider.h b/src/core/providers/gdal/qgsgdalprovider.h index 3bbff95a0e943..3f21fc2888046 100644 --- a/src/core/providers/gdal/qgsgdalprovider.h +++ b/src/core/providers/gdal/qgsgdalprovider.h @@ -216,8 +216,8 @@ class QgsGdalProvider final: public QgsRasterDataProvider, QgsGdalProviderBase QgsPoint transformCoordinates( const QgsPoint &point, TransformType type ) override; bool enableProviderResampling( bool enable ) override { mProviderResamplingEnabled = enable; return true; } - bool setZoomedInResamplingMethod( ResamplingMethod method ) override { mZoomedInResamplingMethod = method; return true; } - bool setZoomedOutResamplingMethod( ResamplingMethod method ) override { mZoomedOutResamplingMethod = method; return true; } + bool setZoomedInResamplingMethod( Qgis::RasterResamplingMethod method ) override { mZoomedInResamplingMethod = method; return true; } + bool setZoomedOutResamplingMethod( Qgis::RasterResamplingMethod method ) override { mZoomedOutResamplingMethod = method; return true; } bool setMaxOversampling( double factor ) override { mMaxOversampling = factor; return true; } Qgis::ProviderStyleStorageCapabilities styleStorageCapabilities() const override; diff --git a/src/core/qgis.h b/src/core/qgis.h index 8d470111f521e..8adab7bfdfa35 100644 --- a/src/core/qgis.h +++ b/src/core/qgis.h @@ -1378,13 +1378,31 @@ class CORE_EXPORT Qgis */ enum class RasterResamplingStage SIP_MONKEYPATCH_SCOPEENUM_UNNEST( QgsRasterPipe, ResamplingStage ) : int { - //! Resampling occurs in ResamplingFilter - ResampleFilter, - //! Resampling occurs in Provider - Provider + ResampleFilter, //!< Resampling occurs in ResamplingFilter + Provider, //!< Resampling occurs in Provider }; Q_ENUM( RasterResamplingStage ) + /** + * Resampling method for raster provider-level resampling. + * + * \note Prior to QGIS 3.42 this was available as QgsRasterDataProvider::ResamplingMethod + * + * \since QGIS 3.42 + */ + enum class RasterResamplingMethod SIP_MONKEYPATCH_SCOPEENUM_UNNEST( QgsRasterDataProvider, ResamplingMethod ) : int + { + Nearest, //!< Nearest-neighbour resampling + Bilinear, //!< Bilinear (2x2 kernel) resampling + Cubic, //!< Cubic Convolution Approximation (4x4 kernel) resampling + CubicSpline, //!< Cubic B-Spline Approximation (4x4 kernel) + Lanczos, //!< Lanczos windowed sinc interpolation (6x6 kernel) + Average, //!< Average resampling + Mode, //!< Mode (selects the value which appears most often of all the sampled points) + Gauss //!< Gauss blurring + }; + Q_ENUM( RasterResamplingMethod ) + /** * Flags which control behavior of raster renderers. * diff --git a/src/core/qgsgdalutils.cpp b/src/core/qgsgdalutils.cpp index afe05bf06573b..8d3310cf9911c 100644 --- a/src/core/qgsgdalutils.cpp +++ b/src/core/qgsgdalutils.cpp @@ -636,37 +636,37 @@ GDALDataType QgsGdalUtils::gdalDataTypeFromQgisDataType( Qgis::DataType dataType return GDALDataType::GDT_Unknown; } -GDALResampleAlg QgsGdalUtils::gdalResamplingAlgorithm( QgsRasterDataProvider::ResamplingMethod method ) +GDALResampleAlg QgsGdalUtils::gdalResamplingAlgorithm( Qgis::RasterResamplingMethod method ) { GDALResampleAlg eResampleAlg = GRA_NearestNeighbour; switch ( method ) { - case QgsRasterDataProvider::ResamplingMethod::Nearest: - case QgsRasterDataProvider::ResamplingMethod::Gauss: // Gauss not available in GDALResampleAlg + case Qgis::RasterResamplingMethod::Nearest: + case Qgis::RasterResamplingMethod::Gauss: // Gauss not available in GDALResampleAlg eResampleAlg = GRA_NearestNeighbour; break; - case QgsRasterDataProvider::ResamplingMethod::Bilinear: + case Qgis::RasterResamplingMethod::Bilinear: eResampleAlg = GRA_Bilinear; break; - case QgsRasterDataProvider::ResamplingMethod::Cubic: + case Qgis::RasterResamplingMethod::Cubic: eResampleAlg = GRA_Cubic; break; - case QgsRasterDataProvider::ResamplingMethod::CubicSpline: + case Qgis::RasterResamplingMethod::CubicSpline: eResampleAlg = GRA_CubicSpline; break; - case QgsRasterDataProvider::ResamplingMethod::Lanczos: + case Qgis::RasterResamplingMethod::Lanczos: eResampleAlg = GRA_Lanczos; break; - case QgsRasterDataProvider::ResamplingMethod::Average: + case Qgis::RasterResamplingMethod::Average: eResampleAlg = GRA_Average; break; - case QgsRasterDataProvider::ResamplingMethod::Mode: + case Qgis::RasterResamplingMethod::Mode: eResampleAlg = GRA_Mode; break; } diff --git a/src/core/qgsgdalutils.h b/src/core/qgsgdalutils.h index bc7ca47d5e8b3..8edc348d2226f 100644 --- a/src/core/qgsgdalutils.h +++ b/src/core/qgsgdalutils.h @@ -22,7 +22,8 @@ #include #include "qgsogrutils.h" -#include "qgsrasterdataprovider.h" + +class QgsRasterBlock; /** * \ingroup core @@ -253,7 +254,7 @@ class CORE_EXPORT QgsGdalUtils * * \since QGIS 3.30 */ - static GDALResampleAlg gdalResamplingAlgorithm( QgsRasterDataProvider::ResamplingMethod method ); + static GDALResampleAlg gdalResamplingAlgorithm( Qgis::RasterResamplingMethod method ); #ifndef QT_NO_NETWORKPROXY //! Sets the gdal proxy variables diff --git a/src/core/raster/qgsrasterdataprovider.cpp b/src/core/raster/qgsrasterdataprovider.cpp index d58648ad68d87..4cdc3d136c5e5 100644 --- a/src/core/raster/qgsrasterdataprovider.cpp +++ b/src/core/raster/qgsrasterdataprovider.cpp @@ -598,37 +598,37 @@ void QgsRasterDataProvider::copyBaseSettings( const QgsRasterDataProvider &other } } -static QgsRasterDataProvider::ResamplingMethod resamplingMethodFromString( const QString &str ) +static Qgis::RasterResamplingMethod resamplingMethodFromString( const QString &str ) { if ( str == QLatin1String( "bilinear" ) ) { - return QgsRasterDataProvider::ResamplingMethod::Bilinear; + return Qgis::RasterResamplingMethod::Bilinear; } else if ( str == QLatin1String( "cubic" ) ) { - return QgsRasterDataProvider::ResamplingMethod::Cubic; + return Qgis::RasterResamplingMethod::Cubic; } else if ( str == QLatin1String( "cubicSpline" ) ) { - return QgsRasterDataProvider::ResamplingMethod::CubicSpline; + return Qgis::RasterResamplingMethod::CubicSpline; } else if ( str == QLatin1String( "lanczos" ) ) { - return QgsRasterDataProvider::ResamplingMethod::Lanczos; + return Qgis::RasterResamplingMethod::Lanczos; } else if ( str == QLatin1String( "average" ) ) { - return QgsRasterDataProvider::ResamplingMethod::Average; + return Qgis::RasterResamplingMethod::Average; } else if ( str == QLatin1String( "mode" ) ) { - return QgsRasterDataProvider::ResamplingMethod::Mode; + return Qgis::RasterResamplingMethod::Mode; } else if ( str == QLatin1String( "gauss" ) ) { - return QgsRasterDataProvider::ResamplingMethod::Gauss; + return Qgis::RasterResamplingMethod::Gauss; } - return QgsRasterDataProvider::ResamplingMethod::Nearest; + return Qgis::RasterResamplingMethod::Nearest; } void QgsRasterDataProvider::readXml( const QDomElement &filterElem ) @@ -650,25 +650,25 @@ void QgsRasterDataProvider::readXml( const QDomElement &filterElem ) } } -static QString resamplingMethodToString( QgsRasterDataProvider::ResamplingMethod method ) +static QString resamplingMethodToString( Qgis::RasterResamplingMethod method ) { switch ( method ) { - case QgsRasterDataProvider::ResamplingMethod::Nearest: + case Qgis::RasterResamplingMethod::Nearest: return QStringLiteral( "nearestNeighbour" ); - case QgsRasterDataProvider::ResamplingMethod::Bilinear: + case Qgis::RasterResamplingMethod::Bilinear: return QStringLiteral( "bilinear" ); - case QgsRasterDataProvider::ResamplingMethod::Cubic: + case Qgis::RasterResamplingMethod::Cubic: return QStringLiteral( "cubic" ); - case QgsRasterDataProvider::ResamplingMethod::CubicSpline: + case Qgis::RasterResamplingMethod::CubicSpline: return QStringLiteral( "cubicSpline" ); - case QgsRasterDataProvider::ResamplingMethod::Lanczos: + case Qgis::RasterResamplingMethod::Lanczos: return QStringLiteral( "lanczos" ); - case QgsRasterDataProvider::ResamplingMethod::Average: + case Qgis::RasterResamplingMethod::Average: return QStringLiteral( "average" ); - case QgsRasterDataProvider::ResamplingMethod::Mode: + case Qgis::RasterResamplingMethod::Mode: return QStringLiteral( "mode" ); - case QgsRasterDataProvider::ResamplingMethod::Gauss: + case Qgis::RasterResamplingMethod::Gauss: return QStringLiteral( "gauss" ); } // should not happen diff --git a/src/core/raster/qgsrasterdataprovider.h b/src/core/raster/qgsrasterdataprovider.h index f747750664cda..8fd0b4f0f4a4a 100644 --- a/src/core/raster/qgsrasterdataprovider.h +++ b/src/core/raster/qgsrasterdataprovider.h @@ -623,35 +623,19 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast */ bool isProviderResamplingEnabled() const { return mProviderResamplingEnabled; } - /** - * Resampling method for provider-level resampling. - * \since QGIS 3.16 - */ - enum class ResamplingMethod - { - Nearest, //!< Nearest-neighbour resampling - Bilinear, //!< Bilinear (2x2 kernel) resampling - Cubic,//!< Cubic Convolution Approximation (4x4 kernel) resampling - CubicSpline, //!< Cubic B-Spline Approximation (4x4 kernel) - Lanczos, //!< Lanczos windowed sinc interpolation (6x6 kernel) - Average, //!< Average resampling - Mode, //!< Mode (selects the value which appears most often of all the sampled points) - Gauss //!< Gauss blurring - }; - /** * Set resampling method to apply for zoomed-in operations. * * \return TRUE if success * \since QGIS 3.16 */ - virtual bool setZoomedInResamplingMethod( ResamplingMethod method ) { Q_UNUSED( method ); return false; } + virtual bool setZoomedInResamplingMethod( Qgis::RasterResamplingMethod method ) { Q_UNUSED( method ); return false; } /** * Returns resampling method for zoomed-in operations. * \since QGIS 3.16 */ - ResamplingMethod zoomedInResamplingMethod() const { return mZoomedInResamplingMethod; } + Qgis::RasterResamplingMethod zoomedInResamplingMethod() const { return mZoomedInResamplingMethod; } /** * Set resampling method to apply for zoomed-out operations. @@ -659,13 +643,13 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast * \return TRUE if success * \since QGIS 3.16 */ - virtual bool setZoomedOutResamplingMethod( ResamplingMethod method ) { Q_UNUSED( method ); return false; } + virtual bool setZoomedOutResamplingMethod( Qgis::RasterResamplingMethod method ) { Q_UNUSED( method ); return false; } /** * Returns resampling method for zoomed-out operations. * \since QGIS 3.16 */ - ResamplingMethod zoomedOutResamplingMethod() const { return mZoomedOutResamplingMethod; } + Qgis::RasterResamplingMethod zoomedOutResamplingMethod() const { return mZoomedOutResamplingMethod; } /** * Sets maximum oversampling factor for zoomed-out operations. @@ -827,10 +811,10 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast bool mProviderResamplingEnabled = false; //! Resampling method for zoomed in pixel extraction - ResamplingMethod mZoomedInResamplingMethod = ResamplingMethod::Nearest; + Qgis::RasterResamplingMethod mZoomedInResamplingMethod = Qgis::RasterResamplingMethod::Nearest; //! Resampling method for zoomed out pixel extraction - ResamplingMethod mZoomedOutResamplingMethod = ResamplingMethod::Nearest; + Qgis::RasterResamplingMethod mZoomedOutResamplingMethod = Qgis::RasterResamplingMethod::Nearest; //! Maximum boundary for oversampling (to avoid too much data traffic). Default: 2.0 double mMaxOversampling = 2.0; diff --git a/src/core/raster/qgsrasterlayer.cpp b/src/core/raster/qgsrasterlayer.cpp index b438d8d449e20..93b73e8739a8d 100644 --- a/src/core/raster/qgsrasterlayer.cpp +++ b/src/core/raster/qgsrasterlayer.cpp @@ -964,18 +964,18 @@ void QgsRasterLayer::setDataProvider( QString const &provider, const QgsDataProv if ( resampling == QLatin1String( "bilinear" ) ) { resampleFilter->setZoomedInResampler( new QgsBilinearRasterResampler() ); - mDataProvider->setZoomedInResamplingMethod( QgsRasterDataProvider::ResamplingMethod::Bilinear ); + mDataProvider->setZoomedInResamplingMethod( Qgis::RasterResamplingMethod::Bilinear ); } else if ( resampling == QLatin1String( "cubic" ) ) { resampleFilter->setZoomedInResampler( new QgsCubicRasterResampler() ); - mDataProvider->setZoomedInResamplingMethod( QgsRasterDataProvider::ResamplingMethod::Cubic ); + mDataProvider->setZoomedInResamplingMethod( Qgis::RasterResamplingMethod::Cubic ); } resampling = settings.value( QStringLiteral( "/Raster/defaultZoomedOutResampling" ), QStringLiteral( "nearest neighbour" ) ).toString(); if ( resampling == QLatin1String( "bilinear" ) ) { resampleFilter->setZoomedOutResampler( new QgsBilinearRasterResampler() ); - mDataProvider->setZoomedOutResamplingMethod( QgsRasterDataProvider::ResamplingMethod::Bilinear ); + mDataProvider->setZoomedOutResamplingMethod( Qgis::RasterResamplingMethod::Bilinear ); } const double maxOversampling = QgsRasterLayer::settingsRasterDefaultOversampling->value(); diff --git a/src/gui/raster/qgsresamplingutils.cpp b/src/gui/raster/qgsresamplingutils.cpp index 22aafde982f19..4c303948cd779 100644 --- a/src/gui/raster/qgsresamplingutils.cpp +++ b/src/gui/raster/qgsresamplingutils.cpp @@ -43,9 +43,9 @@ void QgsResamplingUtils::initWidgets( QgsRasterLayer *rasterLayer, QComboBox *zo for ( QComboBox *combo : { mZoomedInResamplingComboBox, mZoomedOutResamplingComboBox } ) { - combo->addItem( QObject::tr( "Nearest Neighbour" ), static_cast( QgsRasterDataProvider::ResamplingMethod::Nearest ) ); - combo->addItem( QObject::tr( "Bilinear (2x2 Kernel)" ), static_cast( QgsRasterDataProvider::ResamplingMethod::Bilinear ) ); - combo->addItem( QObject::tr( "Cubic (4x4 Kernel)" ), static_cast( QgsRasterDataProvider::ResamplingMethod::Cubic ) ); + combo->addItem( QObject::tr( "Nearest Neighbour" ), static_cast( Qgis::RasterResamplingMethod::Nearest ) ); + combo->addItem( QObject::tr( "Bilinear (2x2 Kernel)" ), static_cast( Qgis::RasterResamplingMethod::Bilinear ) ); + combo->addItem( QObject::tr( "Cubic (4x4 Kernel)" ), static_cast( Qgis::RasterResamplingMethod::Cubic ) ); } if ( mCbEarlyResampling->isChecked() ) @@ -97,16 +97,16 @@ void QgsResamplingUtils::refreshWidgetsFromLayer() { if ( zoomedInResampler->type() == QLatin1String( "bilinear" ) ) { - mZoomedInResamplingComboBox->setCurrentIndex( mZoomedInResamplingComboBox->findData( static_cast( QgsRasterDataProvider::ResamplingMethod::Bilinear ) ) ); + mZoomedInResamplingComboBox->setCurrentIndex( mZoomedInResamplingComboBox->findData( static_cast( Qgis::RasterResamplingMethod::Bilinear ) ) ); } else if ( zoomedInResampler->type() == QLatin1String( "cubic" ) ) { - mZoomedInResamplingComboBox->setCurrentIndex( mZoomedInResamplingComboBox->findData( static_cast( QgsRasterDataProvider::ResamplingMethod::Cubic ) ) ); + mZoomedInResamplingComboBox->setCurrentIndex( mZoomedInResamplingComboBox->findData( static_cast( Qgis::RasterResamplingMethod::Cubic ) ) ); } } else { - mZoomedInResamplingComboBox->setCurrentIndex( mZoomedInResamplingComboBox->findData( static_cast( QgsRasterDataProvider::ResamplingMethod::Nearest ) ) ); + mZoomedInResamplingComboBox->setCurrentIndex( mZoomedInResamplingComboBox->findData( static_cast( Qgis::RasterResamplingMethod::Nearest ) ) ); } const QgsRasterResampler *zoomedOutResampler = resampleFilter->zoomedOutResampler(); @@ -114,16 +114,16 @@ void QgsResamplingUtils::refreshWidgetsFromLayer() { if ( zoomedOutResampler->type() == QLatin1String( "bilinear" ) ) { - mZoomedOutResamplingComboBox->setCurrentIndex( mZoomedOutResamplingComboBox->findData( static_cast( QgsRasterDataProvider::ResamplingMethod::Bilinear ) ) ); + mZoomedOutResamplingComboBox->setCurrentIndex( mZoomedOutResamplingComboBox->findData( static_cast( Qgis::RasterResamplingMethod::Bilinear ) ) ); } else if ( zoomedOutResampler->type() == QLatin1String( "cubic" ) ) { - mZoomedOutResamplingComboBox->setCurrentIndex( mZoomedOutResamplingComboBox->findData( static_cast( QgsRasterDataProvider::ResamplingMethod::Cubic ) ) ); + mZoomedOutResamplingComboBox->setCurrentIndex( mZoomedOutResamplingComboBox->findData( static_cast( Qgis::RasterResamplingMethod::Cubic ) ) ); } } else { - mZoomedOutResamplingComboBox->setCurrentIndex( mZoomedOutResamplingComboBox->findData( static_cast( QgsRasterDataProvider::ResamplingMethod::Nearest ) ) ); + mZoomedOutResamplingComboBox->setCurrentIndex( mZoomedOutResamplingComboBox->findData( static_cast( Qgis::RasterResamplingMethod::Nearest ) ) ); } mMaximumOversamplingSpinBox->setValue( resampleFilter->maxOversampling() ); } @@ -133,10 +133,10 @@ void QgsResamplingUtils::refreshWidgetsFromLayer() void QgsResamplingUtils::refreshLayerFromWidgets() { - const QgsRasterDataProvider::ResamplingMethod zoomedInMethod = static_cast( + const Qgis::RasterResamplingMethod zoomedInMethod = static_cast( mZoomedInResamplingComboBox->itemData( mZoomedInResamplingComboBox->currentIndex() ).toInt() ); - const QgsRasterDataProvider::ResamplingMethod zoomedOutMethod = static_cast( + const Qgis::RasterResamplingMethod zoomedOutMethod = static_cast( mZoomedOutResamplingComboBox->itemData( mZoomedOutResamplingComboBox->currentIndex() ).toInt() ); @@ -157,22 +157,22 @@ void QgsResamplingUtils::refreshLayerFromWidgets() switch ( zoomedInMethod ) { - case QgsRasterDataProvider::ResamplingMethod::Nearest: + case Qgis::RasterResamplingMethod::Nearest: break; - case QgsRasterDataProvider::ResamplingMethod::Bilinear: + case Qgis::RasterResamplingMethod::Bilinear: zoomedInResampler = std::make_unique(); break; - case QgsRasterDataProvider::ResamplingMethod::Cubic: + case Qgis::RasterResamplingMethod::Cubic: zoomedInResampler = std::make_unique(); break; - case QgsRasterDataProvider::ResamplingMethod::CubicSpline: - case QgsRasterDataProvider::ResamplingMethod::Lanczos: - case QgsRasterDataProvider::ResamplingMethod::Average: - case QgsRasterDataProvider::ResamplingMethod::Mode: - case QgsRasterDataProvider::ResamplingMethod::Gauss: + case Qgis::RasterResamplingMethod::CubicSpline: + case Qgis::RasterResamplingMethod::Lanczos: + case Qgis::RasterResamplingMethod::Average: + case Qgis::RasterResamplingMethod::Mode: + case Qgis::RasterResamplingMethod::Gauss: // not supported as late resampler methods break; @@ -185,23 +185,23 @@ void QgsResamplingUtils::refreshLayerFromWidgets() switch ( zoomedOutMethod ) { - case QgsRasterDataProvider::ResamplingMethod::Nearest: + case Qgis::RasterResamplingMethod::Nearest: break; - case QgsRasterDataProvider::ResamplingMethod::Bilinear: + case Qgis::RasterResamplingMethod::Bilinear: zoomedOutResampler = std::make_unique(); break; - case QgsRasterDataProvider::ResamplingMethod::Cubic: + case Qgis::RasterResamplingMethod::Cubic: zoomedOutResampler = std::make_unique(); break; - case QgsRasterDataProvider::ResamplingMethod::CubicSpline: - case QgsRasterDataProvider::ResamplingMethod::Lanczos: - case QgsRasterDataProvider::ResamplingMethod::Average: - case QgsRasterDataProvider::ResamplingMethod::Mode: - case QgsRasterDataProvider::ResamplingMethod::Gauss: + case Qgis::RasterResamplingMethod::CubicSpline: + case Qgis::RasterResamplingMethod::Lanczos: + case Qgis::RasterResamplingMethod::Average: + case Qgis::RasterResamplingMethod::Mode: + case Qgis::RasterResamplingMethod::Gauss: // not supported as late resampler methods break; } @@ -214,33 +214,33 @@ void QgsResamplingUtils::refreshLayerFromWidgets() void QgsResamplingUtils::addExtraEarlyResamplingMethodsToCombos() { - if ( mZoomedInResamplingComboBox->findData( static_cast( QgsRasterDataProvider::ResamplingMethod::CubicSpline ) ) != -1 ) + if ( mZoomedInResamplingComboBox->findData( static_cast( Qgis::RasterResamplingMethod::CubicSpline ) ) != -1 ) return; // already present for ( QComboBox *combo : { mZoomedInResamplingComboBox, mZoomedOutResamplingComboBox } ) { - combo->addItem( QObject::tr( "Cubic B-Spline (4x4 Kernel)" ), static_cast( QgsRasterDataProvider::ResamplingMethod::CubicSpline ) ); - combo->addItem( QObject::tr( "Lanczos (6x6 Kernel)" ), static_cast( QgsRasterDataProvider::ResamplingMethod::Lanczos ) ); - combo->addItem( QObject::tr( "Average" ), static_cast( QgsRasterDataProvider::ResamplingMethod::Average ) ); - combo->addItem( QObject::tr( "Mode" ), static_cast( QgsRasterDataProvider::ResamplingMethod::Mode ) ); - combo->addItem( QObject::tr( "Gauss" ), static_cast( QgsRasterDataProvider::ResamplingMethod::Gauss ) ); + combo->addItem( QObject::tr( "Cubic B-Spline (4x4 Kernel)" ), static_cast( Qgis::RasterResamplingMethod::CubicSpline ) ); + combo->addItem( QObject::tr( "Lanczos (6x6 Kernel)" ), static_cast( Qgis::RasterResamplingMethod::Lanczos ) ); + combo->addItem( QObject::tr( "Average" ), static_cast( Qgis::RasterResamplingMethod::Average ) ); + combo->addItem( QObject::tr( "Mode" ), static_cast( Qgis::RasterResamplingMethod::Mode ) ); + combo->addItem( QObject::tr( "Gauss" ), static_cast( Qgis::RasterResamplingMethod::Gauss ) ); } } void QgsResamplingUtils::removeExtraEarlyResamplingMethodsFromCombos() { - if ( mZoomedInResamplingComboBox->findData( static_cast( QgsRasterDataProvider::ResamplingMethod::CubicSpline ) ) == -1 ) + if ( mZoomedInResamplingComboBox->findData( static_cast( Qgis::RasterResamplingMethod::CubicSpline ) ) == -1 ) return; // already removed for ( QComboBox *combo : { mZoomedInResamplingComboBox, mZoomedOutResamplingComboBox } ) { - for ( const QgsRasterDataProvider::ResamplingMethod method : + for ( const Qgis::RasterResamplingMethod method : { - QgsRasterDataProvider::ResamplingMethod::CubicSpline, - QgsRasterDataProvider::ResamplingMethod::Lanczos, - QgsRasterDataProvider::ResamplingMethod::Average, - QgsRasterDataProvider::ResamplingMethod::Mode, - QgsRasterDataProvider::ResamplingMethod::Gauss + Qgis::RasterResamplingMethod::CubicSpline, + Qgis::RasterResamplingMethod::Lanczos, + Qgis::RasterResamplingMethod::Average, + Qgis::RasterResamplingMethod::Mode, + Qgis::RasterResamplingMethod::Gauss } ) { combo->removeItem( combo->findData( static_cast( method ) ) ); diff --git a/src/providers/wms/qgswmsprovider.h b/src/providers/wms/qgswmsprovider.h index 214976106dc0f..d8affea6ec714 100644 --- a/src/providers/wms/qgswmsprovider.h +++ b/src/providers/wms/qgswmsprovider.h @@ -284,12 +284,12 @@ class QgsWmsProvider final : public QgsRasterDataProvider mProviderResamplingEnabled = enable; return true; } - bool setZoomedInResamplingMethod( ResamplingMethod method ) override + bool setZoomedInResamplingMethod( Qgis::RasterResamplingMethod method ) override { mZoomedInResamplingMethod = method; return true; } - bool setZoomedOutResamplingMethod( ResamplingMethod method ) override + bool setZoomedOutResamplingMethod( Qgis::RasterResamplingMethod method ) override { mZoomedOutResamplingMethod = method; return true; diff --git a/tests/src/core/testqgsmaprendererjob.cpp b/tests/src/core/testqgsmaprendererjob.cpp index 5f341731d6439..40b56d36d89ab 100644 --- a/tests/src/core/testqgsmaprendererjob.cpp +++ b/tests/src/core/testqgsmaprendererjob.cpp @@ -1080,7 +1080,7 @@ void TestQgsMapRendererJob::testMapShading() QVERIFY( rasterLayer->isValid() ); static_cast( rasterLayer->elevationProperties() )->setEnabled( true ); rasterLayer->dataProvider()->enableProviderResampling( true ); - rasterLayer->dataProvider()->setZoomedOutResamplingMethod( QgsRasterDataProvider::ResamplingMethod::Cubic ); + rasterLayer->dataProvider()->setZoomedOutResamplingMethod( Qgis::RasterResamplingMethod::Cubic ); std::unique_ptr meshLayer = std::make_unique( TEST_DATA_DIR + QStringLiteral( "/mesh/mesh_shading.nc" ), diff --git a/tests/src/providers/testqgswmsprovider.cpp b/tests/src/providers/testqgswmsprovider.cpp index d736bfcc38f78..48ac8fa4df27f 100644 --- a/tests/src/providers/testqgswmsprovider.cpp +++ b/tests/src/providers/testqgswmsprovider.cpp @@ -566,8 +566,8 @@ void TestQgsWmsProvider::testResampling() QVERIFY( layer.dataProvider()->dataType( 1 ) == Qgis::DataType::Float32 ); QVERIFY( layer.dataProvider()->enableProviderResampling( true ) ); - QVERIFY( layer.dataProvider()->setZoomedInResamplingMethod( QgsRasterDataProvider::ResamplingMethod::Cubic ) ); - QVERIFY( layer.dataProvider()->setZoomedOutResamplingMethod( QgsRasterDataProvider::ResamplingMethod::Cubic ) ); + QVERIFY( layer.dataProvider()->setZoomedInResamplingMethod( Qgis::RasterResamplingMethod::Cubic ) ); + QVERIFY( layer.dataProvider()->setZoomedOutResamplingMethod( Qgis::RasterResamplingMethod::Cubic ) ); layer.setResamplingStage( Qgis::RasterResamplingStage::Provider ); std::unique_ptr hillshade = std::make_unique( layer.dataProvider(), 1, 315, 45 ); hillshade->setZFactor( 0.0005 );