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 bool isNoData =
false;
104 for (
int i = 0; i < height; i++ )
106 for (
int j = 0; j < width; j++ )
108 double value = inputBlock->valueAndNoData( i, j, isNoData );
114 outputBlock->setValue( i, j, inputBlock->value( i, j ) );
117 outputBlock->setIsNoData( i, j );
121 outputBlock->setValue( i, j, value );
125 return outputBlock.release();
DataType
Raster data types.
@ UnknownDataType
Unknown or unspecified type.
Feedback object tailored for raster block reading.
static bool typeIsColor(Qgis::DataType type)
Returns true if data type is color.
Base class for processing filters like renderers, reprojector, resampler etc.
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.
virtual Qgis::DataType dataType(int bandNo) const =0
Returns data type for the band specified by number.
virtual int bandCount() const =0
Gets number of bands.
QgsRasterInterface * mInput
virtual QgsRectangle extent() const
Gets the extent of the interface.
Raster pipe that deals with null values.
QgsRasterNuller * clone() const override
Clone itself, create deep copy.
void setNoData(int bandNo, const QgsRasterRangeList &noData)
Qgis::DataType dataType(int bandNo) const override
Returns data type for the band specified by number.
QgsRasterBlock * block(int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback=nullptr) override
Read block of data using given extent and size.
void setOutputNoDataValue(int bandNo, double noData)
Sets the output no data value.
QgsRasterNuller(QgsRasterInterface *input=nullptr)
int bandCount() const override
Gets number of bands.
QgsRasterRangeList noData(int bandNo) const
bool contains(double value) const
Returns true if this range contains the specified value.
A rectangle specified with double values.
#define QgsDebugMsgLevel(str, level)
QList< QgsRasterRange > QgsRasterRangeList