QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgsrasternuller.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrasternuller.h
3  -------------------
4  begin : August 2012
5  copyright : (C) 2012 by Radim Blazek
6  email : radim dot blazek at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSRASTERNULLER_H
19 #define QGSRASTERNULLER_H
20 
21 #include "qgis_core.h"
22 #include "qgis_sip.h"
23 #include "qgsrasterrange.h"
24 #include "qgsrasterinterface.h"
25 
26 #include <QList>
27 
32 class CORE_EXPORT QgsRasterNuller : public QgsRasterInterface
33 {
34  public:
35  QgsRasterNuller( QgsRasterInterface *input = nullptr );
36 
37  struct NoData
38  {
39  double min;
40  double max;
41  };
42 
43  QgsRasterNuller *clone() const override SIP_FACTORY;
44 
45  int bandCount() const override;
46 
47  Qgis::DataType dataType( int bandNo ) const override;
48 
49  QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override SIP_FACTORY;
50 
51  void setNoData( int bandNo, const QgsRasterRangeList &noData );
52 
53  QgsRasterRangeList noData( int bandNo ) const { return mNoData.value( bandNo - 1 ); }
54 
56  void setOutputNoDataValue( int bandNo, double noData );
57 
58  private:
59  // no data indexed from 0
60  QVector< QgsRasterRangeList > mNoData;
61  // no data to be set in output, indexed from 0
62  QVector<double> mOutputNoData;
63  QVector<bool> mHasOutputNoData;
64 };
65 
66 #endif // QGSRASTERNULLER_H
Qgis::DataType
DataType
Raster data types.
Definition: qgis.h:114
QgsRasterNuller
Definition: qgsrasternuller.h:32
QgsRectangle
Definition: qgsrectangle.h:41
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
qgsrasterinterface.h
QgsRasterInterface::dataType
virtual Qgis::DataType dataType(int bandNo) const =0
Returns data type for the band specified by number.
qgis_sip.h
QgsRasterInterface::clone
virtual QgsRasterInterface * clone() const =0
Clone itself, create deep copy.
QgsRasterRangeList
QList< QgsRasterRange > QgsRasterRangeList
Definition: qgsrasterrange.h:26
QgsRasterInterface
Definition: qgsrasterinterface.h:116
QgsRasterNuller::NoData
Definition: qgsrasternuller.h:50
QgsRasterBlockFeedback
Definition: qgsrasterinterface.h:40
qgsrasterrange.h
QgsRasterInterface::bandCount
virtual int bandCount() const =0
Gets number of bands.
QgsRasterInterface::block
virtual QgsRasterBlock * block(int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback=nullptr)=0
Read block of data using given extent and size.
QgsRasterBlock
Definition: qgsrasterblock.h:36