Skip to content

Commit

Permalink
Raster resampling: add cubic resampling for zoomed out
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault authored and nyalldawson committed Jun 19, 2020
1 parent c6f3650 commit 458b825
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/app/qgsoptions.cpp
Expand Up @@ -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();
Expand Down
4 changes: 4 additions & 0 deletions src/core/raster/qgsrasterresamplefilter.cpp
Expand Up @@ -305,4 +305,8 @@ void QgsRasterResampleFilter::readXml( const QDomElement &filterElem )
{
mZoomedOutResampler.reset( new QgsBilinearRasterResampler() );
}
else if ( zoomedOutResamplerType == QLatin1String( "cubic" ) )
{
mZoomedOutResampler.reset( new QgsCubicRasterResampler() );
}
}
5 changes: 5 additions & 0 deletions src/gui/raster/qgsresamplingutils.cpp
Expand Up @@ -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()
Expand Down Expand Up @@ -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
{
Expand Down

0 comments on commit 458b825

Please sign in to comment.