QGIS API Documentation 3.41.0-Master (02257426e5a)
Loading...
Searching...
No Matches
qgspointcloudlayerprofilegenerator.h
Go to the documentation of this file.
1/***************************************************************************
2 qgspointcloudlayerprofilegenerator.h
3 ---------------
4 begin : April 2022
5 copyright : (C) 2022 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#ifndef QGSPOINTCLOUDLAYERPROFILEGENERATOR_H
18#define QGSPOINTCLOUDLAYERPROFILEGENERATOR_H
19
20#include "qgis_core.h"
21#include "qgis_sip.h"
27#include "qgslinesymbol.h"
28#include "qgspointcloudindex.h"
30#include "qgsvector3d.h"
31#include "qgsgeos.h"
32
33#include <geos_c.h>
34#include <memory>
35
37class QgsCurve;
46class QgsGeos;
48
49#define SIP_NO_FILE
50
51
60{
61
62 public:
63
66
68 {
69 double x = 0;
70 double y = 0;
71 double z = 0;
72 double distanceAlongCurve = 0;
73 double distanceFromCurve = 0; // only used when the opacity by distance effect is enabled
74 QRgb color;
75 };
76
80 void finalize( QgsFeedback *feedback );
81
82 std::vector< PointResult > results;
83 double tolerance = 0;
84
85 double minZ = std::numeric_limits< double >::max();
86 double maxZ = std::numeric_limits< double >::lowest();
87
88 double pointSize = 1;
91 bool respectLayerColors = true;
92 QColor pointColor;
93 bool opacityByDistanceEffect = false;
94
95 QString type() const override;
96 QMap< double, double > distanceToHeightMap() const override;
97 QgsDoubleRange zRange() const override;
98 QgsPointSequence sampledPoints() const override;
99 QVector< QgsGeometry > asGeometries() const override;
100 QVector< QgsAbstractProfileResults::Feature > asFeatures( Qgis::ProfileExportType type, QgsFeedback *feedback = nullptr ) const override;
101 void renderResults( QgsProfileRenderContext &context ) override;
102 QgsProfileSnapResult snapPoint( const QgsProfilePoint &point, const QgsProfileSnapContext &context ) override;
103 QVector<QgsProfileIdentifyResults> identify( const QgsProfilePoint &point, const QgsProfileIdentifyContext &context ) override;
104 QVector<QgsProfileIdentifyResults> identify( const QgsDoubleRange &distanceRange, const QgsDoubleRange &elevationRange, const QgsProfileIdentifyContext &context ) override;
105 void copyPropertiesFromGenerator( const QgsAbstractProfileGenerator *generator ) override;
106
107 private:
108
109 GEOSSTRtree *mPointIndex = nullptr;
110 QPointer< QgsPointCloudLayer > mLayer;
112 std::unique_ptr< QgsCurve > mProfileCurve;
113 double mTolerance = 0;
114 double mZOffset = 0;
115 double mZScale = 1.0;
116 double mMaxErrorInLayerCoordinates = 0;
117 QString mLayerId;
118
120};
121
122
131{
132
133 public:
134
139
141
142 QString sourceId() const override;
143 Qgis::ProfileGeneratorFlags flags() const override;
144 bool generateProfile( const QgsProfileGenerationContext &context = QgsProfileGenerationContext() ) override;
145 QgsAbstractProfileResults *takeResults() override;
146 QgsFeedback *feedback() const override;
147
148 private:
149 QVector<QgsPointCloudNodeId> traverseTree( const QgsPointCloudIndex &pc, QgsPointCloudNodeId n, double maxErrorPixels, double nodeErrorPixels, const QgsDoubleRange &zRange );
150 int visitNodesSync( const QVector<QgsPointCloudNodeId> &nodes, QgsPointCloudIndex &pc, QgsPointCloudRequest &request, const QgsDoubleRange &zRange );
151 int visitNodesAsync( const QVector<QgsPointCloudNodeId> &nodes, QgsPointCloudIndex &pc, QgsPointCloudRequest &request, const QgsDoubleRange &zRange );
152 void visitBlock( const QgsPointCloudBlock *block, const QgsDoubleRange &zRange );
153
154 QPointer< QgsPointCloudLayer > mLayer;
155 QgsPointCloudIndex mIndex;
156 const QVector< QgsPointCloudSubIndex > mSubIndexes;
157 QgsPointCloudAttributeCollection mLayerAttributes;
158 std::unique_ptr< QgsPointCloudRenderer > mRenderer;
159 double mMaximumScreenError = 0.3;
160 Qgis::RenderUnit mMaximumScreenErrorUnit = Qgis::RenderUnit::Millimeters;
161
162 double mPointSize = 1;
165 QColor mPointColor;
166 bool mOpacityByDistanceEffect = false;
167
168 QString mId;
169 std::unique_ptr<QgsFeedback> mFeedback = nullptr;
170
171 std::unique_ptr< QgsCurve > mProfileCurve;
172
173 double mTolerance = 0;
174
177 QgsCoordinateTransformContext mTransformContext;
178
179 QgsVector3D mScale;
180 QgsVector3D mOffset;
181 double mZOffset = 0;
182 double mZScale = 1.0;
183
184 double mStepDistance = std::numeric_limits<double>::quiet_NaN();
185
186 QgsCoordinateTransform mLayerToTargetTransform;
187
188 std::unique_ptr< QgsAbstractGeometry > mSearchGeometryInLayerCrs;
189 std::unique_ptr< QgsGeos > mSearchGeometryInLayerCrsGeometryEngine;
190 QgsRectangle mMaxSearchExtentInLayerCrs;
191
192 std::unique_ptr< QgsPreparedPointCloudRendererData > mPreparedRendererData;
193
194 std::unique_ptr< QgsPointCloudLayerProfileResults > mResults;
195 QVector< QgsPointCloudLayerProfileResults::PointResult > mGatheredPoints;
196
198
199};
200
201#endif // QGSPOINTCLOUDLAYERPROFILEGENERATOR_H
PointCloudSymbol
Rendering symbols for point cloud points.
Definition qgis.h:4013
@ Square
Renders points as squares.
QFlags< ProfileGeneratorFlag > ProfileGeneratorFlags
Definition qgis.h:3991
RenderUnit
Rendering size units.
Definition qgis.h:4910
@ Millimeters
Millimeters.
ProfileExportType
Types of export for elevation profiles.
Definition qgis.h:4000
Abstract base class for objects which generate elevation profiles.
Abstract base class for storage of elevation profiles.
virtual QgsDoubleRange zRange() const =0
Returns the range of the retrieved elevation values.
virtual void renderResults(QgsProfileRenderContext &context)=0
Renders the results to the specified context.
virtual QMap< double, double > distanceToHeightMap() const =0
Returns the map of distance (chainage) to height.
virtual QString type() const =0
Returns the unique string identifier for the results type.
virtual QVector< QgsAbstractProfileResults::Feature > asFeatures(Qgis::ProfileExportType type, QgsFeedback *feedback=nullptr) const
Returns a list of features representing the calculated elevation results.
virtual QgsPointSequence sampledPoints() const =0
Returns a list of sampled points, with their calculated elevation as the point z value.
virtual QgsProfileSnapResult snapPoint(const QgsProfilePoint &point, const QgsProfileSnapContext &context)
Snaps a point to the generated elevation profile.
virtual QVector< QgsProfileIdentifyResults > identify(const QgsProfilePoint &point, const QgsProfileIdentifyContext &context)
Identify results visible at the specified profile point.
virtual QVector< QgsGeometry > asGeometries() const =0
Returns a list of geometries representing the calculated elevation results.
virtual void copyPropertiesFromGenerator(const QgsAbstractProfileGenerator *generator)
Copies properties from specified generator to the results object.
Abstract base class for terrain providers.
This class represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
Class for doing transforms between two map coordinate systems.
Abstract base class for curved geometry type.
Definition qgscurve.h:35
QgsRange which stores a range of double values.
Definition qgsrange.h:237
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition qgsfeedback.h:44
Does vector analysis using the GEOS library and handles import, export, and exception handling.
Definition qgsgeos.h:139
Collection of point cloud attributes.
Base class for storing raw data from point cloud nodes.
Smart pointer for QgsAbstractPointCloudIndex.
Implementation of QgsAbstractProfileGenerator for point cloud layers.
Implementation of QgsAbstractProfileResults for point cloud layers.
Represents a map layer supporting display of point clouds.
Represents a indexed point cloud node's position in octree.
Abstract base class for 2d point cloud renderers.
Point cloud data request.
Base class for 2d point cloud renderer prepared data containers.
Encapsulates the context in which an elevation profile is to be generated.
Encapsulates the context of identifying profile results.
Encapsulates a point on a distance-elevation profile.
Abstract base class for storage of elevation profiles.
Encapsulates properties and constraints relating to fetching elevation profiles from different source...
Encapsulates the context of snapping a profile point.
Encapsulates results of snapping a profile point.
A rectangle specified with double values.
Class for storage of 3D vectors similar to QVector3D, with the difference that it uses double precisi...
Definition qgsvector3d.h:31
QVector< QgsPoint > QgsPointSequence