18#ifndef QGSRANDOMRASTERALGORITHM_H
19#define QGSRANDOMRASTERALGORITHM_H
33 QString
group()
const final;
35 void initAlgorithm(
const QVariantMap &configuration = QVariantMap() )
final;
43 virtual void addAlgorithmParams() = 0;
51 virtual bool prepareRandomParameters(
const QVariantMap ¶meters,
QgsProcessingContext &context ) = 0;
61 virtual long generateRandomLongValue( std::mt19937 &mersenneTwister ) = 0;
62 virtual double generateRandomDoubleValue( std::mt19937 &mersenneTwister ) = 0;
72class QgsRandomUniformRasterAlgorithm :
public QgsRandomRasterAlgorithmBase
75 QgsRandomUniformRasterAlgorithm() =
default;
77 QString svgIconPath()
const override {
return QgsApplication::iconPath( QStringLiteral(
"/algorithms/mAlgorithmRandomRaster.svg" ) ); }
78 QString name()
const override;
79 QString displayName()
const override;
80 QStringList tags()
const override;
81 QString shortHelpString()
const override;
82 QgsRandomUniformRasterAlgorithm *createInstance() const override
SIP_FACTORY;
85 void addAlgorithmParams() final;
86 Qgis::DataType getRasterDataType(
int typeId ) final;
87 bool prepareRandomParameters( const QVariantMap ¶meters,
QgsProcessingContext &context ) final;
88 long generateRandomLongValue( std::mt19937 &mersenneTwister ) final;
89 double generateRandomDoubleValue( std::mt19937 &mersenneTwister ) final;
92 double mRandomUpperBound;
93 double mRandomLowerBound;
94 std::uniform_int_distribution<
long> mRandomUniformIntDistribution;
95 std::uniform_real_distribution<
double> mRandomUniformDoubleDistribution;
98class QgsRandomBinomialRasterAlgorithm : public QgsRandomRasterAlgorithmBase
101 QgsRandomBinomialRasterAlgorithm() =
default;
103 QString svgIconPath()
const override {
return QgsApplication::iconPath( QStringLiteral(
"/algorithms/mAlgorithmRandomNormalRaster.svg" ) ); }
104 QString name()
const override;
105 QString displayName()
const override;
106 QStringList tags()
const override;
107 QString shortHelpString()
const override;
108 QgsRandomBinomialRasterAlgorithm *createInstance() const override
SIP_FACTORY;
111 void addAlgorithmParams() final;
112 Qgis::DataType getRasterDataType(
int typeId ) final;
113 bool prepareRandomParameters( const QVariantMap ¶meters,
QgsProcessingContext &context ) final;
114 long generateRandomLongValue( std::mt19937 &mersenneTwister ) final;
115 double generateRandomDoubleValue( std::mt19937 &mersenneTwister ) final;
118 std::binomial_distribution<
long> mRandombinomialDistribution;
121class QgsRandomExponentialRasterAlgorithm : public QgsRandomRasterAlgorithmBase
124 QgsRandomExponentialRasterAlgorithm() =
default;
125 QIcon icon()
const override {
return QgsApplication::getThemeIcon( QStringLiteral(
"/algorithms/mAlgorithmRandomExponentialRaster.svg" ) ); }
126 QString svgIconPath()
const override {
return QgsApplication::iconPath( QStringLiteral(
"/algorithms/mAlgorithmRandomExponentialRaster.svg" ) ); }
127 QString name()
const override;
128 QString displayName()
const override;
129 QStringList tags()
const override;
130 QString shortHelpString()
const override;
131 QgsRandomExponentialRasterAlgorithm *createInstance() const override
SIP_FACTORY;
134 void addAlgorithmParams() final;
135 Qgis::DataType getRasterDataType(
int typeId ) final;
136 bool prepareRandomParameters( const QVariantMap ¶meters,
QgsProcessingContext &context ) final;
137 long generateRandomLongValue( std::mt19937 &mersenneTwister ) final;
138 double generateRandomDoubleValue( std::mt19937 &mersenneTwister ) final;
141 std::exponential_distribution<
double> mRandomExponentialDistribution;
145class QgsRandomGammaRasterAlgorithm : public QgsRandomRasterAlgorithmBase
148 QgsRandomGammaRasterAlgorithm() =
default;
150 QString svgIconPath()
const override {
return QgsApplication::iconPath( QStringLiteral(
"/algorithms/mAlgorithmRandomGammaRaster.svg" ) ); }
151 QString name()
const override;
152 QString displayName()
const override;
153 QStringList tags()
const override;
154 QString shortHelpString()
const override;
155 QgsRandomGammaRasterAlgorithm *createInstance() const override
SIP_FACTORY;
158 void addAlgorithmParams() final;
159 Qgis::DataType getRasterDataType(
int typeId ) final;
160 bool prepareRandomParameters( const QVariantMap ¶meters,
QgsProcessingContext &context ) final;
161 long generateRandomLongValue( std::mt19937 &mersenneTwister ) final;
162 double generateRandomDoubleValue( std::mt19937 &mersenneTwister ) final;
165 std::gamma_distribution<
double> mRandomGammaDistribution;
168class QgsRandomGeometricRasterAlgorithm : public QgsRandomRasterAlgorithmBase
171 QgsRandomGeometricRasterAlgorithm() =
default;
172 QIcon icon()
const override {
return QgsApplication::getThemeIcon( QStringLiteral(
"/algorithms/mAlgorithmRandomExponentialRaster.svg" ) ); }
173 QString svgIconPath()
const override {
return QgsApplication::iconPath( QStringLiteral(
"/algorithms/mAlgorithmRandomExponentialRaster.svg" ) ); }
174 QString name()
const override;
175 QString displayName()
const override;
176 QStringList tags()
const override;
177 QString shortHelpString()
const override;
178 QgsRandomGeometricRasterAlgorithm *createInstance() const override
SIP_FACTORY;
181 void addAlgorithmParams() override;
182 Qgis::DataType getRasterDataType(
int typeId ) override;
183 bool prepareRandomParameters( const QVariantMap ¶meters,
QgsProcessingContext &context ) override;
184 long generateRandomLongValue( std::mt19937 &mersenneTwister ) override;
185 double generateRandomDoubleValue( std::mt19937 &mersenneTwister ) override;
188 std::geometric_distribution<
long> mRandomGeometricDistribution;
192class QgsRandomNegativeBinomialRasterAlgorithm : public QgsRandomRasterAlgorithmBase
195 QgsRandomNegativeBinomialRasterAlgorithm() =
default;
197 QString svgIconPath()
const override {
return QgsApplication::iconPath( QStringLiteral(
"/algorithms/mAlgorithmNormalRaster.svg" ) ); }
198 QString name()
const override;
199 QString displayName()
const override;
200 QStringList tags()
const override;
201 QString shortHelpString()
const override;
202 QgsRandomNegativeBinomialRasterAlgorithm *createInstance() const override
SIP_FACTORY;
205 void addAlgorithmParams() final;
206 Qgis::DataType getRasterDataType(
int typeId ) final;
207 bool prepareRandomParameters( const QVariantMap ¶meters,
QgsProcessingContext &context ) final;
208 long generateRandomLongValue( std::mt19937 &mersenneTwister ) final;
209 double generateRandomDoubleValue( std::mt19937 &mersenneTwister ) final;
212 std::negative_binomial_distribution<
long> mRandomNegativeBinomialDistribution;
215class QgsRandomNormalRasterAlgorithm : public QgsRandomRasterAlgorithmBase
218 QgsRandomNormalRasterAlgorithm() =
default;
220 QString svgIconPath()
const override {
return QgsApplication::iconPath( QStringLiteral(
"/algorithms/mAlgorithmNormalRaster.svg" ) ); }
221 QString name()
const override;
222 QString displayName()
const override;
223 QStringList tags()
const override;
224 QString shortHelpString()
const override;
225 QgsRandomNormalRasterAlgorithm *createInstance() const override
SIP_FACTORY;
228 void addAlgorithmParams() final;
229 Qgis::DataType getRasterDataType(
int typeId ) final;
230 bool prepareRandomParameters( const QVariantMap ¶meters,
QgsProcessingContext &context ) final;
231 long generateRandomLongValue( std::mt19937 &mersenneTwister ) final;
232 double generateRandomDoubleValue( std::mt19937 &mersenneTwister ) final;
235 std::normal_distribution<
double> mRandomNormalDistribution;
238class QgsRandomPoissonRasterAlgorithm : public QgsRandomRasterAlgorithmBase
241 QgsRandomPoissonRasterAlgorithm() =
default;
242 QIcon icon()
const override {
return QgsApplication::getThemeIcon( QStringLiteral(
"/algorithms/mAlgorithmRandomPoissonRaster.svg" ) ); }
243 QString svgIconPath()
const override {
return QgsApplication::iconPath( QStringLiteral(
"/algorithms/mAlgorithmRandomPoissonRaster.svg" ) ); }
244 QString name()
const override;
245 QString displayName()
const override;
246 QStringList tags()
const override;
247 QString shortHelpString()
const override;
248 QgsRandomPoissonRasterAlgorithm *createInstance() const override
SIP_FACTORY;
251 void addAlgorithmParams() final;
252 Qgis::DataType getRasterDataType(
int typeId ) final;
253 bool prepareRandomParameters( const QVariantMap ¶meters,
QgsProcessingContext &context ) final;
254 long generateRandomLongValue( std::mt19937 &mersenneTwister ) final;
255 double generateRandomDoubleValue( std::mt19937 &mersenneTwister ) final;
258 std::poisson_distribution<
long> mRandomPoissonDistribution;
The Qgis class provides global constants for use throughout the application.
DataType
Raster data types.
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 QString groupId() const
Returns the unique ID of the group this algorithm belongs to.
virtual QVariantMap processAlgorithm(const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessingFeedback *feedback) SIP_THROW(QgsProcessingException)=0
Runs the algorithm using the specified parameters.
virtual bool prepareAlgorithm(const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessingFeedback *feedback) SIP_THROW(QgsProcessingException)
Prepares the algorithm to run 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.
A rectangle specified with double values.