QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
QgsRasterDataProvider Class Referenceabstract

Base class for raster data providers. More...

#include <qgsrasterdataprovider.h>

Inheritance diagram for QgsRasterDataProvider:
Inheritance graph
[legend]

Signals

void progress (int theType, double theProgress, const QString &theMessage)
 Emit a signal to notify of the progress event. More...
 
void progressUpdate (int theProgress)
 
void statusChanged (const QString &)
 Emit a message to be displayed on status bar, usually used by network providers (WMS,WCS) More...
 
- Signals inherited from QgsDataProvider
void dataChanged ()
 This is emitted whenever an asynchronous operation has finished and the data should be redrawn. More...
 
void dataChanged (int changed)
 This is emitted whenever data or metadata (e.g. More...
 
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. More...
 

Public Member Functions

 QgsRasterDataProvider ()
 
 QgsRasterDataProvider (const QString &uri)
 
virtual ~QgsRasterDataProvider ()
 
virtual double bandOffset (int bandNo) const
 Read band offset for raster value. More...
 
virtual double bandScale (int bandNo) const
 Read band scale for raster value. More...
 
virtual QgsRasterBlockblock (int theBandNo, const QgsRectangle &theExtent, int theWidth, int theHeight) override
 Read block of data using given extent and size. More...
 
virtual QgsRasterBlockblock2 (int theBandNo, const QgsRectangle &theExtent, int theWidth, int theHeight, QgsRasterBlockFeedback *feedback=nullptr) override
 Read block of data using given extent and size. More...
 
virtual QList< QgsRasterPyramidbuildPyramidList (QList< int > overviewList=QList< int >())
 Accessor for ths raster layers pyramid list. More...
 
virtual QString buildPyramids (const QList< QgsRasterPyramid > &thePyramidList, const QString &theResamplingMethod="NEAREST", QgsRaster::RasterPyramidsFormat theFormat=QgsRaster::PyramidsGTiff, const QStringList &theConfigOptions=QStringList())
 Create pyramid overviews. More...
 
virtual QgsRasterInterfaceclone () const override=0
 Clone itself, create deep copy. More...
 
virtual int colorInterpretation (int theBandNo) const
 Returns data type for the band specified by number. More...
 
virtual QString colorInterpretationName (int theBandNo) const
 
QString colorName (int colorInterpretation) const
 
virtual QList< QgsColorRampShader::ColorRampItemcolorTable (int bandNo) const
 
virtual QDateTime dataTimestamp () const override
 Current time stamp of data source. More...
 
virtual QGis::DataType dataType (int bandNo) const override=0
 Returns data type for the band specified by number. More...
 
int dpi () const
 Returns the dpi of the output device. More...
 
virtual QImagedraw (const QgsRectangle &viewExtent, int pixelWidth, int pixelHeight)=0
 Renders the layer as an image. More...
 
virtual QgsRectangle extent () override=0
 Get the extent of the data source. More...
 
virtual QImage getLegendGraphic (double scale=0, bool forceRefresh=false, const QgsRectangle *visibleExtent=nullptr)
 Returns the legend rendered as pixmap. More...
 
virtual QgsImageFetchergetLegendGraphicFetcher (const QgsMapSettings *mapSettings)
 Get an image downloader for the raster legend. More...
 
bool hasPyramids ()
 Returns true if raster has at least one populated histogram. More...
 
virtual QgsRasterIdentifyResult identify (const QgsPoint &thePoint, QgsRaster::IdentifyFormat theFormat, const QgsRectangle &theExtent=QgsRectangle(), int theWidth=0, int theHeight=0, int theDpi=96)
 Identify raster value(s) found on the point position. More...
 
virtual QString lastError ()=0
 Returns the verbose error text for the last error in this provider. More...
 
virtual QString lastErrorFormat ()
 Returns the format of the error text for the last error in this provider. More...
 
virtual QString lastErrorTitle ()=0
 Returns the caption error text for the last error in this provider. More...
 
virtual QString metadata ()=0
 Get metadata in a format suitable for feeding directly into a subset of the GUI raster properties "Metadata" tab. More...
 
virtual bool reload ()
 Reload data (data could change) More...
 
virtual bool remove ()
 Remove dataset. More...
 
void setDpi (int dpi)
 Sets the output device resolution. More...
 
bool setInput (QgsRasterInterface *input) override
 Set input. More...
 
virtual bool setNoDataValue (int bandNo, double noDataValue)
 Set no data value on created dataset. More...
 
virtual void setUserNoDataValue (int bandNo, const QgsRasterRangeList &noData)
 
virtual void setUseSrcNoDataValue (int bandNo, bool use)
 Set source nodata value usage. More...
 
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. More...
 
virtual bool srcHasNoDataValue (int bandNo) const
 Return true if source band has no data value. More...
 
virtual double srcNoDataValue (int bandNo) const
 Value representing no data value. More...
 
virtual QStringList subLayers () const override
 Returns the sublayers of this layer - useful for providers that manage their own layers, such as WMS. More...
 
virtual bool supportsLegendGraphic () const
 Returns whether the provider supplies a legend graphic. More...
 
virtual QDateTime timestamp () const override
 Time stamp of data source in the moment when data/metadata were loaded by provider. More...
 
virtual QgsRasterRangeList userNoDataValues (int bandNo) const
 Get list of user no data value ranges. More...
 
virtual bool useSrcNoDataValue (int bandNo) const
 Get source nodata value usage. More...
 
virtual QString validateCreationOptions (const QStringList &createOptions, const QString &format)
 Validates creation options for a specific dataset and destination format. More...
 
virtual QString validatePyramidsConfigOptions (QgsRaster::RasterPyramidsFormat pyramidsFormat, const QStringList &theConfigOptions, const QString &fileFormat)
 Validates pyramid creation options for a specific dataset and destination format. More...
 
virtual bool write (void *data, int band, int width, int height, int xOffset, int yOffset)
 Writes into the provider datasource. More...
 
- Public Member Functions inherited from QgsDataProvider
 QgsDataProvider (QString const &uri="")
 
virtual ~QgsDataProvider ()
 We need this so the subclass destructors get called. More...
 
virtual QgsCoordinateReferenceSystem crs ()=0
 Get the QgsCoordinateReferenceSystem for this layer. More...
 
virtual QString dataSourceUri (bool expandAuthConfig=false) const
 Get the data source specification. More...
 
virtual QString description () const =0
 Return description. More...
 
virtual bool enterUpdateMode ()
 Enter update mode. More...
 
virtual QgsError error () const
 Get current status error. More...
 
virtual QString fileRasterFilters () const
 Return raster file filter string. More...
 
virtual QString fileVectorFilters () const
 Return vector file filter string. More...
 
virtual void invalidateConnections (const QString &connection)
 Invalidate connections corresponding to specified name. More...
 
virtual bool isValid ()=0
 Returns true if this is a valid layer. More...
 
virtual bool leaveUpdateMode ()
 Leave update mode. More...
 
virtual QString name () const =0
 Return a provider name. More...
 
QVariant providerProperty (ProviderProperty property, const QVariant &defaultValue=QVariant()) const
 Get the current value of a certain provider property. More...
 
QVariant providerProperty (int property, const QVariant &defaultValue) const
 Get the current value of a certain provider property. More...
 
virtual void reloadData ()
 Reloads the data from the source. More...
 
virtual void setDataSourceUri (const QString &uri)
 Set the data source specification. More...
 
virtual void setLayerOrder (const QStringList &layers)
 Reorder the list of layer names to be rendered by this provider (in order from bottom to top) More...
 
void setProviderProperty (ProviderProperty property, const QVariant &value)
 Allows setting arbitrary properties on the provider. More...
 
void setProviderProperty (int property, const QVariant &value)
 Allows setting arbitrary properties on the provider. More...
 
virtual void setSubLayerVisibility (const QString &name, bool vis)
 Set the visibility of the given sublayer name. More...
 
virtual bool setSubsetString (const QString &subset, bool updateFeatureCount=true)
 Set the subset string used to create a subset of features in the layer. More...
 
virtual uint subLayerCount () const
 return the number of layers for the current data source More...
 
virtual QStringList subLayerStyles () const
 Sub-layer styles for each sub-layer handled by this provider, in order from bottom to top. More...
 
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. More...
 
virtual bool supportsSubsetString ()
 Provider supports setting of subset strings. More...
 
virtual void updateExtents ()
 Update the extents of the layer. More...
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual ~QObject ()
 
bool blockSignals (bool block)
 
QObjectchild (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArraydynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObjectparent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThreadthread () const
 
- Public Member Functions inherited from QgsRasterInterface
 QgsRasterInterface (QgsRasterInterface *input=nullptr)
 
virtual ~QgsRasterInterface ()
 
virtual int bandCount () const =0
 Get number of bands. More...
 
virtual QgsRasterBandStats bandStatistics (int theBandNo, int theStats=QgsRasterBandStats::All, const QgsRectangle &theExtent=QgsRectangle(), int theSampleSize=0)
 Get band statistics. More...
 
virtual int capabilities () const
 Returns a bitmask containing the supported capabilities. More...
 
QString capabilitiesString () const
 Returns the above in friendly format. More...
 
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. More...
 
int dataTypeSize (int bandNo)
 
virtual QString generateBandName (int theBandNumber) const
 helper function to create zero padded band names More...
 
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() More...
 
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). More...
 
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. More...
 
virtual QgsRasterInterfaceinput () const
 Current input. More...
 
virtual bool on () const
 Is on/off. More...
 
virtual void readXML (const QDomElement &filterElem)
 Sets base class members from xml. More...
 
virtual void setOn (bool on)
 Set on/off. More...
 
virtual const QgsRasterInterfacesrcInput () const
 Get source / raw input, the first in pipe, usually provider. More...
 
virtual QgsRasterInterfacesrcInput ()
 
virtual void writeXML (QDomDocument &doc, QDomElement &parentElem) const
 Write base class members to xml. More...
 
virtual int xBlockSize () const
 Get block size. More...
 
virtual int xSize () const
 Get raster size. More...
 
virtual int yBlockSize () const
 
virtual int ySize () const
 

Static Public Member Functions

static QgsRasterDataProvidercreate (const QString &providerKey, const QString &uri, const QString &format, int nBands, QGis::DataType type, int width, int height, double *geoTransform, const QgsCoordinateReferenceSystem &crs, const QStringList &createOptions=QStringList())
 Creates a new dataset with mDataSourceURI. More...
 
static QgsRaster::IdentifyFormat identifyFormatFromName (const 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 (const QString &providerKey)
 Returns a list of pyramid resampling method name and label pairs for given provider. More...
 
- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Protected Member Functions

void copyBaseSettings (const QgsRasterDataProvider &other)
 Copy member variables from other raster data provider. More...
 
virtual void readBlock (int bandNo, int xBlock, int yBlock, void *data)
 Read block of data. More...
 
virtual void readBlock (int bandNo, QgsRectangle const &viewExtent, int width, int height, void *data, QgsRasterBlockFeedback *feedback=nullptr)
 Read block of data using give extent and size. More...
 
bool userNoDataValuesContains (int bandNo, double value) const
 Returns true if user no data contains value. More...
 
- Protected Member Functions inherited from QgsDataProvider
void appendError (const QgsErrorMessage &theMessage)
 Add error message. More...
 
void setError (const QgsError &theError)
 Set error message. More...
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObjectsender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- 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. More...
 
void initStatistics (QgsRasterBandStats &theStatistics, int theBandNo, int theStats=QgsRasterBandStats::All, const QgsRectangle &theExtent=QgsRectangle(), int theBinCount=0)
 Fill in statistics defaults if not specified. More...
 

Static Protected Member Functions

static QStringList cStringList2Q_ (char **stringList)
 
static QString makeTableCell (const QString &value)
 
static QString makeTableCells (const QStringList &values)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 

Protected Attributes

int mDpi
 Dots per inch. More...
 
QgsRectangle mExtent
 
QList< bool > mSrcHasNoDataValue
 Source no data value exists. More...
 
QList< double > mSrcNoDataValue
 Source no data value is available and is set to be used or internal no data is available. More...
 
QList< QgsRasterRangeListmUserNoDataValue
 List of lists of user defined additional no data values for each band, indexed from 0. More...
 
QList< bool > mUseSrcNoDataValue
 Use source nodata value. More...
 
- Protected Attributes inherited from QgsDataProvider
QgsError mError
 Error. More...
 
QDateTime mTimestamp
 Timestamp of data in the moment when the data were loaded by provider. More...
 
- Protected Attributes inherited from QgsRasterInterface
QList< QgsRasterHistogrammHistograms
 List of cached histograms, all bands mixed. More...
 
QgsRasterInterfacemInput
 
bool mOn
 
QList< QgsRasterBandStatsmStatistics
 List of cached statistics, all bands mixed. More...
 

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
}
 
enum  ProviderProperty { EvaluateDefaultValues, CustomData = 3000 }
 Properties are used to pass custom configuration options into data providers. More...
 
- 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...
 
- Properties inherited from QObject
 objectName
 

Detailed Description

Base class for raster data providers.

Definition at line 86 of file qgsrasterdataprovider.h.

Constructor & Destructor Documentation

◆ QgsRasterDataProvider() [1/2]

QgsRasterDataProvider::QgsRasterDataProvider ( )

Definition at line 222 of file qgsrasterdataprovider.cpp.

◆ QgsRasterDataProvider() [2/2]

QgsRasterDataProvider::QgsRasterDataProvider ( const QString uri)

Definition at line 228 of file qgsrasterdataprovider.cpp.

◆ ~QgsRasterDataProvider()

virtual QgsRasterDataProvider::~QgsRasterDataProvider ( )
inlinevirtual

Definition at line 95 of file qgsrasterdataprovider.h.

Member Function Documentation

◆ bandOffset()

virtual double QgsRasterDataProvider::bandOffset ( int  bandNo) const
inlinevirtual

Read band offset for raster value.

Note
added in 2.3

Definition at line 206 of file qgsrasterdataprovider.h.

◆ bandScale()

virtual double QgsRasterDataProvider::bandScale ( int  bandNo) const
inlinevirtual

Read band scale for raster value.

Note
added in 2.3

Definition at line 202 of file qgsrasterdataprovider.h.

◆ block()

QgsRasterBlock * QgsRasterDataProvider::block ( int  theBandNo,
const QgsRectangle theExtent,
int  theWidth,
int  theHeight 
)
overridevirtual

Read block of data using given extent and size.

Implements QgsRasterInterface.

Definition at line 45 of file qgsrasterdataprovider.cpp.

◆ block2()

QgsRasterBlock * QgsRasterDataProvider::block2 ( int  bandNo,
const QgsRectangle extent,
int  width,
int  height,
QgsRasterBlockFeedback feedback = nullptr 
)
overridevirtual

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
feedbackoptional raster feedback object for cancellation/preview
Note
This is extended version of block() method. Default implementation falls back to calling block().
Added in QGIS 2.18

Reimplemented from QgsRasterInterface.

Definition at line 50 of file qgsrasterdataprovider.cpp.

◆ buildPyramidList()

virtual QList<QgsRasterPyramid> QgsRasterDataProvider::buildPyramidList ( QList< int >  overviewList = QList<int>())
inlinevirtual

Accessor for ths raster layers pyramid list.

Parameters
overviewListused 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 299 of file qgsrasterdataprovider.h.

◆ buildPyramids()

virtual QString QgsRasterDataProvider::buildPyramids ( const QList< QgsRasterPyramid > &  thePyramidList,
const QString theResamplingMethod = "NEAREST",
QgsRaster::RasterPyramidsFormat  theFormat = QgsRaster::PyramidsGTiff,
const QStringList theConfigOptions = QStringList() 
)
inlinevirtual

Create pyramid overviews.

Definition at line 280 of file qgsrasterdataprovider.h.

◆ clone()

virtual QgsRasterInterface* QgsRasterDataProvider::clone ( ) const
overridepure virtual

Clone itself, create deep copy.

Implements QgsRasterInterface.

◆ colorInterpretation()

virtual int QgsRasterDataProvider::colorInterpretation ( int  theBandNo) const
inlinevirtual

Returns data type for the band specified by number.

Definition at line 125 of file qgsrasterdataprovider.h.

◆ colorInterpretationName()

virtual QString QgsRasterDataProvider::colorInterpretationName ( int  theBandNo) const
inlinevirtual

Definition at line 194 of file qgsrasterdataprovider.h.

◆ colorName()

QString QgsRasterDataProvider::colorName ( int  colorInterpretation) const
inline

Definition at line 131 of file qgsrasterdataprovider.h.

◆ colorTable()

virtual QList<QgsColorRampShader::ColorRampItem> QgsRasterDataProvider::colorTable ( int  bandNo) const
inlinevirtual

Definition at line 231 of file qgsrasterdataprovider.h.

◆ copyBaseSettings()

void QgsRasterDataProvider::copyBaseSettings ( const QgsRasterDataProvider other)
protected

Copy member variables from other raster data provider.

Useful for implementation of clone() method in subclasses

Definition at line 520 of file qgsrasterdataprovider.cpp.

◆ create()

QgsRasterDataProvider * 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,
const QStringList createOptions = QStringList() 
)
static

