diff --git a/src/core/pointcloud/qgspointclouddataprovider.cpp b/src/core/pointcloud/qgspointclouddataprovider.cpp index 9d1e13bff74e..5249c743b88d 100644 --- a/src/core/pointcloud/qgspointclouddataprovider.cpp +++ b/src/core/pointcloud/qgspointclouddataprovider.cpp @@ -286,14 +286,14 @@ struct MapIndexedPointCloudNode blockAttributes.find( QStringLiteral( "Z" ), zOffset ); std::unique_ptr< QgsGeometryEngine > extentEngine( QgsGeometry::createGeometryEngine( mExtentGeometry.constGet() ) ); extentEngine->prepareGeometry(); - for ( int i = 0; i < block->pointCount(); ++i ) + for ( int i = 0; i < block->pointCount() && pointsCount < mPointsLimit; ++i ) { double x, y, z; _pointXY( ptr, i, recordSize, xOffset, yOffset, mIndexScale, mIndexOffset, x, y ); z = _pointZ( ptr, i, recordSize, zOffset, mIndexScale, mIndexOffset ); QgsPoint pointXY( x, y ); - if ( pointsCount < mPointsLimit && extentEngine->contains( &pointXY ) && mZRange.contains( z ) ) + if ( mZRange.contains( z ) && extentEngine->contains( &pointXY ) ) { QMap pointAttr = _attributeMap( ptr, i * recordSize, blockAttributes ); pointAttr[ QStringLiteral( "X" ) ] = x; @@ -327,15 +327,6 @@ QVector> QgsPointCloudDataProvider::identify( const IndexedPointCloudNode root = index->root(); QgsRectangle rootNodeExtentMapCoords = index->nodeMapExtent( root ); -// TODO? reproject the root node extent -// try -// { -// rootNodeExtentMapCoords = renderContext.coordinateTransform().transformBoundingBox( index->nodeMapExtent( root ) ); -// } -// catch ( QgsCsException & ) -// { -// QgsDebugMsg( QStringLiteral( "Could not transform node extent to map CRS" ) ); -// } const float rootErrorInMapCoordinates = rootNodeExtentMapCoords.width() / index->span(); QVector nodes = traverseTree( index, root, maxErrorInMapCoords, rootErrorInMapCoordinates, extentGeometry, extentZRange ); diff --git a/src/core/pointcloud/qgspointcloudlayerrenderer.h b/src/core/pointcloud/qgspointcloudlayerrenderer.h index 5613a238b31f..e02ec4a2c00b 100644 --- a/src/core/pointcloud/qgspointcloudlayerrenderer.h +++ b/src/core/pointcloud/qgspointcloudlayerrenderer.h @@ -77,26 +77,6 @@ class CORE_EXPORT QgsPointCloudLayerRenderer: public QgsMapLayerRenderer QgsPointCloudAttributeCollection mLayerAttributes; QgsPointCloudAttributeCollection mAttributes; QgsGeometry mCloudExtent; - - /** - * Retrieves the x and y coordinate for the point at index \a i. - */ - static void pointXY( QgsPointCloudRenderContext &context, const char *ptr, int i, double &x, double &y ) - { - const qint32 ix = *reinterpret_cast< const qint32 * >( ptr + i * context.pointRecordSize() + context.xOffset() ); - const qint32 iy = *reinterpret_cast< const qint32 * >( ptr + i * context.pointRecordSize() + context.yOffset() ); - x = context.offset().x() + context.scale().x() * ix; - y = context.offset().y() + context.scale().y() * iy; - } - - /** - * Retrieves the z value for the point at index \a i. - */ - static double pointZ( QgsPointCloudRenderContext &context, const char *ptr, int i ) - { - const qint32 iz = *reinterpret_cast( ptr + i * context.pointRecordSize() + context.zOffset() ); - return context.offset().z() + context.scale().z() * iz; - } }; #endif // QGSPOINTCLOUDLAYERRENDERER_H diff --git a/src/core/pointcloud/qgspointcloudrenderer.cpp b/src/core/pointcloud/qgspointcloudrenderer.cpp index a3d00100e0d8..fda2c337ed0f 100644 --- a/src/core/pointcloud/qgspointcloudrenderer.cpp +++ b/src/core/pointcloud/qgspointcloudrenderer.cpp @@ -249,8 +249,8 @@ QVector> QgsPointCloudRenderer::identify( QgsPointCloudL QgsPointXY point1MapCoords = renderContext.mapToPixel().toMapCoordinates( point1.x(), point1.y() ); QgsPointXY point2MapCoords = renderContext.mapToPixel().toMapCoordinates( point2.x(), point2.y() ); QgsCircle circle = QgsCircle::from2Points( QgsPoint( point1MapCoords ), QgsPoint( point2MapCoords ) ); - QgsPolygon *polygon = circle.toPolygon( 6 ); - QgsGeometry circleGeometry( polygon ); + std::unique_ptr polygon( circle.toPolygon( 6 ) ); + QgsGeometry circleGeometry( std::move( polygon ) ); selectionGeometry = circleGeometry; } } diff --git a/src/gui/qgsmaptoolidentify.cpp b/src/gui/qgsmaptoolidentify.cpp index 38f7597cbfb3..4d4685f73a2f 100644 --- a/src/gui/qgsmaptoolidentify.cpp +++ b/src/gui/qgsmaptoolidentify.cpp @@ -520,7 +520,7 @@ bool QgsMapToolIdentify::identifyPointCloudLayer( QList