Skip to content
Permalink
Browse files

Get transformContext from layer instead of provider

  • Loading branch information
elpaso authored and nyalldawson committed Apr 16, 2019
1 parent 6372295 commit e5491ee6108ae8994588d922e097294734c62bcb
@@ -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 );

@@ -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 ) );
@@ -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 ) );
@@ -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;

@@ -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

0 comments on commit e5491ee

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