Quantum GIS API Documentation  1.7.4
Public Types | Signals | Public Member Functions | Static Public Member Functions | Protected Attributes
QgsRasterDataProvider Class Reference

Base class for raster data providers. More...

#include <qgsrasterdataprovider.h>

Inheritance diagram for QgsRasterDataProvider:
Inheritance graph
[legend]
Collaboration diagram for QgsRasterDataProvider:
Collaboration graph
[legend]

List of all members.

Public Types

enum  Capability {
  NoCapabilities = 0, Identify = 1, ExactMinimumMaximum = 1 << 1, ExactResolution = 1 << 2,
  EstimatedMinimumMaximum = 1 << 3, BuildPyramids = 1 << 4, Histogram = 1 << 5, Size = 1 << 6
}
 If you add to this, please also add to capabilitiesString() More...
enum  DataType {
  UnknownDataType = 0, Byte = 1, UInt16 = 2, Int16 = 3,
  UInt32 = 4, Int32 = 5, Float32 = 6, Float64 = 7,
  CInt16 = 8, CInt32 = 9, CFloat32 = 10, CFloat64 = 11,
  ARGBDataType = 12, TypeCount = 13
}
enum  ColorInterpretation {
  UndefinedColorInterpretation = 0, GrayIndex = 1, PaletteIndex = 2, RedBand = 3,
  GreenBand = 4, BlueBand = 5, AlphaBand = 6, HueBand = 7,
  SaturationBand = 8, LightnessBand = 9, CyanBand = 10, MagentaBand = 11,
  YellowBand = 12, BlackBand = 13, YCbCr_YBand = 14, YCbCr_CbBand = 15,
  YCbCr_CrBand = 16, ColorInterpretationMax = 16
}
enum  RasterProgressType { ProgressHistogram = 0, ProgressPyramids = 1, ProgressStatistics = 2 }

Signals

void progress (int theType, double theProgress, QString theMessage)
 Emit a signal to notify of the progress event.

Public Member Functions

 QgsRasterDataProvider ()
 QgsRasterDataProvider (QString const &uri)
virtual ~QgsRasterDataProvider ()
virtual void addLayers (QStringList const &layers, QStringList const &styles=QStringList())=0
 Add the list of WMS layer names to be rendered by this server.
virtual QStringList supportedImageEncodings ()=0
 get raster image encodings supported by (e.g.) the WMS Server, expressed as MIME types
virtual QString imageEncoding () const =0
 Get the image encoding (as a MIME type) used in the transfer from (e.g.) the WMS server.
virtual void setImageEncoding (QString const &mimeType)=0
 Set the image encoding (as a MIME type) used in the transfer from (e.g.) the WMS server.
virtual void setImageCrs (QString const &crs)=0
 Set the image projection (in WMS CRS format) used in the transfer from (e.g.) the WMS server.
virtual QImage * draw (QgsRectangle const &viewExtent, int pixelWidth, int pixelHeight)=0
 Renders the layer as an image.
virtual int capabilities () const
 Returns a bitmask containing the supported capabilities Note, some capabilities may change depending on whether a spatial filter is active on this provider, so it may be prudent to check this value per intended operation.
QString capabilitiesString () const
 Returns the above in friendly format.
virtual int dataType (int bandNo) const
 Returns data type for the band specified by number.
virtual int srcDataType (int bandNo) const
 Returns source data type for the band specified by number, source data type may be shorter than dataType.
int typeSize (int dataType) const
int dataTypeSize (int bandNo) const
virtual int bandCount () const
 Get numbur of bands.
virtual int colorInterpretation (int theBandNo) const
 Returns data type for the band specified by number.
QString colorName (int colorInterpretation) const
virtual bool reload ()
 Reload data (data could change)
virtual QString colorInterpretationName (int theBandNo) const
virtual int xBlockSize () const
 Get block size.
virtual int yBlockSize () const
virtual int xSize () const
 Get raster size.
virtual int ySize () const
virtual void readBlock (int bandNo, int xBlock, int yBlock, void *data)
 read block of data
virtual void readBlock (int bandNo, QgsRectangle const &viewExtent, int width, int height, void *data)
 read block of data using give extent and size
virtual void readBlock (int bandNo, QgsRectangle const &viewExtent, int width, int height, QgsCoordinateReferenceSystem theSrcCRS, QgsCoordinateReferenceSystem theDestCRS, void *data)
 read block of data using give extent and size
virtual double readValue (void *data, int type, int index)
virtual double noDataValue () const
 value representing null data