Creates a new dataset with mDataSourceURI.

Definition at line 435 of file qgsrasterdataprovider.cpp.

◆ cStringList2Q_()

QStringList QgsRasterDataProvider::cStringList2Q_ ( char **  stringList)
staticprotected
Note
not available in Python bindings

Definition at line 241 of file qgsrasterdataprovider.cpp.

◆ dataTimestamp()

virtual QDateTime QgsRasterDataProvider::dataTimestamp ( ) const
inlineoverridevirtual

Current time stamp of data source.

Reimplemented from QgsDataProvider.

Definition at line 372 of file qgsrasterdataprovider.h.

◆ dataType()

virtual QGis::DataType QgsRasterDataProvider::dataType ( int  bandNo) const
overridepure virtual

Returns data type for the band specified by number.

Implements QgsRasterInterface.

◆ dpi()

int QgsRasterDataProvider::dpi ( ) const
inline

Returns the dpi of the output device.

Definition at line 363 of file qgsrasterdataprovider.h.

◆ draw()

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

Renders the layer as an image.

Note
When render caching (/qgis/enable_render_caching) is on the wms provider doesn't wait for the reply of the getmap request or all tiles replies and can return incomplete images. Temporarily disable render caching if you require the complete wms image in the first call.

◆ extent()

virtual QgsRectangle QgsRasterDataProvider::extent ( )
overridepure virtual

