Skip to content
Permalink
Browse files

add fix for point selection

  • Loading branch information
NEDJIMAbelgacem authored and nyalldawson committed Jan 4, 2021
1 parent 2d274af commit d8abdbe973274b64a8a854cce18b074d911c065c
Showing with 10 additions and 1 deletion.
  1. +10 −1 src/core/pointcloud/qgspointcloudlayerrenderer.cpp
@@ -265,7 +265,16 @@ QVector<QMap<QString, QString>> QgsPointCloudLayerRenderer::identify( const QgsG
continue;
}
}
if ( geometry.intersects( QgsGeometry::fromPointXY( QgsPointXY( x, y ) ) ) )
QgsPointXY deviceCoords = context.renderContext().mapToPixel().transform( QgsPointXY( x, y ) );
// TODO: ask about this
// For some reason I need to multiply the pointSize by 2 to have correct point selection behaviour
// Inconvenience: whwn a point is not fully inside the selection area it gets selected too
QgsPointXY point1( deviceCoords.x() - 2 * mRenderer->pointSize(), deviceCoords.y() - 2 * mRenderer->pointSize() );
QgsPointXY point2( deviceCoords.x() + 2 * mRenderer->pointSize(), deviceCoords.y() + 2 * mRenderer->pointSize() );
QgsPointXY point1MapCoords = context.renderContext().mapToPixel().toMapCoordinates( point1.x(), point1.y() );
QgsPointXY point2MapCoords = context.renderContext().mapToPixel().toMapCoordinates( point2.x(), point2.y() );
QgsRectangle pointRect( point1MapCoords, point2MapCoords );
if ( geometry.intersects( pointRect ) )
{
QMap<QString, QString> pointAttr;
for ( QgsPointCloudAttribute attr : blockAttributes.attributes() )

0 comments on commit d8abdbe

Please sign in to comment.
You can’t perform that action at this time.