1 /***************************************************************************
2                          qgsalgorithmcellstatistics.h
3                          ---------------------
4     begin                : May 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 QGSALGORITHMCELLSTATISTICS_H
19 #define QGSALGORITHMCELLSTATISTICS_H
20 
21 #define SIP_NO_FILE
22 
23 #include "qgis_sip.h"
24 #include "qgsapplication.h"
25 #include "qgsprocessingalgorithm.h"
26 #include "qgsrasterprojector.h"
27 #include "qgsrasteranalysisutils.h"
28 
29 ///@cond PRIVATE
30 
31 class QgsCellStatisticsAlgorithm : public QgsProcessingAlgorithm
32 {
33 
34   public:
35     QgsCellStatisticsAlgorithm() = default;
icon()36     QIcon icon() const override { return QgsApplication::getThemeIcon( QStringLiteral( "/algorithms/mAlgorithmCellStatistics.svg" ) ); }
svgIconPath()37     QString svgIconPath() const override { return QgsApplication::iconPath( QStringLiteral( "/algorithms/mAlgorithmCellStatistics.svg" ) ); }
38     void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) override;
39     QString name() const override;
40     QString displayName() const override;
41     QStringList tags() const override;
42     QString group() const override;
43     QString groupId() const override;
44     QString shortHelpString() const override;
45     QgsCellStatisticsAlgorithm *createInstance() const override SIP_FACTORY;
46 
47   protected:
48 
49     bool prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
50     QVariantMap processAlgorithm( const QVariantMap &parameters,
51                                   QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
52 
53   private:
54     std::vector< QgsRasterAnalysisUtils::RasterLogicInput > mInputs;
55     bool mIgnoreNoData;
56     Qgis::DataType mDataType;
57     double mNoDataValue = -9999;
58     int mLayerWidth;
59     int mLayerHeight;
60     QgsRectangle mExtent;
61     QgsCoordinateReferenceSystem mCrs;
62     double mRasterUnitsPerPixelX;
63     double mRasterUnitsPerPixelY;
64 };
65 
66 ///@endcond PRIVATE
67 
68 #endif // QGSALGORITHMCELLSTATISTICS_H
69 
70