Get the extent of the data source.

Returns
QgsRectangle containing the extent of the layer

Implements QgsDataProvider.

◆ getLegendGraphic()

virtual QImage QgsRasterDataProvider::getLegendGraphic ( double  scale = 0,
bool  forceRefresh = false,
const QgsRectangle visibleExtent = nullptr 
)
inlinevirtual

Returns the legend rendered as pixmap.

useful for that layer that need to get legend layer remotely as WMS

Parameters
scaleOptional parameter that is the Scale of the layer
forceRefreshOptional bool parameter to force refresh getLegendGraphic call
visibleExtentVisible extent for providers supporting contextual legends, in layer CRS
Note
visibleExtent parameter added in 2.8 (no available in python bindings)

Definition at line 252 of file qgsrasterdataprovider.h.

◆ getLegendGraphicFetcher()

virtual QgsImageFetcher* QgsRasterDataProvider::getLegendGraphicFetcher ( const QgsMapSettings mapSettings)
inlinevirtual

Get an image downloader for the raster legend.

Parameters
mapSettingsmap settings for legend providers supporting contextual legends.
Returns
a download handler or null if the provider does not support legend at all. Ownership of the returned object is transferred to caller.
Note
added in 2.8

Definition at line 273 of file qgsrasterdataprovider.h.

