mirror of https://gitlab.com/pamhyr/pamhyr2
GeoTIFF: Minor change.
parent
869e116ad0
commit
9308a73e8e
|
|
@ -112,6 +112,7 @@ class GeoTIFF(SQLSubModel):
|
|||
elif key == "description":
|
||||
self.description = value
|
||||
elif key == "file_name":
|
||||
if self._file_name != value:
|
||||
self.read_file(value)
|
||||
elif key == "coordinates":
|
||||
self.coordinates = value
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ from Modules import Modules
|
|||
from View.Tools.PamhyrWindow import PamhyrWindow
|
||||
|
||||
from PyQt5.QtWidgets import (
|
||||
QLabel, QPlainTextEdit, QPushButton,
|
||||
QCheckBox, QFileDialog, QVBoxLayout,
|
||||
QLabel, QPlainTextEdit, QPushButton, QCheckBox,
|
||||
QFileDialog, QVBoxLayout, QDoubleSpinBox,
|
||||
)
|
||||
|
||||
from PyQt5.QtCore import (
|
||||
|
|
@ -78,8 +78,8 @@ class EditGeoTIFFWindow(PamhyrWindow):
|
|||
|
||||
self._undo = undo
|
||||
|
||||
self.setup_graph()
|
||||
self.setup_values()
|
||||
self.setup_graph()
|
||||
self.setup_connection()
|
||||
|
||||
def setup_graph(self):
|
||||
|
|
@ -115,6 +115,12 @@ class EditGeoTIFFWindow(PamhyrWindow):
|
|||
"left": self._geotiff.coord_left,
|
||||
"right": self._geotiff.coord_right,
|
||||
}
|
||||
self._values_default = {
|
||||
"bottom": self._geotiff.coord_bottom,
|
||||
"top": self._geotiff.coord_top,
|
||||
"left": self._geotiff.coord_left,
|
||||
"right": self._geotiff.coord_right,
|
||||
}
|
||||
|
||||
self._reset_values()
|
||||
|
||||
|
|
@ -131,6 +137,12 @@ class EditGeoTIFFWindow(PamhyrWindow):
|
|||
"left": bounds[1],
|
||||
"right": bounds[3],
|
||||
}
|
||||
self._values_default = {
|
||||
"bottom": bounds[0],
|
||||
"top": bounds[2],
|
||||
"left": bounds[1],
|
||||
"right": bounds[3],
|
||||
}
|
||||
|
||||
self._reset_values()
|
||||
|
||||
|
|
@ -139,7 +151,7 @@ class EditGeoTIFFWindow(PamhyrWindow):
|
|||
self._reset_values_key(key)
|
||||
|
||||
def _reset_values_key(self, key):
|
||||
self.set_double_spin_box(f"doubleSpinBox_{key}", self._values[key])
|
||||
self.set_double_spin_box(f"doubleSpinBox_{key}", self._values_default[key])
|
||||
|
||||
def setup_connection(self):
|
||||
self.find(QPushButton, "pushButton_cancel")\
|
||||
|
|
@ -153,6 +165,14 @@ class EditGeoTIFFWindow(PamhyrWindow):
|
|||
self.find(QPushButton, f"pushButton_{key}")\
|
||||
.clicked.connect(lambda: self._reset_values_key(key))
|
||||
|
||||
self.find(QDoubleSpinBox, f"doubleSpinBox_{key}")\
|
||||
.valueChanged.connect(lambda: self.update_spinbox_value(key))
|
||||
|
||||
def update_spinbox_value(self, key):
|
||||
self._values[key] = self.get_double_spin_box(f"doubleSpinBox_{key}")
|
||||
|
||||
self._plot_img.set_extent(list(self._values.values()))
|
||||
|
||||
def draw_geotiff(self, memfile=None):
|
||||
if not _rasterio_loaded:
|
||||
return
|
||||
|
|
@ -169,14 +189,14 @@ class EditGeoTIFFWindow(PamhyrWindow):
|
|||
img = gt.read()
|
||||
b = gt.bounds[:]
|
||||
|
||||
self._set_values_from_bounds(b)
|
||||
|
||||
if self._plot_img is not None:
|
||||
self._plot_img.remove()
|
||||
|
||||
self._set_values_from_bounds(b)
|
||||
|
||||
self._plot_img = self.canvas.axes.imshow(
|
||||
img.transpose((1, 2, 0)),
|
||||
extent=[b[0], b[2], b[1], b[3]]
|
||||
extent=list(self._values.values())
|
||||
)
|
||||
|
||||
self.plot.idle()
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ class GeoTIFFListWindow(PamhyrWindow):
|
|||
|
||||
self._plot_img = {}
|
||||
|
||||
for geotiff in self._study.river.geotiff.lst:
|
||||
for geotiff in self._study.river.geotiff.files:
|
||||
self.draw_geotiff(geotiff)
|
||||
|
||||
def selected_rows(self):
|
||||
|
|
|
|||
Loading…
Reference in New Issue