From cc1528476b5824086507b3d9c4844954f0d29b37 Mon Sep 17 00:00:00 2001 From: Blottiere Paul Date: Tue, 26 Sep 2023 14:53:07 +0200 Subject: [PATCH 1/2] Deactivate progress bar when no nodes --- src/core/pointcloud/qgspointcloudlayerprofilegenerator.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/pointcloud/qgspointcloudlayerprofilegenerator.cpp b/src/core/pointcloud/qgspointcloudlayerprofilegenerator.cpp index 50b894579f96..b5f561253ce4 100644 --- a/src/core/pointcloud/qgspointcloudlayerprofilegenerator.cpp +++ b/src/core/pointcloud/qgspointcloudlayerprofilegenerator.cpp @@ -470,6 +470,10 @@ bool QgsPointCloudLayerProfileGenerator::generateProfile( const QgsProfileGenera } double rootErrorPixels = rootErrorInMapCoordinates / mapUnitsPerPixel; // in pixels const QVector nodes = traverseTree( pc, pc->root(), maximumErrorPixels, rootErrorPixels, context.elevationRange() ); + if ( nodes.empty() ) + { + return false; + } const double rootErrorInLayerCoordinates = rootNodeExtentLayerCoords.width() / pc->span(); const double maxErrorInMapCoordinates = maximumErrorPixels * mapUnitsPerPixel; From 5620ed79b1aee3699826e02e84cb0fc53b50f88d Mon Sep 17 00:00:00 2001 From: Blottiere Paul Date: Fri, 29 Sep 2023 15:23:10 +0200 Subject: [PATCH 2/2] Update tests --- tests/src/python/test_qgspointcloudlayerprofilegenerator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/src/python/test_qgspointcloudlayerprofilegenerator.py b/tests/src/python/test_qgspointcloudlayerprofilegenerator.py index bad06e4ded0b..7dc6b4a7a989 100644 --- a/tests/src/python/test_qgspointcloudlayerprofilegenerator.py +++ b/tests/src/python/test_qgspointcloudlayerprofilegenerator.py @@ -66,9 +66,9 @@ def testProfileGeneration(self): req.setCrs(pcl.crs()) # zero tolerance => no points generator = pcl.createProfileGenerator(req) - self.assertTrue(generator.generateProfile()) + self.assertFalse(generator.generateProfile()) results = generator.takeResults() - self.assertFalse(results.distanceToHeightMap()) + self.assertTrue(results is None) req.setTolerance(0.05) generator = pcl.createProfileGenerator(req)