"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/core/raster/qgsrasterlayer.cpp" between
QGIS-final-3_10_11.tar.gz and QGIS-final-3_10_12.tar.gz

About: QGIS (Quantum GIS) is a Geographic Information System that supports vector, raster, and database formats. Long-term release (3.10.x series).

qgsrasterlayer.cpp  (QGIS-final-3_10_11):qgsrasterlayer.cpp  (QGIS-final-3_10_12)
skipping to change at line 217 skipping to change at line 217
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
int QgsRasterLayer::bandCount() const int QgsRasterLayer::bandCount() const
{ {
if ( !mDataProvider ) return 0; if ( !mDataProvider ) return 0;
return mDataProvider->bandCount(); return mDataProvider->bandCount();
} }
QString QgsRasterLayer::bandName( int bandNo ) const QString QgsRasterLayer::bandName( int bandNo ) const
{ {
return dataProvider()->generateBandName( bandNo ); if ( !mDataProvider ) return QString();
return mDataProvider->generateBandName( bandNo );
} }
void QgsRasterLayer::setRendererForDrawingStyle( QgsRaster::DrawingStyle drawing Style ) void QgsRasterLayer::setRendererForDrawingStyle( QgsRaster::DrawingStyle drawing Style )
{ {
setRenderer( QgsApplication::rasterRendererRegistry()->defaultRendererForDrawi ngStyle( drawingStyle, mDataProvider ) ); setRenderer( QgsApplication::rasterRendererRegistry()->defaultRendererForDrawi ngStyle( drawingStyle, mDataProvider ) );
} }
QgsRasterDataProvider *QgsRasterLayer::dataProvider() QgsRasterDataProvider *QgsRasterLayer::dataProvider()
{ {
return mDataProvider; return mDataProvider;
skipping to change at line 488 skipping to change at line 489
return myMetadata; return myMetadata;
} }
QPixmap QgsRasterLayer::paletteAsPixmap( int bandNumber ) QPixmap QgsRasterLayer::paletteAsPixmap( int bandNumber )
{ {
//TODO: This function should take dimensions //TODO: This function should take dimensions
QgsDebugMsgLevel( QStringLiteral( "entered." ), 4 ); QgsDebugMsgLevel( QStringLiteral( "entered." ), 4 );
// Only do this for the GDAL provider? // Only do this for the GDAL provider?
// Maybe WMS can do this differently using QImage::numColors and QImage::color () // Maybe WMS can do this differently using QImage::numColors and QImage::color ()
if ( mDataProvider->colorInterpretation( bandNumber ) == QgsRaster::PaletteInd if ( mDataProvider &&
ex ) mDataProvider->colorInterpretation( bandNumber ) == QgsRaster::PaletteInd
ex )
{ {
QgsDebugMsgLevel( QStringLiteral( "....found paletted image" ), 4 ); QgsDebugMsgLevel( QStringLiteral( "....found paletted image" ), 4 );
QgsColorRampShader myShader; QgsColorRampShader myShader;
QList<QgsColorRampShader::ColorRampItem> myColorRampItemList = mDataProvider ->colorTable( bandNumber ); QList<QgsColorRampShader::ColorRampItem> myColorRampItemList = mDataProvider ->colorTable( bandNumber );
if ( !myColorRampItemList.isEmpty() ) if ( !myColorRampItemList.isEmpty() )
{ {
QgsDebugMsgLevel( QStringLiteral( "....got color ramp item list" ), 4 ); QgsDebugMsgLevel( QStringLiteral( "....got color ramp item list" ), 4 );
myShader.setColorRampItemList( myColorRampItemList ); myShader.setColorRampItemList( myColorRampItemList );
myShader.setColorRampType( QgsColorRampShader::Discrete ); myShader.setColorRampType( QgsColorRampShader::Discrete );
// Draw image // Draw image
skipping to change at line 548 skipping to change at line 550
} }
double QgsRasterLayer::rasterUnitsPerPixelX() const double QgsRasterLayer::rasterUnitsPerPixelX() const
{ {
// We return one raster pixel per map unit pixel // We return one raster pixel per map unit pixel
// One raster pixel can have several raster units... // One raster pixel can have several raster units...
// We can only use one of the mGeoTransform[], so go with the // We can only use one of the mGeoTransform[], so go with the
// horisontal one. // horisontal one.
if ( mDataProvider->capabilities() & QgsRasterDataProvider::Size && !qgsDouble if ( mDataProvider &&
Near( mDataProvider->xSize(), 0.0 ) ) mDataProvider->capabilities() & QgsRasterDataProvider::Size && !qgsDouble
Near( mDataProvider->xSize(), 0.0 ) )
{ {
return mDataProvider->extent().width() / mDataProvider->xSize(); return mDataProvider->extent().width() / mDataProvider->xSize();
} }
return 1; return 1;
} }
double QgsRasterLayer::rasterUnitsPerPixelY() const double QgsRasterLayer::rasterUnitsPerPixelY() const
{ {
if ( mDataProvider->capabilities() & QgsRasterDataProvider::Size && !qgsDouble if ( mDataProvider &&
Near( mDataProvider->ySize(), 0.0 ) ) mDataProvider->capabilities() & QgsRasterDataProvider::Size && !qgsDouble
Near( mDataProvider->ySize(), 0.0 ) )
{ {
return mDataProvider->extent().height() / mDataProvider->ySize(); return mDataProvider->extent().height() / mDataProvider->ySize();
} }
return 1; return 1;
} }
void QgsRasterLayer::init() void QgsRasterLayer::init()
{ {
mRasterType = QgsRasterLayer::GrayOrUndefined; mRasterType = QgsRasterLayer::GrayOrUndefined;
skipping to change at line 910 skipping to change at line 914
void QgsRasterLayer::computeMinMax( int band, void QgsRasterLayer::computeMinMax( int band,
const QgsRasterMinMaxOrigin &mmo, const QgsRasterMinMaxOrigin &mmo,
QgsRasterMinMaxOrigin::Limits limits, QgsRasterMinMaxOrigin::Limits limits,
const QgsRectangle &extent, const QgsRectangle &extent,
int sampleSize, int sampleSize,
double &min, double &max ) double &min, double &max )
{ {
min = std::numeric_limits<double>::quiet_NaN(); min = std::numeric_limits<double>::quiet_NaN();
max = std::numeric_limits<double>::quiet_NaN(); max = std::numeric_limits<double>::quiet_NaN();
if ( !mDataProvider )
return;
if ( limits == QgsRasterMinMaxOrigin::MinMax ) if ( limits == QgsRasterMinMaxOrigin::MinMax )
{ {
QgsRasterBandStats myRasterBandStats = mDataProvider->bandStatistics( band, QgsRasterBandStats::Min | QgsRasterBandStats::Max, extent, sampleSize ); QgsRasterBandStats myRasterBandStats = mDataProvider->bandStatistics( band, QgsRasterBandStats::Min | QgsRasterBandStats::Max, extent, sampleSize );
min = myRasterBandStats.minimumValue; min = myRasterBandStats.minimumValue;
max = myRasterBandStats.maximumValue; max = myRasterBandStats.maximumValue;
} }
else if ( limits == QgsRasterMinMaxOrigin::StdDev ) else if ( limits == QgsRasterMinMaxOrigin::StdDev )
{ {
QgsRasterBandStats myRasterBandStats = mDataProvider->bandStatistics( band, QgsRasterBandStats::Mean | QgsRasterBandStats::StdDev, extent, sampleSize ); QgsRasterBandStats myRasterBandStats = mDataProvider->bandStatistics( band, QgsRasterBandStats::Mean | QgsRasterBandStats::StdDev, extent, sampleSize );
skipping to change at line 1314 skipping to change at line 1320
if ( mDataProvider ) if ( mDataProvider )
{ {
QgsDebugMsgLevel( QStringLiteral( "About to mDataProvider->setSubLayerVisibi lity(name, vis)." ), 4 ); QgsDebugMsgLevel( QStringLiteral( "About to mDataProvider->setSubLayerVisibi lity(name, vis)." ), 4 );
mDataProvider->setSubLayerVisibility( name, vis ); mDataProvider->setSubLayerVisibility( name, vis );
} }
} }
QDateTime QgsRasterLayer::timestamp() const QDateTime QgsRasterLayer::timestamp() const
{ {
if ( !mDataProvider )
return QDateTime();
return mDataProvider->timestamp(); return mDataProvider->timestamp();
} }
bool QgsRasterLayer::accept( QgsStyleEntityVisitorInterface *visitor ) const bool QgsRasterLayer::accept( QgsStyleEntityVisitorInterface *visitor ) const
{ {
if ( mPipe.renderer() ) if ( mPipe.renderer() )
{ {
if ( !mPipe.renderer()->accept( visitor ) ) if ( !mPipe.renderer()->accept( visitor ) )
return false; return false;
} }
skipping to change at line 1559 skipping to change at line 1567
} }
void QgsRasterLayer::setTransformContext( const QgsCoordinateTransformContext &t ransformContext ) void QgsRasterLayer::setTransformContext( const QgsCoordinateTransformContext &t ransformContext )
{ {
if ( mDataProvider ) if ( mDataProvider )
mDataProvider->setTransformContext( transformContext ); mDataProvider->setTransformContext( transformContext );
} }
QStringList QgsRasterLayer::subLayers() const QStringList QgsRasterLayer::subLayers() const
{ {
if ( ! mDataProvider )
return QStringList();
return mDataProvider->subLayers(); return mDataProvider->subLayers();
} }
// this function should be used when rendering with the MTR engine introduced in 2.3, as QPixmap is not thread safe (see bug #9626) // this function should be used when rendering with the MTR engine introduced in 2.3, as QPixmap is not thread safe (see bug #9626)
// note: previewAsImage and previewAsPixmap should use a common low-level fct Qg sRasterLayer::previewOnPaintDevice( QSize size, QColor bgColor, QPaintDevice &de vice ) // note: previewAsImage and previewAsPixmap should use a common low-level fct Qg sRasterLayer::previewOnPaintDevice( QSize size, QColor bgColor, QPaintDevice &de vice )
QImage QgsRasterLayer::previewAsImage( QSize size, const QColor &bgColor, QImage ::Format format ) QImage QgsRasterLayer::previewAsImage( QSize size, const QColor &bgColor, QImage ::Format format )
{ {
QImage image( size, format ); QImage image( size, format );
if ( ! isValid( ) ) if ( ! isValid( ) )
skipping to change at line 2305 skipping to change at line 2315
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////
// //
// Private methods // Private methods
// //
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
bool QgsRasterLayer::update() bool QgsRasterLayer::update()
{ {
QgsDebugMsgLevel( QStringLiteral( "entered." ), 4 ); QgsDebugMsgLevel( QStringLiteral( "entered." ), 4 );
// Check if data changed // Check if data changed
if ( mDataProvider->dataTimestamp() > mDataProvider->timestamp() ) if ( mDataProvider && mDataProvider->dataTimestamp() > mDataProvider->timestam p() )
{ {
QgsDebugMsgLevel( QStringLiteral( "reload data" ), 4 ); QgsDebugMsgLevel( QStringLiteral( "reload data" ), 4 );
closeDataProvider(); closeDataProvider();
init(); init();
QgsDataProvider::ProviderOptions providerOptions; QgsDataProvider::ProviderOptions providerOptions;
setDataProvider( mProviderKey, providerOptions ); setDataProvider( mProviderKey, providerOptions );
emit dataChanged(); emit dataChanged();
} }
return mValid; return mValid;
} }
 End of changes. 8 change blocks. 
8 lines changed or deleted 18 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)