QGIS API Documentation 3.41.0-Master (cea29feecf2)
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:
44 virtual void addAlgorithmParams() = 0;
45
46 bool prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) final;
47
51 virtual bool prepareAlgorithmFuzzificationParameters( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) = 0;
52
56 QVariantMap processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) final;
57
61 virtual void fuzzify( QgsRasterDataProvider *destinationProvider, QgsProcessingFeedback *feedback ) = 0;
62
63 QgsRasterLayer *mInputRaster = nullptr;
64 int mBand = 1;
65 std::unique_ptr<QgsRasterInterface> mInterface;
66 QgsRectangle mExtent;
68 int mLayerWidth = 0;
69 int mLayerHeight = 0;
70 int mNbCellsXProvider = 0;
71 int mNbCellsYProvider = 0;
72
74 const double mNoDataValue = -9999;
75};
76
77
78class QgsFuzzifyRasterLinearMembershipAlgorithm : public QgsFuzzifyRasterAlgorithmBase
79{
80 public:
81 QgsFuzzifyRasterLinearMembershipAlgorithm() = default;
82 QIcon icon() const override { return QgsApplication::getThemeIcon( QStringLiteral( "/algorithms/mAlgorithmFuzzifyLinear.svg" ) ); }
83 QString svgIconPath() const override { return QgsApplication::iconPath( QStringLiteral( "/algorithms/mAlgorithmFuzzifyLinear.svg" ) ); }
84 QString name() const override;
85 QString displayName() const override;
86 QStringList tags() const override;
87 QString shortHelpString() const override;
88 QgsFuzzifyRasterLinearMembershipAlgorithm *createInstance() const override SIP_FACTORY;
89
90 protected:
91 void addAlgorithmParams() override;
92 bool prepareAlgorithmFuzzificationParameters( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
93 void fuzzify( QgsRasterDataProvider *destinationProvider, QgsProcessingFeedback *feedback ) override;
94
95 private:
96 double mFuzzifyLowBound = 0;
97 double mFuzzifyHighBound = 0;
98};
99
100
101class QgsFuzzifyRasterPowerMembershipAlgorithm : public QgsFuzzifyRasterAlgorithmBase
102{
103 public:
104 QgsFuzzifyRasterPowerMembershipAlgorithm() = default;
105 QIcon icon() const override { return QgsApplication::getThemeIcon( QStringLiteral( "/algorithms/mAlgorithmFuzzifyPower.svg" ) ); }
106 QString svgIconPath() const override { return QgsApplication::iconPath( QStringLiteral( "/algorithms/mAlgorithmFuzzifyPower.svg" ) ); }
107 QString name() const override;
108 QString displayName() const override;
109 QStringList tags() const override;
110 QString shortHelpString() const override;
111 QgsFuzzifyRasterPowerMembershipAlgorithm *createInstance() const override SIP_FACTORY;
112
113 protected:
114 void addAlgorithmParams() override;
115 bool prepareAlgorithmFuzzificationParameters( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
116 void fuzzify( QgsRasterDataProvider *destinationProvider, QgsProcessingFeedback *feedback ) override;
117
118 private:
119 double mFuzzifyLowBound = 0;
120 double mFuzzifyHighBound = 0;
121 double mFuzzifyExponent = 0;
122};
123
124
125class QgsFuzzifyRasterLargeMembershipAlgorithm : public QgsFuzzifyRasterAlgorithmBase
126{
127 public:
128 QgsFuzzifyRasterLargeMembershipAlgorithm() = default;
129 QIcon icon() const override { return QgsApplication::getThemeIcon( QStringLiteral( "/algorithms/mAlgorithmFuzzifyLarge.svg" ) ); }
130 QString svgIconPath() const override { return QgsApplication::iconPath( QStringLiteral( "/algorithms/mAlgorithmFuzzifyLarge.svg" ) ); }
131 QString name() const override;
132 QString displayName() const override;
133 QStringList tags() const override;
134 QString shortHelpString() const override;
135 QgsFuzzifyRasterLargeMembershipAlgorithm *createInstance() const override SIP_FACTORY;
136
137 protected:
138 void addAlgorithmParams() override;
139 bool prepareAlgorithmFuzzificationParameters( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
140 void fuzzify( QgsRasterDataProvider *destinationProvider, QgsProcessingFeedback *feedback ) override;
141
142 private:
143 double mFuzzifyMidpoint = 0;
144 double mFuzzifySpread = 0;
145};
146
147
148class QgsFuzzifyRasterSmallMembershipAlgorithm : public QgsFuzzifyRasterAlgorithmBase
149{
150 public:
151 QgsFuzzifyRasterSmallMembershipAlgorithm() = default;
152 QIcon icon() const override { return QgsApplication::getThemeIcon( QStringLiteral( "/algorithms/mAlgorithmFuzzifySmall.svg" ) ); }
153 QString svgIconPath() const override { return QgsApplication::iconPath( QStringLiteral( "/algorithms/mAlgorithmFuzzifySmall.svg" ) ); }
154 QString name() const override;
155 QString displayName() const override;
156 QStringList tags() const override;
157 QString shortHelpString() const override;
158 QgsFuzzifyRasterSmallMembershipAlgorithm *createInstance() const override SIP_FACTORY;
159
160 protected:
161 void addAlgorithmParams() override;
162 bool prepareAlgorithmFuzzificationParameters( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
163 void fuzzify( QgsRasterDataProvider *destinationProvider, QgsProcessingFeedback *feedback ) override;
164
165 private:
166 double mFuzzifyMidpoint = 0;
167 double mFuzzifySpread = 0;
168};
169
170
171class QgsFuzzifyRasterGaussianMembershipAlgorithm : public QgsFuzzifyRasterAlgorithmBase
172{
173 public:
174 QgsFuzzifyRasterGaussianMembershipAlgorithm() = default;
175 QIcon icon() const override { return QgsApplication::getThemeIcon( QStringLiteral( "/algorithms/mAlgorithmFuzzifyGaussian.svg" ) ); }
176 QString svgIconPath() const override { return QgsApplication::iconPath( QStringLiteral( "/algorithms/mAlgorithmFuzzifyGaussian.svg" ) ); }
177 QString name() const override;
178 QString displayName() const override;
179 QStringList tags() const override;
180 QString shortHelpString() const override;
181 QgsFuzzifyRasterGaussianMembershipAlgorithm *createInstance() const override SIP_FACTORY;
182
183 protected:
184 void addAlgorithmParams() override;
185 bool prepareAlgorithmFuzzificationParameters( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
186 void fuzzify( QgsRasterDataProvider *destinationProvider, QgsProcessingFeedback *feedback ) override;
187
188 private:
189 double mFuzzifyMidpoint = 0;
190 double mFuzzifySpread = 0;
191};
192
193
194class QgsFuzzifyRasterNearMembershipAlgorithm : public QgsFuzzifyRasterAlgorithmBase
195{
196 public:
197 QgsFuzzifyRasterNearMembershipAlgorithm() = default;
198 QIcon icon() const override { return QgsApplication::getThemeIcon( QStringLiteral( "/algorithms/mAlgorithmFuzzifyNear.svg" ) ); }
199 QString svgIconPath() const override { return QgsApplication::iconPath( QStringLiteral( "/algorithms/mAlgorithmFuzzifyNear.svg" ) ); }
200 QString name() const override;
201 QString displayName() const override;
202 QStringList tags() const override;
203 QString shortHelpString() const override;
204 QgsFuzzifyRasterNearMembershipAlgorithm *createInstance() const override SIP_FACTORY;
205
206 protected:
207 void addAlgorithmParams() override;
208 bool prepareAlgorithmFuzzificationParameters( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
209 void fuzzify( QgsRasterDataProvider *destinationProvider, QgsProcessingFeedback *feedback ) override;
210
211 private:
212 double mFuzzifyMidpoint = 0;
213 double mFuzzifySpread = 0;
214};
215
216
218
219#endif // QGSALGORITHMFUZZIFYRASTER_H
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