◆ hasPyramids()

bool QgsRasterDataProvider::hasPyramids ( )

Returns true if raster has at least one populated histogram.

Definition at line 377 of file qgsrasterdataprovider.cpp.

◆ identify()

QgsRasterIdentifyResult QgsRasterDataProvider::identify ( const QgsPoint thePoint,
QgsRaster::IdentifyFormat  theFormat,
const QgsRectangle theExtent = QgsRectangle(),
int  theWidth = 0,
int  theHeight = 0,
int  theDpi = 96 
)
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.

Note
The arbitraryness of the returned document is enforced by WMS standards up to at least v1.3.0
Parameters
thePointcoordinates in data source CRS
theFormatresult format
theExtentcontext extent
theWidthcontext width
theHeightcontext height
theDpicontext dpi
Returns
QgsRaster::IdentifyFormatValue: map of values for each band, keys are band numbers (from 1). QgsRaster::IdentifyFormatFeature: map of QgsRasterFeatureList for each sublayer (WMS) - TODO: it is not consistent with QgsRaster::IdentifyFormatValue. QgsRaster::IdentifyFormatHtml: map of HTML strings for each sublayer (WMS). Empty if failed or there are no results (TODO: better error reporting).

Definition at line 284 of file qgsrasterdataprovider.cpp.

