QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
qgsalgorithmvectorize.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsalgorithmvectorize.h
3 ---------------------
4 begin : June, 2018
5 copyright : (C) 2018 by Nyall Dawson
6 email : nyall dot dawson 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 QGSALGORITHMVECTORIZE_H
19#define QGSALGORITHMVECTORIZE_H
20
21#define SIP_NO_FILE
22
23#include "qgis_sip.h"
25#include "qgsreclassifyutils.h"
26
28
32class QgsVectorizeAlgorithmBase : public QgsProcessingAlgorithm
33{
34 public:
35
36 QString group() const final;
37 QString groupId() const final;
38 void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) final;
39
40 protected:
41
42 bool prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) final;
43
44 QVariantMap processAlgorithm( const QVariantMap &parameters,
45 QgsProcessingContext &context, QgsProcessingFeedback *feedback ) final;
46
47 std::unique_ptr< QgsRasterInterface > mInterface;
48
50 double mNoDataValue = -9999;
51 int mBand = 1;
52 QgsRectangle mExtent;
54 double mRasterUnitsPerPixelX = 0;
55 double mRasterUnitsPerPixelY = 0;
56 int mNbCellsXProvider = 0;
57 int mNbCellsYProvider = 0;
58 QgsReclassifyUtils::RasterClass::BoundsType mBoundsType = QgsReclassifyUtils::RasterClass::IncludeMax;
59 bool mUseNoDataForMissingValues = false;
60
61 private:
62
63 virtual QString outputName() const = 0;
64 virtual QgsProcessing::SourceType outputType() const = 0;
65 virtual QgsWkbTypes::Type sinkType() const = 0;
66 virtual QgsGeometry createGeometryForPixel( double centerX, double centerY, double pixelWidthX, double pixelWidthY ) const = 0;
67};
68
72class QgsRasterPixelsToPolygonsAlgorithm : public QgsVectorizeAlgorithmBase
73{
74 public:
75
76 QgsRasterPixelsToPolygonsAlgorithm() = default;
77 QString name() const override;
78 QString displayName() const override;
79 QStringList tags() const override;
80 QString shortHelpString() const override;
81 QString shortDescription() const override;
82 QgsRasterPixelsToPolygonsAlgorithm *createInstance() const override SIP_FACTORY;
83
84 private:
85
86 QString outputName() const override;
87 QgsProcessing::SourceType outputType() const override;
88 QgsWkbTypes::Type sinkType() const override;
89 QgsGeometry createGeometryForPixel( double centerX, double centerY, double pixelWidthX, double pixelWidthY ) const override;
90
91};
92
96class QgsRasterPixelsToPointsAlgorithm : public QgsVectorizeAlgorithmBase
97{
98 public:
99
100 QgsRasterPixelsToPointsAlgorithm() = default;
101 QString name() const override;
102 QString displayName() const override;
103 QStringList tags() const override;
104 QString shortHelpString() const override;
105 QString shortDescription() const override;
106 QgsRasterPixelsToPointsAlgorithm *createInstance() const override SIP_FACTORY;
107
108 private:
109
110 QString outputName() const override;
111 QgsProcessing::SourceType outputType() const override;
112 QgsWkbTypes::Type sinkType() const override;
113 QgsGeometry createGeometryForPixel( double centerX, double centerY, double pixelWidthX, double pixelWidthY ) const override;
114
115};
116
118
119#endif // QGSALGORITHMVECTORIZE_H
120
121
DataType
Raster data types.
Definition: qgis.h:129
@ Float32
Thirty two bit floating point (float)
This class represents a coordinate reference system (CRS).
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:164
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 &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback) SIP_THROW(QgsProcessingException)=0
Runs the algorithm using the specified parameters.
virtual bool prepareAlgorithm(const QVariantMap &parameters, 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.
Contains enumerations and other constants for use in processing algorithms and parameters.
Definition: qgsprocessing.h:40
SourceType
Data source types enum.
Definition: qgsprocessing.h:46
A rectangle specified with double values.
Definition: qgsrectangle.h:42
Handles storage of information regarding WKB types and their properties.
Definition: qgswkbtypes.h:42
Type
The WKB type describes the number of dimensions a geometry has.
Definition: qgswkbtypes.h:70
#define SIP_FACTORY
Definition: qgis_sip.h:76