diff --git a/src/Model/GeoTIFF/GeoTIFF.py b/src/Model/GeoTIFF/GeoTIFF.py index 315d58cf..221b2acc 100644 --- a/src/Model/GeoTIFF/GeoTIFF.py +++ b/src/Model/GeoTIFF/GeoTIFF.py @@ -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: diff --git a/src/View/GeoTIFF/Edit/Window.py b/src/View/GeoTIFF/Edit/Window.py index f3ede26a..08532128 100644 --- a/src/View/GeoTIFF/Edit/Window.py +++ b/src/View/GeoTIFF/Edit/Window.py @@ -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(