diff --git a/doc/users/Tuto1/build.sh b/doc/users/Tuto1/build.sh index a247a4adfb5b20a1ddbc655a05bd13631cf313d8..47878d6d7c869e39c65f553ee3fee19658cd1d02 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 e5fd52999cede4e9001d893865c1c3519b1a99a5..959e362982b655d2e133b5e9992d8bbac8cd4524 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 f095ee4bcbfb6a5241ffddf39f3beca3d52f0cfa..090ccb74efdea55859bd60f963623334c58b571c 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 b00cae8d1883fcb9d1cecf9d5e2771ee31873ab8..1bd9efb62c2915d45221f7fda948564d3b80924c 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 85bdd8ffcae53814211466b6d598e657b39fdab1..037a3663aeae45bf5f38ee1a3aeb1882dccf5273 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 17044b2be4e0da65bdf7b50e932363e3cc0c5434..abf2ec6afaf2ac72325c7eaa4de95aedff64de67 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 e5c533dd361d3bd8dddb7e8d3b1f36b4500d6130..56eb70e2193f2165995c7d684aab08637d38c2ea 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 abc6b244b4c854ab3c42df17c28b939bd90ae338..3937d720460a4aee810b68c18260480c72e8285f 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 1621e282f4feab3145206bd05736013ef6751a3f..8ae76c040ed98add1de2f862bce7fe75b2165785 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 8eb92d07a45c7166a911d759294bf4fe6e7a95c8..c8c8d0ba70a8547fb3c13c9bced137ab22ada5e1 100644 --- a/src/lang/fr.ts +++ b/src/lang/fr.ts @@ -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> diff --git a/tools/license.el b/tools/license.el index 442c0630e4eae7593c565ec32c1a97bf332b2b6c..892e6734012abd62c34f3c904ae5c3e5443f5428 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 : - <pierre-antoine.rouby@inrae.fr> + <theophile.terraz@inrae.fr> ------------------------------------------ ---âš ï¸--Warning---------------------------