QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
analysis
raster
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 "qgsconfig.h"
22
23
#include <gdal.h>
24
25
#include "qgis_analysis.h"
26
#include "
qgsogrutils.h
"
27
28
#include <QString>
29
30
class
QgsFeedback
;
31
40
class
ANALYSIS_EXPORT
QgsNineCellFilter
41
{
42
public
:
44
enum class
Result
:
int
45
{
46
Success = 0,
47
InputLayerError = 1,
48
DriverError = 2,
49
CreateOutputError = 3,
50
InputBandError = 4,
51
OutputBandError = 5,
52
RasterSizeError = 6,
53
Canceled = 7,
54
};
55
57
QgsNineCellFilter
(
const
QString &inputFile,
const
QString &outputFile,
const
QString &outputFormat );
58
virtual
~QgsNineCellFilter
() =
default
;
59
65
Result
processRaster
(
QgsFeedback
*feedback =
nullptr
);
66
67
double
cellSizeX
()
const
{
return
mCellSizeX
; }
68
void
setCellSizeX
(
double
size ) {
mCellSizeX
= size; }
69
double
cellSizeY
()
const
{
return
mCellSizeY
; }
70
void
setCellSizeY
(
double
size ) {
mCellSizeY
= size; }
71
72
double
zFactor
()
const
{
return
mZFactor
; }
73
void
setZFactor
(
double
factor ) {
mZFactor
= factor; }
74
75
double
inputNodataValue
()
const
{
return
mInputNodataValue
; }
76
void
setInputNodataValue
(
double
value ) {
mInputNodataValue
= value; }
77
double
outputNodataValue
()
const
{
return
mOutputNodataValue
; }
78
void
setOutputNodataValue
(
double
value ) {
mOutputNodataValue
= value; }
79
86
void
setCreationOptions
(
const
QStringList &options ) {
mCreationOptions
= options; }
87
94
QStringList
creationOptions
()
const
{
return
mCreationOptions
; }
95
114
virtual
float
processNineCellWindow
(
float
*x11,
float
*x21,
float
*x31,
float
*x12,
float
*x22,
float
*x32,
float
*x13,
float
*x23,
float
*x33 ) = 0;
115
116
private
:
117
//default constructor forbidden. We need input file, output file and format obligatory
118
QgsNineCellFilter
() =
delete
;
119
121
gdal::dataset_unique_ptr
openInputFile(
int
&nCellsX,
int
&nCellsY );
122
127
GDALDriverH openOutputDriver();
128
133
gdal::dataset_unique_ptr
openOutputFile(
GDALDatasetH
inputDataset, GDALDriverH outputDriver );
134
140
Result
processRasterCPU(
QgsFeedback
*feedback =
nullptr
);
141
142
#ifdef HAVE_OPENCL
143
150
Result
processRasterGPU(
const
QString &source,
QgsFeedback
*feedback =
nullptr
);
151
157
virtual
void
addExtraRasterParams( std::vector<float> ¶ms ) { Q_UNUSED( params ) }
158
159
virtual
const
QString openClProgramBaseName()
const
{
return
QString(); }
160
161
#endif
162
163
protected
:
164
QString
mInputFile
;
165
QString
mOutputFile
;
166
QString
mOutputFormat
;
167
QStringList
mCreationOptions
;
168
169
double
mCellSizeX
= -1.0;
170
double
mCellSizeY
= -1.0;
172
double
mInputNodataValue
= -1.0;
174
double
mOutputNodataValue
= -9999.0;
176
double
mZFactor
= 1.0;
177
};
178
179
#endif
// QGSNINECELLFILTER_H
QgsFeedback
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition
qgsfeedback.h:44
QgsNineCellFilter
Base class for raster analysis methods that work with a 3x3 cell filter and calculate the value of ea...
Definition
qgsninecellfilter.h:41
QgsNineCellFilter::creationOptions
QStringList creationOptions() const
Returns the list of data source creation options which will be used when creating the output raster f...
Definition
qgsninecellfilter.h:94
QgsNineCellFilter::mCreationOptions
QStringList mCreationOptions
Definition
qgsninecellfilter.h:167
QgsNineCellFilter::processNineCellWindow
virtual float processNineCellWindow(float *x11, float *x21, float *x31, float *x12, float *x22, float *x32, float *x13, float *x23, float *x33)=0
Calculates output value from nine input values.
QgsNineCellFilter::mOutputFormat
QString mOutputFormat
Definition
qgsninecellfilter.h:166
QgsNineCellFilter::Result
Result
Result of the calculation.
Definition
qgsninecellfilter.h:45
QgsNineCellFilter::QgsNineCellFilter
QgsNineCellFilter(const QString &inputFile, const QString &outputFile, const QString &outputFormat)
Constructor that takes input file, output file and output format (GDAL string).
Definition
qgsninecellfilter.cpp:42
QgsNineCellFilter::mOutputNodataValue
double mOutputNodataValue
The nodata value of the output layer.
Definition
qgsninecellfilter.h:174
QgsNineCellFilter::cellSizeX
double cellSizeX() const
Definition
qgsninecellfilter.h:67
QgsNineCellFilter::mOutputFile
QString mOutputFile
Definition
qgsninecellfilter.h:165
QgsNineCellFilter::~QgsNineCellFilter
virtual ~QgsNineCellFilter()=default
QgsNineCellFilter::setCellSizeX
void setCellSizeX(double size)
Definition
qgsninecellfilter.h:68
QgsNineCellFilter::mInputNodataValue
double mInputNodataValue
The nodata value of the input layer.
Definition
qgsninecellfilter.h:172
QgsNineCellFilter::setCreationOptions
void setCreationOptions(const QStringList &options)
Sets a list of data source creation options to use when creating the output raster file.
Definition
qgsninecellfilter.h:86
QgsNineCellFilter::setOutputNodataValue
void setOutputNodataValue(double value)
Definition
qgsninecellfilter.h:78
QgsNineCellFilter::mCellSizeY
double mCellSizeY
Definition
qgsninecellfilter.h:170
QgsNineCellFilter::setInputNodataValue
void setInputNodataValue(double value)
Definition
qgsninecellfilter.h:76
QgsNineCellFilter::setZFactor
void setZFactor(double factor)
Definition
qgsninecellfilter.h:73
QgsNineCellFilter::processRaster
Result processRaster(QgsFeedback *feedback=nullptr)
Starts the calculation, reads from mInputFile and stores the result in mOutputFile.
Definition
qgsninecellfilter.cpp:48
QgsNineCellFilter::mInputFile
QString mInputFile
Definition
qgsninecellfilter.h:164
QgsNineCellFilter::setCellSizeY
void setCellSizeY(double size)
Definition
qgsninecellfilter.h:70
QgsNineCellFilter::inputNodataValue
double inputNodataValue() const
Definition
qgsninecellfilter.h:75
QgsNineCellFilter::mZFactor
double mZFactor
Scale factor for z-value if x-/y- units are different to z-units (111120 for degree->meters and 37040...
Definition
qgsninecellfilter.h:176
QgsNineCellFilter::cellSizeY
double cellSizeY() const
Definition
qgsninecellfilter.h:69
QgsNineCellFilter::mCellSizeX
double mCellSizeX
Definition
qgsninecellfilter.h:169
QgsNineCellFilter::zFactor
double zFactor() const
Definition
qgsninecellfilter.h:72
QgsNineCellFilter::outputNodataValue
double outputNodataValue() const
Definition
qgsninecellfilter.h:77
gdal::dataset_unique_ptr
std::unique_ptr< std::remove_pointer< GDALDatasetH >::type, GDALDatasetCloser > dataset_unique_ptr
Scoped GDAL dataset.
Definition
qgsogrutils.h:144
GDALDatasetH
void * GDALDatasetH
Definition
qgsalignraster.h:33
qgsogrutils.h
Generated on
for QGIS API Documentation by
1.17.0