QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgsninecellfilter.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsninecellfilter.h - description
3  -------------------
4  begin : August 6th, 2009
5  copyright : (C) 2009 by Marco Hugentobler
6  email : marco dot hugentobler at karto dot baug dot ethz 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 QGSNINECELLFILTER_H
19 #define QGSNINECELLFILTER_H
20 
21 #include <QString>
22 #include "gdal.h"
23 #include "qgis_analysis.h"
24 #include "qgsogrutils.h"
25 
26 class QgsFeedback;
27 
34 class ANALYSIS_EXPORT QgsNineCellFilter
35 {
36  public:
38  QgsNineCellFilter( const QString &inputFile, const QString &outputFile, const QString &outputFormat );
39  virtual ~QgsNineCellFilter() = default;
40 
46  int processRaster( QgsFeedback *feedback = nullptr );
47 
48  double cellSizeX() const { return mCellSizeX; }
49  void setCellSizeX( double size ) { mCellSizeX = size; }
50  double cellSizeY() const { return mCellSizeY; }
51  void setCellSizeY( double size ) { mCellSizeY = size; }
52 
53  double zFactor() const { return mZFactor; }
54  void setZFactor( double factor ) { mZFactor = factor; }
55 
56  double inputNodataValue() const { return mInputNodataValue; }
57  void setInputNodataValue( double value ) { mInputNodataValue = value; }
58  double outputNodataValue() const { return mOutputNodataValue; }
59  void setOutputNodataValue( double value ) { mOutputNodataValue = value; }
60 
79  virtual float processNineCellWindow( float *x11, float *x21, float *x31,
80  float *x12, float *x22, float *x32,
81  float *x13, float *x23, float *x33 ) = 0;
82 
83  private:
84  //default constructor forbidden. We need input file, output file and format obligatory
85  QgsNineCellFilter() = delete;
86 
88  gdal::dataset_unique_ptr openInputFile( int &nCellsX, int &nCellsY );
89 
93  GDALDriverH openOutputDriver();
94 
98  gdal::dataset_unique_ptr openOutputFile( GDALDatasetH inputDataset, GDALDriverH outputDriver );
99 
105  int processRasterCPU( QgsFeedback *feedback = nullptr );
106 
107 #ifdef HAVE_OPENCL
108 
115  int processRasterGPU( const QString &source, QgsFeedback *feedback = nullptr );
116 
122  virtual void addExtraRasterParams( std::vector<float> &params )
123  {
124  Q_UNUSED( params )
125  }
126 
127  virtual const QString openClProgramBaseName() const
128  {
129  return QString();
130  }
131 
132 #endif
133 
134  protected:
135 
136  QString mInputFile;
137  QString mOutputFile;
138  QString mOutputFormat;
139 
140  double mCellSizeX = -1.0;
141  double mCellSizeY = -1.0;
143  float mInputNodataValue = -1.0;
145  float mOutputNodataValue = -1.0;
147  double mZFactor = 1.0;
148 };
149 
150 #endif // QGSNINECELLFILTER_H
QgsNineCellFilter::setZFactor
void setZFactor(double factor)
Definition: qgsninecellfilter.h:54
QgsNineCellFilter::setCellSizeY
void setCellSizeY(double size)
Definition: qgsninecellfilter.h:51
qgsogrutils.h
QgsNineCellFilter
Definition: qgsninecellfilter.h:34
QgsNineCellFilter::mInputFile
QString mInputFile
Definition: qgsninecellfilter.h:136
QgsNineCellFilter::setCellSizeX
void setCellSizeX(double size)
Definition: qgsninecellfilter.h:49
QgsNineCellFilter::setInputNodataValue
void setInputNodataValue(double value)
Definition: qgsninecellfilter.h:57
gdal::dataset_unique_ptr
std::unique_ptr< std::remove_pointer< GDALDatasetH >::type, GDALDatasetCloser > dataset_unique_ptr
Scoped GDAL dataset.
Definition: qgsogrutils.h:134
QgsFeedback
Definition: qgsfeedback.h:43
QgsNineCellFilter::mOutputFormat
QString mOutputFormat
Definition: qgsninecellfilter.h:138
QgsNineCellFilter::inputNodataValue
double inputNodataValue() const
Definition: qgsninecellfilter.h:56
QgsNineCellFilter::mOutputFile
QString mOutputFile
Definition: qgsninecellfilter.h:137
QgsNineCellFilter::outputNodataValue
double outputNodataValue() const
Definition: qgsninecellfilter.h:58
QgsNineCellFilter::cellSizeX
double cellSizeX() const
Definition: qgsninecellfilter.h:48
QgsNineCellFilter::cellSizeY
double cellSizeY() const
Definition: qgsninecellfilter.h:50
QgsNineCellFilter::zFactor
double zFactor() const
Definition: qgsninecellfilter.h:53
QgsNineCellFilter::setOutputNodataValue
void setOutputNodataValue(double value)
Definition: qgsninecellfilter.h:59
GDALDatasetH
void * GDALDatasetH
Definition: qgsalignraster.h:28