QGIS API Documentation
2.8.2-Wien
|
Base class for raster data providers. More...
#include <qgsrasterdataprovider.h>
Signals | |
void | progress (int theType, double theProgress, QString theMessage) |
Emit a signal to notify of the progress event. | |
void | progressUpdate (int theProgress) |
Signals inherited from QgsDataProvider | |
void | dataChanged () |
This is emitted whenever an asynchronous operation has finished and the data should be redrawn. | |
void | dataChanged (int changed) |
This is emitted whenever data or metadata (e.g. | |
void | fullExtentCalculated () |
This is emitted whenever the worker thread has fully calculated the PostGIS extents for this layer, and its event has been received by this provider. |
Public Member Functions | |
QgsRasterDataProvider () | |
QgsRasterDataProvider (const QString &uri) | |
virtual | ~QgsRasterDataProvider () |
virtual double | bandOffset (int bandNo) const |
Read band offset for raster value @note added in 2.3. | |
virtual double | bandScale (int bandNo) const |
Read band scale for raster value @note added in 2.3. | |
virtual QgsRasterBlock * | block (int theBandNo, const QgsRectangle &theExtent, int theWidth, int theHeight) override |
Read block of data using given extent and size. | |
virtual QList< QgsRasterPyramid > | buildPyramidList (QList< int > overviewList=QList< int >()) |
Accessor for ths raster layers pyramid list. | |
virtual QString | buildPyramids (const QList< QgsRasterPyramid > &thePyramidList, const QString &theResamplingMethod="NEAREST", QgsRaster::RasterPyramidsFormat theFormat=QgsRaster::PyramidsGTiff, const QStringList &theConfigOptions=QStringList()) |
Create pyramid overviews. | |
virtual QgsRasterInterface * | clone () const override=0 |
Clone itself, create deep copy. | |
virtual int | colorInterpretation (int theBandNo) const |
Returns data type for the band specified by number. | |
virtual QString | colorInterpretationName (int theBandNo) const |
QString | colorName (int colorInterpretation) const |
virtual QList < QgsColorRampShader::ColorRampItem > | colorTable (int bandNo) const |
virtual QDateTime | dataTimestamp () const override |
Current time stamp of data source. | |
virtual QGis::DataType | dataType (int bandNo) const override=0 |
Returns data type for the band specified by number. | |
int | dpi () const |
Returns the dpi of the output device. | |
virtual QImage * | draw (const QgsRectangle &viewExtent, int pixelWidth, int pixelHeight)=0 |
Renders the layer as an image. | |
virtual QgsRectangle | extent () override=0 |
Get the extent of the data source. | |
virtual QImage | getLegendGraphic (double scale=0, bool forceRefresh=false, const QgsRectangle *visibleExtent=0) |
Returns the legend rendered as pixmap. | |
virtual QgsImageFetcher * | getLegendGraphicFetcher (const QgsMapSettings *mapSettings) |
Get an image downloader for the raster legend. | |
bool | hasPyramids () |
Returns true if raster has at least one populated histogram. | |
virtual QgsRasterIdentifyResult | identify (const QgsPoint &thePoint, QgsRaster::IdentifyFormat theFormat, const QgsRectangle &theExtent=QgsRectangle(), int theWidth=0, int theHeight=0) |
Identify raster value(s) found on the point position. | |
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. | |
virtual QString | lastErrorTitle ()=0 |
Returns the caption error text for the last error in this provider. | |
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 | reload () |
Reload data (data could change) | |
virtual bool | remove () |
Remove dataset. | |
void | setDpi (int dpi) |
Sets the output device resolution. | |
bool | setInput (QgsRasterInterface *input) override |
Set input. | |
virtual bool | setNoDataValue (int bandNo, double noDataValue) |
Set no data value on created dataset. | |
virtual void | setUserNoDataValue (int bandNo, QgsRasterRangeList noData) |
virtual void | setUseSrcNoDataValue (int bandNo, bool use) |
Set source nodata value usage. | |
virtual QGis::DataType | srcDataType (int bandNo) const override=0 |
Returns source data type for the band specified by number, source data type may be shorter than dataType. | |
virtual bool | srcHasNoDataValue (int bandNo) const |
virtual double | srcNoDataValue (int bandNo) const |
Value representing no data value. | |
virtual QStringList | subLayers () const override |
Returns the sublayers of this layer - useful for providers that manage their own layers, such as WMS. | |
virtual QDateTime | timestamp () const override |
Time stamp of data source in the moment when data/metadata were loaded by provider. | |
virtual QgsRasterRangeList | userNoDataValues (int bandNo) const |
Get list of user no data value ranges. | |
virtual bool | useSrcNoDataValue (int bandNo) const |
Get source nodata value usage. | |
virtual QString | validateCreationOptions (const QStringList &createOptions, QString format) |
Validates creation options for a specific dataset and destination format. | |
virtual QString | validatePyramidsConfigOptions (QgsRaster::RasterPyramidsFormat pyramidsFormat, const QStringList &theConfigOptions, const QString &fileFormat) |
Validates pyramid creation options for a specific dataset and destination format. | |
virtual bool | write (void *data, int band, int width, int height, int xOffset, int yOffset) |
Writes into the provider datasource. | |
Public Member Functions inherited from QgsDataProvider | |
QgsDataProvider (QString const &uri="") | |
virtual | ~QgsDataProvider () |
We need this so the subclass destructors get called. | |
virtual QgsCoordinateReferenceSystem | crs ()=0 |
virtual QString | dataSourceUri () const |
Get the data source specification. | |
virtual QString | description () const =0 |
return description | |
virtual QgsError | error () const |
Get current status error. | |
virtual QString | fileRasterFilters () const |
return raster file filter string | |
virtual QString | fileVectorFilters () const |
return vector file filter string | |
virtual bool | isValid ()=0 |
Returns true if this is a valid layer. | |
virtual QString | name () const =0 |
return a provider name | |
virtual void | reloadData () |
Reloads the data from the source. | |
virtual void | setDataSourceUri (const QString &uri) |
Set the data source specification. | |
virtual void | setLayerOrder (const QStringList &layers) |
Reorder the list of layer names to be rendered by this provider (in order from bottom to top) | |
virtual void | setSubLayerVisibility (const QString &name, bool vis) |
Set the visibility of the given sublayer name. | |
virtual bool | setSubsetString (QString subset, bool updateFeatureCount=true) |
Set the subset string used to create a subset of features in the layer. | |
virtual uint | subLayerCount () const |
return the number of layers for the current data source | |
virtual QStringList | subLayerStyles () const |
Sub-layer styles for each sub-layer handled by this provider, in order from bottom to top. | |
virtual QString | subsetString () |
Returns the subset definition string (typically sql) currently in use by the layer and used by the provider to limit the feature set. | |
virtual bool | supportsSubsetString () |
provider supports setting of subset strings | |
virtual void | updateExtents () |
Update the extents of the layer. | |
Public Member Functions inherited from QgsRasterInterface | |
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 int | capabilities () const |
Returns a bitmask containing the supported capabilities. | |
QString | capabilitiesString () const |
Returns the above in friendly format. | |
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. | |
int | dataTypeSize (int bandNo) |
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 QgsRasterInterface * | input () const |
Current input. | |
virtual bool | on () const |
Is on/off. | |
virtual void | readXML (const QDomElement &filterElem) |
Sets base class members from xml. | |
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 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 |
Static Public Member Functions | |
static QgsRasterDataProvider * | create (const QString &providerKey, const QString &uri, const QString &format, int nBands, QGis::DataType type, int width, int height, double *geoTransform, const QgsCoordinateReferenceSystem &crs, QStringList createOptions=QStringList()) |
Creates a new dataset with mDataSourceURI. | |
static QgsRaster::IdentifyFormat | identifyFormatFromName (QString formatName) |
static QString | identifyFormatLabel (QgsRaster::IdentifyFormat format) |
static QString | identifyFormatName (QgsRaster::IdentifyFormat format) |
static Capability | identifyFormatToCapability (QgsRaster::IdentifyFormat format) |
static QList< QPair< QString, QString > > | pyramidResamplingMethods (QString providerKey) |
Returns a list of pyramid resampling method name and label pairs for given provider. |
Protected Member Functions | |
void | copyBaseSettings (const QgsRasterDataProvider &other) |
Copy member variables from other raster data provider. | |
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. | |
bool | userNoDataValuesContains (int bandNo, double value) const |
Returns true if user no data contains value. | |
Protected Member Functions inherited from QgsDataProvider | |
void | appendError (const QgsErrorMessage &theMessage) |
Add error message. | |
void | setError (const QgsError &theError) |
Set error message. | |
Protected Member Functions inherited from QgsRasterInterface | |
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. |
Static Protected Member Functions | |
static QStringList | cStringList2Q_ (char **stringList) |
static void | initPyramidResamplingDefs () |
static QString | makeTableCell (const QString &value) |
static QString | makeTableCells (const QStringList &values) |
Protected Attributes | |
int | mDpi |
Dots per inch. | |
QgsRectangle | mExtent |
QList< bool > | mSrcHasNoDataValue |
Source no data value exists. | |
QList< double > | mSrcNoDataValue |
Source no data value is available and is set to be used or internal no data is available. | |
QList< QgsRasterRangeList > | mUserNoDataValue |
List of lists of user defined additional no data values for each band, indexed from 0. | |
QList< bool > | mUseSrcNoDataValue |
Use source nodata value. | |
Protected Attributes inherited from QgsDataProvider | |
QgsError | mError |
Error. | |
QDateTime | mTimestamp |
Timestamp of data in the moment when the data were loaded by provider. | |
Protected Attributes inherited from QgsRasterInterface | |
QList< QgsRasterHistogram > | mHistograms |
List of cached histograms, all bands mixed. | |
QgsRasterInterface * | mInput |
bool | mOn |
QList< QgsRasterBandStats > | mStatistics |
List of cached statistics, all bands mixed. |
Static Protected Attributes | |
static QStringList | mPyramidResamplingListGdal |
static QgsStringMap | mPyramidResamplingMapGdal |
Additional Inherited Members | |
Public Types inherited from QgsDataProvider | |
enum | DataCapability { NoDataCapabilities = 0, File = 1, Dir = 1 << 1, Database = 1 << 2, Net = 1 << 3 } |
Public Types inherited from QgsRasterInterface | |
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... |
Base class for raster data providers.
Definition at line 81 of file qgsrasterdataprovider.h.
QgsRasterDataProvider::QgsRasterDataProvider | ( | ) |
Definition at line 218 of file qgsrasterdataprovider.cpp.
QgsRasterDataProvider::QgsRasterDataProvider | ( | const QString & | uri | ) |
Definition at line 224 of file qgsrasterdataprovider.cpp.
|
inlinevirtual |
Definition at line 90 of file qgsrasterdataprovider.h.
|
inlinevirtual |
Read band offset for raster value @note added in 2.3.
Definition at line 197 of file qgsrasterdataprovider.h.
|
inlinevirtual |
Read band scale for raster value @note added in 2.3.
Definition at line 194 of file qgsrasterdataprovider.h.
|
overridevirtual |
Read block of data using given extent and size.
Implements QgsRasterInterface.
Definition at line 46 of file qgsrasterdataprovider.cpp.
|
inlinevirtual |
Accessor for ths raster layers pyramid list.
overviewList | used to construct the pyramid list (optional), when empty the list is defined by the provider. 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 284 of file qgsrasterdataprovider.h.
|
inlinevirtual |
Create pyramid overviews.
Definition at line 267 of file qgsrasterdataprovider.h.
|
overridepure virtual |
Clone itself, create deep copy.
Implements QgsRasterInterface.
|
inlinevirtual |
Returns data type for the band specified by number.
Definition at line 118 of file qgsrasterdataprovider.h.
|
inlinevirtual |
Definition at line 187 of file qgsrasterdataprovider.h.
|
inline |
Definition at line 124 of file qgsrasterdataprovider.h.
|
inlinevirtual |
Definition at line 221 of file qgsrasterdataprovider.h.
|
protected |
Copy member variables from other raster data provider.
Useful for implementation of clone() method in subclasses
Definition at line 516 of file qgsrasterdataprovider.cpp.
|
static |
Creates a new dataset with mDataSourceURI.
Definition at line 431 of file qgsrasterdataprovider.cpp.
|
staticprotected |
Definition at line 237 of file qgsrasterdataprovider.cpp.
|
inlineoverridevirtual |
Current time stamp of data source.
Reimplemented from QgsDataProvider.
Definition at line 356 of file qgsrasterdataprovider.h.
|
overridepure virtual |
Returns data type for the band specified by number.
Implements QgsRasterInterface.
|
inline |
Returns the dpi of the output device.
Definition at line 347 of file qgsrasterdataprovider.h.
|
pure virtual |
Renders the layer as an image.
|
overridepure virtual |
Get the extent of the data source.
Implements QgsDataProvider.
|
inlinevirtual |
Returns the legend rendered as pixmap.
useful for that layer that need to get legend layer remotely as WMS
scale | Optional parameter that is the Scale of the layer |
forceRefresh | Optional bool parameter to force refresh getLegendGraphic call |
visibleExtent | Visible extent for providers supporting contextual legends, in layer CRS |
Definition at line 239 of file qgsrasterdataprovider.h.
|
inlinevirtual |
Get an image downloader for the raster legend.
mapSettings | map settings for legend providers supporting contextual legends. |
Definition at line 260 of file qgsrasterdataprovider.h.
bool QgsRasterDataProvider::hasPyramids | ( | ) |
Returns true if raster has at least one populated histogram.
Definition at line 373 of file qgsrasterdataprovider.cpp.
|
virtual |
Identify raster value(s) found on the point position.
The context parameters theExtent, theWidth and theHeight are important to identify on the same zoom level as a displayed map and to do effective caching (WCS). If context params are not specified the highest resolution is used. capabilities() may be used to test if format is supported by provider. Values are set to 'no data' or empty string if point is outside data source extent.
thePoint | coordinates in data source CRS |
theFormat | result format |
theExtent | context extent |
theWidth | context width |
theHeight | context height |
Definition at line 280 of file qgsrasterdataprovider.cpp.
|
static |
Definition at line 484 of file qgsrasterdataprovider.cpp.
|
static |
Definition at line 467 of file qgsrasterdataprovider.cpp.
|
static |
Definition at line 450 of file qgsrasterdataprovider.cpp.
|
static |
Definition at line 493 of file qgsrasterdataprovider.cpp.
|
staticprotected |
|
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.
|
virtual |
Returns the format of the error text for the last error in this provider.
Definition at line 345 of file qgsrasterdataprovider.cpp.
|
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.
|
staticprotected |
Definition at line 251 of file qgsrasterdataprovider.cpp.
|
staticprotected |
Definition at line 257 of file qgsrasterdataprovider.cpp.
|
pure virtual |
Get metadata in a format suitable for feeding directly into a subset of the GUI raster properties "Metadata" tab.
Definition at line 273 of file qgsrasterdataprovider.cpp.
|
signal |
Emit a signal to notify of the progress event.
Emitted theProgress is in percents (0.0-100.0)
|
signal |
|
static |
Returns a list of pyramid resampling method name and label pairs for given provider.
Definition at line 351 of file qgsrasterdataprovider.cpp.
|
inlineprotectedvirtual |
Read block of data.
Definition at line 419 of file qgsrasterdataprovider.h.
|
inlineprotectedvirtual |
Read block of data using give extent and size.
Definition at line 424 of file qgsrasterdataprovider.h.
|
inlinevirtual |
Reload data (data could change)
Definition at line 185 of file qgsrasterdataprovider.h.
|
inlinevirtual |
Remove dataset.
Definition at line 387 of file qgsrasterdataprovider.h.
|
inline |
Sets the output device resolution.
Definition at line 350 of file qgsrasterdataprovider.h.
|
inlineoverridevirtual |
Set input.
Returns true if set correctly, false if cannot use that input
Reimplemented from QgsRasterInterface.
Definition at line 95 of file qgsrasterdataprovider.h.
|
inlinevirtual |
Set no data value on created dataset.
bandNo | band number |
noDataValue | no data value |
Definition at line 384 of file qgsrasterdataprovider.h.
|
virtual |
Definition at line 393 of file qgsrasterdataprovider.cpp.
|
virtual |
Set source nodata value usage.
Definition at line 34 of file qgsrasterdataprovider.cpp.
|
overridepure virtual |
Returns source data type for the band specified by number, source data type may be shorter than dataType.
Reimplemented from QgsRasterInterface.
|
inlinevirtual |
Definition at line 205 of file qgsrasterdataprovider.h.
|
inlinevirtual |
Value representing no data value.
Definition at line 214 of file qgsrasterdataprovider.h.
|
inlineoverridevirtual |
Returns the sublayers of this layer - useful for providers that manage their own layers, such as WMS.
Reimplemented from QgsDataProvider.
Definition at line 226 of file qgsrasterdataprovider.h.
|
inlineoverridevirtual |
Time stamp of data source in the moment when data/metadata were loaded by provider.
Reimplemented from QgsDataProvider.
Definition at line 353 of file qgsrasterdataprovider.h.
|
inlinevirtual |
Get list of user no data value ranges.
Definition at line 219 of file qgsrasterdataprovider.h.
|
protected |
Returns true if user no data contains value.
Definition at line 510 of file qgsrasterdataprovider.cpp.
|
inlinevirtual |
Get source nodata value usage.
Definition at line 208 of file qgsrasterdataprovider.h.
|
inlinevirtual |
Validates creation options for a specific dataset and destination format.
Definition at line 396 of file qgsrasterdataprovider.h.
|
inlinevirtual |
Validates pyramid creation options for a specific dataset and destination format.
Definition at line 401 of file qgsrasterdataprovider.h.
|
inlinevirtual |
Writes into the provider datasource.
Definition at line 360 of file qgsrasterdataprovider.h.
|
protected |
Dots per inch.
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
Definition at line 440 of file qgsrasterdataprovider.h.
|
protected |
Definition at line 461 of file qgsrasterdataprovider.h.
|
staticprotected |
Definition at line 464 of file qgsrasterdataprovider.h.
|
staticprotected |
Definition at line 465 of file qgsrasterdataprovider.h.
|
protected |
Source no data value exists.
Definition at line 450 of file qgsrasterdataprovider.h.
|
protected |
Source no data value is available and is set to be used or internal no data is available.
Used internally only Cell value representing original source no data. e.g. -9999, indexed from 0
Definition at line 447 of file qgsrasterdataprovider.h.
|
protected |
List of lists of user defined additional no data values for each band, indexed from 0.
Definition at line 459 of file qgsrasterdataprovider.h.
|
protected |
Use source nodata value.
User can disable usage of source nodata value as nodata. It may happen that a value is wrongly given by GDAL as nodata (e.g. 0) and it has to be treated as regular value.
Definition at line 455 of file qgsrasterdataprovider.h.