From 1d3ce8b4e6387174d825b389e0cf340b71d37242 Mon Sep 17 00:00:00 2001 From: uclaros Date: Mon, 13 Jul 2026 10:18:17 +0300 Subject: [PATCH 1/2] Use bounding box intersections to avoid geos bug --- app/inpututils.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/inpututils.cpp b/app/inpututils.cpp index b5573eb39..02a874e8d 100644 --- a/app/inpututils.cpp +++ b/app/inpututils.cpp @@ -330,13 +330,12 @@ QPointF InputUtils::relevantGeometryCenterToScreenCoordinates( const QgsGeometry const QgsRectangle currentExtent = mapSettings->mapSettings().visibleExtent(); - // Cut the geometry to current extent - const QgsGeometry currentExtentAsGeom = QgsGeometry::fromRect( currentExtent ); - const QgsGeometry intersectedGeom = geom.intersection( currentExtentAsGeom ); + // Cut the geometry extent to current extent + const QgsRectangle intersectedExtent = currentExtent.intersect( geom.boundingBox() ); - if ( !intersectedGeom.isEmpty() ) + if ( !intersectedExtent.isEmpty() ) { - target = QgsPoint( intersectedGeom.boundingBox().center() ); + target = QgsPoint( intersectedExtent.center() ); } else { From 8d6f9c0df62b4ee45108591164e549da782f5d50 Mon Sep 17 00:00:00 2001 From: uclaros Date: Mon, 13 Jul 2026 15:26:16 +0300 Subject: [PATCH 2/2] adapt test --- app/test/testutilsfunctions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test/testutilsfunctions.cpp b/app/test/testutilsfunctions.cpp index 7ac5d6302..376852341 100644 --- a/app/test/testutilsfunctions.cpp +++ b/app/test/testutilsfunctions.cpp @@ -968,7 +968,7 @@ void TestUtilsFunctions::testRelevantGeometryCenterToScreenCoordinates() // Case when we cut the geometry to current extent ms.setExtent( QgsRectangle( 599032, 5.40671e+06, 619818, 5.43961e+06 ) ); - QCOMPARE( InputUtils::equals( mUtils->relevantGeometryCenterToScreenCoordinates( geom, &ms ), QPointF( 286.257, 274.5 ), epsilon ), true ); + QCOMPARE( InputUtils::equals( mUtils->relevantGeometryCenterToScreenCoordinates( geom, &ms ), QPointF( 286.261, 304.496 ), epsilon ), true ); } void TestUtilsFunctions::testIsValidEmail()