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;
296 virtual bool hasStatistics(
int bandNo,
299 int sampleSize = 0 );
318 double minimum = std::numeric_limits<double>::quiet_NaN(),
319 double maximum = std::numeric_limits<double>::quiet_NaN(),
322 bool includeOutOfRange =
false,
327 SIP_PYOBJECT minimum = Py_None,
328 SIP_PYOBJECT maximum = Py_None,
331 bool includeOutOfRange =
false,
335 double minimum = 0.0,
336 double maximum = 0.0,
339 bool includeOutOfRange =
false,
346 minimum = std::numeric_limits<double>::quiet_NaN();
350 minimum = PyFloat_AsDouble( a2 );
355 maximum = std::numeric_limits<double>::quiet_NaN();
359 maximum = PyFloat_AsDouble( a3 );
362 QgsRasterHistogram h = sipCpp->histogram( a0, a1, minimum, maximum, *a4, a5, a6, a7 );
373 virtual bool hasHistogram(
int bandNo,
375 double minimum = std::numeric_limits<double>::quiet_NaN(),
376 double maximum = std::numeric_limits<double>::quiet_NaN(),
379 bool includeOutOfRange =
false );
381 virtual bool hasHistogram(
int bandNo,
383 SIP_PYOBJECT minimum = Py_None,
384 SIP_PYOBJECT maximum = Py_None,
387 bool includeOutOfRange =
false )
390 double minimum = 0.0,
391 double maximum = 0.0,
394 bool includeOutOfRange =
false )];
400 minimum = std::numeric_limits<double>::quiet_NaN();
404 minimum = PyFloat_AsDouble( a2 );
409 maximum = std::numeric_limits<double>::quiet_NaN();
413 maximum = PyFloat_AsDouble( a3 );
416 sipRes = sipCpp->hasHistogram( a0, a1, minimum, maximum, *a4, a5, a6 );
431 virtual void cumulativeCut(
int bandNo,
437 int sampleSize = 0 );
440 virtual void writeXml( QDomDocument &doc, QDomElement &parentElem )
const { Q_UNUSED( doc ); Q_UNUSED( parentElem ); }
442 virtual void readXml(
const QDomElement &filterElem ) { Q_UNUSED( filterElem ); }
465 double minimum = std::numeric_limits<double>::quiet_NaN(),
466 double maximum = std::numeric_limits<double>::quiet_NaN(),
469 bool includeOutOfRange =
false );
474 SIP_PYOBJECT minimum = Py_None,
475 SIP_PYOBJECT maximum = Py_None,
478 bool includeOutOfRange =
false )
482 double minimum = 0.0,
483 double maximum = 0.0,
486 bool includeOutOfRange =
false )];
492 minimum = std::numeric_limits<double>::quiet_NaN();
496 minimum = PyFloat_AsDouble( a3 );
501 maximum = std::numeric_limits<double>::quiet_NaN();
505 maximum = PyFloat_AsDouble( a4 );
508 #if defined(SIP_PROTECTED_IS_PUBLIC) 509 sipCpp->initHistogram( *a0, a1, a2, minimum, maximum, *a5, a6, a7 );
511 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
Get 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()
Get source / raw input, the first in pipe, usually provider.
virtual int xBlockSize() const
Get 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)
Set on/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
Is on/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
Get raster size.
virtual const QgsRasterInterface * sourceInput() const
Get source / raw input, the first in pipe, usually provider.
Base class for raster data providers.