19#include "delaunator.hpp"
39using namespace Qt::StringLiterals;
53 mPointIndex =
nullptr;
60 const std::size_t size =
results.size();
62 for ( std::size_t i = 0; i < size; ++i, ++pointData )
69 GEOSSTRtree_insert_r( geosctxt, mPointIndex, geosPoint.get(), pointData );
76 return u
"pointcloud"_s;
82 QMap< double, double > res;
85 res.insert( point.distanceAlongCurve, point.z );
97 res.append(
QgsPoint( point.x, point.y, point.z ) );
105 QVector< QgsGeometry > res;
116 QVector< QgsAbstractProfileResults::Feature > res;
117 res.reserve(
static_cast< int >(
results.size() ) );
142 f.
geometry =
QgsGeometry( std::make_unique< QgsPoint >( point.distanceAlongCurve, point.z ) );
159 { u
"distance"_s, point.distanceAlongCurve },
160 { u
"elevation"_s, point.z }
185 painter->setBrush( Qt::NoBrush );
186 painter->setPen( Qt::NoPen );
204 const QRectF visibleRegion( minDistance,
minZ, maxDistance - minDistance,
maxZ -
minZ );
205 QPainterPath clipPath;
206 clipPath.addPolygon( context.
worldTransform().map( visibleRegion ) );
207 painter->setClipPath( clipPath, Qt::ClipOperation::IntersectClip );
213 QPointF p = context.
worldTransform().map( QPointF( point.distanceAlongCurve, point.z ) );
216 color.setAlphaF( color.alphaF() * ( 1.0 - std::pow( point.distanceFromCurve /
tolerance, 0.5 ) ) );
221 painter->fillRect( QRectF( p.x() - penWidth * 0.5,
222 p.y() - penWidth * 0.5,
223 penWidth, penWidth ), color );
227 painter->setBrush( QBrush( color ) );
228 painter->setPen( Qt::NoPen );
229 painter->drawEllipse( QRectF( p.x() - penWidth * 0.5,
230 p.y() - penWidth * 0.5,
231 penWidth, penWidth ) );
239 QList< const QgsPointCloudLayerProfileResults::PointResult * > *
list;
257 GEOSCoordSequence *coord = GEOSCoordSeq_create_r( geosctxt, 2, 2 );
258 GEOSCoordSeq_setXY_r( geosctxt, coord, 0, minDistance, minElevation );
259 GEOSCoordSeq_setXY_r( geosctxt, coord, 1, maxDistance, maxElevation );
260 geos::unique_ptr searchDiagonal( GEOSGeom_createLineString_r( geosctxt, coord ) );
262 QList<const PointResult *> items;
264 callbackData.
list = &items;
265 GEOSSTRtree_query_r( geosctxt, mPointIndex, searchDiagonal.get(),
_GEOSQueryCallback, &callbackData );
269 double bestMatchDistance = std::numeric_limits< double >::max();
271 for (
const PointResult *candidate : std::as_const( items ) )
273 const double distance = std::sqrt( std::pow( candidate->distanceAlongCurve - point.
distance(), 2 )
275 if ( distance < bestMatchDistance )
277 bestMatchDistance = distance;
278 bestMatch = candidate;
299 std::unique_ptr< QgsCurve > substring( mProfileCurve->curveSubstring( distanceRange.
lower(), distanceRange.
upper() ) );
300 QgsGeos substringGeos( substring.get() );
302 if ( !searchGeometry )
308 searchGeometry->transform( curveToLayerTransform );
316 const QgsDoubleRange providerElevationRange( ( elevationRange.
lower() - mZOffset ) / mZScale, ( elevationRange.
upper() - mZOffset ) / mZScale );
318 const QgsGeometry pointCloudSearchGeometry( std::move( searchGeometry ) );
319 const QVector<QVariantMap> pointAttributes = mLayer->dataProvider()->identify( mMaxErrorInLayerCoordinates, pointCloudSearchGeometry, providerElevationRange );
320 if ( pointAttributes.empty() )
337 mLayer = pcGenerator->
mLayer;
338 mLayerId = pcGenerator->
mId;
344 mZScale = pcGenerator->
mZScale;
353 ,
mIndex( layer->index() )
354 ,
mSubIndexes( layer->dataProvider()->subIndexes() )
366 ,
mZOffset( layer->elevationProperties()->zOffset() )
367 ,
mZScale( layer->elevationProperties()->zScale() )
369 ,
mProfileCurve( request.profileCurve() ? request.profileCurve()->clone() : nullptr )
377 maxErrorInLayerCoordinates = 0;
379 QVector<QgsPointCloudIndex> indexes;
385 for (
const QgsPointCloudSubIndex &subidx :
mSubIndexes )
388 if ( index && index.
isValid() && subidx.polygonBounds().intersects( profileCurveBbox ) )
389 indexes.append( subidx.index() );
392 if ( indexes.empty() )
395 std::unique_ptr< QgsAbstractGeometry > searchGeometryInLayerCrs;
405 QgsDebugError( u
"Error transforming profile line to layer CRS"_s );
414 const QgsRectangle maxSearchExtentInLayerCrs = searchGeometryInLayerCrs->boundingBox();
428 for (
const QString &attribute : std::as_const( rendererAttributes ) )
430 if ( attributes.
indexOf( attribute ) >= 0 )
434 if ( layerIndex < 0 )
436 QgsMessageLog::logMessage( QObject::tr(
"Required attribute %1 not found in layer" ).arg( attribute ), QObject::tr(
"Point Cloud" ) );
466 QgsDebugError( u
"Could not transform node extent to curve CRS"_s );
467 rootNodeExtentInCurveCrs = rootNodeExtentLayerCoords;
470 const double rootErrorInMapCoordinates = rootNodeExtentInCurveCrs.
width() / pc.span();
471 if ( rootErrorInMapCoordinates < 0.0 )
477 double rootErrorPixels = rootErrorInMapCoordinates / mapUnitsPerPixel;
478 gatherPoints( pc, request, maximumErrorPixels, rootErrorPixels, zRange, maxSearchExtentInLayerCrs );
483 const double rootErrorInLayerCoordinates = rootNodeExtentLayerCoords.
width() / pc.span();
484 const double maxErrorInMapCoordinates = maximumErrorPixels * mapUnitsPerPixel;
486 maxErrorInLayerCoordinates = std::max( maxErrorInLayerCoordinates, maxErrorInMapCoordinates * rootErrorInLayerCoordinates / rootErrorInMapCoordinates );
497 QVector<QgsPointCloudNodeId> nodes;
520 double childrenErrorPixels = nodeErrorPixels / 2.0;
521 if ( childrenErrorPixels < maxErrorPixels )
526 nodes +=
traverseTree( pc, nn, maxErrorPixels, childrenErrorPixels, zRange, searchExtent );
540 std::unique_ptr<QgsPointCloudBlock> block( pc.
nodeData( n, request ) );
554 if ( nodes.isEmpty() )
562 QVector<QgsPointCloudBlockRequest *> blockRequests;
566 for (
int i = 0; i < nodes.size(); ++i )
571 blockRequests.append( blockRequest );
573 [
this, &nodesDrawn, &loop, &blockRequests, &zRange, nStr, blockRequest ]()
575 blockRequests.removeOne( blockRequest );
578 if ( blockRequests.isEmpty() )
581 std::unique_ptr<QgsPointCloudBlock> block = blockRequest->
takeBlock();
583 blockRequest->deleteLater();
602 if ( !blockRequests.isEmpty() )
609 std::unique_ptr<QgsPointCloudBlock> block = blockRequest->takeBlock();
611 blockRequest->deleteLater();
619 const QVector<QgsPointCloudNodeId> nodes =
traverseTree( pc, pc.
root(), maxErrorPixels, nodeErrorPixels, zRange, searchExtent );
662 return u
"pointcloud"_s;
674 mGatheredPoints.clear();
679 std::unique_ptr< QgsCurve > trimmedCurve;
681 if ( startDistanceOffset > 0 || endDistance < mProfileCurve->length() )
683 trimmedCurve.reset(
mProfileCurve->curveSubstring( startDistanceOffset, endDistance ) );
684 sourceCurve = trimmedCurve.get();
692 if ( maximumErrorPixels < 0.0 )
703 if ( toleranceInPixels / 4 < maximumErrorPixels )
704 maximumErrorPixels = toleranceInPixels / 4;
706 double maxErrorInLayerCrs;
709 if ( mapUnitsPerPixel < 0.0 )
715 QgsGeos originalCurveGeos( sourceCurve );
718 if ( !
collectData( originalCurveGeos, mapUnitsPerPixel, maximumErrorPixels, context.
elevationRange(), maxErrorInLayerCrs ) || mGatheredPoints.empty() )
725 mResults = std::make_unique< QgsPointCloudLayerProfileResults >();
726 mResults->copyPropertiesFromGenerator(
this );
727 mResults->mMaxErrorInLayerCoordinates = maxErrorInLayerCrs;
732 const int size = mGatheredPoints.size();
733 mResults->results.resize( size );
735 for (
int i = 0; i < size; ++i, ++pointData, ++destData )
740 *destData = *pointData;
742 if ( mOpacityByDistanceEffect )
745 mResults->minZ = std::min( destData->
z, mResults->minZ );
746 mResults->maxZ = std::max( destData->
z, mResults->maxZ );
755 return mResults.release();
765 const char *ptr = block->
data();
773 int xOffset = 0, yOffset = 0, zOffset = 0;
778 bool useRenderer =
false;
786 for (
int i = 0; i < count; ++i )
793 QgsPointCloudLayerProfileResults::PointResult res;
794 QgsPointCloudAttribute::getPointXYZ( ptr, i, recordSize, xOffset, xType, yOffset, yType, zOffset, zType, block->
scale(), block->
offset(), res.
x, res.
y, res.
z );
803 if ( !color.isValid() )
806 res.
color = color.rgba();
810 res.
color = mPointColor.rgba();
821 catch ( QgsCsException & )
827 mGatheredPoints.append( res );
835 mSymbology = qgis::down_cast< QgsPointCloudLayerElevationProperties * >( layer->
elevationProperties() )->profileSymbology();
836 mElevationLimit = qgis::down_cast< QgsPointCloudLayerElevationProperties * >( layer->
elevationProperties() )->elevationLimit();
838 mLineSymbol.reset( qgis::down_cast< QgsPointCloudLayerElevationProperties * >( layer->
elevationProperties() )->profileLineSymbol()->clone() );
839 mFillSymbol.reset( qgis::down_cast< QgsPointCloudLayerElevationProperties * >( layer->
elevationProperties() )->profileFillSymbol()->clone() );
844 const char *ptr = block->
data();
852 int xOffset = 0, yOffset = 0, zOffset = 0;
857 bool useRenderer =
false;
865 for (
int i = 0; i < count; ++i )
873 QgsPointCloudAttribute::getPointXYZ( ptr, i, recordSize, xOffset, xType, yOffset, yType, zOffset, zType, block->
scale(), block->
offset(), x, y, z );
881 if ( !color.isValid() )
891 double x = res.
x(), y = res.
y(), z = res.
z();
897 catch ( QgsCsException & )
903 mGatheredPoints.append( res );
915 return u
"triangulatedpointcloud"_s;
922 mGatheredPoints.clear();
927 QgsGeos originalCurveGeos( sourceCurve );
934 if ( maximumErrorPixels < 0.0 )
941 if ( mapUnitsPerPixel < 0.0 )
947 double maxErrorInLayerCrs;
951 if ( mGatheredPoints.size() < 3 )
957 mResults = std::make_unique< QgsTriangulatedPointCloudLayerProfileResults >();
958 mResults->copyPropertiesFromGenerator(
this );
960 std::unique_ptr<delaunator::Delaunator> triangulator;
961 std::vector<double> vertices;
962 std::vector<double> zValues;
964 vertices.reserve( mGatheredPoints.size() * 2 );
965 zValues.reserve( mGatheredPoints.size() );
967 for (
QgsPoint point : mGatheredPoints )
969 vertices.push_back( point.x() );
970 vertices.push_back( point.y() );
971 zValues.push_back( point.z() );
974 triangulator.reset(
new delaunator::Delaunator( vertices ) );
975 const std::vector<size_t> &triangleIndexes = triangulator->triangles;
979 for (
size_t i = 0; i < triangleIndexes.size(); i += 3 )
981 const size_t idx0 = triangleIndexes[i];
982 const size_t idx1 = triangleIndexes[i + 1];
983 const size_t idx2 = triangleIndexes[i + 2];
985 const QgsPoint pt0( vertices[2 * idx0], vertices[2 * idx0 + 1], zValues[idx0] );
986 const QgsPoint pt1( vertices[2 * idx1], vertices[2 * idx1 + 1], zValues[idx1] );
987 const QgsPoint pt2( vertices[2 * idx2], vertices[2 * idx2 + 1], zValues[idx2] );
994 std::unique_ptr<QgsAbstractGeometry> intersectingGeom( geosPoly.
intersection( sourceCurve ) );
995 if ( !intersectingGeom )
1006 if ( std::isnan( z ) )
1009 const double distanceAlong = originalCurveGeos.
lineLocatePoint( p, &lastError );
1010 if ( std::isnan( distanceAlong ) )
1013 QgsPoint profilePoint( p.x(), p.y(), z, distanceAlong );
1014 profilePoints.append( profilePoint );
1021 std::sort( profilePoints.begin(), profilePoints.end(),
1026 for (
const QgsPoint &pp : std::as_const( profilePoints ) )
1028 const double z = pp.z();
1029 const double distanceAlong = pp.m();
1031 mResults->minZ = std::min( z, mResults->minZ );
1032 mResults->maxZ = std::max( z, mResults->maxZ );
1033 mResults->mDistanceToHeightMap.insert( distanceAlong, z );
1034 mResults->mRawPoints.append( pp );
1043 return mResults.release();
1053 return u
"triangulatedpointcloud"_s;
1061 QVector<QgsProfileIdentifyResults> res;
1062 res.reserve( noLayerResults.size() );
1074 mLayer = pcGenerator->
mLayer;
1075 mLayerId = pcGenerator->
mId;
1080 mLineSymbol.reset( pcGenerator->mLineSymbol->clone() );
1081 mFillSymbol.reset( pcGenerator->mFillSymbol->clone() );
1086 mZScale = pcGenerator->
mZScale;
@ RespectsMaximumErrorMapUnit
Generated profile respects the QgsProfileGenerationContext::maximumErrorMapUnits() property.
@ RespectsDistanceRange
Generated profile respects the QgsProfileGenerationContext::distanceRange() property.
@ Circle
Renders points as circles.
@ Square
Renders points as squares.
QFlags< ProfileGeneratorFlag > ProfileGeneratorFlags
@ Round
Use rounded joins.
@ Flat
Flat cap (in line with start/end of line).
@ Local
Local means the source is a local file on the machine.
@ Remote
Remote means it's loaded through a protocol like HTTP.
ProfileExportType
Types of export for elevation profiles.
@ Profile2D
Export profiles as 2D profile lines, with elevation stored in exported geometry Y dimension and dista...
@ Features3D
Export profiles as 3D features, with elevation values stored in exported geometry Z values.
@ DistanceVsElevationTable
Export profiles as a table of sampled distance vs elevation values.
@ Reverse
Reverse/inverse transform (from destination to source).
Abstract base class for objects which generate elevation profiles.
Abstract base class for storage of elevation profiles.
std::unique_ptr< QgsFillSymbol > mFillSymbol
std::unique_ptr< QgsLineSymbol > mLineSymbol
Qgis::ProfileSurfaceSymbology symbology
void renderResults(QgsProfileRenderContext &context) override
Renders the results to the specified context.
QVector< QgsProfileIdentifyResults > identify(const QgsProfilePoint &point, const QgsProfileIdentifyContext &context) override
Identify results visible at the specified profile point.
A 3-dimensional box composed of x, y, z coordinates.
double zMaximum() const
Returns the maximum z value.
QgsRectangle toRectangle() const
Converts the box to a 2D rectangle.
double zMinimum() const
Returns the minimum z value.
Contains information about the context in which a coordinate transform is executed.
Custom exception class for Coordinate Reference System related exceptions.
Abstract base class for curved geometry type.
QgsRange which stores a range of double values.
bool isInfinite() const
Returns true if the range consists of all possible values.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
bool isCanceled() const
Tells whether the operation has been canceled already.
void canceled()
Internal routines can connect to this signal if they use event loop.
static double interpolateZ(const QgsPoint &a, const QgsPoint &b, const QgsPoint &c, double x, double y)
Interpolates the Z value at the given (x, y) location within the triangle defined by points a,...
A geometry is the spatial representation of a feature.
static QgsGeometry fromRect(const QgsRectangle &rect)
Creates a new geometry from a QgsRectangle.
const QgsAbstractGeometry * constGet() const
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
static GEOSContextHandle_t get()
Returns a thread local instance of a GEOS context, safe for use in the current thread.
Does vector analysis using the GEOS library and handles import, export, and exception handling.
QgsAbstractGeometry * intersection(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr, const QgsGeometryParameters ¶meters=QgsGeometryParameters()) const override
Calculate the intersection of this and geom.
QgsAbstractGeometry * buffer(double distance, int segments, QString *errorMsg=nullptr) const override
double distance(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const override
Calculates the distance between this and geom.
void prepareGeometry() override
Prepares the geometry, so that subsequent calls to spatial relation methods are much faster.
double lineLocatePoint(const QgsPoint &point, QString *errorMsg=nullptr) const
Returns a distance representing the location along this linestring of the closest point on this lines...
Line string geometry type, with support for z-dimension and m-values.
QgsPoint startPoint() const override
Returns the starting point of the curve.
QgsPoint endPoint() const override
Returns the end point of the curve.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true, const char *file=__builtin_FILE(), const char *function=__builtin_FUNCTION(), int line=__builtin_LINE())
Adds a message to the log instance (and creates it if necessary).
A collection of point cloud attributes.
void push_back(const QgsPointCloudAttribute &attribute)
Adds extra attribute.
int pointRecordSize() const
Returns total size of record.
const QgsPointCloudAttribute * find(const QString &attributeName, int &offset) const
Finds the attribute with the name.
int indexOf(const QString &name) const
Returns the index of the attribute with the specified name.
Attribute for point cloud data pair of name and size in bytes.
DataType
Systems of unit measurement.
static void getPointXYZ(const char *ptr, int i, std::size_t pointRecordSize, int xOffset, QgsPointCloudAttribute::DataType xType, int yOffset, QgsPointCloudAttribute::DataType yType, int zOffset, QgsPointCloudAttribute::DataType zType, const QgsVector3D &indexScale, const QgsVector3D &indexOffset, double &x, double &y, double &z)
Retrieves the x, y, z values for the point at index i.
DataType type() const
Returns the data type.
Base class for handling loading QgsPointCloudBlock asynchronously.
QString errorStr() const
Returns the error message string of the request.
void finished()
Emitted when the request processing has finished.
std::unique_ptr< QgsPointCloudBlock > takeBlock()
Returns the requested block.
Base class for storing raw data from point cloud nodes.
QgsVector3D scale() const
Returns the custom scale of the block.
const char * data() const
Returns raw pointer to data.
QgsPointCloudAttributeCollection attributes() const
Returns the attributes that are stored in the data block, along with their size.
int pointCount() const
Returns number of points that are stored in the block.
QgsVector3D offset() const
Returns the custom offset of the block.
Smart pointer for QgsAbstractPointCloudIndex.
QgsPointCloudBlockRequest * asyncNodeData(const QgsPointCloudNodeId &n, const QgsPointCloudRequest &request)
Returns a handle responsible for loading a node data block.
bool isValid() const
Returns whether index is loaded and valid.
std::unique_ptr< QgsPointCloudBlock > nodeData(const QgsPointCloudNodeId &n, const QgsPointCloudRequest &request)
Returns node data block.
QgsPointCloudNodeId root() const
Returns root node of the index.
QgsPointCloudNode getNode(const QgsPointCloudNodeId &id) const
Returns object for a given node.
Qgis::PointCloudAccessType accessType() const
Returns the access type of the data If the access type is Remote, data will be fetched from an HTTP s...
Point cloud layer specific subclass of QgsMapLayerElevationProperties.
QVector< QgsPointCloudNodeId > traverseTree(QgsPointCloudIndex &pc, QgsPointCloudNodeId n, double maxErrorPixels, double nodeErrorPixels, const QgsDoubleRange &zRange, const QgsRectangle &searchExtent)
Recursively traverses the point cloud node tree to gather visible nodes.
virtual ~QgsPointCloudLayerProfileGeneratorBase() override
QgsCoordinateTransform mLayerToTargetTransform
std::unique_ptr< QgsPointCloudRenderer > mRenderer
virtual void visitBlock(const QgsPointCloudBlock *block, const QgsDoubleRange &zRange)=0
Visits a point cloud block and collects points within the given Z range and search geometry.
const QVector< QgsPointCloudSubIndex > mSubIndexes
std::unique_ptr< QgsGeos > mSearchGeometryInLayerCrsGeometryEngine
QgsPointCloudIndex mIndex
void gatherPoints(QgsPointCloudIndex &pc, QgsPointCloudRequest &request, double maxErrorPixels, double nodeErrorPixels, const QgsDoubleRange &zRange, const QgsRectangle &searchExtent)
Collects points from the point cloud index within the given extent and Z range.
QgsCoordinateTransformContext mTransformContext
int visitNodesAsync(const QVector< QgsPointCloudNodeId > &nodes, QgsPointCloudIndex &pc, QgsPointCloudRequest &request, const QgsDoubleRange &zRange)
Asynchronously visits point cloud nodes, loading their data and processing valid blocks.
QgsCoordinateReferenceSystem mSourceCrs
double mMaximumScreenError
QgsPointCloudAttributeCollection mLayerAttributes
std::unique_ptr< QgsFeedback > mFeedback
QPointer< QgsPointCloudLayer > mLayer
Qgis::RenderUnit mMaximumScreenErrorUnit
bool collectData(QgsGeos &curve, const double mapUnitsPerPixel, const double maximumErrorPixels, const QgsDoubleRange &zRange, double &maxErrorInLayerCrs)
Collects point cloud data along a curve within the specified range and tolerance.
QgsPointCloudLayerProfileGeneratorBase(QgsPointCloudLayer *layer, const QgsProfileRequest &request)
Constructor for QgsPointCloudLayerProfileGeneratorBase.
std::unique_ptr< QgsPreparedPointCloudRendererData > mPreparedRendererData
std::unique_ptr< QgsCurve > mProfileCurve
QgsCoordinateReferenceSystem mTargetCrs
int visitNodesSync(const QVector< QgsPointCloudNodeId > &nodes, QgsPointCloudIndex &pc, QgsPointCloudRequest &request, const QgsDoubleRange &zRange)
Synchronously visits point cloud nodes and processes their data.
Qgis::ProfileGeneratorFlags flags() const override
Returns flags which reflect how the profile generator operates.
QString type() const override
Returns the unique string identifier for the results type.
QgsPointCloudLayerProfileGenerator(QgsPointCloudLayer *layer, const QgsProfileRequest &request)
Constructor for QgsPointCloudLayerProfileGenerator.
~QgsPointCloudLayerProfileGenerator() override
QString sourceId() const override
Returns a unique identifier representing the source of the profile.
QgsFeedback * feedback() const override
Access to feedback object of the generator (may be nullptr).
QgsAbstractProfileResults * takeResults() override
Takes results from the generator.
bool generateProfile(const QgsProfileGenerationContext &context=QgsProfileGenerationContext()) override
Generate the profile (based on data stored in the class).
Qgis::PointCloudSymbol pointSymbol
QgsProfileSnapResult snapPoint(const QgsProfilePoint &point, const QgsProfileSnapContext &context) override
Snaps a point to the generated elevation profile.
void finalize(QgsFeedback *feedback)
Finalizes results – should be called after last point is added.
QgsPointSequence sampledPoints() const override
Returns a list of sampled points, with their calculated elevation as the point z value.
QgsDoubleRange zRange() const override
Returns the range of the retrieved elevation values.
std::vector< PointResult > results
QMap< double, double > distanceToHeightMap() const override
Returns the map of distance (chainage) to height.
QVector< QgsGeometry > asGeometries() const override
Returns a list of geometries representing the calculated elevation results.
~QgsPointCloudLayerProfileResults() override
void copyPropertiesFromGenerator(const QgsAbstractProfileGenerator *generator) override
Copies properties from specified generator to the results object.
QVector< QgsProfileIdentifyResults > identify(const QgsProfilePoint &point, const QgsProfileIdentifyContext &context) override
Identify results visible at the specified profile point.
friend class QgsPointCloudLayerProfileGenerator
QString type() const override
Returns the unique string identifier for the results type.
bool opacityByDistanceEffect
QgsPointCloudLayerProfileResults()
void renderResults(QgsProfileRenderContext &context) override
Renders the results to the specified context.
QVector< QgsAbstractProfileResults::Feature > asFeatures(Qgis::ProfileExportType type, QgsFeedback *feedback=nullptr) const override
Returns a list of features representing the calculated elevation results.
Qgis::RenderUnit pointSizeUnit
Represents a map layer supporting display of point clouds.
QgsMapLayerElevationProperties * elevationProperties() override
Returns the layer's elevation properties.
Represents an indexed point cloud node's position in octree.
QString toString() const
Encode node to string.
Keeps metadata for an indexed point cloud node.
QList< QgsPointCloudNodeId > children() const
Returns IDs of child nodes.
qint64 pointCount() const
Returns number of points contained in node data.
QgsBox3D bounds() const
Returns node's bounding cube in CRS coords.
Point cloud data request.
void setAttributes(const QgsPointCloudAttributeCollection &attributes)
Set attributes filter in the request.
Point geometry type, with support for z-dimension and m-values.
Encapsulates the context in which an elevation profile is to be generated.
double mapUnitsPerDistancePixel() const
Returns the number of map units per pixel in the distance dimension.
QgsDoubleRange elevationRange() const
Returns the range of elevations to include in the generation.
double convertDistanceToPixels(double size, Qgis::RenderUnit unit) const
Converts a distance size from the specified units to pixels.
QgsDoubleRange distanceRange() const
Returns the range of distances to include in the generation.
Encapsulates the context of identifying profile results.
double maximumPointElevationDelta
Maximum allowed snapping delta for the elevation values when identifying a point.
double maximumPointDistanceDelta
Maximum allowed snapping delta for the distance values when identifying a point.
QgsProject * project
Associated project.
Stores identify results generated by a QgsAbstractProfileResults object.
Encapsulates a point on a distance-elevation profile.
double elevation() const
Returns the elevation of the point.
double distance() const
Returns the distance of the point.
Abstract base class for storage of elevation profiles.
const QTransform & worldTransform() const
Returns the transform from world coordinates to painter coordinates.
QgsDoubleRange elevationRange() const
Returns the range of elevations to include in the render.
QgsDoubleRange distanceRange() const
Returns the range of distances to include in the render.
QgsRenderContext & renderContext()
Returns a reference to the component QgsRenderContext.
Encapsulates properties and constraints relating to fetching elevation profiles from different source...
Encapsulates the context of snapping a profile point.
double maximumPointDistanceDelta
Maximum allowed snapping delta for the distance values when snapping to a point.
double maximumPointElevationDelta
Maximum allowed snapping delta for the elevation values when snapping to a point.
double displayRatioElevationVsDistance
Display ratio of elevation vs distance units.
Encapsulates results of snapping a profile point.
QgsProfilePoint snappedPoint
Snapped point.
QgsCoordinateTransformContext transformContext
bool overlaps(const QgsRange< T > &other) const
Returns true if this range overlaps another range.
bool contains(const QgsRange< T > &other) const
Returns true if this range contains another range.
T lower() const
Returns the lower bound of the range.
T upper() const
Returns the upper bound of the range.
A rectangle specified with double values.
bool intersects(const QgsRectangle &rect) const
Returns true when rectangle intersects with other rectangle.
double convertToPainterUnits(double size, Qgis::RenderUnit unit, const QgsMapUnitScale &scale=QgsMapUnitScale(), Qgis::RenderSubcomponentProperty property=Qgis::RenderSubcomponentProperty::Generic) const
Converts a size from the specified units to painter units (pixels).
QPainter * painter()
Returns the destination QPainter for the render operation.
Scoped object for saving and restoring a QPainter object's state.
QgsAbstractProfileResults * takeResults() override
Takes results from the generator.
QgsFeedback * feedback() const override
Access to feedback object of the generator (may be nullptr).
bool generateProfile(const QgsProfileGenerationContext &context) override
Generate the profile (based on data stored in the class).
QString type() const override
Returns the unique string identifier for the results type.
QString sourceId() const override
Returns a unique identifier representing the source of the profile.
~QgsTriangulatedPointCloudLayerProfileGenerator() override
QgsTriangulatedPointCloudLayerProfileGenerator(QgsPointCloudLayer *layer, const QgsProfileRequest &request)
Constructor for QgsTriangulatedPointCloudLayerProfileGenerator.
QString type() const override
Returns the unique string identifier for the results type.
QVector< QgsProfileIdentifyResults > identify(const QgsProfilePoint &point, const QgsProfileIdentifyContext &context) override
Identify results visible at the specified profile point.
void copyPropertiesFromGenerator(const QgsAbstractProfileGenerator *generator) override
Copies properties from specified generator to the results object.
friend class QgsTriangulatedPointCloudLayerProfileGenerator
void renderResults(QgsProfileRenderContext &context) override
Renders the results to the specified context.
static Qgis::WkbType flatType(Qgis::WkbType type)
Returns the flat type for a WKB type.
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
T qgsgeometry_cast(QgsAbstractGeometry *geom)
QVector< QgsPoint > QgsPointSequence
#define QgsDebugError(str)
void _GEOSQueryCallback(void *item, void *userdata)
Encapsulates information about a feature exported from the profile results.
QString layerIdentifier
Identifier for grouping output features.
QVariantMap attributes
Exported attributes.
QgsGeometry geometry
Exported geometry.
double distanceAlongCurve
QList< const QgsPointCloudLayerProfileResults::PointResult * > * list