diff --git a/src/View/GeoTIFF/Edit/Window.py b/src/View/GeoTIFF/Edit/Window.py index 47ad9e78..fa14292d 100644 --- a/src/View/GeoTIFF/Edit/Window.py +++ b/src/View/GeoTIFF/Edit/Window.py @@ -189,7 +189,12 @@ class EditGeoTIFFWindow(PamhyrWindow): def update_values_from_spinbox(self, key): self._values[key] = self.get_double_spin_box(f"doubleSpinBox_{key}") - self._plot_img.set_extent(list(self._values.values())) + left = self._values["left"] + right = self._values["right"] + bottom = self._values["bottom"] + top = self._values["top"] + + self._plot_img.set_extent((left, right, bottom, top)) self.plot.idle() def draw_geotiff(self, memfile=None): @@ -205,11 +210,11 @@ class EditGeoTIFFWindow(PamhyrWindow): b = data.bounds[:] # left, bottom, right, top if b[2] > b[0] and b[1] < b[3]: - coord = [b[0], b[2], b[1], b[3]] + coord = [b[1], b[3], b[0], b[2]] else: xlim = self.canvas.axes.get_xlim() ylim = self.canvas.axes.get_ylim() - coord = xlim + ylim + coord = ylim + xlim self._set_values_from_bounds(coord) self._set_default_values_from_bounds(coord) @@ -220,9 +225,14 @@ class EditGeoTIFFWindow(PamhyrWindow): if self._plot_img is not None: self._plot_img.remove() + left = self._values["left"] + right = self._values["right"] + bottom = self._values["bottom"] + top = self._values["top"] + self._plot_img = self.canvas.axes.imshow( img.transpose((1, 2, 0)), - extent=list(self._values.values()) + extent=(left, right, bottom, top) ) self.plot.idle() diff --git a/src/View/GeoTIFF/Window.py b/src/View/GeoTIFF/Window.py index 2ac03485..1fcf6650 100644 --- a/src/View/GeoTIFF/Window.py +++ b/src/View/GeoTIFF/Window.py @@ -140,12 +140,16 @@ class GeoTIFFListWindow(PamhyrWindow): return for row in rows: - geotiff = self._study.river.geotiff.files[row] + files = self._study.river.geotiff.files + if len(files) <= row: + continue + + geotiff = files[row] coord = geotiff.coordinates - xy = (coord["bottom"], coord["left"]) - width = abs(coord["top"] - coord["bottom"]) - height = abs(coord["right"] - coord["left"]) + xy = (coord["left"], coord["bottom"]) + width = abs(coord["right"] - coord["left"]) + height = abs(coord["top"] - coord["bottom"]) rect = Rectangle( xy, width, height, diff --git a/src/View/PlotXY.py b/src/View/PlotXY.py index a62ecb4d..e51933ef 100644 --- a/src/View/PlotXY.py +++ b/src/View/PlotXY.py @@ -157,9 +157,14 @@ class PlotXY(PamhyrPlot): img = gt.read() coords = geotiff.coordinates + left = coords["left"] + right = coords["right"] + bottom = coords["bottom"] + top = coords["top"] + self._plot_img[geotiff] = self.canvas.axes.imshow( img.transpose((1, 2, 0)), - extent=list(coords.values()) + extent=(left, right, bottom, top) ) if not geotiff.is_enabled(): diff --git a/src/View/Results/PlotXY.py b/src/View/Results/PlotXY.py index e52fa33d..a880c009 100644 --- a/src/View/Results/PlotXY.py +++ b/src/View/Results/PlotXY.py @@ -344,9 +344,14 @@ class PlotXY(PamhyrPlot): img = gt.read() coords = geotiff.coordinates + left = coords["left"] + right = coords["right"] + bottom = coords["bottom"] + top = coords["top"] + self._plot_img[geotiff] = self.canvas.axes.imshow( img.transpose((1, 2, 0)), - extent=list(coords.values()) + extent=(left, right, bottom, top) ) if not geotiff.is_enabled():