QGIS API Documentation 3.41.0-Master (cea29feecf2)
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 QString group() const final;
36 QString groupId() const final;
37 void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) final;
38
39 protected:
40 bool prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) final;
41
42 QVariantMap processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) final;
43
44 std::unique_ptr<QgsRasterInterface> mInterface;
45
47 double mNoDataValue = -9999;
48 int mBand = 1;
49 QgsRectangle mExtent;
51 double mRasterUnitsPerPixelX = 0;
52 double mRasterUnitsPerPixelY = 0;
53 int mNbCellsXProvider = 0;
54 int mNbCellsYProvider = 0;
55 QgsReclassifyUtils::RasterClass::BoundsType mBoundsType = QgsReclassifyUtils::RasterClass::IncludeMax;
56 bool mUseNoDataForMissingValues = false;
57
58 private:
59 virtual QString outputName() const = 0;
60 virtual Qgis::ProcessingSourceType outputType() const = 0;
61 virtual Qgis::WkbType sinkType() const = 0;
62 virtual QgsGeometry createGeometryForPixel( double centerX, double centerY, double pixelWidthX, double pixelWidthY ) const = 0;
63};
64
68class QgsRasterPixelsToPolygonsAlgorithm : public QgsVectorizeAlgorithmBase
69{
70 public:
71 QgsRasterPixelsToPolygonsAlgorithm() = default;
72 QString name() const override;
73 QString displayName() const override;
74 QStringList tags() const override;
75 QString shortHelpString() const override;
76 QString shortDescription() const override;
77 QgsRasterPixelsToPolygonsAlgorithm *createInstance() const override SIP_FACTORY;
78
79 private:
80 QString outputName() const override;
81 Qgis::ProcessingSourceType outputType() const override;
82 Qgis::WkbType sinkType() const override;
83 QgsGeometry createGeometryForPixel( double centerX, double centerY, double pixelWidthX, double pixelWidthY ) const override;
84};
85
89class QgsRasterPixelsToPointsAlgorithm : public QgsVectorizeAlgorithmBase
90{
91 public:
92 QgsRasterPixelsToPointsAlgorithm() = default;
93 QString name() const override;
94 QString displayName() const override;
95 QStringList tags() const override;
96 QString shortHelpString() const override;
97 QString shortDescription() const override;
98 QgsRasterPixelsToPointsAlgorithm *createInstance() const override SIP_FACTORY;
99
100 private:
101 QString outputName() const override;
102 Qgis::ProcessingSourceType outputType() const override;
103 Qgis::WkbType sinkType() const override;
104 QgsGeometry createGeometryForPixel( double centerX, double centerY, double pixelWidthX, double pixelWidthY ) const override;
105};
106
108
109#endif // QGSALGORITHMVECTORIZE_H
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
ProcessingSourceType
Processing data source types.
Definition qgis.h:3315
DataType
Raster data types.
Definition qgis.h:351
@ Float32
Thirty two bit floating point (float)
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition qgis.h:256
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