mirror of https://gitlab.com/pamhyr/pamhyr2
Results: Reactivate geotiff if package is imported.
parent
f6e35e2045
commit
64df4129d4
|
|
@ -1176,48 +1176,47 @@ class ResultsWindow(PamhyrWindow):
|
|||
self.update_table_selection_profile(profile_id)
|
||||
|
||||
def import_geotiff(self):
|
||||
# options = QFileDialog.Options()
|
||||
# settings = QSettings(QSettings.IniFormat,
|
||||
# QSettings.UserScope, 'MyOrg', )
|
||||
# options |= QFileDialog.DontUseNativeDialog
|
||||
#
|
||||
# file_types = [
|
||||
# self._trad["file_geotiff"],
|
||||
# self._trad["file_all"],
|
||||
# ]
|
||||
#
|
||||
# filename, _ = QFileDialog.getOpenFileName(
|
||||
# self,
|
||||
# self._trad["open_file"],
|
||||
# "",
|
||||
# ";; ".join(file_types),
|
||||
# options=options
|
||||
# )
|
||||
#
|
||||
# if filename != "":
|
||||
# with rasterio.open(filename) as data:
|
||||
# img = data.read()
|
||||
# b = data.bounds[:]
|
||||
# # b[0] left
|
||||
# # b[1] bottom
|
||||
# # b[2] right
|
||||
# # b[3] top
|
||||
# xlim = self.canvas.axes.get_xlim()
|
||||
# ylim = self.canvas.axes.get_ylim()
|
||||
# if b[2] > b[0] and b[1] < b[3]:
|
||||
# self.canvas.axes.imshow(img.transpose((1, 2, 0)),
|
||||
# extent=[b[0], b[2], b[1], b[3]])
|
||||
# else:
|
||||
# dlg = CoordinatesDialog(
|
||||
# xlim,
|
||||
# ylim,
|
||||
# trad=self._trad,
|
||||
# parent=self
|
||||
# )
|
||||
# if dlg.exec():
|
||||
# self.canvas.axes.imshow(img.transpose((1, 2, 0)),
|
||||
# extent=dlg.values)
|
||||
# self.plot_xy.idle()
|
||||
# self.canvas.axes.set_xlim(xlim)
|
||||
# self.canvas.axes.set_ylim(ylim)
|
||||
return
|
||||
options = QFileDialog.Options()
|
||||
settings = QSettings(QSettings.IniFormat,
|
||||
QSettings.UserScope, 'MyOrg', )
|
||||
options |= QFileDialog.DontUseNativeDialog
|
||||
|
||||
file_types = [
|
||||
self._trad["file_geotiff"],
|
||||
self._trad["file_all"],
|
||||
]
|
||||
|
||||
filename, _ = QFileDialog.getOpenFileName(
|
||||
self,
|
||||
self._trad["open_file"],
|
||||
"",
|
||||
";; ".join(file_types),
|
||||
options=options
|
||||
)
|
||||
|
||||
if filename != "":
|
||||
with rasterio.open(filename) as data:
|
||||
img = data.read()
|
||||
b = data.bounds[:]
|
||||
# b[0] left
|
||||
# b[1] bottom
|
||||
# b[2] right
|
||||
# b[3] top
|
||||
xlim = self.canvas.axes.get_xlim()
|
||||
ylim = self.canvas.axes.get_ylim()
|
||||
if b[2] > b[0] and b[1] < b[3]:
|
||||
self.canvas.axes.imshow(img.transpose((1, 2, 0)),
|
||||
extent=[b[0], b[2], b[1], b[3]])
|
||||
else:
|
||||
dlg = CoordinatesDialog(
|
||||
xlim,
|
||||
ylim,
|
||||
trad=self._trad,
|
||||
parent=self
|
||||
)
|
||||
if dlg.exec():
|
||||
self.canvas.axes.imshow(img.transpose((1, 2, 0)),
|
||||
extent=dlg.values)
|
||||
self.plot_xy.idle()
|
||||
self.canvas.axes.set_xlim(xlim)
|
||||
self.canvas.axes.set_ylim(ylim)
|
||||
|
|
|
|||
Loading…
Reference in New Issue