QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
qgsalgorithmdrape.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsalgorithmdrape.h
3 ---------------------
4 begin : November 2017
5 copyright : (C) 2017 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 QGSALGORITHMDRAPE_H
19#define QGSALGORITHMDRAPE_H
20
21#define SIP_NO_FILE
22
23#include "qgis_sip.h"
25
27
31class QgsDrapeAlgorithmBase : public QgsProcessingFeatureBasedAlgorithm
32{
33
34 public:
35
36 QString group() const override;
37 QString groupId() const override;
38 void initParameters( const QVariantMap &configuration = QVariantMap() ) override;
39
40 protected:
41 QString outputName() const override;
42 bool prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
43 QgsFeatureList processFeature( const QgsFeature &feature, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
44
45 private:
46
47 virtual void prepareGeometry( QgsGeometry &geometry, double defaultVal ) const = 0;
48 virtual QgsPoint drapeVertex( const QgsPoint &vertex, double rasterVal ) const = 0;
49
50 double mNoData = 0.0;
51 bool mDynamicNoData = false;
52 QgsProperty mNoDataProperty;
53
54 double mScale = 1.0;
55 bool mDynamicScale = false;
56 QgsProperty mScaleProperty;
57
58 double mOffset = 0.0;
59 bool mDynamicOffset = false;
60 QgsProperty mOffsetProperty;
61
62 std::unique_ptr< QgsRasterDataProvider > mRasterProvider;
63 int mBand = 1;
64 QgsRectangle mRasterExtent;
65 bool mCreatedTransform = false;
66 QgsCoordinateTransform mTransform;
67
68};
69
70class QgsDrapeToZAlgorithm : public QgsDrapeAlgorithmBase
71{
72 public:
73
74 QString name() const override;
75 QString displayName() const override;
76 QStringList tags() const override;
77 QString shortHelpString() const override;
78 QString shortDescription() const override;
79 QgsDrapeToZAlgorithm *createInstance() const override SIP_FACTORY;
80 bool supportInPlaceEdit( const QgsMapLayer *layer ) const override;
81
82 protected:
83
84 QgsWkbTypes::Type outputWkbType( QgsWkbTypes::Type inputWkbType ) const override;
85
86 private:
87 void prepareGeometry( QgsGeometry &geometry, double defaultVal ) const override;
88 QgsPoint drapeVertex( const QgsPoint &vertex, double rasterVal ) const override;
89
90
91};
92
93
94class QgsDrapeToMAlgorithm : public QgsDrapeAlgorithmBase
95{
96 public:
97
98 QString name() const override;
99 QString displayName() const override;
100 QStringList tags() const override;
101 QString shortHelpString() const override;
102 QString shortDescription() const override;
103 QgsDrapeToMAlgorithm *createInstance() const override SIP_FACTORY;
104 bool supportInPlaceEdit( const QgsMapLayer *layer ) const override;
105
106 protected:
107
108 QgsWkbTypes::Type outputWkbType( QgsWkbTypes::Type inputWkbType ) const override;
109
110 private:
111 void prepareGeometry( QgsGeometry &geometry, double defaultVal ) const override;
112 QgsPoint drapeVertex( const QgsPoint &vertex, double rasterVal ) const override;
113
114};
115
117
118#endif // QGSALGORITHMDRAPE_H
119
120
Class for doing transforms between two map coordinate systems.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition: qgsfeature.h:56
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:164
Base class for all map layer types.
Definition: qgsmaplayer.h:73
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:49
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 bool prepareAlgorithm(const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback) SIP_THROW(QgsProcessingException)
Prepares the algorithm to run using the specified parameters.
Contains information about the context in which a processing algorithm is executed.
An abstract QgsProcessingAlgorithm base class for processing algorithms which operate "feature-by-fea...
virtual void initParameters(const QVariantMap &configuration=QVariantMap())
Initializes any extra parameters added by the algorithm subclass.
virtual QString outputName() const =0
Returns the translated, user visible name for any layers created by this algorithm.
virtual QgsFeatureList processFeature(const QgsFeature &feature, QgsProcessingContext &context, QgsProcessingFeedback *feedback) SIP_THROW(QgsProcessingException)=0
Processes an individual input feature from the source.
Base class for providing feedback from a processing algorithm.
A store for object properties.
Definition: qgsproperty.h:230
A rectangle specified with double values.
Definition: qgsrectangle.h:42
Handles storage of information regarding WKB types and their properties.
Definition: qgswkbtypes.h:42
#define SIP_FACTORY
Definition: qgis_sip.h:76
QList< QgsFeature > QgsFeatureList
Definition: qgsfeature.h:922