QGIS API Documentation 3.27.0-Master (a46f227e17)
qgsalgorithmdistancewithin.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsalgorithmdistancewithin.h
3 ---------------------
4 begin : August 2021
5 copyright : (C) 2021 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 QGSALGORITHMDISTANCEWITHIN_H
19#define QGSALGORITHMDISTANCEWITHIN_H
20
21#define SIP_NO_FILE
22
23#include "qgis_sip.h"
25#include "qgsapplication.h"
26
28
29
33class QgsDistanceWithinAlgorithm : public QgsProcessingAlgorithm
34{
35
36 protected:
37
38 void addDistanceParameter();
39 void process( const QgsProcessingContext &context, QgsFeatureSource *targetSource,
40 QgsFeatureSource *referenceSource,
41 double distance, const QgsProperty &distanceProperty,
42 const std::function< void( const QgsFeature & )> &handleFeatureFunction, bool onlyRequireTargetIds, QgsProcessingFeedback *feedback,
43 QgsExpressionContext &expressionContext );
44
45 private:
46
47 void processByIteratingOverTargetSource( const QgsProcessingContext &context, QgsFeatureSource *targetSource, QgsFeatureSource *referenceSource,
48 double distance, const QgsProperty &distanceProperty,
49 const std::function< void( const QgsFeature & )> &handleFeatureFunction, bool onlyRequireTargetIds,
50 QgsProcessingFeedback *feedback, QgsExpressionContext &expressionContext );
51 void processByIteratingOverReferenceSource( const QgsProcessingContext &context, QgsFeatureSource *targetSource, QgsFeatureSource *referenceSource,
52 double distance,
53 const std::function< void( const QgsFeature & )> &handleFeatureFunction, bool onlyRequireTargetIds, QgsProcessingFeedback *feedback );
54};
55
56
60class QgsSelectWithinDistanceAlgorithm : public QgsDistanceWithinAlgorithm
61{
62
63 public:
64
65 QgsSelectWithinDistanceAlgorithm() = default;
66 void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) override;
67 QString name() const override;
68 Flags flags() const override;
69 QString displayName() const override;
70 QStringList tags() const override;
71 QString group() const override;
72 QString groupId() const override;
73 QString shortHelpString() const override;
74 QgsSelectWithinDistanceAlgorithm *createInstance() const override SIP_FACTORY;
75
76 protected:
77
78 QVariantMap processAlgorithm( const QVariantMap &parameters,
79 QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
80
81};
82
86class QgsExtractWithinDistanceAlgorithm : public QgsDistanceWithinAlgorithm
87{
88
89 public:
90
91 QgsExtractWithinDistanceAlgorithm() = default;
92 void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) override;
93 QString name() const override;
94 QString displayName() const override;
95 QStringList tags() const override;
96 QString group() const override;
97 QString groupId() const override;
98 QString shortHelpString() const override;
99 QgsExtractWithinDistanceAlgorithm *createInstance() const override SIP_FACTORY;
100
101 protected:
102
103 QVariantMap processAlgorithm( const QVariantMap &parameters,
104 QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
105
106};
107
109
110#endif // QGSALGORITHMDISTANCEWITHIN_H
111
112
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
An interface for objects which provide features via a getFeatures method.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition: qgsfeature.h:56
Abstract base class for processing algorithms.
Contains information about the context in which a processing algorithm is executed.
Base class for providing feedback from a processing algorithm.
A store for object properties.
Definition: qgsproperty.h:231
#define SIP_FACTORY
Definition: qgis_sip.h:76