◆ identifyFormatFromName()

QgsRaster::IdentifyFormat QgsRasterDataProvider::identifyFormatFromName ( const QString formatName)
static

Definition at line 488 of file qgsrasterdataprovider.cpp.

◆ identifyFormatLabel()

QString QgsRasterDataProvider::identifyFormatLabel ( QgsRaster::IdentifyFormat  format)
static

Definition at line 471 of file qgsrasterdataprovider.cpp.

◆ identifyFormatName()

QString QgsRasterDataProvider::identifyFormatName ( QgsRaster::IdentifyFormat  format)
static

Definition at line 454 of file qgsrasterdataprovider.cpp.

◆ identifyFormatToCapability()

QgsRasterInterface::Capability QgsRasterDataProvider::identifyFormatToCapability ( QgsRaster::IdentifyFormat  format)
static

Definition at line 497 of file qgsrasterdataprovider.cpp.

◆ lastError()

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.

◆ lastErrorFormat()

QString QgsRasterDataProvider::lastErrorFormat ( )
virtual

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

Definition at line 349 of file qgsrasterdataprovider.cpp.

◆ lastErrorTitle()

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.

◆ makeTableCell()

QString QgsRasterDataProvider::makeTableCell ( const QString value)
staticprotected

Definition at line 255 of file qgsrasterdataprovider.cpp.

