QGIS API Documentation
4.3.0-Master (52aa6503bed)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
analysis
processing
qgsreclassifyutils.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsreclassifyutils.h
3
---------------------
4
begin : June, 2018
5
copyright : (C) 2018 by Nyall Dawson
6
email : nyall dot dawson at gmail dot com
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 QGSRECLASSIFYUTILS
19
#define QGSRECLASSIFYUTILS
20
21
22
#include "qgis_analysis.h"
23
#include "
qgis_sip.h
"
24
#include "
qgsrasterrange.h
"
25
26
#include <QVector>
27
28
#define SIP_NO_FILE
29
30
class
QgsRasterInterface
;
31
class
QgsProcessingFeedback
;
32
class
QgsRasterDataProvider
;
33
class
QgsRectangle
;
34
36
42
class
ANALYSIS_EXPORT QgsReclassifyUtils
43
{
44
public
:
48
class
RasterClass :
public
QgsRasterRange
49
{
50
public
:
52
RasterClass() =
default
;
53
58
RasterClass(
double
minValue,
double
maxValue,
QgsRasterRange::BoundsType
type,
double
value )
59
:
QgsRasterRange
( minValue, maxValue, type )
60
, value( value )
61
{}
62
64
double
value = 0;
65
};
66
70
static
void
reportClasses(
const
QVector<RasterClass> &classes, QgsProcessingFeedback *feedback );
71
76
static
void
checkForOverlaps(
const
QVector<RasterClass> &classes, QgsProcessingFeedback *feedback );
77
99
static
void
reclassify(
100
const
QVector<RasterClass> &classes,
101
QgsRasterInterface *sourceRaster,
102
int
band,
103
const
QgsRectangle &extent,
104
int
sourceWidthPixels,
105
int
sourceHeightPixels,
106
std::unique_ptr<QgsRasterDataProvider> destinationRaster,
107
double
destNoDataValue,
108
bool
useNoDataForMissingValues,
109
QgsProcessingFeedback *feedback =
nullptr
110
);
111
121
static
double
reclassifyValue(
const
QVector<RasterClass> &classes,
double
input,
bool
&reclassified )
122
{
123
reclassified =
false
;
124
for
(
const
QgsReclassifyUtils::RasterClass &
c
: classes )
125
{
126
if
(
c
.contains( input ) )
127
{
128
reclassified =
true
;
129
return
c
.value;
130
}
131
}
132
return
input;
133
}
134
};
135
136
Q_DECLARE_TYPEINFO
( QgsReclassifyUtils::RasterClass, Q_MOVABLE_TYPE );
137
138
140
141
#endif
// QGSRECLASSIFYUTILS
QgsProcessingFeedback
Base class for providing feedback from a processing algorithm.
Definition
qgsprocessingfeedback.h:40
QgsRasterDataProvider
Base class for raster data providers.
Definition
qgsrasterdataprovider.h:94
QgsRasterInterface
Base class for processing filters like renderers, reprojector, resampler etc.
Definition
qgsrasterinterface.h:140
QgsRasterRange
Represents a range of raster values between min and max, optionally including the min and max value.
Definition
qgsrasterrange.h:37
QgsRasterRange::BoundsType
BoundsType
Handling for min and max bounds.
Definition
qgsrasterrange.h:41
QgsRectangle
A rectangle specified with double values.
Definition
qgsrectangle.h:47
c
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
Definition
porting_processing.dox:1
qgis_sip.h
Q_DECLARE_TYPEINFO
Q_DECLARE_TYPEINFO(QgsMargins, Q_MOVABLE_TYPE)
qgsrasterrange.h
Generated on
for QGIS API Documentation by
1.17.0