|
@@ -195,7 +195,7 @@ void QgsPointCloudRenderer::setPointSymbol( PointSymbol symbol ) |
|
|
mPointSymbol = symbol; |
|
|
} |
|
|
|
|
|
QVector<QVariantMap> QgsPointCloudRenderer::identify( QgsPointCloudLayer *layer, const QgsRenderContext &renderContext, const QgsGeometry &geometry ) |
|
|
QVector<QVariantMap> QgsPointCloudRenderer::identify( QgsPointCloudLayer *layer, const QgsRenderContext &renderContext, const QgsGeometry &geometry, double toleranceForPointIdentification ) |
|
|
{ |
|
|
QVector<QVariantMap> selectedPoints; |
|
|
|
|
@@ -234,13 +234,15 @@ QVector<QVariantMap> QgsPointCloudRenderer::identify( QgsPointCloudLayer *layer, |
|
|
{ |
|
|
double x = geometry.asPoint().x(); |
|
|
double y = geometry.asPoint().y(); |
|
|
const double toleranceInPixels = toleranceForPointIdentification / renderContext.mapToPixel().mapUnitsPerPixel(); |
|
|
const double pointSizePixels = renderContext.convertToPainterUnits( mPointSize, mPointSizeUnit, mPointSizeMapUnitScale ); |
|
|
switch ( pointSymbol() ) |
|
|
{ |
|
|
case QgsPointCloudRenderer::PointSymbol::Square: |
|
|
{ |
|
|
QgsPointXY deviceCoords = renderContext.mapToPixel().transform( QgsPointXY( x, y ) ); |
|
|
QgsPointXY point1( deviceCoords.x() - 2 * pointSize(), deviceCoords.y() - 2 * pointSize() ); |
|
|
QgsPointXY point2( deviceCoords.x() + 2 * pointSize(), deviceCoords.y() + 2 * pointSize() ); |
|
|
QgsPointXY point1( deviceCoords.x() - std::max( toleranceInPixels, pointSizePixels / 2.0 ), deviceCoords.y() - std::max( toleranceInPixels, pointSizePixels / 2.0 ) ); |
|
|
QgsPointXY point2( deviceCoords.x() + std::max( toleranceInPixels, pointSizePixels / 2.0 ), deviceCoords.y() + std::max( toleranceInPixels, pointSizePixels / 2.0 ) ); |
|
|
QgsPointXY point1MapCoords = renderContext.mapToPixel().toMapCoordinates( point1.x(), point1.y() ); |
|
|
QgsPointXY point2MapCoords = renderContext.mapToPixel().toMapCoordinates( point2.x(), point2.y() ); |
|
|
QgsRectangle pointRect( point1MapCoords, point2MapCoords ); |
|
@@ -251,8 +253,8 @@ QVector<QVariantMap> QgsPointCloudRenderer::identify( QgsPointCloudLayer *layer, |
|
|
{ |
|
|
QgsPoint centerMapCoords( x, y ); |
|
|
QgsPointXY deviceCoords = renderContext.mapToPixel().transform( centerMapCoords ); |
|
|
QgsPoint point1( deviceCoords.x(), deviceCoords.y() - 2 * pointSize() ); |
|
|
QgsPoint point2( deviceCoords.x(), deviceCoords.y() + 2 * pointSize() ); |
|
|
QgsPoint point1( deviceCoords.x(), deviceCoords.y() - std::max( toleranceInPixels, pointSizePixels / 2.0 ) ); |
|
|
QgsPoint point2( deviceCoords.x(), deviceCoords.y() + std::max( toleranceInPixels, pointSizePixels / 2.0 ) ); |
|
|
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 ) ); |
|
|