diff --git a/doc/users/Tuto1/build.sh b/doc/users/Tuto1/build.sh index a247a4ad..47878d6d 100755 --- a/doc/users/Tuto1/build.sh +++ b/doc/users/Tuto1/build.sh @@ -1,4 +1,6 @@ #! /bin/sh +pdflatex -no-shell-escape step-by-step.tex pdflatex -no-shell-escape step-by-step.tex pdflatex -no-shell-escape pas-a-pas.tex +pdflatex -no-shell-escape pas-a-pas.tex diff --git a/doc/users/Tuto1/img/frictions.png b/doc/users/Tuto1/img/frictions.png index e5fd5299..959e3629 100644 Binary files a/doc/users/Tuto1/img/frictions.png and b/doc/users/Tuto1/img/frictions.png differ diff --git a/doc/users/Tuto1/img/hs.png b/doc/users/Tuto1/img/hs.png index f095ee4b..090ccb74 100644 Binary files a/doc/users/Tuto1/img/hs.png and b/doc/users/Tuto1/img/hs.png differ diff --git a/src/View/Frictions/PlotRKZ.py b/src/View/Frictions/PlotRKZ.py index b00cae8d..1bd9efb6 100644 --- a/src/View/Frictions/PlotRKZ.py +++ b/src/View/Frictions/PlotRKZ.py @@ -48,3 +48,6 @@ class PlotRKZ(PlotRKC): def onpick(self, event): return + + def draw_hs(self): + pass diff --git a/src/View/HydraulicStructures/PlotRKC.py b/src/View/HydraulicStructures/PlotRKC.py index 85bdd8ff..037a3663 100644 --- a/src/View/HydraulicStructures/PlotRKC.py +++ b/src/View/HydraulicStructures/PlotRKC.py @@ -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 diff --git a/src/View/LateralContribution/PlotXY.py b/src/View/LateralContribution/PlotXY.py index 17044b2b..abf2ec6a 100644 --- a/src/View/LateralContribution/PlotXY.py +++ b/src/View/LateralContribution/PlotXY.py @@ -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 diff --git a/src/View/LateralContribution/Table.py b/src/View/LateralContribution/Table.py index e5c533dd..56eb70e2 100644 --- a/src/View/LateralContribution/Table.py +++ b/src/View/LateralContribution/Table.py @@ -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() diff --git a/src/View/Results/CustomPlot/Translate.py b/src/View/Results/CustomPlot/Translate.py index abc6b244..3937d720 100644 --- a/src/View/Results/CustomPlot/Translate.py +++ b/src/View/Results/CustomPlot/Translate.py @@ -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"] diff --git a/src/View/Results/PlotXY.py b/src/View/Results/PlotXY.py index 1621e282..8ae76c04 100644 --- a/src/View/Results/PlotXY.py +++ b/src/View/Results/PlotXY.py @@ -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() diff --git a/src/lang/fr.ts b/src/lang/fr.ts index 8eb92d07..c8c8d0ba 100644 --- a/src/lang/fr.ts +++ b/src/lang/fr.ts @@ -1,5 +1,6 @@ - + + About @@ -448,10 +449,15 @@ Sélection des graphiques personnalisés - + Bed elevation (m) Cote du fond (m) + + + Elevation (m) + Cote (m) + Debug @@ -1145,18 +1151,13 @@ - Copyright © 2022-2024 INRAE + Copyright © 2022-2024 INRAE Copyright © 2022-2024 INRAE Version: @version @codename - - - - - Copyright © 2022-2024 INRAE - + Version : @version @codename diff --git a/tools/license.el b/tools/license.el index 442c0630..892e6734 100644 --- a/tools/license.el +++ b/tools/license.el @@ -132,7 +132,7 @@ Repport an issue : https://gitlab.irstea.fr/theophile.terraz/pamhyr/-/issues or by email at : - + ------------------------------------------ ---⚠️--Warning---------------------------