QGIS API Documentation 3.36.0-Maidenhead (09951dc0acf)
|
Base class for processing filters like renderers, reprojector, resampler etc. More...
#include <qgsrasterinterface.h>
Public Types | |
enum | Capability { NoCapabilities = 0 , Size = 1 << 1 , Create = 1 << 2 , Remove = 1 << 3 , BuildPyramids = 1 << 4 , Identify = 1 << 5 , IdentifyValue = 1 << 6 , IdentifyText = 1 << 7 , IdentifyHtml = 1 << 8 , IdentifyFeature = 1 << 9 , Prefetch = 1 << 10 } |
If you add to this, please also add to capabilitiesString() More... | |
Public Member Functions | |
QgsRasterInterface (QgsRasterInterface *input=nullptr) | |
virtual | ~QgsRasterInterface ()=default |
virtual int | bandCount () const =0 |
Gets number of bands. | |
Q_DECL_DEPRECATED QgsRasterBandStats | bandStatistics (int bandNo, int stats, const QgsRectangle &extent=QgsRectangle(), int sampleSize=0, QgsRasterBlockFeedback *feedback=nullptr) |
Returns the band statistics. | |
virtual QgsRasterBandStats | bandStatistics (int bandNo, Qgis::RasterBandStatistics stats=Qgis::RasterBandStatistic::All, const QgsRectangle &extent=QgsRectangle(), int sampleSize=0, QgsRasterBlockFeedback *feedback=nullptr) |
Returns the band statistics. | |
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 int | capabilities () const |
Returns a bitmask containing the supported capabilities. | |
QString | capabilitiesString () const |
Returns the raster interface capabilities in friendly format. | |
virtual QgsRasterInterface * | clone () const =0 |
Clone itself, create deep copy. | |
virtual QString | colorInterpretationName (int bandNumber) const |
Returns the name of the color interpretation for the specified bandNumber. | |
virtual void | cumulativeCut (int bandNo, double lowerCount, double upperCount, double &lowerValue, double &upperValue, const QgsRectangle &extent=QgsRectangle(), int sampleSize=0) |
Find values for cumulative pixel count cut. | |
virtual Qgis::DataType | dataType (int bandNo) const =0 |
Returns data type for the band specified by number. | |
int | dataTypeSize (int bandNo) const |
Returns the size (in bytes) for the data type for the specified band. | |
QString | displayBandName (int bandNumber) const |
Generates a friendly, descriptive name for the specified bandNumber. | |
virtual QgsRectangle | extent () const |
Gets the extent of the interface. | |
virtual QString | generateBandName (int bandNumber) const |
helper function to create zero padded band names | |
virtual bool | hasHistogram (int bandNo, int binCount, 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) |
Returns true if histogram is available (cached, already calculated) | |
Q_DECL_DEPRECATED bool | hasStatistics (int bandNo, int stats, const QgsRectangle &extent=QgsRectangle(), int sampleSize=0) |
Returns true if histogram is available (cached, already calculated). | |
virtual bool | hasStatistics (int bandNo, Qgis::RasterBandStatistics stats=Qgis::RasterBandStatistic::All, const QgsRectangle &extent=QgsRectangle(), int sampleSize=0) |
Returns true if histogram is available (cached, already calculated). | |
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 QgsRasterInterface * | input () const |
Current input. | |
virtual bool | on () const |
Returns whether the interface is on or off. | |
virtual void | readXml (const QDomElement &filterElem) |
Sets base class members from xml. Usually called from create() methods of subclasses. | |
virtual bool | setInput (QgsRasterInterface *input) |
Set input. | |
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 dataType. | |
virtual QgsRasterInterface * | sourceInput () |
Gets source / raw input, the first in pipe, usually provider. | |
virtual const QgsRasterInterface * | sourceInput () const |
Gets source / raw input, the first in pipe, usually provider. | |
virtual void | writeXml (QDomDocument &doc, QDomElement &parentElem) const |
Write base class members to xml. | |
virtual int | xBlockSize () const |
Gets block size. | |
virtual int | xSize () const |
Gets raster size. | |
virtual int | yBlockSize () const |
virtual int | ySize () const |
Protected Member Functions | |
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. | |
Q_DECL_DEPRECATED void | initStatistics (QgsRasterBandStats &statistics, int bandNo, int stats, const QgsRectangle &boundingBox=QgsRectangle(), int binCount=0) const |
Fill in statistics defaults if not specified. | |
void | initStatistics (QgsRasterBandStats &statistics, int bandNo, Qgis::RasterBandStatistics stats=Qgis::RasterBandStatistic::All, const QgsRectangle &boundingBox=QgsRectangle(), int binCount=0) const |
Fill in statistics defaults if not specified. | |
Protected Attributes | |
QList< QgsRasterHistogram > | mHistograms |
List of cached histograms, all bands mixed. | |
QgsRasterInterface * | mInput = nullptr |
bool | mOn = true |
QList< QgsRasterBandStats > | mStatistics |
List of cached statistics, all bands mixed. | |
Base class for processing filters like renderers, reprojector, resampler etc.
Definition at line 135 of file qgsrasterinterface.h.
If you add to this, please also add to capabilitiesString()
Definition at line 205 of file qgsrasterinterface.h.
QgsRasterInterface::QgsRasterInterface | ( | QgsRasterInterface * | input = nullptr | ) |
Definition at line 31 of file qgsrasterinterface.cpp.
|
virtualdefault |
|
pure virtual |
Gets number of bands.
Implemented in QgsBrightnessContrastFilter, QgsHueSaturationFilter, QgsRasterNuller, QgsRasterProjector, QgsRasterRenderer, and QgsRasterResampleFilter.
QgsRasterBandStats QgsRasterInterface::bandStatistics | ( | int | bandNo, |
int | stats, | ||
const QgsRectangle & | extent = QgsRectangle() , |
||
int | sampleSize = 0 , |
||
QgsRasterBlockFeedback * | feedback = nullptr |
||
) |
Returns the band statistics.
bandNo | The band (number). |
stats | Requested statistics |
extent | Extent used to calc statistics, if empty, whole raster extent is used. |
sampleSize | Approximate number of cells in sample. If 0, all cells (whole raster will be used). If raster does not have exact size (WCS without exact size for example), provider decides size of sample. |
feedback | optional feedback object |
Definition at line 657 of file qgsrasterinterface.cpp.
|
virtual |
Returns the band statistics.
bandNo | The band (number). |
stats | Requested statistics |
extent | Extent used to calc statistics, if empty, whole raster extent is used. |
sampleSize | Approximate number of cells in sample. If 0, all cells (whole raster will be used). If raster does not have exact size (WCS without exact size for example), provider decides size of sample. |
feedback | optional feedback object |
Definition at line 116 of file qgsrasterinterface.cpp.
|
pure virtual |
Read block of data using given extent and size.
Returns pointer to data. Caller is responsible to free the memory returned.
bandNo | band number |
extent | extent of block |
width | pixel width of block |
height | pixel height of block |
feedback | optional raster feedback object for cancellation/preview. Added in QGIS 3.0. |
Implemented in QgsRasterDataProvider, QgsBrightnessContrastFilter, QgsHillshadeRenderer, QgsHueSaturationFilter, QgsMultiBandColorRenderer, QgsPalettedRasterRenderer, QgsRasterContourRenderer, QgsRasterNuller, QgsRasterProjector, QgsRasterResampleFilter, QgsSingleBandColorDataRenderer, QgsSingleBandGrayRenderer, QgsSingleBandPseudoColorRenderer, and QgsRasterRenderer.
|
inlinevirtual |
Returns a bitmask containing the supported capabilities.
Definition at line 228 of file qgsrasterinterface.h.
QString QgsRasterInterface::capabilitiesString | ( | ) | const |
Returns the raster interface capabilities in friendly format.
Definition at line 594 of file qgsrasterinterface.cpp.
|
pure virtual |
Clone itself, create deep copy.
Implemented in QgsBrightnessContrastFilter, QgsHillshadeRenderer, QgsHueSaturationFilter, QgsMultiBandColorRenderer, QgsPalettedRasterRenderer, QgsRasterContourRenderer, QgsRasterNuller, QgsRasterProjector, QgsRasterResampleFilter, QgsSingleBandColorDataRenderer, QgsSingleBandGrayRenderer, QgsSingleBandPseudoColorRenderer, QgsRasterDataProvider, and QgsRasterRenderer.
|
virtual |
Returns the name of the color interpretation for the specified bandNumber.
Reimplemented in QgsRasterDataProvider.
Definition at line 638 of file qgsrasterinterface.cpp.
|
virtual |
Find values for cumulative pixel count cut.
bandNo | The band (number). |
lowerCount | The lower count as fraction of 1, e.g. 0.02 = 2% |
upperCount | The upper count as fraction of 1, e.g. 0.98 = 98% |
lowerValue | Location into which the lower value will be set. |
upperValue | Location into which the upper value will be set. |
extent | Extent used to calc histogram, if empty, whole raster extent is used. |
sampleSize | Approximate number of cells in sample. If 0, all cells (whole raster will be used). If raster does not have exact size (WCS without exact size for example), provider decides size of sample. |
Definition at line 532 of file qgsrasterinterface.cpp.
|
pure virtual |
Returns data type for the band specified by number.
Implemented in QgsBrightnessContrastFilter, QgsHueSaturationFilter, QgsRasterNuller, QgsRasterProjector, QgsRasterRenderer, QgsRasterResampleFilter, and QgsRasterDataProvider.
|
inline |
Returns the size (in bytes) for the data type for the specified band.
Definition at line 256 of file qgsrasterinterface.h.
QString QgsRasterInterface::displayBandName | ( | int | bandNumber | ) | const |
Generates a friendly, descriptive name for the specified bandNumber.
Definition at line 646 of file qgsrasterinterface.cpp.
|
inlinevirtual |
Gets the extent of the interface.
Reimplemented in QgsRasterDataProvider.
Definition at line 251 of file qgsrasterinterface.h.
|
virtual |
helper function to create zero padded band names
Definition at line 629 of file qgsrasterinterface.cpp.
|
virtual |
Returns true
if histogram is available (cached, already calculated)
Definition at line 386 of file qgsrasterinterface.cpp.
bool QgsRasterInterface::hasStatistics | ( | int | bandNo, |
int | stats, | ||
const QgsRectangle & | extent = QgsRectangle() , |
||
int | sampleSize = 0 |
||
) |
Returns true
if histogram is available (cached, already calculated).
The parameters are the same as in bandStatistics()
true
if statistics are available (ready to use) Definition at line 249 of file qgsrasterinterface.cpp.
|
virtual |
Returns true
if histogram is available (cached, already calculated).
The parameters are the same as in bandStatistics()
true
if statistics are available (ready to use) Definition at line 93 of file qgsrasterinterface.cpp.
|
virtual |
Returns a band histogram.
Histograms are cached in providers.
bandNo | The band (number). |
binCount | Number of bins (intervals,buckets). If 0, the number of bins is decided automatically according to data type, raster size etc. |
minimum | Minimum value, if NaN (None for Python), raster minimum value will be used. |
maximum | Maximum value, if NaN (None for Python), raster maximum value will be used. |
extent | Extent used to calc histogram, if empty, whole raster extent is used. |
sampleSize | Approximate number of cells in sample. If 0, all cells (whole raster will be used). If raster does not have exact size (WCS without exact size for example), provider decides size of sample. |
includeOutOfRange | include out of range values |
feedback | optional feedback object |
Definition at line 413 of file qgsrasterinterface.cpp.
|
protected |
Fill in histogram defaults if not specified.
Definition at line 254 of file qgsrasterinterface.cpp.
|
protected |
Fill in statistics defaults if not specified.
Definition at line 381 of file qgsrasterinterface.cpp.
|
protected |
Fill in statistics defaults if not specified.
Definition at line 36 of file qgsrasterinterface.cpp.
|
inlinevirtual |
Current input.
Definition at line 305 of file qgsrasterinterface.h.
|
inlinevirtual |
Returns whether the interface is on or off.
Definition at line 308 of file qgsrasterinterface.h.
|
inlinevirtual |
Sets base class members from xml. Usually called from create() methods of subclasses.
Reimplemented in QgsBrightnessContrastFilter, QgsHueSaturationFilter, QgsRasterDataProvider, QgsRasterResampleFilter, and QgsRasterRenderer.
Definition at line 519 of file qgsrasterinterface.h.
|
inlinevirtual |
Set input.
Returns true
if set correctly, false
if cannot use that input
Reimplemented in QgsBrightnessContrastFilter, QgsHueSaturationFilter, QgsRasterDataProvider, QgsRasterRenderer, QgsRasterResampleFilter, and QgsSingleBandColorDataRenderer.
Definition at line 302 of file qgsrasterinterface.h.
|
inlinevirtual |
Sets whether the interface is on or off.
Definition at line 311 of file qgsrasterinterface.h.
|
inlinevirtual |
Returns source data type for the band specified by number, source data type may be shorter than dataType.
Reimplemented in QgsRasterDataProvider.
Definition at line 245 of file qgsrasterinterface.h.
|
inlinevirtual |
Gets source / raw input, the first in pipe, usually provider.
It may be used to get info about original data, e.g. resolution to decide resampling etc.
Definition at line 330 of file qgsrasterinterface.h.
|
inlinevirtual |
Gets source / raw input, the first in pipe, usually provider.
It may be used to get info about original data, e.g. resolution to decide resampling etc.
Definition at line 319 of file qgsrasterinterface.h.
|
inlinevirtual |
Write base class members to xml.
Reimplemented in QgsBrightnessContrastFilter, QgsHillshadeRenderer, QgsHueSaturationFilter, QgsMultiBandColorRenderer, QgsPalettedRasterRenderer, QgsRasterContourRenderer, QgsRasterDataProvider, QgsRasterResampleFilter, QgsSingleBandColorDataRenderer, QgsSingleBandGrayRenderer, and QgsSingleBandPseudoColorRenderer.
Definition at line 517 of file qgsrasterinterface.h.
|
inlinevirtual |
Gets block size.
Definition at line 262 of file qgsrasterinterface.h.
|
inlinevirtual |
Gets raster size.
Definition at line 266 of file qgsrasterinterface.h.
|
inlinevirtual |
Definition at line 263 of file qgsrasterinterface.h.
|
inlinevirtual |
Definition at line 267 of file qgsrasterinterface.h.
|
protected |
List of cached histograms, all bands mixed.
Definition at line 529 of file qgsrasterinterface.h.
|
protected |
Definition at line 523 of file qgsrasterinterface.h.
|
protected |
Definition at line 532 of file qgsrasterinterface.h.
|
protected |
List of cached statistics, all bands mixed.
Definition at line 526 of file qgsrasterinterface.h.