QGIS API Documentation
3.4.15-Madeira (e83d02e274)
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
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
29
class
QgsRasterLayer
;
30
class
QgsFeedback
;
31
38
class
ANALYSIS_EXPORT
QgsRasterCalculatorEntry
39
{
40
41
public
:
42
46
QString
ref
;
47
51
QgsRasterLayer
*raster =
nullptr
;
52
56
int
bandNumber = 1;
57
};
58
63
class
ANALYSIS_EXPORT
QgsRasterCalculator
64
{
65
public
:
66
68
enum
Result
69
{
70
Success = 0,
71
CreateOutputError = 1,
72
InputLayerError = 2,
73
Canceled = 3,
74
ParserError = 4,
75
MemoryError = 5,
76
BandError = 6,
77
};
78
89
QgsRasterCalculator
(
const
QString &formulaString,
const
QString &outputFile,
const
QString &outputFormat,
90
const
QgsRectangle
&outputExtent,
int
nOutputColumns,
int
nOutputRows,
const
QVector<QgsRasterCalculatorEntry> &rasterEntries );
91
104
QgsRasterCalculator
(
const
QString &formulaString,
const
QString &outputFile,
const
QString &outputFormat,
105
const
QgsRectangle
&outputExtent,
const
QgsCoordinateReferenceSystem
&
outputCrs
,
int
nOutputColumns,
int
nOutputRows,
const
QVector<QgsRasterCalculatorEntry> &rasterEntries );
106
115
Result
processCalculation(
QgsFeedback
*feedback =
nullptr
);
116
121
QString lastError()
const
;
122
123
private
:
124
//default constructor forbidden. We need formula, output file, output format and output raster resolution obligatory
125
QgsRasterCalculator
() =
delete
;
126
130
GDALDriverH openOutputDriver();
131
135
gdal::dataset_unique_ptr
openOutputFile( GDALDriverH outputDriver );
136
140
void
outputGeoTransform(
double
*transform )
const
;
141
142
QString mFormulaString;
143
QString mOutputFile;
144
QString mOutputFormat;
145
147
QgsRectangle
mOutputRectangle;
148
QgsCoordinateReferenceSystem
mOutputCrs;
149
151
int
mNumOutputColumns = 0;
153
int
mNumOutputRows = 0;
154
155
QString mLastError;
156
157
/***/
158
QVector<QgsRasterCalculatorEntry> mRasterEntries;
159
};
160
161
#endif // QGSRASTERCALCULATOR_H
QgsRectangle
A rectangle specified with double values.
Definition:
qgsrectangle.h:40
QgsRasterCalculator
Performs raster layer calculations.
Definition:
qgsrastercalculator.h:63
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:46
qgsogrutils.h
QgsFeedback
Base class for feedback objects to be used for cancellation 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:38
QgsRasterCalculator::Result
Result
Result of the calculation.
Definition:
qgsrastercalculator.h:68
QgsCoordinateReferenceSystem
This class represents a coordinate reference system (CRS).
Definition:
qgscoordinatereferencesystem.h:189
outputCrs
const QgsCoordinateReferenceSystem & outputCrs
Definition:
qgswfsgetfeature.cpp:65
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 Sun Jan 19 2020 15:27:13 for QGIS API Documentation by
1.8.11