QGIS API Documentation
3.6.0-Noosa (5873452)
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 <QString>
24
#include <QVector>
25
#include "gdal.h"
26
#include "qgis_analysis.h"
27
#include "
qgsogrutils.h
"
28
#include "
qgsrastercalcnode.h
"
29
30
class
QgsRasterLayer
;
31
class
QgsFeedback
;
32
39
class
ANALYSIS_EXPORT
QgsRasterCalculatorEntry
40
{
41
42
public
:
43
54
static
QVector<QgsRasterCalculatorEntry> rasterEntries();
55
59
QString
ref
;
60
64
QgsRasterLayer
*raster =
nullptr
;
65
69
int
bandNumber = 1;
70
};
71
76
class
ANALYSIS_EXPORT
QgsRasterCalculator
77
{
78
public
:
79
81
enum
Result
82
{
83
Success = 0,
84
CreateOutputError = 1,
85
InputLayerError = 2,
86
Canceled = 3,
87
ParserError = 4,
88
MemoryError = 5,
89
BandError = 6,
90
};
91
102
QgsRasterCalculator
(
const
QString &formulaString,
const
QString &outputFile,
const
QString &outputFormat,
103
const
QgsRectangle
&outputExtent,
int
nOutputColumns,
int
nOutputRows,
const
QVector<QgsRasterCalculatorEntry> &rasterEntries );
104
117
QgsRasterCalculator
(
const
QString &formulaString,
const
QString &outputFile,
const
QString &outputFormat,
118
const
QgsRectangle
&outputExtent,
const
QgsCoordinateReferenceSystem
&
outputCrs
,
int
nOutputColumns,
int
nOutputRows,
const
QVector<QgsRasterCalculatorEntry> &rasterEntries );
119
128
Result
processCalculation(
QgsFeedback
*feedback =
nullptr
);
129
134
QString lastError()
const
;
135
136
private
:
137
//default constructor forbidden. We need formula, output file, output format and output raster resolution obligatory
138
QgsRasterCalculator
() =
delete
;
139
143
GDALDriverH openOutputDriver();
144
148
gdal::dataset_unique_ptr
openOutputFile( GDALDriverH outputDriver );
149
153
void
outputGeoTransform(
double
*transform )
const
;
154
156
Result
processCalculationGPU( std::unique_ptr< QgsRasterCalcNode > calcNode,
QgsFeedback
*feedback =
nullptr
);
157
158
QString mFormulaString;
159
QString mOutputFile;
160
QString mOutputFormat;
161
163
QgsRectangle
mOutputRectangle;
164
QgsCoordinateReferenceSystem
mOutputCrs;
165
167
int
mNumOutputColumns = 0;
169
int
mNumOutputRows = 0;
170
171
QString mLastError;
172
173
/***/
174
QVector<QgsRasterCalculatorEntry> mRasterEntries;
175
};
176
177
#endif // QGSRASTERCALCULATOR_H
QgsRectangle
A rectangle specified with double values.
Definition:
qgsrectangle.h:41
QgsRasterCalculator
Performs raster layer calculations.
Definition:
qgsrastercalculator.h:76
QgsRasterLayer
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
Definition:
qgsrasterlayer.h:138
QgsRasterCalculatorEntry::ref
QString ref
Name of entry.
Definition:
qgsrastercalculator.h:59
qgsogrutils.h
QgsFeedback
Base class for feedback objects to be used for cancelation of something running in a worker thread...
Definition:
qgsfeedback.h:44
qgsrectangle.h
QgsRasterCalculatorEntry
Represents an individual raster layer/band number entry within a raster calculation.
Definition:
qgsrastercalculator.h:39
QgsRasterCalculator::Result
Result
Result of the calculation.
Definition:
qgsrastercalculator.h:81
qgsrastercalcnode.h
QgsCoordinateReferenceSystem
This class represents a coordinate reference system (CRS).
Definition:
qgscoordinatereferencesystem.h:191
outputCrs
const QgsCoordinateReferenceSystem & outputCrs
Definition:
qgswfsgetfeature.cpp:59
gdal::dataset_unique_ptr
std::unique_ptr< std::remove_pointer< GDALDatasetH >::type, GDALDatasetCloser > dataset_unique_ptr
Scoped GDAL dataset.
Definition:
qgsogrutils.h:134
qgscoordinatereferencesystem.h
Generated on Sat Feb 23 2019 03:59:22 for QGIS API Documentation by
1.8.13