Skip to content

Commit

Permalink
Avoid getting stuck in raster projector loop for long times
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Mar 17, 2017
1 parent 9887734 commit 68ec95d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/core/raster/qgsrasterprojector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,9 @@ QgsRasterBlock *QgsRasterProjector::block( int bandNo, QgsRectangle const &exte
return new QgsRasterBlock();
}

if ( feedback && feedback->isCanceled() )
return new QgsRasterBlock();

if ( ! mSrcCRS.isValid() || ! mDestCRS.isValid() || mSrcCRS == mDestCRS )
{
QgsDebugMsgLevel( "No projection necessary", 4 );
Expand Down Expand Up @@ -813,6 +816,8 @@ QgsRasterBlock *QgsRasterProjector::block( int bandNo, QgsRectangle const &exte
int srcRow, srcCol;
for ( int i = 0; i < height; ++i )
{
if ( feedback && feedback->isCanceled() )
break;
for ( int j = 0; j < width; ++j )
{
bool inside = pd.srcRowCol( i, j, &srcRow, &srcCol );
Expand All @@ -832,12 +837,12 @@ QgsRasterBlock *QgsRasterProjector::block( int bandNo, QgsRectangle const &exte
char *destBits = outputBlock->bits( destIndex );
if ( !srcBits )
{
QgsDebugMsg( QString( "Cannot get input block data: row = %1 col = %2" ).arg( i ).arg( j ) );
// QgsDebugMsg( QString( "Cannot get input block data: row = %1 col = %2" ).arg( i ).arg( j ) );
continue;
}
if ( !destBits )
{
QgsDebugMsg( QString( "Cannot set output block data: srcRow = %1 srcCol = %2" ).arg( srcRow ).arg( srcCol ) );
// QgsDebugMsg( QString( "Cannot set output block data: srcRow = %1 srcCol = %2" ).arg( srcRow ).arg( srcCol ) );
continue;
}
memcpy( destBits, srcBits, pixelSize );
Expand Down

0 comments on commit 68ec95d

Please sign in to comment.