QGIS API Documentation  2.99.0-Master (5169e0d)
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 
25 class QProgressDialog;
26 
32 class ANALYSIS_EXPORT QgsNineCellFilter
33 {
34  public:
36  QgsNineCellFilter( const QString &inputFile, const QString &outputFile, const QString &outputFormat );
37  virtual ~QgsNineCellFilter() = default;
38 
42  int processRaster( QProgressDialog *p );
43 
44  double cellSizeX() const { return mCellSizeX; }
45  void setCellSizeX( double size ) { mCellSizeX = size; }
46  double cellSizeY() const { return mCellSizeY; }
47  void setCellSizeY( double size ) { mCellSizeY = size; }
48 
49  double zFactor() const { return mZFactor; }
50  void setZFactor( double factor ) { mZFactor = factor; }
51 
52  double inputNodataValue() const { return mInputNodataValue; }
53  void setInputNodataValue( double value ) { mInputNodataValue = value; }
54  double outputNodataValue() const { return mOutputNodataValue; }
55  void setOutputNodataValue( double value ) { mOutputNodataValue = value; }
56 
59  virtual float processNineCellWindow( float *x11, float *x21, float *x31,
60  float *x12, float *x22, float *x32,
61  float *x13, float *x23, float *x33 ) = 0;
62 
63  private:
64  //default constructor forbidden. We need input file, output file and format obligatory
66 
68  GDALDatasetH openInputFile( int &nCellsX, int &nCellsY );
69 
72  GDALDriverH openOutputDriver();
73 
76  GDALDatasetH openOutputFile( GDALDatasetH inputDataset, GDALDriverH outputDriver );
77 
78  protected:
79 
80  QString mInputFile;
81  QString mOutputFile;
82  QString mOutputFormat;
83 
84  double mCellSizeX;
85  double mCellSizeY;
91  double mZFactor;
92 };
93 
94 #endif // QGSNINECELLFILTER_H
void setZFactor(double factor)
void setCellSizeY(double size)
void setInputNodataValue(double value)
double inputNodataValue() const
void setCellSizeX(double size)
void * GDALDatasetH
double cellSizeX() const
float mOutputNodataValue
The nodata value of the output layer.
double outputNodataValue() const
double mZFactor
Scale factor for z-value if x-/y- units are different to z-units (111120 for degree->meters and 37040...
double zFactor() const
void setOutputNodataValue(double value)
float mInputNodataValue
The nodata value of the input layer.
double cellSizeY() const
Base class for raster analysis methods that work with a 3x3 cell filter and calculate the value of ea...