Check for non-zero cell sizes

This commit is contained in:
Nyall Dawson 2023-11-12 09:24:56 +10:00
parent da514d0e5e
commit 33e1d4fba9
2 changed files with 12 additions and 0 deletions

View File

@ -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)

View File

@ -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)