30 nuller->mNoData = mNoData;
31 nuller->mOutputNoData = mOutputNoData;
32 nuller->mHasOutputNoData = mHasOutputNoData;
38 if ( bandNo > mOutputNoData.size() )
40 mOutputNoData.resize( bandNo );
41 mHasOutputNoData.resize( bandNo );
43 mOutputNoData[bandNo - 1] =
noData;
44 mHasOutputNoData[bandNo - 1] =
true;
49 if ( bandNo > mNoData.size() )
51 mNoData.resize( bandNo );
53 mNoData[bandNo - 1] =
noData;
76 std::unique_ptr< QgsRasterBlock > inputBlock(
mInput->
block( bandNo, extent, width, height, feedback ) );
85 return inputBlock.release();
88 std::unique_ptr< QgsRasterBlock > outputBlock(
new QgsRasterBlock( inputBlock->dataType(), width, height ) );
89 if ( mHasOutputNoData.value( bandNo - 1 ) || inputBlock->hasNoDataValue() )
92 if ( mHasOutputNoData.value( bandNo - 1 ) )
94 noDataValue = mOutputNoData.value( bandNo - 1 );
98 noDataValue = inputBlock->noDataValue();
100 outputBlock->setNoDataValue( noDataValue );
103 for (
int i = 0; i < height; i++ )
105 for (
int j = 0; j < width; j++ )
107 double value = inputBlock->value( i, j );
109 bool isNoData = inputBlock->isNoData( i, j );
114 outputBlock->setValue( i, j, inputBlock->value( i, j ) );
117 outputBlock->setIsNoData( i, j );
121 outputBlock->setValue( i, j, value );
125 return outputBlock.release();
virtual int bandCount() const =0
Get number of bands.
A rectangle specified with double values.
static bool contains(double value, const QgsRasterRangeList &rangeList)
Test if value is within the list of ranges.
virtual QgsRectangle extent() const
Get the extent of the interface.
static bool typeIsColor(Qgis::DataType type)
Returns true if data type is color.
Raster pipe that deals with null values.
DataType
Raster data types.
virtual Qgis::DataType dataType(int bandNo) const =0
Returns data type for the band specified by number.
Qgis::DataType dataType(int bandNo) const override
Returns data type for the band specified by number.
QgsRasterNuller * clone() const override
Clone itself, create deep copy.
#define QgsDebugMsgLevel(str, level)
virtual QgsRasterBlock * block(int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback=nullptr)=0
Read block of data using given extent and size.
Unknown or unspecified type.
QgsRasterRangeList noData(int bandNo) const
Base class for processing filters like renderers, reprojector, resampler etc.
void setOutputNoDataValue(int bandNo, double noData)
Set output no data value.
void setNoData(int bandNo, const QgsRasterRangeList &noData)
QgsRasterNuller(QgsRasterInterface *input=nullptr)
QList< QgsRasterRange > QgsRasterRangeList
QgsRasterBlock * block(int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback=nullptr) override
Read block of data using given extent and size.
QgsRasterInterface * mInput
Feedback object tailored for raster block reading.
int bandCount() const override
Get number of bands.