Quantum GIS API Documentation  master-ce49b66
QgsRasterInterface Class Reference

Base class for processing filters like renderers, reprojector, resampler etc. More...

#include <qgsrasterinterface.h>

+ Inheritance diagram for QgsRasterInterface:
+ Collaboration diagram for QgsRasterInterface:

List of all members.

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 int bandCount () const =0
 Get number of bands.
virtual QgsRasterBandStats bandStatistics (int theBandNo, int theStats=QgsRasterBandStats::All, const QgsRectangle &theExtent=QgsRectangle(), int theSampleSize=0)
 Get band statistics.
virtual QgsRasterBlockblock (int bandNo, const QgsRectangle &extent, int width, int height)=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 above in friendly format.
virtual QgsRasterInterfaceclone () const =0
 Clone itself, create deep copy.
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 QGis::DataType dataType (int bandNo) const =0
 Returns data type for the band specified by number.
int dataTypeSize (int bandNo)
virtual QgsRectangle extent ()
 Get the extent of the interface.
virtual QString generateBandName (int theBandNumber) const
 helper function to create zero padded band names
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 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 QgsRasterInterfaceinput () const
 Current input.
virtual bool on () const
 Is on/off.
virtual void readXML (const QDomElement &filterElem)
 Sets base class members from xml.
virtual bool setInput (QgsRasterInterface *input)
 Set input.
virtual void setOn (bool on)
 Set on/off.
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 const QgsRasterInterfacesrcInput () const
 Get source / raw input, the first in pipe, usually provider.
virtual QgsRasterInterfacesrcInput ()
virtual void writeXML (QDomDocument &doc, QDomElement &parentElem) const
 Write base class members to xml.
virtual int xBlockSize () const
 Get block size.
virtual int xSize () const
 Get raster size.
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.
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

QList< QgsRasterHistogrammHistograms
 List of cached histograms, all bands mixed.
QgsRasterInterfacemInput
bool mOn
QList< QgsRasterBandStatsmStatistics
 List of cached statistics, all bands mixed.

Private Member Functions

 Q_DECLARE_TR_FUNCTIONS (QgsRasterInterface)

Detailed Description

Base class for processing filters like renderers, reprojector, resampler etc.

Definition at line 35 of file qgsrasterinterface.h.


Member Enumeration Documentation

If you add to this, please also add to capabilitiesString()

Enumerator:
NoCapabilities 
Size 
Create 
Remove 
BuildPyramids 
Identify 
IdentifyValue 
IdentifyText 
IdentifyHtml 
IdentifyFeature 

Definition at line 41 of file qgsrasterinterface.h.


Constructor & Destructor Documentation

Definition at line 38 of file qgsrasterinterface.cpp.


Member Function Documentation

QgsRasterBandStats QgsRasterInterface::bandStatistics ( int  theBandNo,
int  theStats = QgsRasterBandStats::All,
const QgsRectangle theExtent = QgsRectangle(),
int  theSampleSize = 0 
) [virtual]

Returns the above in friendly format.

Definition at line 539 of file qgsrasterinterface.cpp.

References BuildPyramids, capabilities(), Create, Identify, QgsDebugMsg, Remove, and tr.

void QgsRasterInterface::cumulativeCut ( int  theBandNo,
double  theLowerCount,
double  theUpperCount,
double &  theLowerValue,
double &  theUpperValue,
const QgsRectangle theExtent = QgsRectangle(),
int  theSampleSize = 0 
) [virtual]

Find values for cumulative pixel count cut.

Parameters:
theBandNoThe band (number).
theLowerCountThe lower count as fraction of 1, e.g. 0.02 = 2%
theUpperCountThe upper count as fraction of 1, e.g. 0.98 = 98%
theLowerValueLocation into which the lower value will be set.
theUpperValueLocation into which the upper value will be set.
theExtentExtent used to calc histogram, if empty, whole raster extent is used.
theSampleSizeApproximate 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().

int QgsRasterInterface::dataTypeSize ( int  bandNo) [inline]

Definition at line 86 of file qgsrasterinterface.h.

References QgsRasterBlock::typeSize().

Referenced by QgsRasterDataProvider::block().

virtual QgsRectangle QgsRasterInterface::extent ( ) [inline, virtual]

Get the extent of the interface.

Returns:
QgsRectangle containing the extent of the layer

