QGIS API Documentation 3.99.0-Master (c22de0620c0)
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
22#include "qgis_sip.h"
24
25#define SIP_NO_FILE
26
28
32class QgsTransectAlgorithmBase : public QgsProcessingAlgorithm
33{
34 public:
38 enum Side
39 {
40 Left,
41 Right,
42 Both
43 };
44
48 enum Direction
49 {
50 RightToLeft,
51 LeftToRight
52 };
53
54 QString group() const final;
55 QString groupId() const final;
56 QStringList tags() const override;
57 QString shortDescription() const override;
59 void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) final;
60
61 protected:
66 virtual void addAlgorithmParams() = 0;
67
71 virtual bool
72 prepareAlgorithmTransectParameters( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback )
73 = 0;
74
79 QVariantMap processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) final;
80
85 virtual std::vector<QgsPoint>
86 generateSamplingPoints( const QgsLineString &line, const QVariantMap &parameters, QgsProcessingContext &context ) = 0;
87
92 virtual double calculateAzimuth( const QgsLineString &line, const QgsPoint &point, int pointIndex ) = 0;
93
97 static QgsGeometry calcTransect( const QgsPoint &point, double angleAtVertex, double length, Side orientation, double angle, Direction direction );
98
99 // Shared member variables accessible to subclasses
100 Side mOrientation = Both;
101 double mAngle = 90.0;
102 double mLength = 5.0;
103 bool mDynamicAngle = false;
104 bool mDynamicLength = false;
105 Direction mDirection = RightToLeft;
106 QgsProperty mAngleProperty;
107 QgsProperty mLengthProperty;
108};
109
111
112#endif // QGSALGORITHMTRANSECTBASE_H
QFlags< ProcessingAlgorithmDocumentationFlag > ProcessingAlgorithmDocumentationFlags
Flags describing algorithm behavior for documentation purposes.
Definition qgis.h:3716
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.