mirror of https://gitlab.com/pamhyr/pamhyr2
Compare commits
3 Commits
f6e08f203c
...
7ef3184699
| Author | SHA1 | Date |
|---|---|---|
|
|
7ef3184699 | |
|
|
5f6c823301 | |
|
|
bc4557e21f |
|
|
@ -180,8 +180,6 @@ class MeshingDialog(PamhyrDialog):
|
|||
# self._begin_dir = self.get_combobox_text("comboBox_begin_gl")
|
||||
# self._end_dir = self.get_combobox_text("comboBox_end_gl")
|
||||
|
||||
self.parent.tableView.selectionModel().clearSelection()
|
||||
|
||||
super().accept()
|
||||
|
||||
def reject(self):
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ from PyQt5.QtGui import (
|
|||
from PyQt5.QtCore import (
|
||||
QModelIndex, Qt, QSettings, pyqtSlot,
|
||||
QItemSelectionModel, QCoreApplication, QSize,
|
||||
QItemSelection, QItemSelectionRange,
|
||||
)
|
||||
from PyQt5.QtWidgets import (
|
||||
QApplication, QMainWindow, QFileDialog, QCheckBox,
|
||||
|
|
@ -286,6 +287,13 @@ class GeometryWindow(PamhyrWindow):
|
|||
self.tableView.model().blockSignals(False)
|
||||
|
||||
def edit_meshing(self):
|
||||
|
||||
rows = list(
|
||||
set(
|
||||
(i.row() for i in self.tableView.selectedIndexes())
|
||||
)
|
||||
)
|
||||
selected_rk = [self._reach.profile(r).rk for r in rows]
|
||||
try:
|
||||
dlg = MeshingDialog(
|
||||
reach=self._reach,
|
||||
|
|
@ -303,6 +311,23 @@ class GeometryWindow(PamhyrWindow):
|
|||
logger_exception(e)
|
||||
return
|
||||
|
||||
ind = []
|
||||
for i in range(self._reach.number_profiles):
|
||||
if self._reach.profile(i).rk in selected_rk:
|
||||
ind.append(i)
|
||||
self.tableView.setFocus()
|
||||
selection = self.tableView.selectionModel()
|
||||
index = QItemSelection()
|
||||
if len(ind) > 0:
|
||||
for i in ind:
|
||||
index.append(QItemSelectionRange(self.tableView.model().index(i, 0)))
|
||||
selection.select(
|
||||
index,
|
||||
QItemSelectionModel.Rows |
|
||||
QItemSelectionModel.ClearAndSelect |
|
||||
QItemSelectionModel.Select
|
||||
)
|
||||
|
||||
def _edit_meshing(self, data):
|
||||
try:
|
||||
mesher = InternalMeshing()
|
||||
|
|
|
|||
|
|
@ -156,9 +156,9 @@ class TableModel(PamhyrTableModel):
|
|||
if self._opt_data == "reach":
|
||||
self._lst = _river.reachs
|
||||
elif self._opt_data == "profile" or self._opt_data == "raw_data":
|
||||
# self._lst = _river.reach(reach).profiles
|
||||
self._lst = list(compress(_river.reach(reach).profiles,
|
||||
_river.reach(reach).profile_mask))
|
||||
self._lst = _river.reach(reach).profiles
|
||||
# self._lst = list(compress(_river.reach(reach).profiles,
|
||||
# _river.reach(reach).profile_mask))
|
||||
elif self._opt_data == "solver":
|
||||
self._lst = self._parent._solvers
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
import os
|
||||
import csv
|
||||
import logging
|
||||
import rasterio
|
||||
# import rasterio
|
||||
|
||||
from numpy import sqrt
|
||||
|
||||
|
|
@ -338,6 +338,8 @@ class ResultsWindow(PamhyrWindow):
|
|||
# "action_export": self.export_current,
|
||||
"action_Geo_tiff": self.import_geotiff
|
||||
}
|
||||
self.find(QAction, "action_Geo_tiff").setEnabled(False)
|
||||
self.find(QAction, "action_Geo_tiff").setVisible(False)
|
||||
|
||||
if len(self._results) > 1:
|
||||
self.find(QAction, "action_reload").setEnabled(False)
|
||||
|
|
@ -1166,47 +1168,48 @@ 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)
|
||||
# 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
|
||||
|
|
|
|||
Loading…
Reference in New Issue