◆ makeTableCells()

QString QgsRasterDataProvider::makeTableCells ( const QStringList values)
staticprotected

Definition at line 261 of file qgsrasterdataprovider.cpp.

◆ metadata()

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 277 of file qgsrasterdataprovider.cpp.

◆ progress

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

Emit a signal to notify of the progress event.

Emitted theProgress is in percents (0.0-100.0)

◆ progressUpdate

void QgsRasterDataProvider::progressUpdate ( int  theProgress)
signal

◆ pyramidResamplingMethods()

QList< QPair< QString, QString > > QgsRasterDataProvider::pyramidResamplingMethods ( const QString providerKey)
static

Returns a list of pyramid resampling method name and label pairs for given provider.

Definition at line 355 of file qgsrasterdataprovider.cpp.

◆ readBlock() [1/2]

virtual void QgsRasterDataProvider::readBlock ( int  bandNo,
int  xBlock,
int  yBlock,
void *  data 
)
inlineprotectedvirtual

Read block of data.

Note
not available in python bindings

Definition at line 444 of file qgsrasterdataprovider.h.

◆ readBlock() [2/2]

virtual void QgsRasterDataProvider::readBlock ( int  bandNo,
QgsRectangle const &  viewExtent,
int  width,
int  height,
void *  data,
QgsRasterBlockFeedback feedback = nullptr 
)
inlineprotectedvirtual

