QGIS API Documentation 3.41.0-Master (cea29feecf2)
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 protected:
36 void addDistanceParameter();
37 void process( const QgsProcessingContext &context, QgsFeatureSource *targetSource, QgsFeatureSource *referenceSource, double distance, const QgsProperty &distanceProperty, const std::function<void( const QgsFeature & )> &handleFeatureFunction, bool onlyRequireTargetIds, QgsProcessingFeedback *feedback, QgsExpressionContext &expressionContext );
38
39 private:
40 void processByIteratingOverTargetSource( const QgsProcessingContext &context, QgsFeatureSource *targetSource, QgsFeatureSource *referenceSource, double distance, const QgsProperty &distanceProperty, const std::function<void( const QgsFeature & )> &handleFeatureFunction, bool onlyRequireTargetIds, QgsProcessingFeedback *feedback, QgsExpressionContext &expressionContext );
41 void processByIteratingOverReferenceSource( const QgsProcessingContext &context, QgsFeatureSource *targetSource, QgsFeatureSource *referenceSource, double distance, const std::function<void( const QgsFeature & )> &handleFeatureFunction, bool onlyRequireTargetIds, QgsProcessingFeedback *feedback );
42};
43
44
48class QgsSelectWithinDistanceAlgorithm : public QgsDistanceWithinAlgorithm
49{
50 public:
51 QgsSelectWithinDistanceAlgorithm() = default;
52 void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) override;
53 QIcon icon() const override { return QgsApplication::getThemeIcon( QStringLiteral( "/algorithms/mAlgorithmSelectDistance.svg" ) ); }
54 QString svgIconPath() const override { return QgsApplication::iconPath( QStringLiteral( "/algorithms/mAlgorithmSelectDistance.svg" ) ); }
55 QString name() const override;
56 Qgis::ProcessingAlgorithmFlags flags() const override;
57 QString displayName() const override;
58 QStringList tags() const override;
59 QString group() const override;
60 QString groupId() const override;
61 QString shortHelpString() const override;
62 QgsSelectWithinDistanceAlgorithm *createInstance() const override SIP_FACTORY;
63
64 protected:
65 QVariantMap processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
66};
67
71class QgsExtractWithinDistanceAlgorithm : public QgsDistanceWithinAlgorithm
72{
73 public:
74 QgsExtractWithinDistanceAlgorithm() = default;
75 void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) override;
76 QString name() const override;
77 QString displayName() const override;
78 QStringList tags() const override;
79 QString group() const override;
80 QString groupId() const override;
81 QString shortHelpString() const override;
82 QgsExtractWithinDistanceAlgorithm *createInstance() const override SIP_FACTORY;
83
84 protected:
85 QVariantMap processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
86};
87
89
90#endif // QGSALGORITHMDISTANCEWITHIN_H
QFlags< ProcessingAlgorithmFlag > ProcessingAlgorithmFlags
Flags indicating how and when an algorithm operates and should be exposed to users.
Definition qgis.h:3392
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