QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
src
analysis
raster
qgsrastercalculator.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsrastercalculator.h - description
3
---------------------
4
begin : September 28th, 2010
5
copyright : (C) 2010 by Marco Hugentobler
6
email : marco dot hugentobler 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 QGSRASTERCALCULATOR_H
19
#define QGSRASTERCALCULATOR_H
20
21
#include "
qgsrectangle.h
"
22
#include "
qgscoordinatereferencesystem.h
"
23
#include "
qgscoordinatetransformcontext.h
"
24
#include <QString>
25
#include <QVector>
26
#include "gdal.h"
27
#include "qgis_analysis.h"
28
#include "
qgsogrutils.h
"
29
#include "
qgsrastercalcnode.h
"
30
31
class
QgsRasterLayer
;
32
class
QgsFeedback
;
33
40
class
ANALYSIS_EXPORT
QgsRasterCalculatorEntry
41
{
42
43
public
:
44
55
static
QVector<QgsRasterCalculatorEntry> rasterEntries();
56
60
QString
ref
;
61
65
QgsRasterLayer
*raster =
nullptr
;
66
70
int
bandNumber = 1;
71
};
72
77
class
ANALYSIS_EXPORT
QgsRasterCalculator
78
{
79
public
:
80
82
enum
Result
83
{
84
Success = 0,
85
CreateOutputError = 1,
86
InputLayerError = 2,
87
Canceled = 3,
88
ParserError = 4,
89
MemoryError = 5,
90
BandError = 6,
91
CalculationError = 7,
92
};
93
94
107
QgsRasterCalculator
(
const
QString &formulaString,
const
QString &outputFile,
const
QString &outputFormat,
108
const
QgsRectangle
&outputExtent,
int
nOutputColumns,
int
nOutputRows,
109
const
QVector<QgsRasterCalculatorEntry> &rasterEntries,
110
const
QgsCoordinateTransformContext
&transformContext );
111
125
QgsRasterCalculator
(
const
QString &formulaString,
const
QString &outputFile,
const
QString &outputFormat,
126
const
QgsRectangle
&outputExtent,
const
QgsCoordinateReferenceSystem
&
outputCrs
,
127
int
nOutputColumns,
int
nOutputRows,
128
const
QVector<QgsRasterCalculatorEntry> &rasterEntries,
129
const
QgsCoordinateTransformContext
&transformContext );
130
131
143
Q_DECL_DEPRECATED
QgsRasterCalculator
(
const
QString &formulaString,
const
QString &outputFile,
const
QString &outputFormat,
144
const
QgsRectangle
&outputExtent,
int
nOutputColumns,
int
nOutputRows,
const
QVector<QgsRasterCalculatorEntry> &rasterEntries )
SIP_DEPRECATED
;
145
159
Q_DECL_DEPRECATED
QgsRasterCalculator
(
const
QString &formulaString,
const
QString &outputFile,
const
QString &outputFormat,
160
const
QgsRectangle
&outputExtent,
const
QgsCoordinateReferenceSystem
&
outputCrs
,
int
nOutputColumns,
int
nOutputRows,
const
QVector<QgsRasterCalculatorEntry> &rasterEntries )
SIP_DEPRECATED
;
161
170
Result processCalculation(
QgsFeedback
*feedback =
nullptr
);
171
176
QString lastError()
const
;
177
178
private
:
179
//default constructor forbidden. We need formula, output file, output format and output raster resolution obligatory
180
QgsRasterCalculator
() =
delete
;
181
186
GDALDriverH openOutputDriver();
187
192
gdal::dataset_unique_ptr
openOutputFile( GDALDriverH outputDriver );
193
198
void
outputGeoTransform(
double
*transform )
const
;
199
201
Result processCalculationGPU( std::unique_ptr< QgsRasterCalcNode > calcNode,
QgsFeedback
*feedback =
nullptr
);
202
203
QString mFormulaString;
204
QString mOutputFile;
205
QString mOutputFormat;
206
208
QgsRectangle
mOutputRectangle;
209
QgsCoordinateReferenceSystem
mOutputCrs;
210
212
int
mNumOutputColumns = 0;
214
int
mNumOutputRows = 0;
215
216
QString mLastError;
217
218
/***/
219
QVector<QgsRasterCalculatorEntry> mRasterEntries;
220
221
QgsCoordinateTransformContext
mTransformContext;
222
};
223
224
#endif // QGSRASTERCALCULATOR_H
QgsRasterCalculator::Result
Result
Result of the calculation.
Definition:
qgsrastercalculator.h:82
outputCrs
const QgsCoordinateReferenceSystem & outputCrs
Definition:
qgswfsgetfeature.cpp:115
QgsCoordinateTransformContext
Contains information about the context in which a coordinate transform is executed.
Definition:
qgscoordinatetransformcontext.h:57
QgsRasterCalculatorEntry::ref
QString ref
Name of entry.
Definition:
qgsrastercalculator.h:60
qgsrectangle.h
qgscoordinatetransformcontext.h
qgsogrutils.h
QgsRasterCalculatorEntry
Represents an individual raster layer/band number entry within a raster calculation.
Definition:
qgsrastercalculator.h:40
QgsRectangle
A rectangle specified with double values.
Definition:
qgsrectangle.h:41
SIP_DEPRECATED
#define SIP_DEPRECATED
Definition:
qgis_sip.h:106
gdal::dataset_unique_ptr
std::unique_ptr< std::remove_pointer< GDALDatasetH >::type, GDALDatasetCloser > dataset_unique_ptr
Scoped GDAL dataset.
Definition:
qgsogrutils.h:139
QgsFeedback
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition:
qgsfeedback.h:44
QgsRasterCalculator
Performs raster layer calculations.
Definition:
qgsrastercalculator.h:77
QgsRasterLayer
Represents a raster layer.
Definition:
qgsrasterlayer.h:76
QgsCoordinateReferenceSystem
This class represents a coordinate reference system (CRS).
Definition:
qgscoordinatereferencesystem.h:211
qgsrastercalcnode.h
qgscoordinatereferencesystem.h
Generated on Sun Sep 11 2022 00:03:17 for QGIS API Documentation by
1.8.17