QGIS API Documentation 3.38.0-Grenoble (exported)
Loading...
Searching...
No Matches
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 Qgis::ProcessingSourceType outputType() const = 0;
65 virtual Qgis::WkbType 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 Qgis::ProcessingSourceType outputType() const override;
88 Qgis::WkbType 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 Qgis::ProcessingSourceType outputType() const override;
112 Qgis::WkbType 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
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
ProcessingSourceType
Processing data source types.
Definition qgis.h:2995
DataType
Raster data types.
Definition qgis.h:288
@ Float32
Thirty two bit floating point (float)
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition qgis.h:201
This class represents a coordinate reference system (CRS).
A geometry is the spatial representation of a feature.
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.
A rectangle specified with double values.
#define SIP_FACTORY
Definition qgis_sip.h:76