18 #ifndef QGSRASTERINTERFACE_H 19 #define QGSRASTERINTERFACE_H 21 #include "qgis_core.h" 26 #include <QCoreApplication> 86 bool mPreviewOnly =
false;
89 bool mRenderPartialOutput =
false;
121 if ( dynamic_cast<QgsBrightnessContrastFilter *>( sipCpp ) )
122 sipType = sipType_QgsBrightnessContrastFilter;
123 else if ( dynamic_cast<QgsHueSaturationFilter *>( sipCpp ) )
124 sipType = sipType_QgsHueSaturationFilter;
125 else if ( dynamic_cast<QgsRasterDataProvider *>( sipCpp ) )
127 sipType = sipType_QgsRasterDataProvider;
132 else if ( dynamic_cast<QgsRasterNuller *>( sipCpp ) )
133 sipType = sipType_QgsRasterNuller;
134 else if ( dynamic_cast<QgsRasterProjector *>( sipCpp ) )
135 sipType = sipType_QgsRasterProjector;
136 else if ( dynamic_cast<QgsRasterRenderer *>( sipCpp ) )
138 if ( dynamic_cast<QgsHillshadeRenderer *>( sipCpp ) )
139 sipType = sipType_QgsHillshadeRenderer;
140 else if ( dynamic_cast<QgsMultiBandColorRenderer *>( sipCpp ) )
141 sipType = sipType_QgsMultiBandColorRenderer;
142 else if ( dynamic_cast<QgsPalettedRasterRenderer *>( sipCpp ) )
143 sipType = sipType_QgsPalettedRasterRenderer;
144 else if ( dynamic_cast<QgsSingleBandColorDataRenderer *>( sipCpp ) )
145 sipType = sipType_QgsSingleBandColorDataRenderer;
146 else if ( dynamic_cast<QgsSingleBandGrayRenderer *>( sipCpp ) )
147 sipType = sipType_QgsSingleBandGrayRenderer;
148 else if ( dynamic_cast<QgsSingleBandPseudoColorRenderer *>( sipCpp ) )
149 sipType = sipType_QgsSingleBandPseudoColorRenderer;
151 sipType = sipType_QgsRasterRenderer;
153 else if ( dynamic_cast<QgsRasterResampleFilter *>( sipCpp ) )
154 sipType = sipType_QgsRasterResampleFilter;
170 BuildPyramids = 1 << 4,
172 IdentifyValue = 1 << 6,
173 IdentifyText = 1 << 7,
174 IdentifyHtml = 1 << 8,
175 IdentifyFeature = 1 << 9,
194 QString capabilitiesString()
const;
213 virtual int bandCount()
const = 0;
216 virtual int xBlockSize()
const {
return mInput ? mInput->xBlockSize() : 0; }
217 virtual int yBlockSize()
const {
return mInput ? mInput->yBlockSize() : 0; }
220 virtual int xSize()
const {
return mInput ? mInput->xSize() : 0; }
221 virtual int ySize()
const {
return mInput ? mInput->ySize() : 0; }
226 return tr(
"Band" ) + QStringLiteral(
" %1" ) .arg( bandNumber, 1 + static_cast< int >( std::log10( static_cast< double >( bandCount() ) ) ), 10, QChar(
'0' ) );
250 virtual bool on()
const {
return mOn; }
253 virtual void setOn(
bool on ) { mOn = on; }
264 return mInput ? mInput->sourceInput() :
this;
275 return mInput ? mInput->sourceInput() :
this;
295 virtual bool hasStatistics(
int bandNo,
298 int sampleSize = 0 );
317 double minimum = std::numeric_limits<double>::quiet_NaN(),
318 double maximum = std::numeric_limits<double>::quiet_NaN(),
321 bool includeOutOfRange =
false,
326 SIP_PYOBJECT minimum = Py_None,
327 SIP_PYOBJECT maximum = Py_None,
330 bool includeOutOfRange =
false,
334 double minimum = 0.0,
335 double maximum = 0.0,
338 bool includeOutOfRange =
false,
345 minimum = std::numeric_limits<double>::quiet_NaN();
349 minimum = PyFloat_AsDouble( a2 );
354 maximum = std::numeric_limits<double>::quiet_NaN();
358 maximum = PyFloat_AsDouble( a3 );
361 QgsRasterHistogram h = sipCpp->histogram( a0, a1, minimum, maximum, *a4, a5, a6, a7 );
372 virtual bool hasHistogram(
int bandNo,
374 double minimum = std::numeric_limits<double>::quiet_NaN(),
375 double maximum = std::numeric_limits<double>::quiet_NaN(),
378 bool includeOutOfRange =
false );
380 virtual bool hasHistogram(
int bandNo,
382 SIP_PYOBJECT minimum = Py_None,
383 SIP_PYOBJECT maximum = Py_None,
386 bool includeOutOfRange =
false )
389 double minimum = 0.0,
390 double maximum = 0.0,
393 bool includeOutOfRange =
false )];
399 minimum = std::numeric_limits<double>::quiet_NaN();
403 minimum = PyFloat_AsDouble( a2 );
408 maximum = std::numeric_limits<double>::quiet_NaN();
412 maximum = PyFloat_AsDouble( a3 );
415 sipRes = sipCpp->hasHistogram( a0, a1, minimum, maximum, *a4, a5, a6 );
430 virtual void cumulativeCut(
int bandNo,
436 int sampleSize = 0 );
439 virtual void writeXml( QDomDocument &doc, QDomElement &parentElem )
const { Q_UNUSED( doc ); Q_UNUSED( parentElem ); }
441 virtual void readXml(
const QDomElement &filterElem ) { Q_UNUSED( filterElem ); }
464 double minimum = std::numeric_limits<double>::quiet_NaN(),
465 double maximum = std::numeric_limits<double>::quiet_NaN(),
468 bool includeOutOfRange =
false );
473 SIP_PYOBJECT minimum = Py_None,
474 SIP_PYOBJECT maximum = Py_None,
477 bool includeOutOfRange =
false )
481 double minimum = 0.0,
482 double maximum = 0.0,
485 bool includeOutOfRange =
false )];
491 minimum = std::numeric_limits<double>::quiet_NaN();
495 minimum = PyFloat_AsDouble( a3 );
500 maximum = std::numeric_limits<double>::quiet_NaN();
504 maximum = PyFloat_AsDouble( a4 );
507 #if defined(SIP_PROTECTED_IS_PUBLIC) 508 sipCpp->initHistogram( *a0, a1, a2, minimum, maximum, *a5, a6, a7 );
510 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.