From 33e1d4fba901b0793e25e79514865c08a1eb32ed Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Sun, 12 Nov 2023 09:24:56 +1000 Subject: [PATCH] Check for non-zero cell sizes --- python/plugins/processing/algs/qgis/ui/HeatmapWidgets.py | 6 ++++++ .../plugins/processing/algs/qgis/ui/InterpolationWidgets.py | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/python/plugins/processing/algs/qgis/ui/HeatmapWidgets.py b/python/plugins/processing/algs/qgis/ui/HeatmapWidgets.py index d13aa556f22..9fdee858746 100644 --- a/python/plugins/processing/algs/qgis/ui/HeatmapWidgets.py +++ b/python/plugins/processing/algs/qgis/ui/HeatmapWidgets.py @@ -120,6 +120,9 @@ class HeatmapPixelSizeWidget(BASE, WIDGET): return cell_size = self.raster_bounds.height() / rows + if cell_size == 0: + return + cols = max(round(self.raster_bounds.width() / cell_size) + 1, 1) self.mColumnsSpinBox.blockSignals(True) self.mColumnsSpinBox.setValue(cols) @@ -135,6 +138,9 @@ class HeatmapPixelSizeWidget(BASE, WIDGET): return cell_size = self.raster_bounds.width() / (cols - 1) + if cell_size == 0: + return + rows = max(round(self.raster_bounds.height() / cell_size), 1) self.mRowsSpinBox.blockSignals(True) self.mRowsSpinBox.setValue(rows) diff --git a/python/plugins/processing/algs/qgis/ui/InterpolationWidgets.py b/python/plugins/processing/algs/qgis/ui/InterpolationWidgets.py index 2f1bb2e9f2a..92483cc63f9 100644 --- a/python/plugins/processing/algs/qgis/ui/InterpolationWidgets.py +++ b/python/plugins/processing/algs/qgis/ui/InterpolationWidgets.py @@ -324,6 +324,9 @@ class PixelSizeWidget(BASE, WIDGET): return cell_size = self.extent.height() / rows + if cell_size == 0: + return + cols = max(round(self.extent.width() / cell_size) + 1, 1) self.mColumnsSpinBox.blockSignals(True) self.mColumnsSpinBox.setValue(cols) @@ -339,6 +342,9 @@ class PixelSizeWidget(BASE, WIDGET): return cell_size = self.extent.width() / (cols - 1) + if cell_size == 0: + return + rows = max(round(self.extent.height() / cell_size), 1) self.mRowsSpinBox.blockSignals(True) self.mRowsSpinBox.setValue(rows)