QGIS API Documentation 4.1.0-Master (5bf3c20f3c9)
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 prepareAlgorithmTransectParameters( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) = 0;
72
77 QVariantMap processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) final;
78
83 virtual std::vector<QgsPoint> generateSamplingPoints( const QgsLineString &line, const QVariantMap &parameters, QgsProcessingContext &context ) = 0;
84
89 virtual double calculateAzimuth( const QgsLineString &line, const QgsPoint &point, int pointIndex ) = 0;
90
94 static QgsGeometry calcTransect( const QgsPoint &point, double angleAtVertex, double length, Side orientation, double angle, Direction direction );
95
96 // Shared member variables accessible to subclasses
97 Side mOrientation = Both;
98 double mAngle = 90.0;
99 double mLength = 5.0;
100 bool mDynamicAngle = false;
101 bool mDynamicLength = false;
102 Direction mDirection = RightToLeft;
103 QgsProperty mAngleProperty;
104 QgsProperty mLengthProperty;
105};
106
108
109#endif // QGSALGORITHMTRANSECTBASE_H
QFlags< ProcessingAlgorithmDocumentationFlag > ProcessingAlgorithmDocumentationFlags
Flags describing algorithm behavior for documentation purposes.
Definition qgis.h:3745
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.