Skip to content

Commit

Permalink
fix build of grassrasterprovider
Browse files Browse the repository at this point in the history
(cherry picked from commit fbd3289)
  • Loading branch information
jef-n authored and nyalldawson committed May 23, 2019
1 parent 76b29dc commit dd3b716
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 9 additions & 4 deletions src/providers/grass/qgsgrassrasterprovider.cpp
Expand Up @@ -174,7 +174,7 @@ QgsRasterInterface *QgsGrassRasterProvider::clone() const
return provider;
}

void QgsGrassRasterProvider::readBlock( int bandNo, int xBlock, int yBlock, void *block )
bool QgsGrassRasterProvider::readBlock( int bandNo, int xBlock, int yBlock, void *block )
{
Q_UNUSED( xBlock );
clearLastError();
Expand Down Expand Up @@ -214,6 +214,7 @@ void QgsGrassRasterProvider::readBlock( int bandNo, int xBlock, int yBlock, void
QgsDebugMsg( error );
appendError( error );
// We don't set mValid to false, because the raster can be recreated and work next time
return false;
}
QgsDebugMsg( QString( "%1 bytes read from modules stdout" ).arg( data.size() ) );
// byteCount() in Qt >= 4.6
Expand All @@ -228,9 +229,11 @@ void QgsGrassRasterProvider::readBlock( int bandNo, int xBlock, int yBlock, void
size = size < data.size() ? size : data.size();
}
memcpy( block, data.data(), size );

return true;
}

void QgsGrassRasterProvider::readBlock( int bandNo, QgsRectangle const &viewExtent, int pixelWidth, int pixelHeight, void *block, QgsRasterBlockFeedback *feedback )
bool QgsGrassRasterProvider::readBlock( int bandNo, QgsRectangle const &viewExtent, int pixelWidth, int pixelHeight, void *block, QgsRasterBlockFeedback *feedback )
{
Q_UNUSED( feedback );
QgsDebugMsg( "pixelWidth = " + QString::number( pixelWidth ) );
Expand All @@ -239,7 +242,7 @@ void QgsGrassRasterProvider::readBlock( int bandNo, QgsRectangle const &viewExt
clearLastError();

if ( pixelWidth <= 0 || pixelHeight <= 0 )
return;
return false;

QStringList arguments;
arguments.append( "map=" + mMapName + "@" + mMapset );
Expand All @@ -264,7 +267,7 @@ void QgsGrassRasterProvider::readBlock( int bandNo, QgsRectangle const &viewExt
appendError( error );

// We don't set mValid to false, because the raster can be recreated and work next time
return;
return false;
}
QgsDebugMsg( QString( "%1 bytes read from modules stdout" ).arg( data.size() ) );
// byteCount() in Qt >= 4.6
Expand All @@ -278,6 +281,8 @@ void QgsGrassRasterProvider::readBlock( int bandNo, QgsRectangle const &viewExt
size = size < data.size() ? size : data.size();
}
memcpy( block, data.data(), size );

return true;
}

QgsRasterBandStats QgsGrassRasterProvider::bandStatistics( int bandNo, int stats, const QgsRectangle &boundingBox, int sampleSize, QgsRasterBlockFeedback * )
Expand Down
4 changes: 2 additions & 2 deletions src/providers/grass/qgsgrassrasterprovider.h
Expand Up @@ -189,8 +189,8 @@ class GRASS_LIB_EXPORT QgsGrassRasterProvider : public QgsRasterDataProvider
int xSize() const override;
int ySize() const override;

void readBlock( int bandNo, int xBlock, int yBlock, void *data ) override;
void readBlock( int bandNo, QgsRectangle const &viewExtent, int width, int height, void *data, QgsRasterBlockFeedback *feedback = nullptr ) override;
bool readBlock( int bandNo, int xBlock, int yBlock, void *data ) override;
bool readBlock( int bandNo, QgsRectangle const &viewExtent, int width, int height, void *data, QgsRasterBlockFeedback *feedback = nullptr ) override;

QgsRasterBandStats bandStatistics( int bandNo,
int stats = QgsRasterBandStats::All,
Expand Down

0 comments on commit dd3b716

Please sign in to comment.