QGIS API Documentation 3.99.0-Master (357b655ed83)
Loading...
Searching...
No Matches
qgsalgorithmtransectbase.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsalgorithmtransectbase.h
3 -------------------------
4 begin : September 2025
5 copyright : (C) 2025 by Loïc Bartoletti
6 email : loic dot bartoletti at oslandia 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 QGSALGORITHMTRANSECTBASE_H
19#define QGSALGORITHMTRANSECTBASE_H
20
21#define SIP_NO_FILE
22
23#include "qgis_sip.h"
25
27
31class QgsTransectAlgorithmBase : public QgsProcessingAlgorithm
32{
33 public:
37 enum Side
38 {
39 Left,
40 Right,
41 Both
42 };
43
47 enum Direction
48 {
49 RightToLeft,
50 LeftToRight
51 };
52
53 QString group() const final;
54 QString groupId() const final;
55 QStringList tags() const override;
56 QString shortDescription() const override;
58 void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) final;
59
60 protected:
65 virtual void addAlgorithmParams() = 0;
66
70 virtual bool
71 prepareAlgorithmTransectParameters( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback )
72 = 0;
73
78 QVariantMap processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) final;
79
84 virtual std::vector<QgsPoint>
85 generateSamplingPoints( const QgsLineString &line, const QVariantMap &parameters, QgsProcessingContext &context ) = 0;
86
91 virtual double calculateAzimuth( const QgsLineString &line, const QgsPoint &point, int pointIndex ) = 0;
92
96 static QgsGeometry calcTransect( const QgsPoint &point, double angleAtVertex, double length, Side orientation, double angle, Direction direction );
97
98 // Shared member variables accessible to subclasses
99 Side mOrientation = Both;
100 double mAngle = 90.0;
101 double mLength = 5.0;
102 bool mDynamicAngle = false;
103 bool mDynamicLength = false;
104 Direction mDirection = RightToLeft;
105 QgsProperty mAngleProperty;
106 QgsProperty mLengthProperty;
107};
108
110
111#endif // QGSALGORITHMTRANSECTBASE_H
QFlags< ProcessingAlgorithmDocumentationFlag > ProcessingAlgorithmDocumentationFlags
Flags describing algorithm behavior for documentation purposes.
Definition qgis.h:3701
A geometry is the spatial representation of a feature.
Line string geometry type, with support for z-dimension and m-values.
Point geometry type, with support for z-dimension and m-values.
Definition qgspoint.h:53
Abstract base class for processing algorithms.
virtual QString group() const
Returns the name of the group this algorithm belongs to.
virtual QString groupId() const
Returns the unique ID of the group this algorithm belongs to.
virtual QString shortDescription() const
Returns an optional translated short description of the algorithm.
virtual QVariantMap processAlgorithm(const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback)=0
Runs the algorithm using the specified parameters.
virtual QStringList tags() const
Returns a list of tags which relate to the algorithm, and are used to assist users in searching for s...
virtual void initAlgorithm(const QVariantMap &configuration=QVariantMap())=0
Initializes the algorithm using the specified configuration.
virtual Qgis::ProcessingAlgorithmDocumentationFlags documentationFlags() const
Returns the flags describing algorithm behavior for documentation purposes.
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.