mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Merge branch 'master' of gitlab-ssh.irstea.fr:theophile.terraz/pamhyr into terraz_dev
This commit is contained in:
commit
2b85f221bb
11 files changed
+57
-57
No files matched your search
@@ -48,3 +48,6 @@ class PlotRKZ(PlotRKC):
|
||||
|
||||
def onpick(self, event):
|
||||
return
|
||||
|
||||
def draw_hs(self):
|
||||
pass
|
||||
@@ -52,6 +52,7 @@ class PlotRKC(PamhyrPlot):
|
||||
self._auto_relim_update = True
|
||||
self._autoscale_update = True
|
||||
self.parent = parent
|
||||
self.anotate_lst = []
|
||||
|
||||
@property
|
||||
def river(self):
|
||||
@@ -80,14 +81,12 @@ class PlotRKC(PamhyrPlot):
|
||||
return
|
||||
|
||||
self.draw_data(highlight)
|
||||
self.draw_current()
|
||||
|
||||
self.idle()
|
||||
self._init = True
|
||||
|
||||
def draw_data(self, highlight):
|
||||
reach = self._current_reach
|
||||
|
||||
rk = reach.reach.get_rk()
|
||||
z_min = reach.reach.get_z_min()
|
||||
z_max = reach.reach.get_z_max()
|
||||
@@ -114,8 +113,14 @@ class PlotRKC(PamhyrPlot):
|
||||
picker=10
|
||||
)
|
||||
|
||||
self.draw_hs()
|
||||
# Draw HS
|
||||
|
||||
def draw_hs(self):
|
||||
reach = self._current_reach
|
||||
rk = reach.reach.get_rk()
|
||||
z_min = reach.reach.get_z_min()
|
||||
z_max = reach.reach.get_z_max()
|
||||
lhs = filter(
|
||||
lambda hs: hs._input_reach is reach,
|
||||
filter(
|
||||
@@ -129,9 +134,12 @@ class PlotRKC(PamhyrPlot):
|
||||
vymax = []
|
||||
self.anotate_lst = []
|
||||
hs_color = []
|
||||
for hs in lhs:
|
||||
if hs.enabled:
|
||||
hs_color.append("black")
|
||||
index = self.parent.tableView.selectedIndexes()
|
||||
for i, hs in enumerate(lhs):
|
||||
if i == index[0].row():
|
||||
hs_color.append("blue")
|
||||
elif hs.enabled:
|
||||
hs_color.append("red")
|
||||
else:
|
||||
hs_color.append("darkgrey")
|
||||
x = hs.input_rk
|
||||
@@ -160,7 +168,7 @@ class PlotRKC(PamhyrPlot):
|
||||
def color_highlight(self, highlight):
|
||||
|
||||
reach = self._current_reach
|
||||
colors = [self.color_plot] * reach.reach.number_profiles
|
||||
colors = [self.color_plot_river_bottom] * reach.reach.number_profiles
|
||||
|
||||
if highlight is not None:
|
||||
rk = reach.reach.get_rk()
|
||||
@@ -168,24 +176,9 @@ class PlotRKC(PamhyrPlot):
|
||||
if (rk[i] >= highlight[0] and rk[i] <= highlight[1])]
|
||||
if len(rows) > 0:
|
||||
for row in rows:
|
||||
colors[row] = self.color_plot_current
|
||||
colors[row] = "blue"
|
||||
return colors
|
||||
|
||||
def draw_current(self):
|
||||
if self._current_profile is None:
|
||||
self.profile = None
|
||||
else:
|
||||
rk = [self._current_profile.rk,
|
||||
self._current_profile.rk]
|
||||
min_max = [self._current_profile.z_min(),
|
||||
self._current_profile.z_max()]
|
||||
|
||||
self.profile = self.canvas.axes.plot(
|
||||
rk, min_max,
|
||||
color=self.color_plot_current,
|
||||
lw=1.
|
||||
)
|
||||
|
||||
def set_reach(self, reach):
|
||||
self._current_reach = reach
|
||||
self._current_profile = None
|
||||
|
||||
@@ -60,7 +60,7 @@ class PlotXY(PamhyrPlot):
|
||||
def onpick(self, event):
|
||||
if event.mouseevent.inaxes != self.canvas.axes:
|
||||
return
|
||||
if event.mouseevent.button.value not in [1, 3]:
|
||||
if event.mouseevent.button not in [1, 3]:
|
||||
return
|
||||
|
||||
closest = self._closest_section(event)
|
||||
@@ -70,9 +70,9 @@ class PlotXY(PamhyrPlot):
|
||||
index = tableView.selectedIndexes()
|
||||
rk = self.data.get_rk()
|
||||
if self.parent._table is not None:
|
||||
if event.mouseevent.button.value == 1:
|
||||
if event.mouseevent.button == 1:
|
||||
table.setData(index[3], rk[closest[0]])
|
||||
if event.mouseevent.button.value == 3:
|
||||
if event.mouseevent.button == 3:
|
||||
table.setData(index[4], rk[closest[0]])
|
||||
|
||||
return
|
||||
@@ -141,7 +141,8 @@ class PlotXY(PamhyrPlot):
|
||||
if self._highlight_data is not None:
|
||||
rk_min, rk_max = self._highlight_data
|
||||
|
||||
colors = [self.color_plot for row in range(len(self._data))]
|
||||
colors = [self.color_plot_river_bottom
|
||||
for row in range(len(self._data))]
|
||||
for i, rk in enumerate(self.data.get_rk_complete_profiles()):
|
||||
if rk_min <= rk <= rk_max:
|
||||
colors[i] = self.color_plot_current
|
||||
|
||||
@@ -94,7 +94,10 @@ class ComboBoxDelegate(QItemDelegate):
|
||||
else:
|
||||
self.editor.addItems(
|
||||
list(
|
||||
map(str, self._data.reach.get_rk())
|
||||
map(
|
||||
lambda p: p.display_name(),
|
||||
self._data.reach.profiles
|
||||
)
|
||||
)
|
||||
)
|
||||
else:
|
||||
@@ -112,7 +115,20 @@ class ComboBoxDelegate(QItemDelegate):
|
||||
|
||||
def setModelData(self, editor, model, index):
|
||||
text = str(editor.currentText())
|
||||
model.setData(index, text)
|
||||
|
||||
if self._mode == "rk":
|
||||
profiles = list(
|
||||
filter(
|
||||
lambda p: p.display_name() == text,
|
||||
self._data.reach.profiles
|
||||
)
|
||||
)
|
||||
|
||||
value = profiles[0].rk if len(profiles) > 0 else None
|
||||
else:
|
||||
value = text
|
||||
|
||||
model.setData(index, value)
|
||||
editor.close()
|
||||
editor.deleteLater()
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ class CustomPlotTranslate(ResultsTranslate):
|
||||
# Unit corresponding long name (plot axes display)
|
||||
|
||||
self._dict['0-meter'] = _translate(
|
||||
"CustomPlot", "Bed elevation (m)"
|
||||
"CustomPlot", "Elevation (m)"
|
||||
)
|
||||
self._dict['1-m3s'] = self._dict["unit_discharge"]
|
||||
self._dict['2-ms'] = self._dict["unit_speed"]
|
||||
|
||||
@@ -166,7 +166,8 @@ class PlotXY(PamhyrPlot):
|
||||
reach.geometry.get_y()):
|
||||
self.line_xy.append(np.column_stack(xy))
|
||||
|
||||
self._colors, self._style = self.color_hightlight()
|
||||
self._colors = self.color_plot_river_bottom
|
||||
self._style = "-"
|
||||
self.line_xy_collection = collections.LineCollection(
|
||||
self.line_xy,
|
||||
colors=self._colors,
|
||||
@@ -175,23 +176,6 @@ class PlotXY(PamhyrPlot):
|
||||
)
|
||||
self.canvas.axes.add_collection(self.line_xy_collection)
|
||||
|
||||
def color_hightlight(self):
|
||||
reach = self.results.river.reach(self._current_reach_id)
|
||||
rows = [self._current_profile_id]
|
||||
colors = [self.color_plot
|
||||
for row in range(reach.geometry.number_profiles)]
|
||||
style = ["-" for row in range(reach.geometry.number_profiles)]
|
||||
if len(rows) > 0:
|
||||
for row in rows:
|
||||
colors[row] = self.color_plot_current
|
||||
if rows[0] > 0:
|
||||
colors[rows[0]-1] = self.color_plot_previous
|
||||
style[rows[0]-1] = "--"
|
||||
if rows[-1] < reach.geometry.number_profiles-1:
|
||||
colors[rows[-1]+1] = self.color_plot_next
|
||||
style[rows[-1]+1] = "--"
|
||||
return colors, style
|
||||
|
||||
def draw_guide_lines(self, reach):
|
||||
x_complete = reach.geometry.get_guidelines_x()
|
||||
y_complete = reach.geometry.get_guidelines_y()
|
||||
|
||||
+10
-9
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS><TS version="2.0" language="fr_FR" sourcelanguage="en_150">
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="fr_FR" sourcelanguage="en_150">
|
||||
<context>
|
||||
<name>About</name>
|
||||
<message>
|
||||
@@ -448,10 +449,15 @@
|
||||
<translation>Sélection des graphiques personnalisés</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../View/Results/CustomPlot/Translate.py" line="54"/>
|
||||
<location filename="../View/Results/CustomPlot/Translate.py" line="40"/>
|
||||
<source>Bed elevation (m)</source>
|
||||
<translation>Cote du fond (m)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../View/Results/CustomPlot/Translate.py" line="54"/>
|
||||
<source>Elevation (m)</source>
|
||||
<translation>Cote (m)</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Debug</name>
|
||||
@@ -1145,18 +1151,13 @@
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../View/ui/about.ui" line="94"/>
|
||||
<source>Copyright © 2022-2024 INRAE</source>
|
||||
<source>Copyright © 2022-2024 INRAE</source>
|
||||
<translation type="obsolete">Copyright © 2022-2024 INRAE</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../View/ui/about.ui" line="131"/>
|
||||
<source>Version: @version @codename</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message encoding="UTF-8">
|
||||
<location filename="../View/ui/about.ui" line="94"/>
|
||||
<source>Copyright © 2022-2024 INRAE</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Version : @version @codename</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
||||
Reference in new issue
Block a user