virtual double minimumValue (int bandNo) const
virtual double maximumValue (int bandNo) const
virtual QList
< QgsColorRampShader::ColorRampItem
colorTable (int bandNo) const
virtual QStringList subLayers () const
 Returns the sublayers of this layer - Useful for providers that manage their own layers, such as WMS.
virtual void populateHistogram (int theBandNoInt, QgsRasterBandStats &theBandStats, int theBinCountInt=256, bool theIgnoreOutOfRangeFlag=true, bool theThoroughBandScanFlag=false)
 Populate the histogram vector for a given band.
virtual QString buildPyramids (const QList< QgsRasterPyramid > &thePyramidList, const QString &theResamplingMethod="NEAREST", bool theTryInternalFlag=false)
 Create pyramid overviews.
virtual QList< QgsRasterPyramidbuildPyramidList ()
 Accessor for ths raster layers pyramid list.
virtual QgsRasterBandStats bandStatistics (int theBandNo)
 If the provider supports it, return band stats for the given band.
QString generateBandName (int theBandNumber)
 helper function to create zero padded band names
virtual QString metadata ()=0
 Get metadata in a format suitable for feeding directly into a subset of the GUI raster properties "Metadata" tab.
virtual bool identify (const QgsPoint &point, QMap< QString, QString > &results)
 Identify raster value(s) found on the point position.
