QGIS API Documentation 3.41.0-Master (a6c88b06562)
Loading...
Searching...
No Matches
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 QIcon icon() const override { return QgsApplication::getThemeIcon( QStringLiteral( "/algorithms/mAlgorithmSelectDistance.svg" ) ); }
68 QString svgIconPath() const override { return QgsApplication::iconPath( QStringLiteral( "/algorithms/mAlgorithmSelectDistance.svg" ) ); }
69 QString name() const override;
70 Qgis::ProcessingAlgorithmFlags flags() const override;
71 QString displayName() const override;
72 QStringList tags() const override;
73 QString group() const override;
74 QString groupId() const override;
75 QString shortHelpString() const override;
76 QgsSelectWithinDistanceAlgorithm *createInstance() const override SIP_FACTORY;
77
78 protected:
79
80 QVariantMap processAlgorithm( const QVariantMap &parameters,
81 QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
82
83};
84
88class QgsExtractWithinDistanceAlgorithm : public QgsDistanceWithinAlgorithm
89{
90
91 public:
92
93 QgsExtractWithinDistanceAlgorithm() = default;
94 void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) override;
95 QString name() const override;
96 QString displayName() const override;
97 QStringList tags() const override;
98 QString group() const override;
99 QString groupId() const override;
100 QString shortHelpString() const override;
101 QgsExtractWithinDistanceAlgorithm *createInstance() const override SIP_FACTORY;
102
103 protected:
104
105 QVariantMap processAlgorithm( const QVariantMap &parameters,
106 QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
107
108};
109
111
112#endif // QGSALGORITHMDISTANCEWITHIN_H
113
114
QFlags< ProcessingAlgorithmFlag > ProcessingAlgorithmFlags
Flags indicating how and when an algorithm operates and should be exposed to users.
Definition qgis.h:3339
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
static QString iconPath(const QString &iconFile)
Returns path to the desired icon file.
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:58
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.
#define SIP_FACTORY
Definition qgis_sip.h:76