QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
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 "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 QVector< QgsAbstractProfileResults::Feature > asFeatures( Qgis::ProfileExportType type, QgsFeedback *feedback = nullptr ) const override;
99 void renderResults( QgsProfileRenderContext &context ) override;
100 QgsProfileSnapResult snapPoint( const QgsProfilePoint &point, const QgsProfileSnapContext &context ) override;
101 QVector<QgsProfileIdentifyResults> identify( const QgsProfilePoint &point, const QgsProfileIdentifyContext &context ) override;
102 QVector<QgsProfileIdentifyResults> identify( const QgsDoubleRange &distanceRange, const QgsDoubleRange &elevationRange, const QgsProfileIdentifyContext &context ) override;
103 void copyPropertiesFromGenerator( const QgsAbstractProfileGenerator *generator ) override;
104
105 private:
106
107 GEOSSTRtree *mPointIndex = nullptr;
108 QPointer< QgsPointCloudLayer > mLayer;
110 std::unique_ptr< QgsCurve > mProfileCurve;
111 double mTolerance = 0;
112 double mZOffset = 0;
113 double mZScale = 1.0;
114 double mMaxErrorInLayerCoordinates = 0;
115 QString mLayerId;
116
118};
119
120
129{
130
131 public:
132
137
139
140 QString sourceId() const override;
141 Qgis::ProfileGeneratorFlags flags() const override;
142 bool generateProfile( const QgsProfileGenerationContext &context = QgsProfileGenerationContext() ) override;
143 QgsAbstractProfileResults *takeResults() override;
144 QgsFeedback *feedback() const override;
145
146 private:
147 QVector<IndexedPointCloudNode> traverseTree( const QgsPointCloudIndex *pc, IndexedPointCloudNode n, double maxErrorPixels, double nodeErrorPixels, const QgsDoubleRange &zRange );
148 int visitNodesSync( const QVector<IndexedPointCloudNode> &nodes, QgsPointCloudIndex *pc, QgsPointCloudRequest &request, const QgsDoubleRange &zRange );
149 int visitNodesAsync( const QVector<IndexedPointCloudNode> &nodes, QgsPointCloudIndex *pc, QgsPointCloudRequest &request, const QgsDoubleRange &zRange );
150 void visitBlock( const QgsPointCloudBlock *block, const QgsDoubleRange &zRange );
151
152 QPointer< QgsPointCloudLayer > mLayer;
153 QgsPointCloudAttributeCollection mLayerAttributes;
154 std::unique_ptr< QgsPointCloudRenderer > mRenderer;
155 double mMaximumScreenError = 0.3;
156 Qgis::RenderUnit mMaximumScreenErrorUnit = Qgis::RenderUnit::Millimeters;
157
158 double mPointSize = 1;
161 QColor mPointColor;
162 bool mOpacityByDistanceEffect = false;
163
164 QString mId;
165 std::unique_ptr<QgsFeedback> mFeedback = nullptr;
166
167 std::unique_ptr< QgsCurve > mProfileCurve;
168
169 double mTolerance = 0;
170
173 QgsCoordinateTransformContext mTransformContext;
174
175 QgsVector3D mScale;
176 QgsVector3D mOffset;
177 double mZOffset = 0;
178 double mZScale = 1.0;
179
180 double mStepDistance = std::numeric_limits<double>::quiet_NaN();
181
182 QgsCoordinateTransform mLayerToTargetTransform;
183
184 std::unique_ptr< QgsAbstractGeometry > mSearchGeometryInLayerCrs;
185 std::unique_ptr< QgsGeos > mSearchGeometryInLayerCrsGeometryEngine;
186 QgsRectangle mMaxSearchExtentInLayerCrs;
187
188 std::unique_ptr< QgsPreparedPointCloudRendererData > mPreparedRendererData;
189
190 std::unique_ptr< QgsPointCloudLayerProfileResults > mResults;
191 QVector< QgsPointCloudLayerProfileResults::PointResult > mGatheredPoints;
192
194
195};
196
197#endif // QGSPOINTCLOUDLAYERPROFILEGENERATOR_H
Represents a indexed point cloud node in octree.
PointCloudSymbol
Rendering symbols for point cloud points.
Definition qgis.h:3942
@ Square
Renders points as squares.
QFlags< ProfileGeneratorFlag > ProfileGeneratorFlags
Definition qgis.h:3920
RenderUnit
Rendering size units.
Definition qgis.h:4839
@ Millimeters
Millimeters.
ProfileExportType
Types of export for elevation profiles.
Definition qgis.h:3929
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:231
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, exception handling*.
Definition qgsgeos.h:137
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.
Class for storage of 3D vectors similar to QVector3D, with the difference that it uses double precisi...
Definition qgsvector3d.h:31
QVector< QgsPoint > QgsPointSequence