QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
Loading...
Searching...
No Matches
qgsalgorithmfuzzifyraster.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsalgorithmrasterlayeruniquevalues.h
3 ---------------------
4 begin : October 2019
5 copyright : (C) 2019 by Clemens Raffler
6 email : clemens dot raffler 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 QGSFUZZIFYRASTERALGORITHM_H
19#define QGSFUZZIFYRASTERALGORITHM_H
20
21#define SIP_NO_FILE
22
23#include "qgis_sip.h"
25#include "qgsapplication.h"
26
28
32class QgsFuzzifyRasterAlgorithmBase : public QgsProcessingAlgorithm
33{
34 public:
35 QString group() const final;
36 QString groupId() const final;
37 void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) final;
38
39 protected:
40
45 virtual void addAlgorithmParams() = 0;
46
47 bool prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) final;
48
52 virtual bool prepareAlgorithmFuzzificationParameters( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) = 0;
53
57 QVariantMap processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) final;
58
62 virtual void fuzzify( QgsRasterDataProvider *destinationProvider, QgsProcessingFeedback *feedback ) = 0;
63
64 QgsRasterLayer *mInputRaster = nullptr;
65 int mBand = 1;
66 std::unique_ptr< QgsRasterInterface > mInterface;
67 QgsRectangle mExtent;
69 int mLayerWidth = 0;
70 int mLayerHeight = 0;
71 int mNbCellsXProvider = 0;
72 int mNbCellsYProvider = 0;
73
75 const double mNoDataValue = -9999;
76};
77
78
79
80
81class QgsFuzzifyRasterLinearMembershipAlgorithm : public QgsFuzzifyRasterAlgorithmBase
82{
83
84 public:
85 QgsFuzzifyRasterLinearMembershipAlgorithm() = default;
86 QIcon icon() const override { return QgsApplication::getThemeIcon( QStringLiteral( "/algorithms/mAlgorithmFuzzifyLinear.svg" ) ); }
87 QString svgIconPath() const override { return QgsApplication::iconPath( QStringLiteral( "/algorithms/mAlgorithmFuzzifyLinear.svg" ) ); }
88 QString name() const override;
89 QString displayName() const override;
90 QStringList tags() const override;
91 QString shortHelpString() const override;
92 QgsFuzzifyRasterLinearMembershipAlgorithm *createInstance() const override SIP_FACTORY;
93
94 protected:
95 void addAlgorithmParams() override;
96 bool prepareAlgorithmFuzzificationParameters( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
97 void fuzzify( QgsRasterDataProvider *destinationProvider, QgsProcessingFeedback *feedback ) override;
98
99 private:
100 double mFuzzifyLowBound = 0;
101 double mFuzzifyHighBound = 0;
102
103};
104
105
106class QgsFuzzifyRasterPowerMembershipAlgorithm : public QgsFuzzifyRasterAlgorithmBase
107{
108
109 public:
110 QgsFuzzifyRasterPowerMembershipAlgorithm() = default;
111 QIcon icon() const override { return QgsApplication::getThemeIcon( QStringLiteral( "/algorithms/mAlgorithmFuzzifyPower.svg" ) ); }
112 QString svgIconPath() const override { return QgsApplication::iconPath( QStringLiteral( "/algorithms/mAlgorithmFuzzifyPower.svg" ) ); }
113 QString name() const override;
114 QString displayName() const override;
115 QStringList tags() const override;
116 QString shortHelpString() const override;
117 QgsFuzzifyRasterPowerMembershipAlgorithm *createInstance() const override SIP_FACTORY;
118
119 protected:
120 void addAlgorithmParams() override;
121 bool prepareAlgorithmFuzzificationParameters( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
122 void fuzzify( QgsRasterDataProvider *destinationProvider, QgsProcessingFeedback *feedback ) override;
123
124 private:
125 double mFuzzifyLowBound = 0;
126 double mFuzzifyHighBound = 0;
127 double mFuzzifyExponent = 0;
128
129};
130
131
132class QgsFuzzifyRasterLargeMembershipAlgorithm : public QgsFuzzifyRasterAlgorithmBase
133{
134
135 public:
136 QgsFuzzifyRasterLargeMembershipAlgorithm() = default;
137 QIcon icon() const override { return QgsApplication::getThemeIcon( QStringLiteral( "/algorithms/mAlgorithmFuzzifyLarge.svg" ) ); }
138 QString svgIconPath() const override { return QgsApplication::iconPath( QStringLiteral( "/algorithms/mAlgorithmFuzzifyLarge.svg" ) ); }
139 QString name() const override;
140 QString displayName() const override;
141 QStringList tags() const override;
142 QString shortHelpString() const override;
143 QgsFuzzifyRasterLargeMembershipAlgorithm *createInstance() const override SIP_FACTORY;
144
145 protected:
146 void addAlgorithmParams() override;
147 bool prepareAlgorithmFuzzificationParameters( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
148 void fuzzify( QgsRasterDataProvider *destinationProvider, QgsProcessingFeedback *feedback ) override;
149
150 private:
151 double mFuzzifyMidpoint = 0;
152 double mFuzzifySpread = 0;
153
154};
155
156
157class QgsFuzzifyRasterSmallMembershipAlgorithm : public QgsFuzzifyRasterAlgorithmBase
158{
159
160 public:
161 QgsFuzzifyRasterSmallMembershipAlgorithm() = default;
162 QIcon icon() const override { return QgsApplication::getThemeIcon( QStringLiteral( "/algorithms/mAlgorithmFuzzifySmall.svg" ) ); }
163 QString svgIconPath() const override { return QgsApplication::iconPath( QStringLiteral( "/algorithms/mAlgorithmFuzzifySmall.svg" ) ); }
164 QString name() const override;
165 QString displayName() const override;
166 QStringList tags() const override;
167 QString shortHelpString() const override;
168 QgsFuzzifyRasterSmallMembershipAlgorithm *createInstance() const override SIP_FACTORY;
169
170 protected:
171 void addAlgorithmParams() override;
172 bool prepareAlgorithmFuzzificationParameters( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
173 void fuzzify( QgsRasterDataProvider *destinationProvider, QgsProcessingFeedback *feedback ) override;
174
175 private:
176 double mFuzzifyMidpoint = 0;
177 double mFuzzifySpread = 0;
178
179};
180
181
182class QgsFuzzifyRasterGaussianMembershipAlgorithm : public QgsFuzzifyRasterAlgorithmBase
183{
184
185 public:
186 QgsFuzzifyRasterGaussianMembershipAlgorithm() = default;
187 QIcon icon() const override { return QgsApplication::getThemeIcon( QStringLiteral( "/algorithms/mAlgorithmFuzzifyGaussian.svg" ) ); }
188 QString svgIconPath() const override { return QgsApplication::iconPath( QStringLiteral( "/algorithms/mAlgorithmFuzzifyGaussian.svg" ) ); }
189 QString name() const override;
190 QString displayName() const override;
191 QStringList tags() const override;
192 QString shortHelpString() const override;
193 QgsFuzzifyRasterGaussianMembershipAlgorithm *createInstance() const override SIP_FACTORY;
194
195 protected:
196 void addAlgorithmParams() override;
197 bool prepareAlgorithmFuzzificationParameters( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
198 void fuzzify( QgsRasterDataProvider *destinationProvider, QgsProcessingFeedback *feedback ) override;
199
200 private:
201 double mFuzzifyMidpoint = 0;
202 double mFuzzifySpread = 0;
203
204};
205
206
207class QgsFuzzifyRasterNearMembershipAlgorithm : public QgsFuzzifyRasterAlgorithmBase
208{
209
210 public:
211 QgsFuzzifyRasterNearMembershipAlgorithm() = default;
212 QIcon icon() const override { return QgsApplication::getThemeIcon( QStringLiteral( "/algorithms/mAlgorithmFuzzifyNear.svg" ) ); }
213 QString svgIconPath() const override { return QgsApplication::iconPath( QStringLiteral( "/algorithms/mAlgorithmFuzzifyNear.svg" ) ); }
214 QString name() const override;
215 QString displayName() const override;
216 QStringList tags() const override;
217 QString shortHelpString() const override;
218 QgsFuzzifyRasterNearMembershipAlgorithm *createInstance() const override SIP_FACTORY;
219
220 protected:
221 void addAlgorithmParams() override;
222 bool prepareAlgorithmFuzzificationParameters( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
223 void fuzzify( QgsRasterDataProvider *destinationProvider, QgsProcessingFeedback *feedback ) override;
224
225 private:
226 double mFuzzifyMidpoint = 0;
227 double mFuzzifySpread = 0;
228
229};
230
231
233
234#endif // QGSALGORITHMFUZZIFYRASTER_H
235
236
DataType
Raster data types.
Definition qgis.h:351
@ Float32
Thirty two bit floating point (float)
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
static QString iconPath(const QString &iconFile)
Returns path to the desired icon file.
This class represents a coordinate reference system (CRS).
Abstract base class for processing algorithms.
virtual QString group() const
Returns the name of the group this algorithm belongs to.
virtual bool prepareAlgorithm(const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback)
Prepares the algorithm to run using the specified parameters.
virtual QString groupId() const
Returns the unique ID of the group this algorithm belongs to.
virtual QVariantMap processAlgorithm(const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback)=0
Runs the algorithm using the specified parameters.
virtual void initAlgorithm(const QVariantMap &configuration=QVariantMap())=0
Initializes the algorithm using the specified configuration.
Contains information about the context in which a processing algorithm is executed.
Base class for providing feedback from a processing algorithm.
Base class for raster data providers.
Represents a raster layer.
A rectangle specified with double values.
#define SIP_FACTORY
Definition qgis_sip.h:76