Reimplemented in QgsRasterDataProvider.

Definition at line 84 of file qgsrasterinterface.h.

Referenced by QgsRasterProjector::block(), initHistogram(), and initStatistics().

virtual QString QgsRasterInterface::generateBandName ( int  theBandNumber) const [inline, virtual]

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().

bool QgsRasterInterface::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 
) [virtual]

Returns true if histogram is available (cached, already calculated), the parameters are the same as in histogram()

Note:
theBinCount, theMinimun and theMaximum not optional in python bindings

Definition at line 359 of file qgsrasterinterface.cpp.

References histogram(), initHistogram(), mHistograms, and QgsDebugMsg.

Referenced by QgsRasterHistogramWidget::computeHistogram().

bool QgsRasterInterface::hasStatistics ( int  theBandNo,
int  theStats = QgsRasterBandStats::All,
const QgsRectangle theExtent = QgsRectangle(),
int  theSampleSize = 0 
) [virtual]

Returns true if histogram is available (cached, already calculated).

* The parameters are the same as in bandStatistics()

Returns:
true if statistics are available (ready to use)

Definition at line 99 of file qgsrasterinterface.cpp.

References QgsRasterBandStats::contains(), initStatistics(), mStatistics, and QgsDebugMsg.

QgsRasterHistogram QgsRasterInterface::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 
) [virtual]

Get histogram.

Histograms are cached in providers.

Parameters:
theBandNoThe band (number).
theBinCountNumber of bins (intervals,buckets). If 0, the number of bins is decided automaticaly according to data type, raster size etc.
theMinimumMinimum value, if NaN, raster minimum value will be used.
theMaximumMaximum value, if NaN, raster minimum value will be used.
theExtentExtent used to calc histogram, if empty, whole raster extent is used.
theSampleSizeApproximate 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.
theIncludeOutOfRangeinclude out of range values
Returns:
Vector of non NULL cell counts for each bin.
Note:
theBinCount, theMinimun and theMaximum not optional in python bindings

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().

void QgsRasterInterface::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 
) [protected]
virtual bool QgsRasterInterface::on ( ) const [inline, virtual]

Is on/off.

Definition at line 123 of file qgsrasterinterface.h.

virtual void QgsRasterInterface::readXML ( const QDomElement &  filterElem) [inline, virtual]

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.

virtual bool QgsRasterInterface::setInput ( QgsRasterInterface input) [inline, virtual]

Set input.

Returns true if set correctly, false if cannot use that input

Reimplemented in QgsRasterRenderer, QgsRasterDataProvider, QgsHueSaturationFilter, QgsRasterResampleFilter, QgsBrightnessContrastFilter, and QgsSingleBandColorDataRenderer.

Definition at line 117 of file qgsrasterinterface.h.

virtual void QgsRasterInterface::setOn ( bool  on) [inline, virtual]

Set on/off.

Definition at line 126 of file qgsrasterinterface.h.

virtual QGis::DataType QgsRasterInterface::srcDataType ( int  bandNo) const [inline, virtual]

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().

virtual const QgsRasterInterface* QgsRasterInterface::srcInput ( ) const [inline, virtual]

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().

virtual QgsRasterInterface* QgsRasterInterface::srcInput ( ) [inline, virtual]

Definition at line 137 of file qgsrasterinterface.h.

References QgsDebugMsg.

virtual void QgsRasterInterface::writeXML ( QDomDocument &  doc,
QDomElement &  parentElem 
) const [inline, virtual]
virtual int QgsRasterInterface::xBlockSize ( ) const [inline, virtual]

Get block size.

Definition at line 92 of file qgsrasterinterface.h.

Referenced by bandStatistics(), and histogram().

virtual int QgsRasterInterface::yBlockSize ( ) const [inline, virtual]

Definition at line 93 of file qgsrasterinterface.h.

Referenced by bandStatistics(), and histogram().


Member Data Documentation

List of cached histograms, all bands mixed.

Definition at line 223 of file qgsrasterinterface.h.

Referenced by hasHistogram(), histogram(), and QgsRasterDataProvider::setUserNoDataValue().

List of cached statistics, all bands mixed.

Definition at line 220 of file qgsrasterinterface.h.

Referenced by bandStatistics(), hasStatistics(), and QgsRasterDataProvider::setUserNoDataValue().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines