QGIS API Documentation  2.99.0-Master (b95d432)
qgsrasterresamplefilter.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrasterresamplefilter.h
3  -------------------
4  begin : December 2011
5  copyright : (C) 2011 by Marco Hugentobler
6  email : marco at sourcepole dot ch
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 QGSRASTERRESAMPLEFILTER_H
19 #define QGSRASTERRESAMPLEFILTER_H
20 
21 #include "qgis_core.h"
22 #include "qgis.h"
23 #include "qgsrasterinterface.h"
24 #include "qgsrasterresampler.h"
25 
26 class QDomElement;
27 
31 class CORE_EXPORT QgsRasterResampleFilter : public QgsRasterInterface
32 {
33  public:
34  QgsRasterResampleFilter( QgsRasterInterface *input = nullptr );
35 
36  QgsRasterResampleFilter *clone() const override SIP_FACTORY;
37 
38  int bandCount() const override;
39 
40  Qgis::DataType dataType( int bandNo ) const override;
41 
42  bool setInput( QgsRasterInterface *input ) override;
43 
44  QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override SIP_FACTORY;
45 
47  void setZoomedInResampler( QgsRasterResampler *r SIP_TRANSFER );
48  const QgsRasterResampler *zoomedInResampler() const { return mZoomedInResampler.get(); }
49 
51  void setZoomedOutResampler( QgsRasterResampler *r SIP_TRANSFER );
52  const QgsRasterResampler *zoomedOutResampler() const { return mZoomedOutResampler.get(); }
53 
54  void setMaxOversampling( double os ) { mMaxOversampling = os; }
55  double maxOversampling() const { return mMaxOversampling; }
56 
57  void writeXml( QDomDocument &doc, QDomElement &parentElem ) const override;
58 
60  void readXml( const QDomElement &filterElem ) override;
61 
62  protected:
64  std::unique_ptr< QgsRasterResampler > mZoomedInResampler;
66  std::unique_ptr< QgsRasterResampler > mZoomedOutResampler;
67 
70 
71  private:
72 };
73 
74 #endif // QGSRASTERRESAMPLEFILTER_H
virtual int bandCount() const =0
Get number of bands.
A rectangle specified with double values.
Definition: qgsrectangle.h:38
virtual void readXml(const QDomElement &filterElem)
Sets base class members from xml. Usually called from create() methods of subclasses.
Interface for resampling rasters (e.g.
DataType
Raster data types.
Definition: qgis.h:74
Resample filter pipe for rasters.
virtual Qgis::DataType dataType(int bandNo) const =0
Returns data type for the band specified by number.
Raster data container.
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.
#define SIP_TRANSFER
Definition: qgis_sip.h:36
#define SIP_FACTORY
Definition: qgis_sip.h:69
Base class for processing filters like renderers, reprojector, resampler etc.
double mMaxOversampling
Maximum boundary for oversampling (to avoid too much data traffic). Default: 2.0. ...
virtual bool setInput(QgsRasterInterface *input)
Set input.
std::unique_ptr< QgsRasterResampler > mZoomedOutResampler
Resampler used if raster resolution is higher than raster resolution (zoomed out). 0 mean no resampling (nearest neighbour)
virtual QgsRasterInterface * clone() const =0
Clone itself, create deep copy.
const QgsRasterResampler * zoomedOutResampler() const
std::unique_ptr< QgsRasterResampler > mZoomedInResampler
Resampler used if screen resolution is higher than raster resolution (zoomed in). 0 means no resampli...
virtual void writeXml(QDomDocument &doc, QDomElement &parentElem) const
Write base class members to xml.
Feedback object tailored for raster block reading.
const QgsRasterResampler * zoomedInResampler() const