Read block of data using give extent and size.

Note
not available in python bindings

Definition at line 450 of file qgsrasterdataprovider.h.

◆ reload()

virtual bool QgsRasterDataProvider::reload ( )
inlinevirtual

Reload data (data could change)

Definition at line 192 of file qgsrasterdataprovider.h.

◆ remove()

virtual bool QgsRasterDataProvider::remove ( )
inlinevirtual

Remove dataset.

Definition at line 403 of file qgsrasterdataprovider.h.

◆ setDpi()

void QgsRasterDataProvider::setDpi ( int  dpi)
inline

Sets the output device resolution.

Definition at line 366 of file qgsrasterdataprovider.h.

◆ setInput()

bool QgsRasterDataProvider::setInput ( QgsRasterInterface input)
inlineoverridevirtual

Set input.

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

Reimplemented from QgsRasterInterface.

Definition at line 100 of file qgsrasterdataprovider.h.

◆ setNoDataValue()

virtual bool QgsRasterDataProvider::setNoDataValue ( int  bandNo,
double  noDataValue 
)
inlinevirtual

Set no data value on created dataset.

Parameters
bandNoband number
noDataValueno data value

Definition at line 400 of file qgsrasterdataprovider.h.

◆ setUserNoDataValue()

void QgsRasterDataProvider::setUserNoDataValue ( int  bandNo,
const QgsRasterRangeList noData 
)
virtual

Definition at line 397 of file qgsrasterdataprovider.cpp.

◆ setUseSrcNoDataValue()

void QgsRasterDataProvider::setUseSrcNoDataValue ( int  bandNo,
bool  use 
)
virtual

Set source nodata value usage.

Definition at line 33 of file qgsrasterdataprovider.cpp.

◆ srcDataType()

virtual QGis::DataType QgsRasterDataProvider::srcDataType ( int  bandNo) const
overridepure virtual

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

Reimplemented from QgsRasterInterface.

◆ srcHasNoDataValue()

virtual bool QgsRasterDataProvider::srcHasNoDataValue ( int  bandNo) const
inlinevirtual

Return true if source band has no data value.

Definition at line 215 of file qgsrasterdataprovider.h.

◆ srcNoDataValue()

virtual double QgsRasterDataProvider::srcNoDataValue ( int  bandNo) const
inlinevirtual

Value representing no data value.

Definition at line 224 of file qgsrasterdataprovider.h.

◆ statusChanged

void QgsRasterDataProvider::statusChanged ( const QString )
signal

Emit a message to be displayed on status bar, usually used by network providers (WMS,WCS)

Note
added in 2.14

◆ subLayers()

virtual QStringList QgsRasterDataProvider::subLayers ( ) const
inlineoverridevirtual

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

Reimplemented from QgsDataProvider.

