18 #ifndef QGSRASTERINTERFACE_H 19 #define QGSRASTERINTERFACE_H 21 #include "qgis_core.h" 25 #include <QCoreApplication> 85 bool mPreviewOnly =
false;
88 bool mRenderPartialOutput =
false;
120 if ( dynamic_cast<QgsBrightnessContrastFilter *>( sipCpp ) )
121 sipType = sipType_QgsBrightnessContrastFilter;
122 else if ( dynamic_cast<QgsHueSaturationFilter *>( sipCpp ) )
123 sipType = sipType_QgsHueSaturationFilter;
124 else if ( dynamic_cast<QgsRasterDataProvider *>( sipCpp ) )
126 sipType = sipType_QgsRasterDataProvider;
131 else if ( dynamic_cast<QgsRasterNuller *>( sipCpp ) )
132 sipType = sipType_QgsRasterNuller;
133 else if ( dynamic_cast<QgsRasterProjector *>( sipCpp ) )
134 sipType = sipType_QgsRasterProjector;
135 else if ( dynamic_cast<QgsRasterRenderer *>( sipCpp ) )
137 if ( dynamic_cast<QgsHillshadeRenderer *>( sipCpp ) )
138 sipType = sipType_QgsHillshadeRenderer;
139 else if ( dynamic_cast<QgsMultiBandColorRenderer *>( sipCpp ) )
140 sipType = sipType_QgsMultiBandColorRenderer;
141 else if ( dynamic_cast<QgsPalettedRasterRenderer *>( sipCpp ) )
142 sipType = sipType_QgsPalettedRasterRenderer;
143 else if ( dynamic_cast<QgsSingleBandColorDataRenderer *>( sipCpp ) )
144 sipType = sipType_QgsSingleBandColorDataRenderer;
145 else if ( dynamic_cast<QgsSingleBandGrayRenderer *>( sipCpp ) )
146 sipType = sipType_QgsSingleBandGrayRenderer;
147 else if ( dynamic_cast<QgsSingleBandPseudoColorRenderer *>( sipCpp ) )
148 sipType = sipType_QgsSingleBandPseudoColorRenderer;
150 sipType = sipType_QgsRasterRenderer;
152 else if ( dynamic_cast<QgsRasterResampleFilter *>( sipCpp ) )
153 sipType = sipType_QgsRasterResampleFilter;
169 BuildPyramids = 1 << 4,
171 IdentifyValue = 1 << 6,
172 IdentifyText = 1 << 7,
173 IdentifyHtml = 1 << 8,
174 IdentifyFeature = 1 << 9,
193 QString capabilitiesString()
const;
212 virtual int bandCount()
const = 0;
215 virtual int xBlockSize()
const {
return mInput ? mInput->xBlockSize() : 0; }
216 virtual int yBlockSize()
const {
return mInput ? mInput->yBlockSize() : 0; }
219 virtual int xSize()
const {
return mInput ? mInput->xSize() : 0; }
220 virtual int ySize()
const {
return mInput ? mInput->ySize() : 0; }
225 return tr(
"Band" ) + QStringLiteral(
" %1" ) .arg( bandNumber, 1 + static_cast< int >( std::log10( static_cast< double >( bandCount() ) ) ), 10, QChar(
'0' ) );
249 virtual bool on()
const {
return mOn; }
252 virtual void setOn(
bool on ) { mOn = on; }
263 return mInput ? mInput->sourceInput() :
this;
274 return mInput ? mInput->sourceInput() :
this;
294 virtual bool hasStatistics(
int bandNo,
297 int sampleSize = 0 );
316 double minimum = std::numeric_limits<double>::quiet_NaN(),
317 double maximum = std::numeric_limits<double>::quiet_NaN(),
320 bool includeOutOfRange =
false,
325 SIP_PYOBJECT minimum = Py_None,
326 SIP_PYOBJECT maximum = Py_None,
329 bool includeOutOfRange =
false,
333 double minimum = 0.0,
334 double maximum = 0.0,
337 bool includeOutOfRange =
false,
344 minimum = std::numeric_limits<double>::quiet_NaN();
348 minimum = PyFloat_AsDouble( a2 );
353 maximum = std::numeric_limits<double>::quiet_NaN();
357 maximum = PyFloat_AsDouble( a3 );
360 QgsRasterHistogram h = sipCpp->histogram( a0, a1, minimum, maximum, *a4, a5, a6, a7 );
371 virtual bool hasHistogram(
int bandNo,
373 double minimum = std::numeric_limits<double>::quiet_NaN(),
374 double maximum = std::numeric_limits<double>::quiet_NaN(),
377 bool includeOutOfRange =
false );
379 virtual bool hasHistogram(
int bandNo,
381 SIP_PYOBJECT minimum = Py_None,
382 SIP_PYOBJECT maximum = Py_None,
385 bool includeOutOfRange =
false )
388 double minimum = 0.0,
389 double maximum = 0.0,
392 bool includeOutOfRange =
false )];
398 minimum = std::numeric_limits<double>::quiet_NaN();
402 minimum = PyFloat_AsDouble( a2 );
407 maximum = std::numeric_limits<double>::quiet_NaN();
411 maximum = PyFloat_AsDouble( a3 );
414 sipRes = sipCpp->hasHistogram( a0, a1, minimum, maximum, *a4, a5, a6 );
429 virtual void cumulativeCut(
int bandNo,
435 int sampleSize = 0 );
438 virtual void writeXml( QDomDocument &doc, QDomElement &parentElem )
const { Q_UNUSED( doc ); Q_UNUSED( parentElem ); }
440 virtual void readXml(
const QDomElement &filterElem ) { Q_UNUSED( filterElem ); }
463 double minimum = std::numeric_limits<double>::quiet_NaN(),
464 double maximum = std::numeric_limits<double>::quiet_NaN(),
467 bool includeOutOfRange =
false );
472 SIP_PYOBJECT minimum = Py_None,
473 SIP_PYOBJECT maximum = Py_None,
476 bool includeOutOfRange =
false )
480 double minimum = 0.0,
481 double maximum = 0.0,
484 bool includeOutOfRange =
false )];
490 minimum = std::numeric_limits<double>::quiet_NaN();
494 minimum = PyFloat_AsDouble( a3 );
499 maximum = std::numeric_limits<double>::quiet_NaN();
503 maximum = PyFloat_AsDouble( a4 );
506 #if defined(SIP_PROTECTED_IS_PUBLIC) 507 sipCpp->initHistogram( *a0, a1, a2, minimum, maximum, *a5, a6, a7 );
509 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.
bool renderPartialOutput() const
Whether our painter is drawing to a temporary image used just by this layer.
virtual QgsRectangle extent() const
Gets the extent of the interface.
virtual QgsRasterInterface * input() const
Current input.
DataType
Raster data types.
virtual int ySize() const
Capability
If you add to this, please also add to capabilitiesString()
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 xBlockSize() const
Gets block size.
Base class for feedback objects to be used for cancelation of something running in a worker thread...
The RasterBandStats struct is a container for statistics about a single raster band.
void setPreviewOnly(bool preview)
set flag whether the block request is for preview purposes only
#define QgsDebugMsgLevel(str, level)
virtual int capabilities() const
Returns a bitmask containing the supported capabilities.
virtual void setOn(bool on)
Sets whether the interface is on or off.
QList< QgsRasterHistogram > mHistograms
List of cached histograms, all bands mixed.
Unknown or unspecified type.
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...
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 bool setInput(QgsRasterInterface *input)
Set input.
virtual bool on() const
Returns whether the interface is on or off.
virtual int yBlockSize() const
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
bool isPreviewOnly() const
Whether the raster provider should return only data that are already available without waiting for fu...
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 void writeXml(QDomDocument &doc, QDomElement &parentElem) const
Write base class members to xml.
virtual QString generateBandName(int bandNumber) const
helper function to create zero padded band names
Feedback object tailored for raster block reading.
virtual int xSize() const
Gets raster size.
virtual const QgsRasterInterface * sourceInput() const
Gets source / raw input, the first in pipe, usually provider.
Base class for raster data providers.