QGIS API Documentation
2.18.21-Las Palmas (9fba24a)
|
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 } |
If you add to this, please also add to capabilitiesString() More... | |
Public Member Functions | |
QgsRasterInterface (QgsRasterInterface *input=nullptr) | |
virtual | ~QgsRasterInterface () |
virtual int | bandCount () const =0 |
Get number of bands. More... | |
virtual QgsRasterBandStats | bandStatistics (int theBandNo, int theStats=QgsRasterBandStats::All, const QgsRectangle &theExtent=QgsRectangle(), int theSampleSize=0) |
Get band statistics. More... | |
virtual QgsRasterBlock * | block (int bandNo, const QgsRectangle &extent, int width, int height)=0 |
Read block of data using given extent and size. More... | |
virtual QgsRasterBlock * | block2 (int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback=nullptr) |
Read block of data using given extent and size. More... | |
virtual int | capabilities () const |
Returns a bitmask containing the supported capabilities. More... | |
QString | capabilitiesString () const |
Returns the above in friendly format. More... | |
virtual QgsRasterInterface * | clone () const =0 |
Clone itself, create deep copy. More... | |
virtual void | cumulativeCut (int theBandNo, double theLowerCount, double theUpperCount, double &theLowerValue, double &theUpperValue, const QgsRectangle &theExtent=QgsRectangle(), int theSampleSize=0) |
Find values for cumulative pixel count cut. More... | |
virtual QGis::DataType | dataType (int bandNo) const =0 |
Returns data type for the band specified by number. More... | |
int | dataTypeSize (int bandNo) |
virtual QgsRectangle | extent () |
Get the extent of the interface. More... | |
virtual QString | generateBandName (int theBandNumber) const |
helper function to create zero padded band names More... | |
virtual bool | hasHistogram (int theBandNo, int theBinCount, double theMinimum=std::numeric_limits< double >::quiet_NaN(), double theMaximum=std::numeric_limits< double >::quiet_NaN(), const QgsRectangle &theExtent=QgsRectangle(), int theSampleSize=0, bool theIncludeOutOfRange=false) |
Returns true if histogram is available (cached, already calculated), the parameters are the same as in histogram() More... | |
virtual bool | hasStatistics (int theBandNo, int theStats=QgsRasterBandStats::All, const QgsRectangle &theExtent=QgsRectangle(), int theSampleSize=0) |
Returns true if histogram is available (cached, already calculated). More... | |
virtual QgsRasterHistogram | histogram (int theBandNo, int theBinCount=0, double theMinimum=std::numeric_limits< double >::quiet_NaN(), double theMaximum=std::numeric_limits< double >::quiet_NaN(), const QgsRectangle &theExtent=QgsRectangle(), int theSampleSize=0, bool theIncludeOutOfRange=false) |
Get histogram. More... | |
virtual QgsRasterInterface * | input () const |
Current input. More... | |
virtual bool | on () const |
Is on/off. More... | |
virtual void | readXML (const QDomElement &filterElem) |
Sets base class members from xml. More... | |
virtual bool | setInput (QgsRasterInterface *input) |
Set input. More... | |
virtual void | setOn (bool on) |
Set on/off. More... | |
virtual QGis::DataType | srcDataType (int bandNo) const |
Returns source data type for the band specified by number, source data type may be shorter than dataType. More... | |
virtual const QgsRasterInterface * | srcInput () const |
Get source / raw input, the first in pipe, usually provider. More... | |
virtual QgsRasterInterface * | srcInput () |
virtual void | writeXML (QDomDocument &doc, QDomElement &parentElem) const |
Write base class members to xml. More... | |
virtual int | xBlockSize () const |
Get block size. More... | |
virtual int | xSize () const |
Get raster size. More... | |
virtual int | yBlockSize () const |
virtual int | ySize () const |
Protected Member Functions | |
void | initHistogram (QgsRasterHistogram &theHistogram, int theBandNo, int theBinCount=0, double theMinimum=std::numeric_limits< double >::quiet_NaN(), double theMaximum=std::numeric_limits< double >::quiet_NaN(), const QgsRectangle &theExtent=QgsRectangle(), int theSampleSize=0, bool theIncludeOutOfRange=false) |
Fill in histogram defaults if not specified. More... | |
void | initStatistics (QgsRasterBandStats &theStatistics, int theBandNo, int theStats=QgsRasterBandStats::All, const QgsRectangle &theExtent=QgsRectangle(), int theBinCount=0) |
Fill in statistics defaults if not specified. More... | |
Protected Attributes | |
QList< QgsRasterHistogram > | mHistograms |
List of cached histograms, all bands mixed. More... | |
QgsRasterInterface * | mInput |
bool | mOn |
QList< QgsRasterBandStats > | mStatistics |
List of cached statistics, all bands mixed. More... | |
Base class for processing filters like renderers, reprojector, resampler etc.
Definition at line 76 of file qgsrasterinterface.h.
If you add to this, please also add to capabilitiesString()
Enumerator | |
---|---|
NoCapabilities | |
Size | |
Create | |
Remove | |
BuildPyramids | |
Identify | |
IdentifyValue | |
IdentifyText | |
IdentifyHtml | |
IdentifyFeature |
Definition at line 82 of file qgsrasterinterface.h.
QgsRasterInterface::QgsRasterInterface | ( | QgsRasterInterface * | input = nullptr | ) |
Definition at line 32 of file qgsrasterinterface.cpp.
|
virtual |
Definition at line 38 of file qgsrasterinterface.cpp.
|
pure virtual |
Get number of bands.
Implemented in QgsRasterProjector, QgsRasterRenderer, QgsHueSaturationFilter, QgsRasterNuller, QgsRasterResampleFilter, and QgsBrightnessContrastFilter.
|
virtual |
Get band statistics.
theBandNo | The band (number). |
theStats | Requested statistics |
theExtent | Extent used to calc statistics, if empty, whole raster extent is used. |
theSampleSize | 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 121 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 |
Implemented in QgsRasterDataProvider, QgsRasterProjector, QgsHillshadeRenderer, QgsHueSaturationFilter, QgsRasterNuller, QgsRasterResampleFilter, QgsSingleBandGrayRenderer, QgsBrightnessContrastFilter, QgsPalettedRasterRenderer, QgsMultiBandColorRenderer, QgsSingleBandColorDataRenderer, and QgsSingleBandPseudoColorRenderer.
|
inlinevirtual |
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 |
Reimplemented in QgsRasterDataProvider, QgsRasterProjector, QgsHillshadeRenderer, QgsHueSaturationFilter, QgsRasterNuller, QgsRasterResampleFilter, QgsSingleBandGrayRenderer, QgsBrightnessContrastFilter, QgsPalettedRasterRenderer, QgsMultiBandColorRenderer, QgsSingleBandColorDataRenderer, and QgsSingleBandPseudoColorRenderer.
Definition at line 167 of file qgsrasterinterface.h.
|
inlinevirtual |
Returns a bitmask containing the supported capabilities.
Definition at line 104 of file qgsrasterinterface.h.
QString QgsRasterInterface::capabilitiesString | ( | ) | const |
Returns the above in friendly format.
Definition at line 572 of file qgsrasterinterface.cpp.
|
pure virtual |
Clone itself, create deep copy.
Implemented in QgsRasterDataProvider, QgsRasterProjector, QgsRasterRenderer, QgsHillshadeRenderer, QgsHueSaturationFilter, QgsRasterNuller, QgsSingleBandGrayRenderer, QgsPalettedRasterRenderer, QgsRasterResampleFilter, QgsMultiBandColorRenderer, QgsBrightnessContrastFilter, QgsSingleBandPseudoColorRenderer, and QgsSingleBandColorDataRenderer.
|
virtual |
Find values for cumulative pixel count cut.
theBandNo | The band (number). |
theLowerCount | The lower count as fraction of 1, e.g. 0.02 = 2% |
theUpperCount | The upper count as fraction of 1, e.g. 0.98 = 98% |
theLowerValue | Location into which the lower value will be set. |
theUpperValue | Location into which the upper value will be set. |
theExtent | Extent used to calc histogram, if empty, whole raster extent is used. |
theSampleSize | 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 510 of file qgsrasterinterface.cpp.
|
pure virtual |
Returns data type for the band specified by number.
Implemented in QgsRasterDataProvider, QgsRasterProjector, QgsRasterRenderer, QgsHueSaturationFilter, QgsRasterNuller, QgsRasterResampleFilter, and QgsBrightnessContrastFilter.
|
inline |
Definition at line 127 of file qgsrasterinterface.h.
|
inlinevirtual |
Get the extent of the interface.
Reimplemented in QgsRasterDataProvider.
Definition at line 125 of file qgsrasterinterface.h.
|
inlinevirtual |
helper function to create zero padded band names
Definition at line 141 of file qgsrasterinterface.h.
|
virtual |
Returns true if histogram is available (cached, already calculated), the parameters are the same as in histogram()
Definition at line 369 of file qgsrasterinterface.cpp.
|
virtual |
Returns true if histogram is available (cached, already calculated).
Definition at line 99 of file qgsrasterinterface.cpp.
|
virtual |
Get histogram.
Histograms are cached in providers.
theBandNo | The band (number). |
theBinCount | Number of bins (intervals,buckets). If 0, the number of bins is decided automaticaly according to data type, raster size etc. |
theMinimum | Minimum value, if NaN, raster minimum value will be used. |
theMaximum | Maximum value, if NaN, raster minimum value will be used. |
theExtent | Extent used to calc histogram, if empty, whole raster extent is used. |
theSampleSize | 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. |
theIncludeOutOfRange | include out of range values |
Definition at line 395 of file qgsrasterinterface.cpp.
|
protected |
Fill in histogram defaults if not specified.
Definition at line 248 of file qgsrasterinterface.cpp.
|
protected |
Fill in statistics defaults if not specified.
Definition at line 42 of file qgsrasterinterface.cpp.
|
inlinevirtual |
Current input.
Definition at line 178 of file qgsrasterinterface.h.
|
inlinevirtual |
Is on/off.
Definition at line 181 of file qgsrasterinterface.h.
|
inlinevirtual |
Sets base class members from xml.
Usually called from create() methods of subclasses
Reimplemented in QgsRasterRenderer, QgsHueSaturationFilter, QgsRasterResampleFilter, and QgsBrightnessContrastFilter.
Definition at line 271 of file qgsrasterinterface.h.
|
inlinevirtual |
Set input.
Returns true if set correctly, false if cannot use that input
Reimplemented in QgsRasterDataProvider, QgsRasterRenderer, QgsHueSaturationFilter, QgsRasterResampleFilter, QgsBrightnessContrastFilter, and QgsSingleBandColorDataRenderer.
Definition at line 175 of file qgsrasterinterface.h.
|
inlinevirtual |
Set on/off.
Definition at line 184 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 119 of file qgsrasterinterface.h.
|
inlinevirtual |
Get 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 190 of file qgsrasterinterface.h.
|
inlinevirtual |
Definition at line 195 of file qgsrasterinterface.h.
|
inlinevirtual |
Write base class members to xml.
Reimplemented in QgsHueSaturationFilter, QgsMultiBandColorRenderer, QgsPalettedRasterRenderer, QgsRasterResampleFilter, QgsHillshadeRenderer, QgsSingleBandGrayRenderer, QgsBrightnessContrastFilter, QgsSingleBandPseudoColorRenderer, and QgsSingleBandColorDataRenderer.
Definition at line 269 of file qgsrasterinterface.h.
|
inlinevirtual |
Get block size.
Definition at line 133 of file qgsrasterinterface.h.
|
inlinevirtual |
Get raster size.
Definition at line 137 of file qgsrasterinterface.h.
|
inlinevirtual |
Definition at line 134 of file qgsrasterinterface.h.
|
inlinevirtual |
Definition at line 138 of file qgsrasterinterface.h.
|
protected |
List of cached histograms, all bands mixed.
Definition at line 281 of file qgsrasterinterface.h.
|
protected |
Definition at line 275 of file qgsrasterinterface.h.
|
protected |
Definition at line 284 of file qgsrasterinterface.h.
|
protected |
List of cached statistics, all bands mixed.
Definition at line 278 of file qgsrasterinterface.h.