QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
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 "qgsvector3d.h"
29#include "qgsgeos.h"
30
31#include <geos_c.h>
32#include <memory>
33
35class QgsCurve;
44class QgsGeos;
46
47#define SIP_NO_FILE
48
49
58{
59
60 public:
61
64
66 {
67 double x = 0;
68 double y = 0;
69 double z = 0;
70 double distanceAlongCurve = 0;
71 double distanceFromCurve = 0; // only used when the opacity by distance effect is enabled
72 QRgb color;
73 };
74
78 void finalize( QgsFeedback *feedback );
79
80 std::vector< PointResult > results;
81 double tolerance = 0;
82
83 double minZ = std::numeric_limits< double >::max();
84 double maxZ = std::numeric_limits< double >::lowest();
85
86 double pointSize = 1;
89 bool respectLayerColors = true;
90 QColor pointColor;
91 bool opacityByDistanceEffect = false;
92
93 QString type() const override;
94 QMap< double, double > distanceToHeightMap() const override;
95 QgsDoubleRange zRange() const override;
96 QgsPointSequence sampledPoints() const override;
97 QVector< QgsGeometry > asGeometries() const override;
98 void renderResults( QgsProfileRenderContext &context ) override;
99 QgsProfileSnapResult snapPoint( const QgsProfilePoint &point, const QgsProfileSnapContext &context ) override;
100 QVector<QgsProfileIdentifyResults> identify( const QgsProfilePoint &point, const QgsProfileIdentifyContext &context ) override;
101 QVector<QgsProfileIdentifyResults> identify( const QgsDoubleRange &distanceRange, const QgsDoubleRange &elevationRange, const QgsProfileIdentifyContext &context ) override;
102 void copyPropertiesFromGenerator( const QgsAbstractProfileGenerator *generator ) override;
103
104 private:
105
106 GEOSSTRtree *mPointIndex = nullptr;
107 QPointer< QgsPointCloudLayer > mLayer;
109 std::unique_ptr< QgsCurve > mProfileCurve;
110 double mTolerance = 0;
111 double mZOffset = 0;
112 double mZScale = 1.0;
113 double mMaxErrorInLayerCoordinates = 0;
114
116};
117
118
127{
128
129 public:
130
135
137
138 QString sourceId() const override;
139 Qgis::ProfileGeneratorFlags flags() const override;
140 bool generateProfile( const QgsProfileGenerationContext &context = QgsProfileGenerationContext() ) override;
141 QgsAbstractProfileResults *takeResults() override;
142 QgsFeedback *feedback() const override;
143
144 private:
145 QVector<IndexedPointCloudNode> traverseTree( const QgsPointCloudIndex *pc, IndexedPointCloudNode n, double maxErrorPixels, double nodeErrorPixels, const QgsDoubleRange &zRange );
146 int visitNodesSync( const QVector<IndexedPointCloudNode> &nodes, QgsPointCloudIndex *pc, QgsPointCloudRequest &request, const QgsDoubleRange &zRange );
147 int visitNodesAsync( const QVector<IndexedPointCloudNode> &nodes, QgsPointCloudIndex *pc, QgsPointCloudRequest &request, const QgsDoubleRange &zRange );
148 void visitBlock( const QgsPointCloudBlock *block, const QgsDoubleRange &zRange );
149
150 QPointer< QgsPointCloudLayer > mLayer;
151 QgsPointCloudAttributeCollection mLayerAttributes;
152 std::unique_ptr< QgsPointCloudRenderer > mRenderer;
153 double mMaximumScreenError = 0.3;
155
156 double mPointSize = 1;
159 QColor mPointColor;
160 bool mOpacityByDistanceEffect = false;
161
162 QString mId;
163 std::unique_ptr<QgsFeedback> mFeedback = nullptr;
164
165 std::unique_ptr< QgsCurve > mProfileCurve;
166
167 double mTolerance = 0;
168
171 QgsCoordinateTransformContext mTransformContext;
172
173 QgsVector3D mScale;
174 QgsVector3D mOffset;
175 double mZOffset = 0;
176 double mZScale = 1.0;
177
178 double mStepDistance = std::numeric_limits<double>::quiet_NaN();
179
180 QgsCoordinateTransform mLayerToTargetTransform;
181
182 std::unique_ptr< QgsAbstractGeometry > mSearchGeometryInLayerCrs;
183 std::unique_ptr< QgsGeos > mSearchGeometryInLayerCrsGeometryEngine;
184 QgsRectangle mMaxSearchExtentInLayerCrs;
185
186 std::unique_ptr< QgsPreparedPointCloudRendererData > mPreparedRendererData;
187
188 std::unique_ptr< QgsPointCloudLayerProfileResults > mResults;
189 QVector< QgsPointCloudLayerProfileResults::PointResult > mGatheredPoints;
190
192
193};
194
195#endif // QGSPOINTCLOUDLAYERPROFILEGENERATOR_H
Represents a indexed point cloud node in octree.
PointCloudSymbol
Rendering symbols for point cloud points.
Definition: qgis.h:2058
@ Square
Renders points as squares.
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 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:36
QgsRange which stores a range of double values.
Definition: qgsrange.h:203
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition: qgsfeedback.h:45
Does vector analysis using the geos library and handles import, export, exception handling*.
Definition: qgsgeos.h:99
Collection of point cloud attributes.
Base class for storing raw data from point cloud nodes.
Represents a indexed point clouds data in octree.
Implementation of QgsAbstractProfileGenerator for point cloud layers.
Implementation of QgsAbstractProfileResults for point cloud layers.
Represents a map layer supporting display of point clouds.
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.
Definition: qgsrectangle.h:42
RenderUnit
Rendering size units.
Definition: qgsunittypes.h:168
@ RenderMillimeters
Millimeters.
Definition: qgsunittypes.h:169
QVector< QgsPoint > QgsPointSequence