Skip to content

Commit

Permalink
Check for non-zero cell sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 13, 2023
1 parent da514d0 commit 33e1d4f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions python/plugins/processing/algs/qgis/ui/HeatmapWidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ def rowsChanged(self):
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)
Expand All @@ -135,6 +138,9 @@ def columnsChanged(self):
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,9 @@ def rowsChanged(self):
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)
Expand All @@ -339,6 +342,9 @@ def columnsChanged(self):
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)
Expand Down

0 comments on commit 33e1d4f

Please sign in to comment.