18 #ifndef QGSRASTERINTERFACE_H 19 #define QGSRASTERINTERFACE_H 21 #include "qgis_core.h" 26 #include <QCoreApplication> 87 void appendError(
const QString &error ) { mErrors.append( error ); }
95 QStringList
errors()
const {
return mErrors; }
103 bool mPreviewOnly =
false;
106 bool mRenderPartialOutput =
false;
141 if ( dynamic_cast<QgsBrightnessContrastFilter *>( sipCpp ) )
142 sipType = sipType_QgsBrightnessContrastFilter;
143 else if ( dynamic_cast<QgsHueSaturationFilter *>( sipCpp ) )
144 sipType = sipType_QgsHueSaturationFilter;
145 else if ( dynamic_cast<QgsRasterDataProvider *>( sipCpp ) )
147 sipType = sipType_QgsRasterDataProvider;
152 else if ( dynamic_cast<QgsRasterNuller *>( sipCpp ) )
153 sipType = sipType_QgsRasterNuller;
154 else if ( dynamic_cast<QgsRasterProjector *>( sipCpp ) )
155 sipType = sipType_QgsRasterProjector;
156 else if ( dynamic_cast<QgsRasterRenderer *>( sipCpp ) )
158 if ( dynamic_cast<QgsHillshadeRenderer *>( sipCpp ) )
159 sipType = sipType_QgsHillshadeRenderer;
160 else if ( dynamic_cast<QgsMultiBandColorRenderer *>( sipCpp ) )
161 sipType = sipType_QgsMultiBandColorRenderer;
162 else if ( dynamic_cast<QgsPalettedRasterRenderer *>( sipCpp ) )
163 sipType = sipType_QgsPalettedRasterRenderer;
164 else if ( dynamic_cast<QgsSingleBandColorDataRenderer *>( sipCpp ) )
165 sipType = sipType_QgsSingleBandColorDataRenderer;
166 else if ( dynamic_cast<QgsSingleBandGrayRenderer *>( sipCpp ) )
167 sipType = sipType_QgsSingleBandGrayRenderer;
168 else if ( dynamic_cast<QgsSingleBandPseudoColorRenderer *>( sipCpp ) )
169 sipType = sipType_QgsSingleBandPseudoColorRenderer;
171 sipType = sipType_QgsRasterRenderer;
173 else if ( dynamic_cast<QgsRasterResampleFilter *>( sipCpp ) )
174 sipType = sipType_QgsRasterResampleFilter;
190 BuildPyramids = 1 << 4,
192 IdentifyValue = 1 << 6,
193 IdentifyText = 1 << 7,
194 IdentifyHtml = 1 << 8,
195 IdentifyFeature = 1 << 9,
214 QString capabilitiesString()
const;
233 virtual int bandCount()
const = 0;
236 virtual int xBlockSize()
const {
return mInput ? mInput->xBlockSize() : 0; }
237 virtual int yBlockSize()
const {
return mInput ? mInput->yBlockSize() : 0; }
240 virtual int xSize()
const {
return mInput ? mInput->xSize() : 0; }
241 virtual int ySize()
const {
return mInput ? mInput->ySize() : 0; }
246 return tr(
"Band" ) + QStringLiteral(
" %1" ) .arg( bandNumber, 1 + static_cast< int >( std::log10( static_cast< double >( bandCount() ) ) ), 10, QChar(
'0' ) );
270 virtual bool on()
const {
return mOn; }
273 virtual void setOn(
bool on ) { mOn = on; }
284 return mInput ? mInput->sourceInput() :
this;
295 return mInput ? mInput->sourceInput() :
this;
315 virtual bool hasStatistics(
int bandNo,
318 int sampleSize = 0 );
337 double minimum = std::numeric_limits<double>::quiet_NaN(),
338 double maximum = std::numeric_limits<double>::quiet_NaN(),
341 bool includeOutOfRange =
false,
346 SIP_PYOBJECT minimum = Py_None,
347 SIP_PYOBJECT maximum = Py_None,
350 bool includeOutOfRange =
false,
354 double minimum = 0.0,
355 double maximum = 0.0,
358 bool includeOutOfRange =
false,
365 minimum = std::numeric_limits<double>::quiet_NaN();
369 minimum = PyFloat_AsDouble( a2 );
374 maximum = std::numeric_limits<double>::quiet_NaN();
378 maximum = PyFloat_AsDouble( a3 );
382 return sipConvertFromType( h, sipType_QgsRasterHistogram, Py_None );
392 virtual bool hasHistogram(
int bandNo,
394 double minimum = std::numeric_limits<double>::quiet_NaN(),
395 double maximum = std::numeric_limits<double>::quiet_NaN(),
398 bool includeOutOfRange =
false );
400 virtual bool hasHistogram(
int bandNo,
402 SIP_PYOBJECT minimum = Py_None,
403 SIP_PYOBJECT maximum = Py_None,
406 bool includeOutOfRange =
false )
409 double minimum = 0.0,
410 double maximum = 0.0,
413 bool includeOutOfRange =
false )];
419 minimum = std::numeric_limits<double>::quiet_NaN();
423 minimum = PyFloat_AsDouble( a2 );
428 maximum = std::numeric_limits<double>::quiet_NaN();
432 maximum = PyFloat_AsDouble( a3 );
435 sipRes = sipCpp->hasHistogram( a0, a1, minimum, maximum, *a4, a5, a6 );
450 virtual void cumulativeCut(
int bandNo,
456 int sampleSize = 0 );
459 virtual void writeXml( QDomDocument &doc, QDomElement &parentElem )
const { Q_UNUSED( doc ); Q_UNUSED( parentElem ); }
461 virtual void readXml(
const QDomElement &filterElem ) { Q_UNUSED( filterElem ); }
484 double minimum = std::numeric_limits<double>::quiet_NaN(),
485 double maximum = std::numeric_limits<double>::quiet_NaN(),
488 bool includeOutOfRange =
false );
493 SIP_PYOBJECT minimum = Py_None,
494 SIP_PYOBJECT maximum = Py_None,
497 bool includeOutOfRange =
false )
501 double minimum = 0.0,
502 double maximum = 0.0,
505 bool includeOutOfRange =
false )];
511 minimum = std::numeric_limits<double>::quiet_NaN();
515 minimum = PyFloat_AsDouble( a3 );
520 maximum = std::numeric_limits<double>::quiet_NaN();
524 maximum = PyFloat_AsDouble( a4 );
527 #if defined(SIP_PROTECTED_IS_PUBLIC) 528 sipCpp->initHistogram( *a0, a1, a2, minimum, maximum, *a5, a6, a7 );
530 sipCpp->sipProtect_initHistogram( *a0, a1, a2, minimum, maximum, *a5, a6, a7 );
virtual void onNewData()
May be emitted by raster data provider to indicate that some partial data are available and a new pre...
A rectangle specified with double values.
virtual void readXml(const QDomElement &filterElem)
Sets base class members from xml. Usually called from create() methods of subclasses.
virtual int xBlockSize() const
Gets block size.
virtual int yBlockSize() const
DataType
Raster data types.
Capability
If you add to this, please also add to capabilitiesString()
virtual QgsRasterInterface * input() const
Current input.
void setRenderPartialOutput(bool enable)
Set whether our painter is drawing to a temporary image used just by this layer.
virtual QgsRasterInterface * sourceInput()
Gets source / raw input, the first in pipe, usually provider.
virtual int ySize() const
virtual Qgis::DataType sourceDataType(int bandNo) const
Returns source data type for the band specified by number, source data type may be shorter than dataT...
Base class for feedback objects to be used for cancellation of something running in a worker thread...
The RasterBandStats struct is a container for statistics about a single raster band.
QStringList errors() const
Returns a list of any errors encountered while retrieving the raster block.
void setPreviewOnly(bool preview)
set flag whether the block request is for preview purposes only
#define QgsDebugMsgLevel(str, level)
virtual void setOn(bool on)
Sets whether the interface is on or off.
QList< QgsRasterHistogram > mHistograms
List of cached histograms, all bands mixed.
void appendError(const QString &error)
Appends an error message to the stored list of errors.
virtual void writeXml(QDomDocument &doc, QDomElement &parentElem) const
Write base class members to xml.
bool renderPartialOutput() const
Whether our painter is drawing to a temporary image used just by this layer.
Unknown or unspecified type.
QgsRasterBlockFeedback(QObject *parent=nullptr)
Construct a new raster block feedback object.
static int typeSize(int dataType)
Base class for processing filters like renderers, reprojector, resampler etc.
virtual int capabilities() const
Returns a bitmask containing the supported capabilities.
virtual QString generateBandName(int bandNumber) const
helper function to create zero padded band names
virtual bool setInput(QgsRasterInterface *input)
Set input.
virtual int xSize() const
Gets raster size.
virtual QgsRectangle extent() const
Gets the extent of the interface.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
int dataTypeSize(int bandNo)
The QgsRasterHistogram is a container for histogram of a single raster band.
QList< QgsRasterBandStats > mStatistics
List of cached statistics, all bands mixed.
virtual const QgsRasterInterface * sourceInput() const
Gets source / raw input, the first in pipe, usually provider.
Feedback object tailored for raster block reading.
bool isPreviewOnly() const
Whether the raster provider should return only data that are already available without waiting for fu...
virtual bool on() const
Returns whether the interface is on or off.
Base class for raster data providers.