QGIS API Documentation
2.2.0-Valmiera
|
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=0) | |
virtual | ~QgsRasterInterface () |
virtual QgsRasterInterface * | clone () const =0 |
Clone itself, create deep copy. | |
virtual int | capabilities () const |
Returns a bitmask containing the supported capabilities. | |
QString | capabilitiesString () const |
Returns the above in friendly format. | |
virtual QGis::DataType | dataType (int bandNo) const =0 |
Returns data type for the band specified by number. | |
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. | |
virtual QgsRectangle | extent () |
Get the extent of the interface. | |
int | dataTypeSize (int bandNo) |
virtual int | bandCount () const =0 |
Get number of bands. | |
virtual int | xBlockSize () const |
Get block size. | |
virtual int | yBlockSize () const |
virtual int | xSize () const |
Get raster size. | |
virtual int | ySize () const |
virtual QString | generateBandName (int theBandNumber) const |
helper function to create zero padded band names | |
virtual QgsRasterBlock * | block (int bandNo, const QgsRectangle &extent, int width, int height)=0 |
Read block of data using given extent and size. | |
virtual bool | setInput (QgsRasterInterface *input) |
Set input. | |
virtual QgsRasterInterface * | input () const |
Current input. | |
virtual bool | on () const |
Is on/off. | |
virtual void | setOn (bool on) |
Set on/off. | |
virtual const QgsRasterInterface * | srcInput () const |
Get source / raw input, the first in pipe, usually provider. | |
virtual QgsRasterInterface * | srcInput () |
virtual QgsRasterBandStats | bandStatistics (int theBandNo, int theStats=QgsRasterBandStats::All, const QgsRectangle &theExtent=QgsRectangle(), int theSampleSize=0) |
Get band statistics. | |
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). | |
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. | |
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() | |
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. | |
virtual void | writeXML (QDomDocument &doc, QDomElement &parentElem) const |
Write base class members to xml. | |
virtual void | readXML (const QDomElement &filterElem) |
Sets base class members from xml. |
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. | |
void | initStatistics (QgsRasterBandStats &theStatistics, int theBandNo, int theStats=QgsRasterBandStats::All, const QgsRectangle &theExtent=QgsRectangle(), int theBinCount=0) |
Fill in statistics defaults if not specified. |
Protected Attributes | |
QgsRasterInterface * | mInput |
QList< QgsRasterBandStats > | mStatistics |
List of cached statistics, all bands mixed. | |
QList< QgsRasterHistogram > | mHistograms |
List of cached histograms, all bands mixed. | |
bool | mOn |
Private Member Functions | |
Q_DECLARE_TR_FUNCTIONS (QgsRasterInterface) |
Base class for processing filters like renderers, reprojector, resampler etc.
Definition at line 35 of file qgsrasterinterface.h.
If you add to this, please also add to capabilitiesString()
NoCapabilities | |
Size | |
Create | |
Remove | |
BuildPyramids | |
Identify | |
IdentifyValue | |
IdentifyText | |
IdentifyHtml | |
IdentifyFeature |
Definition at line 41 of file qgsrasterinterface.h.
QgsRasterInterface::QgsRasterInterface | ( | QgsRasterInterface * | input = 0 | ) |
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.
Referenced by QgsBrightnessContrastFilter::bandCount(), QgsRasterResampleFilter::bandCount(), QgsRasterNuller::bandCount(), QgsHueSaturationFilter::bandCount(), QgsRasterRenderer::bandCount(), QgsRasterProjector::bandCount(), QgsRasterLayer::bandCount(), QgsRasterFileWriter::createVRT(), QgsRasterRendererRegistry::defaultRendererForDrawingStyle(), QgsRasterDataProvider::identify(), QgsRasterMinMaxWidget::on_mLoadPushButton_clicked(), QgsRasterLayerSaveAsDialog::on_mRawModeRadioButton_toggled(), QgsMultiBandColorRendererWidget::QgsMultiBandColorRendererWidget(), QgsPalettedRendererWidget::QgsPalettedRendererWidget(), QgsSingleBandGrayRendererWidget::QgsSingleBandGrayRendererWidget(), QgsSingleBandPseudoColorRendererWidget::QgsSingleBandPseudoColorRendererWidget(), QgsRasterChecker::runTest(), QgsRasterLayer::setDataProvider(), QgsBrightnessContrastFilter::setInput(), QgsRasterResampleFilter::setInput(), QgsHueSaturationFilter::setInput(), QgsRasterRenderer::setInput(), QgsRasterFileWriter::writeDataRaster(), and QgsRasterLayer::writeXml().
|
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.
References QgsRasterBandStats::All, block(), QgsRasterBandStats::contains(), QgsRasterBandStats::elementCount, QgsRasterBandStats::extent, QgsRectangle::height(), QgsRasterBandStats::height, initStatistics(), QgsRasterBlock::isNoData(), QgsRasterBandStats::maximumValue, QgsRasterBandStats::mean, QgsRasterBandStats::minimumValue, mStatistics, QgsDebugMsg, QgsRasterBandStats::range, QgsRasterBandStats::statsGathered, QgsRasterBandStats::stdDev, QgsRasterBandStats::sum, QgsRasterBandStats::sumOfSquares, QgsRasterBlock::value(), QgsRectangle::width(), QgsRasterBandStats::width, xBlockSize(), QgsRectangle::xMinimum(), yBlockSize(), and QgsRectangle::yMaximum().
Referenced by QgsProjectFileTransform::convertRasterProperties(), initHistogram(), QgsRasterLayer::metadata(), QgsRasterRendererRegistry::minMaxValuesForBand(), QgsRasterMinMaxWidget::on_mLoadPushButton_clicked(), QgsRasterChecker::runTest(), QgsRasterLayer::setContrastEnhancement(), and QgsRasterFileWriter::writeDataRaster().
|
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, QgsRasterRenderer, QgsHueSaturationFilter, QgsRasterNuller, QgsRasterResampleFilter, QgsSingleBandGrayRenderer, QgsBrightnessContrastFilter, QgsPalettedRasterRenderer, QgsMultiBandColorRenderer, QgsSingleBandColorDataRenderer, and QgsSingleBandPseudoColorRenderer.
Referenced by bandStatistics(), QgsSingleBandColorDataRenderer::block(), QgsSingleBandPseudoColorRenderer::block(), QgsMultiBandColorRenderer::block(), QgsPalettedRasterRenderer::block(), QgsBrightnessContrastFilter::block(), QgsSingleBandGrayRenderer::block(), QgsRasterResampleFilter::block(), QgsRasterNuller::block(), QgsHueSaturationFilter::block(), QgsRasterProjector::block(), histogram(), and QgsRasterIterator::readNextRasterPart().
|
inlinevirtual |
Returns a bitmask containing the supported capabilities.
Definition at line 63 of file qgsrasterinterface.h.
References NoCapabilities.
Referenced by QgsRasterResampleFilter::block(), QgsRasterDataProvider::block(), QgsRasterProjector::calc(), capabilitiesString(), QgsRasterDataProvider::identify(), QgsMapToolIdentify::identifyRasterLayer(), initHistogram(), initStatistics(), QgsRasterLayerSaveAsDialog::QgsRasterLayerSaveAsDialog(), QgsRasterLayer::rasterUnitsPerPixelX(), QgsRasterLayer::rasterUnitsPerPixelY(), QgsRasterLayer::setDataProvider(), QgsRasterLayerSaveAsDialog::setOriginalResolution(), and QgsRasterLayerSaveAsDialog::toggleResolutionSize().
QString QgsRasterInterface::capabilitiesString | ( | ) | const |
Returns the above in friendly format.
Definition at line 539 of file qgsrasterinterface.cpp.
References BuildPyramids, capabilities(), Create, Identify, QgsDebugMsg, Remove, and tr.
|
pure virtual |
Clone itself, create deep copy.
Implemented in QgsRasterProjector, QgsRasterDataProvider, QgsRasterRenderer, QgsHueSaturationFilter, QgsRasterNuller, QgsSingleBandGrayRenderer, QgsPalettedRasterRenderer, QgsRasterResampleFilter, QgsMultiBandColorRenderer, QgsBrightnessContrastFilter, QgsSingleBandPseudoColorRenderer, and QgsSingleBandColorDataRenderer.
Referenced by QgsRasterPipe::QgsRasterPipe().
|
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 500 of file qgsrasterinterface.cpp.
References QgsRasterHistogram::binCount, histogram(), QgsRasterHistogram::histogramVector, QgsRasterHistogram::maximum, QgsRasterHistogram::minimum, QgsRasterHistogram::nonNullCount, and QgsDebugMsg.
Referenced by QgsRasterMinMaxWidget::on_mLoadPushButton_clicked(), and QgsRasterLayer::setContrastEnhancement().
|
pure virtual |
Returns data type for the band specified by number.
Implemented in QgsRasterProjector, QgsRasterDataProvider, QgsRasterRenderer, QgsHueSaturationFilter, QgsRasterNuller, QgsRasterResampleFilter, and QgsBrightnessContrastFilter.
Referenced by QgsRasterProjector::block(), QgsMultiBandColorRenderer::create(), QgsSingleBandGrayRenderer::create(), QgsBrightnessContrastFilter::dataType(), QgsRasterResampleFilter::dataType(), QgsRasterNuller::dataType(), QgsHueSaturationFilter::dataType(), QgsRasterRenderer::dataType(), QgsRasterProjector::dataType(), QgsSingleBandColorDataRenderer::setInput(), QgsBrightnessContrastFilter::setInput(), QgsRasterResampleFilter::setInput(), QgsHueSaturationFilter::setInput(), QgsRasterRenderer::setInput(), QgsRasterFileWriter::writeImageRaster(), and QgsRasterFileWriter::writeRaster().
|
inline |
Definition at line 86 of file qgsrasterinterface.h.
References QgsRasterBlock::typeSize().
Referenced by QgsRasterDataProvider::block().
|
inlinevirtual |
Get the extent of the interface.
Reimplemented in QgsRasterDataProvider.
Definition at line 84 of file qgsrasterinterface.h.
Referenced by QgsRasterProjector::block(), initHistogram(), initStatistics(), and QgsRasterRenderer::minMaxOriginLabel().
|
inlinevirtual |
helper function to create zero padded band names
Definition at line 100 of file qgsrasterinterface.h.
References tr.
Referenced by QgsRasterLayer::bandName(), QgsRasterRendererWidget::displayBandName(), and QgsMapToolIdentify::identifyRasterLayer().
|
virtual |
Returns true if histogram is available (cached, already calculated), the parameters are the same as in histogram()
Definition at line 359 of file qgsrasterinterface.cpp.
References histogram(), initHistogram(), mHistograms, and QgsDebugMsg.
Referenced by QgsRasterHistogramWidget::computeHistogram().
|
virtual |
Returns true if histogram is available (cached, already calculated).
* The parameters are the same as in bandStatistics()
Definition at line 99 of file qgsrasterinterface.cpp.
References QgsRasterBandStats::contains(), initStatistics(), mStatistics, and QgsDebugMsg.
|
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 385 of file qgsrasterinterface.cpp.
References QgsRasterHistogram::binCount, block(), QgsRasterHistogram::extent, QgsRectangle::height(), QgsRasterHistogram::height, QgsRasterHistogram::histogramVector, initHistogram(), QgsRasterBlock::isNoData(), QgsRasterHistogram::maximum, mHistograms, QgsRasterHistogram::minimum, QgsRasterHistogram::nonNullCount, QgsDebugMsg, QgsRasterHistogram::valid, QgsRasterBlock::value(), QgsRectangle::width(), QgsRasterHistogram::width, xBlockSize(), QgsRectangle::xMinimum(), yBlockSize(), and QgsRectangle::yMaximum().
Referenced by QgsRasterHistogramWidget::computeHistogram(), cumulativeCut(), hasHistogram(), and QgsRasterHistogramWidget::refreshHistogram().
|
protected |
Fill in histogram defaults if not specified.
Definition at line 248 of file qgsrasterinterface.cpp.
References QgsRasterHistogram::bandNumber, bandStatistics(), QgsRasterHistogram::binCount, QGis::Byte, capabilities(), extent(), QgsRasterHistogram::extent, QgsRectangle::height(), QgsRasterHistogram::height, QgsRasterHistogram::includeOutOfRange, QgsRectangle::intersect(), QgsRectangle::isEmpty(), QgsRasterBandStats::Max, QgsRasterHistogram::maximum, QgsRasterBandStats::maximumValue, QgsRasterBandStats::Min, QgsRasterHistogram::minimum, QgsRasterBandStats::minimumValue, mInput, QgsDebugMsg, Size, srcDataType(), QgsRectangle::width(), QgsRasterHistogram::width, xSize(), and ySize().
Referenced by hasHistogram(), and histogram().
|
protected |
Fill in statistics defaults if not specified.
Definition at line 42 of file qgsrasterinterface.cpp.
References QgsRasterBandStats::bandNumber, capabilities(), extent(), QgsRasterBandStats::extent, QgsRectangle::height(), QgsRasterBandStats::height, QgsRectangle::intersect(), QgsRectangle::isEmpty(), QgsDebugMsg, Size, QgsRasterBandStats::statsGathered, QgsRectangle::width(), QgsRasterBandStats::width, xSize(), and ySize().
Referenced by bandStatistics(), and hasStatistics().
|
inlinevirtual |
Current input.
Definition at line 120 of file qgsrasterinterface.h.
Referenced by QgsSingleBandColorDataRenderer::setInput(), QgsBrightnessContrastFilter::setInput(), QgsRasterResampleFilter::setInput(), QgsHueSaturationFilter::setInput(), and QgsRasterRenderer::setInput().
|
inlinevirtual |
Is on/off.
Definition at line 123 of file qgsrasterinterface.h.
|
private |
|
inlinevirtual |
Sets base class members from xml.
Usually called from create() methods of subclasses
Reimplemented in QgsRasterRenderer, QgsHueSaturationFilter, QgsRasterResampleFilter, and QgsBrightnessContrastFilter.
Definition at line 213 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 117 of file qgsrasterinterface.h.
|
inlinevirtual |
Set on/off.
Definition at line 126 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 78 of file qgsrasterinterface.h.
References QGis::UnknownDataType.
Referenced by initHistogram().
|
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 132 of file qgsrasterinterface.h.
References QgsDebugMsg.
Referenced by QgsRasterResampleFilter::block(), QgsRasterProjector::calc(), QgsRasterFileWriter::writeDataRaster(), and QgsRasterFileWriter::writeRaster().
|
inlinevirtual |
Definition at line 137 of file qgsrasterinterface.h.
References QgsDebugMsg.
|
inlinevirtual |
Write base class members to xml.
Reimplemented in QgsHueSaturationFilter, QgsMultiBandColorRenderer, QgsPalettedRasterRenderer, QgsRasterResampleFilter, QgsSingleBandGrayRenderer, QgsBrightnessContrastFilter, QgsSingleBandPseudoColorRenderer, and QgsSingleBandColorDataRenderer.
Definition at line 211 of file qgsrasterinterface.h.
|
inlinevirtual |
Get block size.
Definition at line 92 of file qgsrasterinterface.h.
Referenced by bandStatistics(), and histogram().
|
inlinevirtual |
Get raster size.
Definition at line 96 of file qgsrasterinterface.h.
Referenced by QgsRasterResampleFilter::block(), QgsRasterDataProvider::block(), QgsRasterProjector::calc(), QgsRasterDataProvider::identify(), initHistogram(), initStatistics(), QgsRasterLayerSaveAsDialog::QgsRasterLayerSaveAsDialog(), QgsRasterLayer::rasterUnitsPerPixelX(), QgsRasterLayer::rasterUnitsPerPixelY(), QgsRasterChecker::runTest(), QgsRasterLayerSaveAsDialog::setOriginalResolution(), QgsRasterLayerSaveAsDialog::setOriginalSize(), and QgsRasterLayer::width().
|
inlinevirtual |
Definition at line 93 of file qgsrasterinterface.h.
Referenced by bandStatistics(), and histogram().
|
inlinevirtual |
Definition at line 97 of file qgsrasterinterface.h.
Referenced by QgsRasterDataProvider::block(), QgsRasterProjector::calc(), QgsRasterLayer::height(), QgsRasterDataProvider::identify(), initHistogram(), initStatistics(), QgsRasterLayerSaveAsDialog::QgsRasterLayerSaveAsDialog(), QgsRasterLayer::rasterUnitsPerPixelY(), QgsRasterChecker::runTest(), QgsRasterLayerSaveAsDialog::setOriginalResolution(), and QgsRasterLayerSaveAsDialog::setOriginalSize().
|
protected |
List of cached histograms, all bands mixed.
Definition at line 223 of file qgsrasterinterface.h.
Referenced by hasHistogram(), histogram(), and QgsRasterDataProvider::setUserNoDataValue().
|
protected |
Definition at line 217 of file qgsrasterinterface.h.
Referenced by QgsBrightnessContrastFilter::bandCount(), QgsRasterResampleFilter::bandCount(), QgsRasterNuller::bandCount(), QgsHueSaturationFilter::bandCount(), QgsRasterRenderer::bandCount(), QgsRasterProjector::bandCount(), QgsSingleBandColorDataRenderer::block(), QgsSingleBandPseudoColorRenderer::block(), QgsMultiBandColorRenderer::block(), QgsPalettedRasterRenderer::block(), QgsBrightnessContrastFilter::block(), QgsSingleBandGrayRenderer::block(), QgsRasterResampleFilter::block(), QgsRasterNuller::block(), QgsHueSaturationFilter::block(), QgsRasterProjector::block(), QgsRasterProjector::calc(), QgsBrightnessContrastFilter::dataType(), QgsRasterResampleFilter::dataType(), QgsRasterNuller::dataType(), QgsHueSaturationFilter::dataType(), QgsRasterRenderer::dataType(), QgsRasterProjector::dataType(), initHistogram(), QgsSingleBandColorDataRenderer::setInput(), QgsBrightnessContrastFilter::setInput(), QgsRasterResampleFilter::setInput(), QgsHueSaturationFilter::setInput(), QgsRasterRenderer::setInput(), and QgsRasterRenderer::usesTransparency().
|
protected |
Definition at line 226 of file qgsrasterinterface.h.
Referenced by QgsBrightnessContrastFilter::bandCount(), QgsRasterResampleFilter::bandCount(), QgsHueSaturationFilter::bandCount(), QgsRasterRenderer::bandCount(), QgsBrightnessContrastFilter::dataType(), QgsRasterResampleFilter::dataType(), QgsHueSaturationFilter::dataType(), QgsRasterRenderer::dataType(), QgsSingleBandColorDataRenderer::setInput(), QgsBrightnessContrastFilter::setInput(), QgsRasterResampleFilter::setInput(), QgsHueSaturationFilter::setInput(), and QgsRasterRenderer::setInput().
|
protected |
List of cached statistics, all bands mixed.
Definition at line 220 of file qgsrasterinterface.h.
Referenced by bandStatistics(), hasStatistics(), and QgsRasterDataProvider::setUserNoDataValue().