18#ifndef QGSRANDOMRASTERALGORITHM_H
19#define QGSRANDOMRASTERALGORITHM_H
33 QString
group()
const final;
35 void initAlgorithm(
const QVariantMap &configuration = QVariantMap() )
final;
42 virtual void addAlgorithmParams() = 0;
50 virtual bool prepareRandomParameters(
const QVariantMap ¶meters,
QgsProcessingContext &context ) = 0;
60 virtual long generateRandomLongValue( std::mt19937 &mersenneTwister ) = 0;
61 virtual double generateRandomDoubleValue( std::mt19937 &mersenneTwister ) = 0;
66 double mPixelSize = 0;
71class QgsRandomUniformRasterAlgorithm :
public QgsRandomRasterAlgorithmBase
74 QgsRandomUniformRasterAlgorithm() =
default;
76 QString svgIconPath()
const override {
return QgsApplication::iconPath( QStringLiteral(
"/algorithms/mAlgorithmRandomRaster.svg" ) ); }
77 QString name()
const override;
78 QString displayName()
const override;
79 QStringList tags()
const override;
80 QString shortHelpString()
const override;
81 QgsRandomUniformRasterAlgorithm *createInstance() const override
SIP_FACTORY;
84 void addAlgorithmParams() final;
85 Qgis::DataType getRasterDataType(
int typeId ) final;
86 bool prepareRandomParameters( const QVariantMap ¶meters,
QgsProcessingContext &context ) final;
87 long generateRandomLongValue( std::mt19937 &mersenneTwister ) final;
88 double generateRandomDoubleValue( std::mt19937 &mersenneTwister ) final;
91 double mRandomUpperBound = 0;
92 double mRandomLowerBound = 0;
93 std::uniform_int_distribution<
long> mRandomUniformIntDistribution;
94 std::uniform_real_distribution<
double> mRandomUniformDoubleDistribution;
97class QgsRandomBinomialRasterAlgorithm : public QgsRandomRasterAlgorithmBase
100 QgsRandomBinomialRasterAlgorithm() =
default;
102 QString svgIconPath()
const override {
return QgsApplication::iconPath( QStringLiteral(
"/algorithms/mAlgorithmRandomNormalRaster.svg" ) ); }
103 QString name()
const override;
104 QString displayName()
const override;
105 QStringList tags()
const override;
106 QString shortHelpString()
const override;
107 QgsRandomBinomialRasterAlgorithm *createInstance() const override
SIP_FACTORY;
110 void addAlgorithmParams() final;
111 Qgis::DataType getRasterDataType(
int typeId ) final;
112 bool prepareRandomParameters( const QVariantMap ¶meters,
QgsProcessingContext &context ) final;
113 long generateRandomLongValue( std::mt19937 &mersenneTwister ) final;
114 double generateRandomDoubleValue( std::mt19937 &mersenneTwister ) final;
117 std::binomial_distribution<
long> mRandombinomialDistribution;
120class QgsRandomExponentialRasterAlgorithm : public QgsRandomRasterAlgorithmBase
123 QgsRandomExponentialRasterAlgorithm() =
default;
124 QIcon icon()
const override {
return QgsApplication::getThemeIcon( QStringLiteral(
"/algorithms/mAlgorithmRandomExponentialRaster.svg" ) ); }
125 QString svgIconPath()
const override {
return QgsApplication::iconPath( QStringLiteral(
"/algorithms/mAlgorithmRandomExponentialRaster.svg" ) ); }
126 QString name()
const override;
127 QString displayName()
const override;
128 QStringList tags()
const override;
129 QString shortHelpString()
const override;
130 QgsRandomExponentialRasterAlgorithm *createInstance() const override
SIP_FACTORY;
133 void addAlgorithmParams() final;
134 Qgis::DataType getRasterDataType(
int typeId ) final;
135 bool prepareRandomParameters( const QVariantMap ¶meters,
QgsProcessingContext &context ) final;
136 long generateRandomLongValue( std::mt19937 &mersenneTwister ) final;
137 double generateRandomDoubleValue( std::mt19937 &mersenneTwister ) final;
140 std::exponential_distribution<
double> mRandomExponentialDistribution;
144class QgsRandomGammaRasterAlgorithm : public QgsRandomRasterAlgorithmBase
147 QgsRandomGammaRasterAlgorithm() =
default;
149 QString svgIconPath()
const override {
return QgsApplication::iconPath( QStringLiteral(
"/algorithms/mAlgorithmRandomGammaRaster.svg" ) ); }
150 QString name()
const override;
151 QString displayName()
const override;
152 QStringList tags()
const override;
153 QString shortHelpString()
const override;
154 QgsRandomGammaRasterAlgorithm *createInstance() const override
SIP_FACTORY;
157 void addAlgorithmParams() final;
158 Qgis::DataType getRasterDataType(
int typeId ) final;
159 bool prepareRandomParameters( const QVariantMap ¶meters,
QgsProcessingContext &context ) final;
160 long generateRandomLongValue( std::mt19937 &mersenneTwister ) final;
161 double generateRandomDoubleValue( std::mt19937 &mersenneTwister ) final;
164 std::gamma_distribution<
double> mRandomGammaDistribution;
167class QgsRandomGeometricRasterAlgorithm : public QgsRandomRasterAlgorithmBase
170 QgsRandomGeometricRasterAlgorithm() =
default;
171 QIcon icon()
const override {
return QgsApplication::getThemeIcon( QStringLiteral(
"/algorithms/mAlgorithmRandomExponentialRaster.svg" ) ); }
172 QString svgIconPath()
const override {
return QgsApplication::iconPath( QStringLiteral(
"/algorithms/mAlgorithmRandomExponentialRaster.svg" ) ); }
173 QString name()
const override;
174 QString displayName()
const override;
175 QStringList tags()
const override;
176 QString shortHelpString()
const override;
177 QgsRandomGeometricRasterAlgorithm *createInstance() const override
SIP_FACTORY;
180 void addAlgorithmParams() override;
181 Qgis::DataType getRasterDataType(
int typeId ) override;
182 bool prepareRandomParameters( const QVariantMap ¶meters,
QgsProcessingContext &context ) override;
183 long generateRandomLongValue( std::mt19937 &mersenneTwister ) override;
184 double generateRandomDoubleValue( std::mt19937 &mersenneTwister ) override;
187 std::geometric_distribution<
long> mRandomGeometricDistribution;
191class QgsRandomNegativeBinomialRasterAlgorithm : public QgsRandomRasterAlgorithmBase
194 QgsRandomNegativeBinomialRasterAlgorithm() =
default;
196 QString svgIconPath()
const override {
return QgsApplication::iconPath( QStringLiteral(
"/algorithms/mAlgorithmNormalRaster.svg" ) ); }
197 QString name()
const override;
198 QString displayName()
const override;
199 QStringList tags()
const override;
200 QString shortHelpString()
const override;
201 QgsRandomNegativeBinomialRasterAlgorithm *createInstance() const override
SIP_FACTORY;
204 void addAlgorithmParams() final;
205 Qgis::DataType getRasterDataType(
int typeId ) final;
206 bool prepareRandomParameters( const QVariantMap ¶meters,
QgsProcessingContext &context ) final;
207 long generateRandomLongValue( std::mt19937 &mersenneTwister ) final;
208 double generateRandomDoubleValue( std::mt19937 &mersenneTwister ) final;
211 std::negative_binomial_distribution<
long> mRandomNegativeBinomialDistribution;
214class QgsRandomNormalRasterAlgorithm : public QgsRandomRasterAlgorithmBase
217 QgsRandomNormalRasterAlgorithm() =
default;
219 QString svgIconPath()
const override {
return QgsApplication::iconPath( QStringLiteral(
"/algorithms/mAlgorithmNormalRaster.svg" ) ); }
220 QString name()
const override;
221 QString displayName()
const override;
222 QStringList tags()
const override;
223 QString shortHelpString()
const override;
224 QgsRandomNormalRasterAlgorithm *createInstance() const override
SIP_FACTORY;
227 void addAlgorithmParams() final;
228 Qgis::DataType getRasterDataType(
int typeId ) final;
229 bool prepareRandomParameters( const QVariantMap ¶meters,
QgsProcessingContext &context ) final;
230 long generateRandomLongValue( std::mt19937 &mersenneTwister ) final;
231 double generateRandomDoubleValue( std::mt19937 &mersenneTwister ) final;
234 std::normal_distribution<
double> mRandomNormalDistribution;
237class QgsRandomPoissonRasterAlgorithm : public QgsRandomRasterAlgorithmBase
240 QgsRandomPoissonRasterAlgorithm() =
default;
241 QIcon icon()
const override {
return QgsApplication::getThemeIcon( QStringLiteral(
"/algorithms/mAlgorithmRandomPoissonRaster.svg" ) ); }
242 QString svgIconPath()
const override {
return QgsApplication::iconPath( QStringLiteral(
"/algorithms/mAlgorithmRandomPoissonRaster.svg" ) ); }
243 QString name()
const override;
244 QString displayName()
const override;
245 QStringList tags()
const override;
246 QString shortHelpString()
const override;
247 QgsRandomPoissonRasterAlgorithm *createInstance() const override
SIP_FACTORY;
250 void addAlgorithmParams() final;
251 Qgis::DataType getRasterDataType(
int typeId ) final;
252 bool prepareRandomParameters( const QVariantMap ¶meters,
QgsProcessingContext &context ) final;
253 long generateRandomLongValue( std::mt19937 &mersenneTwister ) final;
254 double generateRandomDoubleValue( std::mt19937 &mersenneTwister ) final;
257 std::poisson_distribution<
long> mRandomPoissonDistribution;
The Qgis class provides global constants for use throughout the application.
DataType
Raster data types.
@ UnknownDataType
Unknown or unspecified type.
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 ¶meters, 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 ¶meters, 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.
A rectangle specified with double values.