18#ifndef QGSRASTERINTERFACE_H
19#define QGSRASTERINTERFACE_H
33#include <QCoreApplication>
37using namespace Qt::StringLiterals;
92 void appendError(
const QString &error ) { mErrors.append( error ); }
100 QStringList
errors()
const {
return mErrors; }
123 bool mPreviewOnly =
false;
126 bool mRenderPartialOutput =
false;
164 sipType = sipType_QgsBrightnessContrastFilter;
166 sipType = sipType_QgsHueSaturationFilter;
169 sipType = sipType_QgsRasterDataProvider;
175 sipType = sipType_QgsRasterNuller;
177 sipType = sipType_QgsRasterProjector;
181 sipType = sipType_QgsHillshadeRenderer;
183 sipType = sipType_QgsMultiBandColorRenderer;
185 sipType = sipType_QgsPalettedRasterRenderer;
187 sipType = sipType_QgsSingleBandColorDataRenderer;
189 sipType = sipType_QgsSingleBandGrayRenderer;
191 sipType = sipType_QgsSingleBandPseudoColorRenderer;
193 sipType = sipType_QgsRasterSingleColorRenderer;
195 sipType = sipType_QgsRasterContourRenderer;
197 sipType = sipType_QgsRasterVectorFieldRenderer;
199 sipType = sipType_QgsRasterRenderer;
202 sipType = sipType_QgsRasterResampleFilter;
268 virtual QString generateBandName(
int bandNumber )
const;
276 virtual QString colorInterpretationName(
int bandNumber )
const;
283 QString displayBandName(
int bandNumber )
const;
311 virtual bool on()
const {
return mOn; }
377 virtual
bool hasStatistics(
int bandNo,
Qgis::RasterBandStatistics stats =
Qgis::RasterBandStatistic::All, const
QgsRectangle &extent =
QgsRectangle(),
int sampleSize = 0 );
397 double minimum = std::numeric_limits<double>::quiet_NaN(),
398 double maximum = std::numeric_limits<double>::quiet_NaN(),
401 bool includeOutOfRange =
false,
407 SIP_PYOBJECT minimum = Py_None,
408 SIP_PYOBJECT maximum = Py_None,
411 bool includeOutOfRange =
false,
415 double minimum = 0.0,
416 double maximum = 0.0,
419 bool includeOutOfRange =
false,
426 minimum = std::numeric_limits<double>::quiet_NaN();
430 minimum = PyFloat_AsDouble( a2 );
435 maximum = std::numeric_limits<double>::quiet_NaN();
439 maximum = PyFloat_AsDouble( a3 );
442 QgsRasterHistogram *h =
new QgsRasterHistogram( sipCpp->histogram( a0, a1, minimum, maximum, *a4, a5, a6, a7 ) );
443 return sipConvertFromType( h, sipType_QgsRasterHistogram, Py_None );
456 virtual bool hasHistogram(
int bandNo,
458 double minimum = std::numeric_limits<double>::quiet_NaN(),
459 double maximum = std::numeric_limits<double>::quiet_NaN(),
460 const QgsRectangle &extent = QgsRectangle(),
462 bool includeOutOfRange =
false );
465 virtual bool hasHistogram(
int bandNo,
467 SIP_PYOBJECT minimum = Py_None,
468 SIP_PYOBJECT maximum = Py_None,
469 const QgsRectangle &extent = QgsRectangle(),
471 bool includeOutOfRange =
false )
474 double minimum = 0.0,
475 double maximum = 0.0,
476 const QgsRectangle &extent = QgsRectangle(),
478 bool includeOutOfRange =
false )];
484 minimum = std::numeric_limits<double>::quiet_NaN();
488 minimum = PyFloat_AsDouble( a2 );
493 maximum = std::numeric_limits<double>::quiet_NaN();
497 maximum = PyFloat_AsDouble( a3 );
500 sipRes = sipCpp->hasHistogram( a0, a1, minimum, maximum, *a4, a5, a6 );
517 virtual void cumulativeCut(
int bandNo,
double lowerCount,
double upperCount,
double &lowerValue,
double &upperValue,
const QgsRectangle &extent = QgsRectangle(),
int sampleSize = 0 );
520 virtual void writeXml( QDomDocument &doc, QDomElement &parentElem )
const
523 Q_UNUSED( parentElem );
526 virtual void readXml(
const QDomElement &filterElem ) { Q_UNUSED( filterElem ) }
550 double minimum = std::numeric_limits<double>::quiet_NaN(),
551 double maximum = std::numeric_limits<double>::quiet_NaN(),
554 bool includeOutOfRange =
false );
560 SIP_PYOBJECT minimum = Py_None,
561 SIP_PYOBJECT maximum = Py_None,
564 bool includeOutOfRange =
false )
568 double minimum = 0.0,
569 double maximum = 0.0,
572 bool includeOutOfRange =
false )];
578 minimum = std::numeric_limits<double>::quiet_NaN();
582 minimum = PyFloat_AsDouble( a3 );
587 maximum = std::numeric_limits<double>::quiet_NaN();
591 maximum = PyFloat_AsDouble( a4 );
594#if defined(SIP_PROTECTED_IS_PUBLIC) || !defined(_MSC_VER)
595 sipCpp->initHistogram( *a0, a1, a2, minimum, maximum, *a5, a6, a7 );
597 sipCpp->sipProtect_initHistogram( *a0, a1, a2, minimum, maximum, *a5, a6, a7 );
608 Q_DECL_DEPRECATED
void initStatistics( QgsRasterBandStats &statistics,
int bandNo,
int stats,
const QgsRectangle &boundingBox = QgsRectangle(),
int binCount = 0 ) const
SIP_DEPRECATED;
612 QgsRasterBandStats &statistics,
int bandNo, Qgis::RasterBandStatistics stats = Qgis::RasterBandStatistic::All, const QgsRectangle &boundingBox = QgsRectangle(),
int binCount = 0
617 QgsRasterInterface(
const QgsRasterInterface & );
618 QgsRasterInterface &operator=(
const QgsRasterInterface & );
621 Q_DISABLE_COPY( QgsRasterInterface )
Provides global constants and enumerations for use throughout the application.
QFlags< RasterInterfaceCapability > RasterInterfaceCapabilities
Raster interface capabilities.
@ UnknownDataType
Unknown or unspecified type.
Brightness/contrast and gamma correction filter pipe for rasters.
QgsFeedback(QObject *parent=nullptr)
Construct a feedback object.
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)
Returns the size in bytes for the specified dataType.
Raster renderer that generates contours on the fly for a source raster band.
Base class for raster data providers.
A container for a histogram of a single raster band.
virtual QgsRasterInterface * clone() const =0
Clone itself, create deep copy.
virtual Qgis::RasterInterfaceCapabilities capabilities() const
Returns the capabilities supported by the interface.
virtual int yBlockSize() const
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 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.
Q_DECL_DEPRECATED QString capabilitiesString() const
Returns the raster interface capabilities in friendly format.
void initHistogram(QgsRasterHistogram &histogram, int bandNo, int binCount, double minimum=std::numeric_limits< double >::quiet_NaN(), double maximum=std::numeric_limits< double >::quiet_NaN(), const QgsRectangle &boundingBox=QgsRectangle(), int sampleSize=0, bool includeOutOfRange=false)
Fill in histogram defaults if not specified.
virtual int xSize() const
Gets raster size.
virtual void setOn(bool on)
Sets whether the interface is on or off.
QgsRasterInterface(QgsRasterInterface *input=nullptr)
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 int bandCount() const =0
Gets number of bands.
virtual bool on() const
Returns whether the interface is on or off.
virtual QgsRasterInterface * sourceInput()
Gets source / raw input, the first in pipe, usually provider.
virtual ~QgsRasterInterface()=default
int dataTypeSize(int bandNo) const
Returns the size (in bytes) for the data type for the specified band.
QgsRasterInterface * mInput
virtual void readXml(const QDomElement &filterElem)
Sets base class members from xml. Usually called from create() methods of subclasses.
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 QgsRasterInterface * input() const
Current input.
virtual const QgsRasterInterface * sourceInput() const
Gets source / raw input, the first in pipe, usually provider.
virtual QgsRasterHistogram histogram(int bandNo, int binCount=0, double minimum=std::numeric_limits< double >::quiet_NaN(), double maximum=std::numeric_limits< double >::quiet_NaN(), const QgsRectangle &extent=QgsRectangle(), int sampleSize=0, bool includeOutOfRange=false, QgsRasterBlockFeedback *feedback=nullptr)
Returns a band histogram.
virtual bool setInput(QgsRasterInterface *input)
Set input.
Raster pipe that deals with null values.
Implements approximate projection support for optimised raster transformation.
Raster renderer pipe that applies colors to a raster.
Resample filter pipe for rasters.
Raster renderer which renders all data pixels using a single color.
Raster renderer which draws a vector field stored in raster bands.
A rectangle specified with double values.
Contains information about the context of a rendering operation.
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)