virtual QString identifyAsText (const QgsPoint &point)=0
 Identify details from a server (e.g.
virtual QString identifyAsHtml (const QgsPoint &point)=0
 Identify details from a server (e.g.
virtual QString lastErrorTitle ()=0
 Returns the caption error text for the last error in this provider.
virtual QString lastError ()=0
 Returns the verbose error text for the last error in this provider.
virtual QString lastErrorFormat ()
 Returns the format of the error text for the last error in this provider.
int dpi () const
 This helper checks to see whether the file name appears to be a valid raster file name.
void setDpi (int dpi)
 Sets the output device resolution.
bool isNoDataValueValid () const
 Is the NoDataValue Valid.
QByteArray noValueBytes (int theBandNo)
 Set null value in char.
virtual QDateTime timestamp () const
 Time stamp of data source in the moment when data/metadata were loaded by provider.
virtual QDateTime dataTimestamp () const
 Current time stamp of data source.

Static Public Member Functions

static QStringList cStringList2Q_ (char **stringList)
static QString makeTableCell (QString const &value)
static QString makeTableCells (QStringList const &values)

Protected Attributes

int mDpi
 Dots per intch.
QList< double > mNoDataValue
 Cell value representing no data.
bool mValidNoDataValue
 Flag indicating if the nodatavalue is valid.
QgsRectangle mExtent

Detailed Description

Base class for raster data providers.

Note:
This class has been copied and pasted from QgsVectorDataProvider, and does not yet make sense for Raster layers.

Definition at line 49 of file qgsrasterdataprovider.h.


Member Enumeration Documentation

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

Enumerator:
NoCapabilities 
Identify 
ExactMinimumMaximum 
ExactResolution 
EstimatedMinimumMaximum 
BuildPyramids 
Histogram 
Size 

Definition at line 57 of file qgsrasterdataprovider.h.

Enumerator:
UndefinedColorInterpretation 
GrayIndex 

Greyscale

PaletteIndex 

Paletted (see associated color table)

RedBand 

Red band of RGBA image

GreenBand 

Green band of RGBA image

BlueBand 

Blue band of RGBA image

AlphaBand 

Alpha (0=transparent, 255=opaque)

HueBand 

Hue band of HLS image

SaturationBand 

Saturation band of HLS image

LightnessBand 

Lightness band of HLS image

CyanBand 

Cyan band of CMYK image

MagentaBand 

Magenta band of CMYK image

YellowBand 

Yellow band of CMYK image

BlackBand 

Black band of CMLY image

YCbCr_YBand 

Y Luminance

YCbCr_CbBand 

Cb Chroma

YCbCr_CrBand 

Cr Chroma

ColorInterpretationMax 

Max current value

Definition at line 89 of file qgsrasterdataprovider.h.

Enumerator:
UnknownDataType 

Unknown or unspecified type

Byte 

Eight bit unsigned integer

UInt16 

Sixteen bit unsigned integer

Int16 

Sixteen bit signed integer

UInt32 

Thirty two bit unsigned integer

Int32 

Thirty two bit signed integer

Float32 

Thirty two bit floating point

Float64 

Sixty four bit floating point

CInt16 

Complex Int16

CInt32 

Complex Int32

CFloat32 

Complex Float32

CFloat64 

Complex Float64

ARGBDataType 

Color, alpha, red, green, blue, 4 bytes

TypeCount 

Definition at line 70 of file qgsrasterdataprovider.h.

Enumerator:
ProgressHistogram 
ProgressPyramids 
ProgressStatistics 

Definition at line 112 of file qgsrasterdataprovider.h.


Constructor & Destructor Documentation

Definition at line 92 of file qgsrasterdataprovider.cpp.

Definition at line 96 of file qgsrasterdataprovider.cpp.

virtual QgsRasterDataProvider::~QgsRasterDataProvider ( ) [inline, virtual]

Definition at line 123 of file qgsrasterdataprovider.h.


Member Function Documentation

virtual void QgsRasterDataProvider::addLayers ( QStringList const &  layers,
QStringList const &  styles = QStringList() 
) [pure virtual]

Add the list of WMS layer names to be rendered by this server.

Referenced by QgsRasterLayer::setDataProvider().

virtual int QgsRasterDataProvider::bandCount ( ) const [inline, virtual]
virtual QList<QgsRasterPyramid> QgsRasterDataProvider::buildPyramidList ( ) [inline, virtual]

Accessor for ths raster layers pyramid list.

A pyramid list defines the POTENTIAL pyramids that can be in a raster. To know which of the pyramid layers ACTUALLY exists you need to look at the existsFlag member in each struct stored in the list.

Definition at line 370 of file qgsrasterdataprovider.h.

Referenced by QgsRasterLayer::buildPyramidList().

virtual QString QgsRasterDataProvider::buildPyramids ( const QList< QgsRasterPyramid > &  thePyramidList,
const QString &  theResamplingMethod = "NEAREST",
bool  theTryInternalFlag = false 
) [inline, virtual]

Create pyramid overviews.

Definition at line 360 of file qgsrasterdataprovider.h.

Referenced by QgsRasterLayer::buildPyramids().

virtual int QgsRasterDataProvider::capabilities ( ) const [inline, virtual]

Returns a bitmask containing the supported capabilities Note, some capabilities may change depending on whether a spatial filter is active on this provider, so it may be prudent to check this value per intended operation.

Definition at line 161 of file qgsrasterdataprovider.h.

References NoCapabilities.

Referenced by capabilitiesString(), QgsRasterLayer::rasterUnitsPerPixel(), readBlock(), and QgsRasterLayer::setDataProvider().

Returns the above in friendly format.

Definition at line 154 of file qgsrasterdataprovider.cpp.

References BuildPyramids, capabilities(), Identify, and QgsDebugMsg.

virtual int QgsRasterDataProvider::colorInterpretation ( int  theBandNo) const [inline, virtual]

Returns data type for the band specified by number.

Definition at line 236 of file qgsrasterdataprovider.h.

References UndefinedColorInterpretation.

Referenced by QgsRasterLayer::setDataProvider().

virtual QString QgsRasterDataProvider::colorInterpretationName ( int  theBandNo) const [inline, virtual]
QString QgsRasterDataProvider::colorName ( int  colorInterpretation) const [inline]

Definition at line 242 of file qgsrasterdataprovider.h.

virtual QList<QgsColorRampShader::ColorRampItem> QgsRasterDataProvider::colorTable ( int  bandNo) const [inline, virtual]
QStringList QgsRasterDataProvider::cStringList2Q_ ( char **  stringList) [static]

Definition at line 109 of file qgsrasterdataprovider.cpp.

virtual QDateTime QgsRasterDataProvider::dataTimestamp ( ) const [inline, virtual]

Current time stamp of data source.

Reimplemented from QgsDataProvider.

Definition at line 489 of file qgsrasterdataprovider.h.

Referenced by QgsRasterLayer::update().

virtual int QgsRasterDataProvider::dataType ( int  bandNo) const [inline, virtual]
int QgsRasterDataProvider::dataTypeSize ( int  bandNo) const [inline]
int QgsRasterDataProvider::dpi ( ) const [inline]

This helper checks to see whether the file name appears to be a valid raster file name.

If the file name looks like it could be valid, but some sort of error occurs in processing the file, the error is returned in retError.Returns the dpi of the output device.

Note:
: this method was added in version 1.2

Definition at line 468 of file qgsrasterdataprovider.h.

virtual QImage* QgsRasterDataProvider::draw ( QgsRectangle const &  viewExtent,
int  pixelWidth,
int  pixelHeight 
) [pure virtual]

Renders the layer as an image.

QString QgsRasterDataProvider::generateBandName ( int  theBandNumber) [inline]

helper function to create zero padded band names

Definition at line 378 of file qgsrasterdataprovider.h.

Referenced by bandStatistics(), QgsRasterLayer::setDataProvider(), and QgsRasterLayer::validateBandName().

bool QgsRasterDataProvider::identify ( const QgsPoint point,
QMap< QString, QString > &  results 
) [virtual]

Identify raster value(s) found on the point position.

Definition at line 175 of file qgsrasterdataprovider.cpp.

Referenced by QgsRasterLayer::identify().

virtual QString QgsRasterDataProvider::identifyAsHtml ( const QgsPoint point) [pure virtual]

Identify details from a server (e.g.

WMS) from the last screen update

Parameters:
[in]pointThe pixel coordinate (as it was displayed locally on screen)
Returns:
A html document containing the return from the WMS server
Note:
WMS Servers prefer to receive coordinates in image space, therefore this function expects coordinates in that format.
The arbitraryness of the returned document is enforced by WMS standards up to at least v1.3.0
added in 1.5

Referenced by QgsRasterLayer::identifyAsHtml().

virtual QString QgsRasterDataProvider::identifyAsText ( const QgsPoint point) [pure virtual]

Identify details from a server (e.g.

WMS) from the last screen update

Parameters:
[in]pointThe pixel coordinate (as it was displayed locally on screen)
Returns:
A text document containing the return from the WMS server
Note:
WMS Servers prefer to receive coordinates in image space, therefore this function expects coordinates in that format.
The arbitraryness of the returned document is enforced by WMS standards up to at least v1.3.0

Referenced by QgsRasterLayer::identifyAsText().

virtual QString QgsRasterDataProvider::imageEncoding ( ) const [pure virtual]

Get the image encoding (as a MIME type) used in the transfer from (e.g.) the WMS server.

Referenced by QgsRasterLayer::writeSymbology().

Is the NoDataValue Valid.

Definition at line 475 of file qgsrasterdataprovider.h.

Referenced by QgsRasterLayer::resetNoDataValue(), and QgsRasterLayer::setDataProvider().

virtual QString QgsRasterDataProvider::lastError ( ) [pure virtual]

Returns the verbose error text for the last error in this provider.

If an operation returns 0 (e.g. draw()), this function returns the text of the error associated with the failure. Interactive users of this provider can then, for example, call a QMessageBox to display the contents.

Returns the format of the error text for the last error in this provider.

Note:
added in 1.6

Definition at line 182 of file qgsrasterdataprovider.cpp.

virtual QString QgsRasterDataProvider::lastErrorTitle ( ) [pure virtual]

Returns the caption error text for the last error in this provider.

If an operation returns 0 (e.g. draw()), this function returns the text of the error associated with the failure. Interactive users of this provider can then, for example, call a QMessageBox to display the contents.

QString QgsRasterDataProvider::makeTableCell ( QString const &  value) [static]

Definition at line 124 of file qgsrasterdataprovider.cpp.

Referenced by makeTableCells().

QString QgsRasterDataProvider::makeTableCells ( QStringList const &  values) [static]

Definition at line 132 of file qgsrasterdataprovider.cpp.

References makeTableCell().

virtual double QgsRasterDataProvider::maximumValue ( int  bandNo) const [inline, virtual]
QString QgsRasterDataProvider::metadata ( ) [pure virtual]

Get metadata in a format suitable for feeding directly into a subset of the GUI raster properties "Metadata" tab.

Definition at line 148 of file qgsrasterdataprovider.cpp.

Referenced by QgsRasterLayer::metadata().

virtual double QgsRasterDataProvider::minimumValue ( int  bandNo) const [inline, virtual]
virtual double QgsRasterDataProvider::noDataValue ( ) const [inline, virtual]

value representing null data

Definition at line 334 of file qgsrasterdataprovider.h.

Referenced by bandStatistics(), readValue(), QgsRasterLayer::resetNoDataValue(), and QgsRasterLayer::setDataProvider().

QByteArray QgsRasterDataProvider::noValueBytes ( int  theBandNo)

Set null value in char.

Definition at line 187 of file qgsrasterdataprovider.cpp.

References Byte, dataType(), dataTypeSize(), Float32, Float64, Int16, Int32, mNoDataValue, UInt16, UInt32, and QgsLogger::warning().

virtual void QgsRasterDataProvider::populateHistogram ( int  theBandNoInt,
QgsRasterBandStats theBandStats,
int  theBinCountInt = 256,
bool  theIgnoreOutOfRangeFlag = true,
bool  theThoroughBandScanFlag = false 
) [inline, virtual]

Populate the histogram vector for a given band.

Definition at line 351 of file qgsrasterdataprovider.h.

Referenced by QgsRasterLayer::populateHistogram().

void QgsRasterDataProvider::progress ( int  theType,
double  theProgress,
QString  theMessage 
) [signal]

Emit a signal to notify of the progress event.

Emited theProgress is in percents (0.0-100.0)

virtual void QgsRasterDataProvider::readBlock ( int  bandNo,
int  xBlock,
int  yBlock,
void *  data 
) [inline, virtual]
virtual void QgsRasterDataProvider::readBlock ( int  bandNo,
QgsRectangle const &  viewExtent,
int  width,
int  height,
void *  data 
) [inline, virtual]

read block of data using give extent and size

Definition at line 324 of file qgsrasterdataprovider.h.

void QgsRasterDataProvider::readBlock ( int  bandNo,
QgsRectangle const &  viewExtent,
int  width,
int  height,
QgsCoordinateReferenceSystem  theSrcCRS,
QgsCoordinateReferenceSystem  theDestCRS,
void *  data 
) [virtual]
double QgsRasterDataProvider::readValue ( void *  data,
int  type,
int  index 
) [virtual]
virtual bool QgsRasterDataProvider::reload ( ) [inline, virtual]

Reload data (data could change)

Definition at line 303 of file qgsrasterdataprovider.h.

void QgsRasterDataProvider::setDpi ( int  dpi) [inline]

Sets the output device resolution.

Note:
: this method was added in version 1.2

Definition at line 472 of file qgsrasterdataprovider.h.

Referenced by QgsRasterLayer::draw().

virtual void QgsRasterDataProvider::setImageCrs ( QString const &  crs) [pure virtual]

Set the image projection (in WMS CRS format) used in the transfer from (e.g.) the WMS server.

Referenced by QgsRasterLayer::setDataProvider().

virtual void QgsRasterDataProvider::setImageEncoding ( QString const &  mimeType) [pure virtual]

Set the image encoding (as a MIME type) used in the transfer from (e.g.) the WMS server.

Referenced by QgsRasterLayer::setDataProvider().

virtual int QgsRasterDataProvider::srcDataType ( int  bandNo) const [inline, virtual]

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

Definition at line 185 of file qgsrasterdataprovider.h.

References UnknownDataType.

Referenced by QgsRasterLayer::setDataProvider().

virtual QStringList QgsRasterDataProvider::subLayers ( ) const [inline, virtual]

Returns the sublayers of this layer - Useful for providers that manage their own layers, such as WMS.

Reimplemented from QgsDataProvider.

Definition at line 344 of file qgsrasterdataprovider.h.

Referenced by QgsRasterLayer::subLayers().

virtual QStringList QgsRasterDataProvider::supportedImageEncodings ( ) [pure virtual]

get raster image encodings supported by (e.g.) the WMS Server, expressed as MIME types

virtual QDateTime QgsRasterDataProvider::timestamp ( ) const [inline, virtual]

Time stamp of data source in the moment when data/metadata were loaded by provider.

Reimplemented from QgsDataProvider.

Definition at line 486 of file qgsrasterdataprovider.h.

References QgsDataProvider::mTimestamp.

Referenced by QgsRasterLayer::update().

int QgsRasterDataProvider::typeSize ( int  dataType) const [inline]

Definition at line 191 of file qgsrasterdataprovider.h.

virtual int QgsRasterDataProvider::xBlockSize ( ) const [inline, virtual]

Get block size.

Definition at line 311 of file qgsrasterdataprovider.h.

Referenced by bandStatistics().

virtual int QgsRasterDataProvider::xSize ( ) const [inline, virtual]
virtual int QgsRasterDataProvider::yBlockSize ( ) const [inline, virtual]

Definition at line 312 of file qgsrasterdataprovider.h.

Referenced by bandStatistics().

virtual int QgsRasterDataProvider::ySize ( ) const [inline, virtual]

Member Data Documentation

int QgsRasterDataProvider::mDpi [protected]

Dots per intch.

Extended WMS (e.g. QGIS mapserver) support DPI dependent output and therefore are suited for printing. A value of -1 means it has not been set

Note:
: this member has been added in version 1.2

Definition at line 500 of file qgsrasterdataprovider.h.

Definition at line 508 of file qgsrasterdataprovider.h.

QList<double> QgsRasterDataProvider::mNoDataValue [protected]

Cell value representing no data.

e.g. -9999, indexed from 0

Definition at line 503 of file qgsrasterdataprovider.h.

Referenced by noValueBytes().

Flag indicating if the nodatavalue is valid.

Definition at line 506 of file qgsrasterdataprovider.h.

Referenced by bandStatistics(), and readValue().


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