Skip to content

Commit

Permalink
Get transformContext from layer instead of provider
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso authored and nyalldawson committed Apr 17, 2019
1 parent 6372295 commit e5491ee
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/analysis/raster/qgsrastercalculator.cpp
Expand Up @@ -261,7 +261,7 @@ QgsRasterCalculator::Result QgsRasterCalculator::processCalculation( QgsFeedback
if ( it->raster->crs() != mOutputCrs )
{
QgsRasterProjector proj;
proj.setCrs( it->raster->crs(), mOutputCrs, it->raster->dataProvider()->transformContext() );
proj.setCrs( it->raster->crs(), mOutputCrs, it->raster->transformContext() );
proj.setInput( it->raster->dataProvider() );
proj.setPrecision( QgsRasterProjector::Exact );

Expand Down Expand Up @@ -550,7 +550,7 @@ QgsRasterCalculator::Result QgsRasterCalculator::processCalculationGPU( std::uni
if ( ref.layer->crs() != mOutputCrs )
{
QgsRasterProjector proj;
proj.setCrs( ref.layer->crs(), mOutputCrs, ref.layer->dataProvider()->transformContext() );
proj.setCrs( ref.layer->crs(), mOutputCrs, ref.layer->transformContext() );
proj.setInput( ref.layer->dataProvider() );
proj.setPrecision( QgsRasterProjector::Exact );
block.reset( proj.block( ref.band, rect, mNumOutputColumns, 1 ) );
Expand Down
4 changes: 2 additions & 2 deletions src/server/services/wcs/qgswcsgetcoverage.cpp
Expand Up @@ -201,14 +201,14 @@ namespace QgsWcs
if ( responseCRS != rLayer->crs() )
{
QgsRasterProjector *projector = new QgsRasterProjector;
projector->setCrs( rLayer->crs(), responseCRS, rLayer->dataProvider()->transformContext() );
projector->setCrs( rLayer->crs(), responseCRS, rLayer->transformContext() );
if ( !pipe.insert( 2, projector ) )
{
throw QgsRequestNotWellFormedException( QStringLiteral( "Cannot set pipe projector" ) );
}
}

QgsRasterFileWriter::WriterError err = fileWriter.writeRaster( &pipe, width, height, rect, responseCRS, rLayer->dataProvider()->transformContext() );
QgsRasterFileWriter::WriterError err = fileWriter.writeRaster( &pipe, width, height, rect, responseCRS, rLayer->transformContext() );
if ( err != QgsRasterFileWriter::NoError )
{
throw QgsRequestNotWellFormedException( QStringLiteral( "Cannot write raster error code: %1" ).arg( err ) );
Expand Down
4 changes: 2 additions & 2 deletions tests/src/core/testqgsrasterfilewriter.cpp
Expand Up @@ -168,7 +168,7 @@ bool TestQgsRasterFileWriter::writeTest( const QString &rasterName )
}
qDebug() << "projector set";

fileWriter.writeRaster( pipe, provider->xSize(), provider->ySize(), provider->extent(), provider->crs() );
fileWriter.writeRaster( pipe, provider->xSize(), provider->ySize(), provider->extent(), provider->crs(), provider->transformContext() );

delete pipe;

Expand Down Expand Up @@ -302,7 +302,7 @@ void TestQgsRasterFileWriter::testVrtCreation()
QgsRasterPipe pipe;
pipe.set( srcRasterLayer->dataProvider()->clone() );
// Let's do it !
QgsRasterFileWriter::WriterError res = rasterFileWriter->writeRaster( &pipe, srcRasterLayer->width(), srcRasterLayer->height(), srcRasterLayer->extent(), crs );
QgsRasterFileWriter::WriterError res = rasterFileWriter->writeRaster( &pipe, srcRasterLayer->width(), srcRasterLayer->height(), srcRasterLayer->extent(), crs, srcRasterLayer->transformContext() );
QCOMPARE( res, QgsRasterFileWriter::NoError );

// Now let's compare the georef of the original raster with the georef of the generated vrt file
Expand Down

0 comments on commit e5491ee

Please sign in to comment.