QGIS API Documentation  2.6.0-Brighton
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
QgsRasterInterface Class Reference

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

#include <qgsrasterinterface.h>

Inheritance diagram for QgsRasterInterface:
Inheritance graph
[legend]

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 QgsRasterInterfaceclone () 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 QgsRasterBlockblock (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 QgsRasterInterfaceinput () const
 Current input.
virtual bool on () const
 Is on/off.
virtual void setOn (bool on)
 Set on/off.
virtual const QgsRasterInterfacesrcInput () const
 Get source / raw input, the first in pipe, usually provider.
virtual QgsRasterInterfacesrcInput ()
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

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

Detailed Description

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

Member Enumeration Documentation

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

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

Constructor & Destructor Documentation

QgsRasterInterface::QgsRasterInterface ( QgsRasterInterface input = 0)
QgsRasterInterface::~QgsRasterInterface ( )
virtual

Member Function Documentation

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

Get band statistics.

Parameters
theBandNoThe band (number).
theStatsRequested statistics
theExtentExtent used to calc statistics, 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.
Returns
Band statistics.
virtual QgsRasterBlock* QgsRasterInterface::block ( int  bandNo,
const QgsRectangle extent,
int  width,
int  height 
)
pure virtual

Read block of data using given extent and size.

Returns pointer to data. Caller is responsible to free the memory returned.

Parameters
bandNoband number
extentextent of block
widthpixel width of block
heightpixel height of block

Implemented in QgsRasterDataProvider, QgsRasterProjector, QgsRasterRenderer, QgsHueSaturationFilter, QgsRasterNuller, QgsRasterResampleFilter, QgsSingleBandGrayRenderer, QgsBrightnessContrastFilter, QgsPalettedRasterRenderer, QgsMultiBandColorRenderer, QgsSingleBandColorDataRenderer, and QgsSingleBandPseudoColorRenderer.

virtual int QgsRasterInterface::capabilities ( ) const
inlinevirtual

Returns a bitmask containing the supported capabilities.

QString QgsRasterInterface::capabilitiesString ( ) const

Returns the above in friendly format.

virtual QgsRasterInterface* QgsRasterInterface::clone ( ) const
pure virtual
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.
virtual QGis::DataType QgsRasterInterface::dataType ( int  bandNo) const
pure virtual
int QgsRasterInterface::dataTypeSize ( int  bandNo)
inline
virtual QgsRectangle QgsRasterInterface::extent ( )
inlinevirtual

Get the extent of the interface.

Returns
QgsRectangle containing the extent of the layer

Reimplemented in QgsRasterDataProvider.

virtual QString QgsRasterInterface::generateBandName ( int  theBandNumber) const
inlinevirtual

helper function to create zero padded band names

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

Fill in histogram defaults if not specified.

Note
theBinCount, theMinimun and theMaximum not optional in python bindings
void QgsRasterInterface::initStatistics ( QgsRasterBandStats theStatistics,
int  theBandNo,
int  theStats = QgsRasterBandStats::All,
const QgsRectangle theExtent = QgsRectangle(),
int  theBinCount = 0 
)
protected

Fill in statistics defaults if not specified.

virtual QgsRasterInterface* QgsRasterInterface::input ( ) const
inlinevirtual

Current input.

virtual bool QgsRasterInterface::on ( ) const
inlinevirtual

Is on/off.

virtual void QgsRasterInterface::readXML ( const QDomElement &  filterElem)
inlinevirtual

Sets base class members from xml.

Usually called from create() methods of subclasses

Reimplemented in QgsRasterRenderer, QgsHueSaturationFilter, QgsRasterResampleFilter, and QgsBrightnessContrastFilter.

virtual bool QgsRasterInterface::setInput ( QgsRasterInterface input)
inlinevirtual

Set input.

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

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

virtual void QgsRasterInterface::setOn ( bool  on)
inlinevirtual

Set on/off.

virtual QGis::DataType QgsRasterInterface::srcDataType ( int  bandNo) const
inlinevirtual

Returns source data type for the band specified by number, source data type may be shorter than dataType.

Reimplemented in QgsRasterDataProvider.

virtual const QgsRasterInterface* QgsRasterInterface::srcInput ( ) const
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.

virtual QgsRasterInterface* QgsRasterInterface::srcInput ( )
inlinevirtual
virtual void QgsRasterInterface::writeXML ( QDomDocument &  doc,
QDomElement &  parentElem 
) const
inlinevirtual
virtual int QgsRasterInterface::xBlockSize ( ) const
inlinevirtual

Get block size.

virtual int QgsRasterInterface::xSize ( ) const
inlinevirtual

Get raster size.

virtual int QgsRasterInterface::yBlockSize ( ) const
inlinevirtual
virtual int QgsRasterInterface::ySize ( ) const
inlinevirtual

Member Data Documentation

QList<QgsRasterHistogram> QgsRasterInterface::mHistograms
protected

List of cached histograms, all bands mixed.

QgsRasterInterface* QgsRasterInterface::mInput
protected
bool QgsRasterInterface::mOn
protected
QList<QgsRasterBandStats> QgsRasterInterface::mStatistics
protected

List of cached statistics, all bands mixed.


The documentation for this class was generated from the following files: