QGIS API Documentation 3.37.0-Master (4ace69f83af)
Loading...
Searching...
No Matches
qgsalgorithmrasterstackposition.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsalgorithmrasterstackposition.h
3 ---------------------
4 begin : July 2020
5 copyright : (C) 2020 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 QGSALGORITHMRASTERSTACKPOSITION_H
19#define QGSALGORITHMRASTERSTACKPOSITION_H
20
21#define SIP_NO_FILE
22
23#include "qgis_sip.h"
24#include "qgsapplication.h"
26#include "qgsrasterprojector.h"
28
30
31class QgsRasterStackPositionAlgorithmBase : public QgsProcessingAlgorithm
32{
33 public:
34 QgsRasterStackPositionAlgorithmBase() = default;
35 void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) override;
36 QString group() const override;
37 QString groupId() const override;
38
39 protected:
40 bool prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
41 QVariantMap processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
42 virtual int findPosition( std::vector< std::unique_ptr< QgsRasterBlock > > &rasterBlockStack, int &row, int &col, bool &noDataInRasterBlockStack ) = 0;
43 double mNoDataValue = -9999;
44
45 private:
46 std::vector< QgsRasterAnalysisUtils::RasterLogicInput > mInputs;
47 bool mIgnoreNoData = false;
48 int mLayerWidth = 0;
49 int mLayerHeight = 0;
50 QgsRectangle mExtent;
52 double mRasterUnitsPerPixelX = 0;
53 double mRasterUnitsPerPixelY = 0;
54};
55
56class QgsRasterStackLowestPositionAlgorithm : public QgsRasterStackPositionAlgorithmBase
57{
58 public:
59 QgsRasterStackLowestPositionAlgorithm() = default;
60 QString name() const override;
61 QString displayName() const override;
62 QStringList tags() const override;
63 QString shortHelpString() const override;
64 QgsRasterStackLowestPositionAlgorithm *createInstance() const override SIP_FACTORY;
65
66 protected:
67 int findPosition( std::vector< std::unique_ptr< QgsRasterBlock > > &rasterBlockStack, int &row, int &col, bool &noDataInRasterBlockStack ) override;
68};
69
70class QgsRasterStackHighestPositionAlgorithm : public QgsRasterStackPositionAlgorithmBase
71{
72 public:
73 QgsRasterStackHighestPositionAlgorithm() = default;
74 QString name() const override;
75 QString displayName() const override;
76 QStringList tags() const override;
77 QString shortHelpString() const override;
78 QgsRasterStackHighestPositionAlgorithm *createInstance() const override SIP_FACTORY;
79
80 protected:
81 int findPosition( std::vector< std::unique_ptr< QgsRasterBlock > > &rasterBlockStack, int &row, int &col, bool &noDataInRasterBlockStack ) override;
82};
83
85
86#endif // QGSALGORITHMRASTERSTACKPOSITION_H
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.
Raster data container.
A rectangle specified with double values.
#define SIP_FACTORY
Definition qgis_sip.h:76