QGIS API Documentation  2.99.0-Master (f1c3692)
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 
32 class CORE_EXPORT QgsRasterResampleFilter : public QgsRasterInterface
33 {
34  public:
35  QgsRasterResampleFilter( QgsRasterInterface *input = nullptr );
36 
37  QgsRasterResampleFilter *clone() const override SIP_FACTORY;
38 
39  int bandCount() const override;
40 
41  Qgis::DataType dataType( int bandNo ) const override;
42 
43  bool setInput( QgsRasterInterface *input ) override;
44 
45  QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override SIP_FACTORY;
46 
48  void setZoomedInResampler( QgsRasterResampler *r SIP_TRANSFER );
49  const QgsRasterResampler *zoomedInResampler() const { return mZoomedInResampler.get(); }
50 
52  void setZoomedOutResampler( QgsRasterResampler *r SIP_TRANSFER );
53  const QgsRasterResampler *zoomedOutResampler() const { return mZoomedOutResampler.get(); }
54 
55  void setMaxOversampling( double os ) { mMaxOversampling = os; }
56  double maxOversampling() const { return mMaxOversampling; }
57 
58  void writeXml( QDomDocument &doc, QDomElement &parentElem ) const override;
59 
61  void readXml( const QDomElement &filterElem ) override;
62 
63  protected:
65  std::unique_ptr< QgsRasterResampler > mZoomedInResampler;
67  std::unique_ptr< QgsRasterResampler > mZoomedOutResampler;
68 
70  double mMaxOversampling = 2.0;
71 
72  private:
73 };
74 
75 #endif // QGSRASTERRESAMPLEFILTER_H
virtual int bandCount() const =0
Get number of bands.
A rectangle specified with double values.
Definition: qgsrectangle.h:39
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:78
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.
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