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;
141 sipType = sipType_QgsBrightnessContrastFilter;
143 sipType = sipType_QgsHueSaturationFilter;
146 sipType = sipType_QgsRasterDataProvider;
152 sipType = sipType_QgsRasterNuller;
154 sipType = sipType_QgsRasterProjector;
158 sipType = sipType_QgsHillshadeRenderer;
160 sipType = sipType_QgsMultiBandColorRenderer;
162 sipType = sipType_QgsPalettedRasterRenderer;
164 sipType = sipType_QgsSingleBandColorDataRenderer;
166 sipType = sipType_QgsSingleBandGrayRenderer;
168 sipType = sipType_QgsSingleBandPseudoColorRenderer;
170 sipType = sipType_QgsRasterRenderer;
173 sipType = sipType_QgsRasterResampleFilter;
189 BuildPyramids = 1 << 4,
191 IdentifyValue = 1 << 6,
192 IdentifyText = 1 << 7,
193 IdentifyHtml = 1 << 8,
194 IdentifyFeature = 1 << 9,
214 QString capabilitiesString()
const;
240 virtual int xBlockSize()
const {
return mInput ? mInput->xBlockSize() : 0; }
241 virtual int yBlockSize()
const {
return mInput ? mInput->yBlockSize() : 0; }
244 virtual int xSize()
const {
return mInput ? mInput->xSize() : 0; }
245 virtual int ySize()
const {
return mInput ? mInput->ySize() : 0; }
248 virtual QString generateBandName(
int bandNumber )
const;
255 virtual QString colorInterpretationName(
int bandNumber )
const;
262 QString displayBandName(
int bandNumber )
const;
286 virtual bool on()
const {
return mOn; }
289 virtual void setOn(
bool on ) { mOn = on; }
300 return mInput ? mInput->sourceInput() :
this;
311 return mInput ? mInput->sourceInput() :
this;
331 virtual bool hasStatistics(
int bandNo,
334 int sampleSize = 0 );
353 double minimum = std::numeric_limits<double>::quiet_NaN(),
354 double maximum = std::numeric_limits<double>::quiet_NaN(),
357 bool includeOutOfRange =
false,
362 SIP_PYOBJECT minimum = Py_None,
363 SIP_PYOBJECT maximum = Py_None,
366 bool includeOutOfRange =
false,
370 double minimum = 0.0,
371 double maximum = 0.0,
374 bool includeOutOfRange =
false,
381 minimum = std::numeric_limits<double>::quiet_NaN();
385 minimum = PyFloat_AsDouble( a2 );
390 maximum = std::numeric_limits<double>::quiet_NaN();
394 maximum = PyFloat_AsDouble( a3 );
398 return sipConvertFromType( h, sipType_QgsRasterHistogram, Py_None );
408 virtual bool hasHistogram(
int bandNo,
410 double minimum = std::numeric_limits<double>::quiet_NaN(),
411 double maximum = std::numeric_limits<double>::quiet_NaN(),
414 bool includeOutOfRange =
false );
416 virtual bool hasHistogram(
int bandNo,
418 SIP_PYOBJECT minimum = Py_None,
419 SIP_PYOBJECT maximum = Py_None,
422 bool includeOutOfRange =
false )
425 double minimum = 0.0,
426 double maximum = 0.0,
429 bool includeOutOfRange =
false )];
435 minimum = std::numeric_limits<double>::quiet_NaN();
439 minimum = PyFloat_AsDouble( a2 );
444 maximum = std::numeric_limits<double>::quiet_NaN();
448 maximum = PyFloat_AsDouble( a3 );
451 sipRes = sipCpp->hasHistogram( a0, a1, minimum, maximum, *a4, a5, a6 );
466 virtual void cumulativeCut(
int bandNo,
472 int sampleSize = 0 );
475 virtual void writeXml( QDomDocument &doc, QDomElement &parentElem )
const { Q_UNUSED( doc ) Q_UNUSED( parentElem ); }
477 virtual void readXml(
const QDomElement &filterElem ) { Q_UNUSED( filterElem ) }
500 double minimum = std::numeric_limits<double>::quiet_NaN(),
501 double maximum = std::numeric_limits<double>::quiet_NaN(),
504 bool includeOutOfRange =
false );
509 SIP_PYOBJECT minimum = Py_None,
510 SIP_PYOBJECT maximum = Py_None,
513 bool includeOutOfRange =
false )
517 double minimum = 0.0,
518 double maximum = 0.0,
521 bool includeOutOfRange =
false )];
527 minimum = std::numeric_limits<double>::quiet_NaN();
531 minimum = PyFloat_AsDouble( a3 );
536 maximum = std::numeric_limits<double>::quiet_NaN();
540 maximum = PyFloat_AsDouble( a4 );
543 #if defined(SIP_PROTECTED_IS_PUBLIC) || (SIP_VERSION >= 0x050000 && !defined(_MSC_VER))
544 sipCpp->initHistogram( *a0, a1, a2, minimum, maximum, *a5, a6, a7 );
546 sipCpp->sipProtect_initHistogram( *a0, a1, a2, minimum, maximum, *a5, a6, a7 );
DataType
Raster data types.
@ UnknownDataType
Unknown or unspecified type.
Brightness/contrast and gamma correction filter pipe for rasters.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
A renderer for generating live hillshade models.
Color and saturation filter pipe for rasters.
Renderer for multiband images with the color components.
Renderer for paletted raster images.
The RasterBandStats struct is a container for statistics about a single raster band.
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...
QStringList errors() const
Returns a list of any errors encountered while retrieving the raster block.
virtual void onNewData()
May be emitted by raster data provider to indicate that some partial data are available and a new pre...
QgsRasterBlockFeedback(QObject *parent=nullptr)
Construct a new raster block feedback object.
void setPreviewOnly(bool preview)
set flag whether the block request is for preview purposes only
bool renderPartialOutput() const
Whether our painter is drawing to a temporary image used just by this layer.
void appendError(const QString &error)
Appends an error message to the stored list of errors.
void setRenderPartialOutput(bool enable)
Set whether our painter is drawing to a temporary image used just by this layer.
static int typeSize(Qgis::DataType dataType) SIP_HOLDGIL
Returns the size in bytes for the specified dataType.
Base class for raster data providers.
The QgsRasterHistogram is a container for histogram of a single raster band.
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 QgsRasterInterface * clone() const =0
Clone itself, create deep copy.
virtual int yBlockSize() const
virtual QgsRasterInterface * sourceInput()
Gets source / raw input, the first in pipe, usually provider.
virtual Qgis::DataType dataType(int bandNo) const =0
Returns data type for the band specified by number.
QList< QgsRasterBandStats > mStatistics
List of cached statistics, all bands mixed.
Capability
If you add to this, please also add to capabilitiesString()
virtual QgsRasterInterface * input() const
Current input.
virtual int xSize() const
Gets raster size.
virtual void setOn(bool on)
Sets whether the interface is on or off.
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...
virtual int xBlockSize() const
Gets block size.
virtual const QgsRasterInterface * sourceInput() const
Gets source / raw input, the first in pipe, usually provider.
virtual int bandCount() const =0
Gets number of bands.
virtual bool on() const
Returns whether the interface is on or off.
virtual ~QgsRasterInterface()=default
int dataTypeSize(int bandNo) const
Returns the size (in bytes) for the data type for the specified band.
virtual void readXml(const QDomElement &filterElem)
Sets base class members from xml. Usually called from create() methods of subclasses.
virtual int capabilities() const
Returns a bitmask containing the supported capabilities.
virtual int ySize() const
virtual QgsRectangle extent() const
Gets the extent of the interface.
QList< QgsRasterHistogram > mHistograms
List of cached histograms, all bands mixed.
virtual void writeXml(QDomDocument &doc, QDomElement &parentElem) const
Write base class members to xml.
virtual bool setInput(QgsRasterInterface *input)
Set input.
Raster pipe that deals with null values.
QgsRasterProjector implements approximate projection support for it calculates grid of points in sour...
Raster renderer pipe that applies colors to a raster.
Resample filter pipe for rasters.
A rectangle specified with double values.
Raster renderer pipe for single band color.
Raster renderer pipe for single band gray.
Raster renderer pipe for single band pseudocolor.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
#define QgsDebugMsgLevel(str, level)