Definition at line 236 of file qgsrasterdataprovider.h.

◆ supportsLegendGraphic()

virtual bool QgsRasterDataProvider::supportsLegendGraphic ( ) const
inlinevirtual

Returns whether the provider supplies a legend graphic.

Definition at line 242 of file qgsrasterdataprovider.h.

◆ timestamp()

virtual QDateTime QgsRasterDataProvider::timestamp ( ) const
inlineoverridevirtual

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

Reimplemented from QgsDataProvider.

Definition at line 369 of file qgsrasterdataprovider.h.

◆ userNoDataValues()

virtual QgsRasterRangeList QgsRasterDataProvider::userNoDataValues ( int  bandNo) const
inlinevirtual

Get list of user no data value ranges.

Definition at line 229 of file qgsrasterdataprovider.h.

◆ userNoDataValuesContains()

bool QgsRasterDataProvider::userNoDataValuesContains ( int  bandNo,
double  value 
) const
protected

Returns true if user no data contains value.

Definition at line 514 of file qgsrasterdataprovider.cpp.

◆ useSrcNoDataValue()

virtual bool QgsRasterDataProvider::useSrcNoDataValue ( int  bandNo) const
inlinevirtual

Get source nodata value usage.

Definition at line 218 of file qgsrasterdataprovider.h.

◆ validateCreationOptions()

virtual QString QgsRasterDataProvider::validateCreationOptions ( const QStringList createOptions,
const QString format 
)
inlinevirtual

Validates creation options for a specific dataset and destination format.

Note
used by GDAL provider only
see also validateCreationOptionsFormat() in gdal provider for validating options based on format only

Definition at line 414 of file qgsrasterdataprovider.h.

◆ validatePyramidsConfigOptions()

virtual QString QgsRasterDataProvider::validatePyramidsConfigOptions ( QgsRaster::RasterPyramidsFormat  pyramidsFormat,
const QStringList theConfigOptions,
const QString fileFormat 
)
inlinevirtual

Validates pyramid creation options for a specific dataset and destination format.

Note
used by GDAL provider only

Definition at line 420 of file qgsrasterdataprovider.h.

◆ write()

virtual bool QgsRasterDataProvider::write ( void *  data,
int  band,
int  width,
int  height,
int  xOffset,
int  yOffset 
)
inlinevirtual

Writes into the provider datasource.

Definition at line 376 of file qgsrasterdataprovider.h.

Member Data Documentation

◆ mDpi

int QgsRasterDataProvider::mDpi
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 467 of file qgsrasterdataprovider.h.

◆ mExtent

QgsRectangle QgsRasterDataProvider::mExtent
protected

Definition at line 488 of file qgsrasterdataprovider.h.

◆ mPyramidResamplingListGdal

QStringList QgsRasterDataProvider::mPyramidResamplingListGdal
staticprotected

Definition at line 490 of file qgsrasterdataprovider.h.

◆ mPyramidResamplingMapGdal

QgsStringMap QgsRasterDataProvider::mPyramidResamplingMapGdal
staticprotected

Definition at line 491 of file qgsrasterdataprovider.h.

◆ mSrcHasNoDataValue

QList<bool> QgsRasterDataProvider::mSrcHasNoDataValue
protected

Source no data value exists.

Definition at line 477 of file qgsrasterdataprovider.h.

◆ mSrcNoDataValue

QList<double> QgsRasterDataProvider::mSrcNoDataValue
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 474 of file qgsrasterdataprovider.h.

◆ mUserNoDataValue

QList< QgsRasterRangeList > QgsRasterDataProvider::mUserNoDataValue
protected

List of lists of user defined additional no data values for each band, indexed from 0.

Definition at line 486 of file qgsrasterdataprovider.h.

◆ mUseSrcNoDataValue

QList<bool> QgsRasterDataProvider::mUseSrcNoDataValue
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 482 of file qgsrasterdataprovider.h.


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