Skip to content
Permalink
Browse files

Raster resampling: add cubic resampling for zoomed out

  • Loading branch information
rouault authored and nyalldawson committed Jun 19, 2020
1 parent c6f3650 commit 458b825d3532ec1969b7530fdfda0059beb95ab2
Showing with 10 additions and 0 deletions.
  1. +1 −0 src/app/qgsoptions.cpp
  2. +4 −0 src/core/raster/qgsrasterresamplefilter.cpp
  3. +5 −0 src/gui/raster/qgsresamplingutils.cpp
@@ -716,6 +716,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
mZoomedInResamplingComboBox->insertItem( 2, tr( "Cubic" ), QStringLiteral( "cubic" ) );
mZoomedOutResamplingComboBox->insertItem( 0, tr( "Nearest neighbour" ), QStringLiteral( "nearest neighbour" ) );
mZoomedOutResamplingComboBox->insertItem( 1, tr( "Average" ), QStringLiteral( "bilinear" ) );
mZoomedOutResamplingComboBox->insertItem( 2, tr( "Cubic" ), QStringLiteral( "cubic" ) );
QString zoomedInResampling = mSettings->value( QStringLiteral( "/Raster/defaultZoomedInResampling" ), QStringLiteral( "nearest neighbour" ) ).toString();
mZoomedInResamplingComboBox->setCurrentIndex( mZoomedInResamplingComboBox->findData( zoomedInResampling ) );
QString zoomedOutResampling = mSettings->value( QStringLiteral( "/Raster/defaultZoomedOutResampling" ), QStringLiteral( "nearest neighbour" ) ).toString();
@@ -305,4 +305,8 @@ void QgsRasterResampleFilter::readXml( const QDomElement &filterElem )
{
mZoomedOutResampler.reset( new QgsBilinearRasterResampler() );
}
else if ( zoomedOutResamplerType == QLatin1String( "cubic" ) )
{
mZoomedOutResampler.reset( new QgsCubicRasterResampler() );
}
}
@@ -48,6 +48,7 @@ void QgsResamplingUtils::initWidgets( QgsRasterLayer *rasterLayer,

mZoomedOutResamplingComboBox->addItem( QObject::tr( "Nearest neighbour" ), static_cast<int>( QgsRasterDataProvider::ResamplingMethod::Nearest ) );
mZoomedOutResamplingComboBox->addItem( QObject::tr( "Average" ), static_cast<int>( QgsRasterDataProvider::ResamplingMethod::Bilinear ) );
mZoomedOutResamplingComboBox->addItem( QObject::tr( "Cubic" ), static_cast<int>( QgsRasterDataProvider::ResamplingMethod::Cubic ) );
}

void QgsResamplingUtils::refreshWidgetsFromLayer()
@@ -94,6 +95,10 @@ void QgsResamplingUtils::refreshWidgetsFromLayer()
{
mZoomedOutResamplingComboBox->setCurrentIndex( mZoomedOutResamplingComboBox->findData( static_cast<int>( QgsRasterDataProvider::ResamplingMethod::Bilinear ) ) );
}
else if ( zoomedOutResampler->type() == QLatin1String( "cubic" ) )
{
mZoomedOutResamplingComboBox->setCurrentIndex( mZoomedOutResamplingComboBox->findData( static_cast<int>( QgsRasterDataProvider::ResamplingMethod::Cubic ) ) );
}
}
else
{

0 comments on commit 458b825

Please sign in to comment.
You can’t perform that action at this time.