GeoTIFF: Prepare model/view integration.

scenario-dev-pa
Pierre-Antoine 2025-11-10 17:09:27 +01:00
parent 1ed5d69bf4
commit f27b2cc586
2 changed files with 55 additions and 6 deletions

View File

@ -80,6 +80,14 @@ class GeoTIFF(SQLSubModel):
value = self.file_name
elif key == "coordinates":
value = self.coordinates
elif key == "coordinates_bottom":
value = self.coordinates["bottom"]
elif key == "coordinates_top":
value = self.coordinates["top"]
elif key == "coordinates_left":
value = self.coordinates["left"]
elif key == "coordinates_right":
value = self.coordinates["right"]
elif key == "memfile":
value = self.memfile
@ -96,6 +104,14 @@ class GeoTIFF(SQLSubModel):
self.file_name = value
elif key == "coordinates":
self.coordinates = value
elif key == "coordinates_bottom":
self.coordinates["bottom"] = value
elif key == "coordinates_top":
self.coordinates["top"] = value
elif key == "coordinates_left":
self.coordinates["left"] = value
elif key == "coordinates_right":
self.coordinates["right"] = value
self.modified()
@ -147,6 +163,34 @@ class GeoTIFF(SQLSubModel):
self._coordinates = coordinates
self.modified()
@property
def coord_bottom(self):
if self._coordinates is None:
return 0.0
return self._coordinates["bottom"]
@property
def coord_top(self):
if self._coordinates is None:
return 0.0
return self._coordinates["top"]
@property
def coord_left(self):
if self._coordinates is None:
return 0.0
return self._coordinates["left"]
@property
def coord_right(self):
if self._coordinates is None:
return 0.0
return self._coordinates["right"]
@property
def memfile(self):
if not _rasterio_loaded:

View File

@ -61,8 +61,12 @@ class EditGeoTIFFWindow(PamhyrWindow):
def setup_values(self):
self.set_check_box("checkBox", self._geotiff.enabled)
self.set_line_edit_text("lineEdit_name", self._geotiff.name)
self.set_line_edit_text("lineEdit_path", self._geotiff.description)
self.set_plaintext_edit_text("plainTextEdit", self._geotiff.text)
self.set_line_edit_text("lineEdit_description", self._geotiff.description)
self.set_double_spin_box("doubleSpinBox_bottom", self._geotiff.coord_bottom)
self.set_double_spin_box("doubleSpinBox_top", self._geotiff.coord_top)
self.set_double_spin_box("doubleSpinBox_left", self._geotiff.coord_left)
self.set_double_spin_box("doubleSpinBox_right", self._geotiff.coord_right)
if self._study.is_read_only():
self.set_check_box_enable("checkBox", False)
@ -81,10 +85,11 @@ class EditGeoTIFFWindow(PamhyrWindow):
is_enabled = self.get_check_box("checkBox")
name = self.get_line_edit_text("lineEdit_name")
path = self.get_line_edit_text("lineEdit_path")
coord_bottom = self.get_plaintext_edit_text("plainTextEdit")
coord_top = self.get_plaintext_edit_text("plainTextEdit")
coord_left = self.get_plaintext_edit_text("plainTextEdit")
coord_right = self.get_plaintext_edit_text("plainTextEdit")
coord_bottom = self.get_double_spin_box("doubleSpinBox_bottom")
coord_top = self.get_double_spin_box("doubleSpinBox_top")
coord_left = self.get_double_spin_box("doubleSpinBox_left")
coord_right = self.get_double_spin_box("doubleSpinBox_right")
self._undo.push(
SetCommand(