Skip to content

Commit

Permalink
Added fields accessor to raster data provider
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Apr 6, 2020
1 parent 3a5ad9a commit 1231aa0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Expand Up @@ -117,6 +117,13 @@ It makes no sense to set input on provider */
Returns data type for the band specified by number
%End

virtual QgsFields fields() const;
%Docstring
Returns the fields of the raster layer for data providers that expose them,
the default implementation returns an empty list.

.. versionadded:: 3.14
%End
virtual Qgis::DataType sourceDataType( int bandNo ) const = 0;

%Docstring
Expand Down
9 changes: 8 additions & 1 deletion src/core/raster/qgsrasterdataprovider.h
Expand Up @@ -33,8 +33,8 @@

#include "qgscolorrampshader.h"
#include "qgsdataprovider.h"
#include "qgsfields.h"
#include "qgsraster.h"
#include "qgsfields.h"
#include "qgsrasterinterface.h"
#include "qgsrasterpyramid.h"
#include "qgsrasterrange.h"
Expand Down Expand Up @@ -134,6 +134,13 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast
//! Returns data type for the band specified by number
Qgis::DataType dataType( int bandNo ) const override = 0;

/**
* Returns the fields of the raster layer for data providers that expose them,
* the default implementation returns an empty list.
* \since QGIS 3.14
*/
virtual QgsFields fields() const { return QgsFields(); };

/**
* Returns source data type for the band specified by number,
* source data type may be shorter than dataType
Expand Down

0 comments on commit 1231aa0

Please sign in to comment.