18 #ifndef QGSRASTERINTERFACE_H 19 #define QGSRASTERINTERFACE_H 21 #include "qgis_core.h" 25 #include <QCoreApplication> 86 void appendError(
const QString &error ) { mErrors.append( error ); }
94 QStringList
errors()
const {
return mErrors; }
102 bool mPreviewOnly =
false;
105 bool mRenderPartialOutput =
false;
140 if ( dynamic_cast<QgsBrightnessContrastFilter *>( sipCpp ) )
141 sipType = sipType_QgsBrightnessContrastFilter;
142 else if ( dynamic_cast<QgsHueSaturationFilter *>( sipCpp ) )
143 sipType = sipType_QgsHueSaturationFilter;
144 else if ( dynamic_cast<QgsRasterDataProvider *>( sipCpp ) )
146 sipType = sipType_QgsRasterDataProvider;
151 else if ( dynamic_cast<QgsRasterNuller *>( sipCpp ) )
152 sipType = sipType_QgsRasterNuller;
153 else if ( dynamic_cast<QgsRasterProjector *>( sipCpp ) )
154 sipType = sipType_QgsRasterProjector;
155 else if ( dynamic_cast<QgsRasterRenderer *>( sipCpp ) )
157 if ( dynamic_cast<QgsHillshadeRenderer *>( sipCpp ) )
158 sipType = sipType_QgsHillshadeRenderer;
159 else if ( dynamic_cast<QgsMultiBandColorRenderer *>( sipCpp ) )
160 sipType = sipType_QgsMultiBandColorRenderer;
161 else if ( dynamic_cast<QgsPalettedRasterRenderer *>( sipCpp ) )
162 sipType = sipType_QgsPalettedRasterRenderer;
163 else if ( dynamic_cast<QgsSingleBandColorDataRenderer *>( sipCpp ) )
164 sipType = sipType_QgsSingleBandColorDataRenderer;
165 else if ( dynamic_cast<QgsSingleBandGrayRenderer *>( sipCpp ) )
166 sipType = sipType_QgsSingleBandGrayRenderer;
167 else if ( dynamic_cast<QgsSingleBandPseudoColorRenderer *>( sipCpp ) )
168 sipType = sipType_QgsSingleBandPseudoColorRenderer;
170 sipType = sipType_QgsRasterRenderer;
172 else if ( dynamic_cast<QgsRasterResampleFilter *>( sipCpp ) )
173 sipType = sipType_QgsRasterResampleFilter;
189 BuildPyramids = 1 << 4,
191 IdentifyValue = 1 << 6,
192 IdentifyText = 1 << 7,
193 IdentifyHtml = 1 << 8,
194 IdentifyFeature = 1 << 9,
213 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' ) );
271 virtual bool on()
const {
return mOn; }
274 virtual void setOn(
bool on ) { mOn = on; }
285 return mInput ? mInput->sourceInput() :
this;
296 return mInput ? mInput->sourceInput() :
this;
316 virtual bool hasStatistics(
int bandNo,
319 int sampleSize = 0 );
338 double minimum = std::numeric_limits<double>::quiet_NaN(),
339 double maximum = std::numeric_limits<double>::quiet_NaN(),
342 bool includeOutOfRange =
false,
347 SIP_PYOBJECT minimum = Py_None,
348 SIP_PYOBJECT maximum = Py_None,
351 bool includeOutOfRange =
false,
355 double minimum = 0.0,
356 double maximum = 0.0,
359 bool includeOutOfRange =
false,
366 minimum = std::numeric_limits<double>::quiet_NaN();
370 minimum = PyFloat_AsDouble( a2 );
375 maximum = std::numeric_limits<double>::quiet_NaN();
379 maximum = PyFloat_AsDouble( a3 );
383 return sipConvertFromType( h, sipType_QgsRasterHistogram, Py_None );
393 virtual bool hasHistogram(
int bandNo,
395 double minimum = std::numeric_limits<double>::quiet_NaN(),
396 double maximum = std::numeric_limits<double>::quiet_NaN(),
399 bool includeOutOfRange =
false );
401 virtual bool hasHistogram(
int bandNo,
403 SIP_PYOBJECT minimum = Py_None,
404 SIP_PYOBJECT maximum = Py_None,
407 bool includeOutOfRange =
false )
410 double minimum = 0.0,
411 double maximum = 0.0,
414 bool includeOutOfRange =
false )];
420 minimum = std::numeric_limits<double>::quiet_NaN();
424 minimum = PyFloat_AsDouble( a2 );
429 maximum = std::numeric_limits<double>::quiet_NaN();
433 maximum = PyFloat_AsDouble( a3 );
436 sipRes = sipCpp->hasHistogram( a0, a1, minimum, maximum, *a4, a5, a6 );
451 virtual void cumulativeCut(
int bandNo,
457 int sampleSize = 0 );
460 virtual void writeXml( QDomDocument &doc, QDomElement &parentElem )
const { Q_UNUSED( doc ) Q_UNUSED( parentElem ); }
462 virtual void readXml(
const QDomElement &filterElem ) { Q_UNUSED( filterElem ) }
485 double minimum = std::numeric_limits<double>::quiet_NaN(),
486 double maximum = std::numeric_limits<double>::quiet_NaN(),
489 bool includeOutOfRange =
false );
494 SIP_PYOBJECT minimum = Py_None,
495 SIP_PYOBJECT maximum = Py_None,
498 bool includeOutOfRange =
false )
502 double minimum = 0.0,
503 double maximum = 0.0,
506 bool includeOutOfRange =
false )];
512 minimum = std::numeric_limits<double>::quiet_NaN();
516 minimum = PyFloat_AsDouble( a3 );
521 maximum = std::numeric_limits<double>::quiet_NaN();
525 maximum = PyFloat_AsDouble( a4 );
528 #if defined(SIP_PROTECTED_IS_PUBLIC) 529 sipCpp->initHistogram( *a0, a1, a2, minimum, maximum, *a5, a6, a7 );
531 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 cancellation 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.
void appendError(const QString &error)
Appends an error message to the stored list of errors.
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
QStringList errors() const
Returns a list of any errors encountered while retrieving the raster block.
#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.