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