diff --git a/src/View/Geometry/PlotXY.py b/src/View/Geometry/PlotXY.py index ecc479a5..39e8feb8 100644 --- a/src/View/Geometry/PlotXY.py +++ b/src/View/Geometry/PlotXY.py @@ -192,7 +192,7 @@ class PlotXY(PamhyrPlot): for xy in zip(self.data.get_x(), self.data.get_y()): self.line_xy.append(np.column_stack(xy)) - self._colors, self._style = self.color_hightlight() + self._colors, self._style = self.color_highlight() self.line_xy_collection = collections.LineCollection( self.line_xy, colors=self._colors, @@ -201,7 +201,7 @@ class PlotXY(PamhyrPlot): ) self.canvas.axes.add_collection(self.line_xy_collection) - def color_hightlight(self): + def color_highlight(self): rows = sorted(list( set( (i.row() for i in self.parent.tableView.selectedIndexes()) @@ -320,7 +320,7 @@ class PlotXY(PamhyrPlot): def update_current(self): if self._current_data_update: - self._colors, self._style = self.color_hightlight() + self._colors, self._style = self.color_highlight() self.line_xy_collection.set_colors(self._colors) self.line_xy_collection.set_linestyle(self._style) diff --git a/src/View/LateralContribution/PlotXY.py b/src/View/LateralContribution/PlotXY.py index fbcb1867..4ba09d21 100644 --- a/src/View/LateralContribution/PlotXY.py +++ b/src/View/LateralContribution/PlotXY.py @@ -127,7 +127,7 @@ class PlotXY(PamhyrPlot): for xy in zip(self.data.get_x(), self.data.get_y()): self.line_xy.append(np.column_stack(xy)) - self._colors, self._style = self.color_hightlight() + self._colors, self._style = self.color_highlight() self.line_xy_collection = collections.LineCollection( self.line_xy, colors=self._colors, @@ -136,7 +136,7 @@ class PlotXY(PamhyrPlot): ) self.canvas.axes.add_collection(self.line_xy_collection) - def color_hightlight(self): + def color_highlight(self): rk_min, rk_max = (-1, -1) if self._highlight_data is not None: rk_min, rk_max = self._highlight_data @@ -250,7 +250,7 @@ class PlotXY(PamhyrPlot): def update_current(self): if self._current_data_update: - self._colors, self._style = self.color_hightlight() + self._colors, self._style = self.color_highlight() self.line_xy_collection.set_colors(self._colors) self.line_xy_collection.set_linestyle(self._style) diff --git a/src/View/LateralContributionsAdisTS/PlotXY.py b/src/View/LateralContributionsAdisTS/PlotXY.py new file mode 100644 index 00000000..1859c73f --- /dev/null +++ b/src/View/LateralContributionsAdisTS/PlotXY.py @@ -0,0 +1,36 @@ +# PlotXY.py -- Pamhyr +# Copyright (C) 2023-2026 INRAE +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from View.Geometry.PlotXY import PlotXY as GeometryPlotXY + + +class PlotXY(GeometryPlotXY): + """Geometry plot highlighting the lateral-contribution extent.""" + + def color_highlight(self): + rk_min, rk_max = (-1, -1) + if self.highlight is not None: + rk_min, rk_max = self.highlight + + colors = [ + self.color_plot_river_bottom for _ in range(len(self.data)) + ] + for index, rk in enumerate(self.data.get_rk_complete_profiles()): + if rk_min <= rk <= rk_max: + colors[index] = self.color_plot_current + + styles = ["-" for _ in range(len(self.data))] + return colors, styles diff --git a/src/View/LateralContributionsAdisTS/Window.py b/src/View/LateralContributionsAdisTS/Window.py index 92038bb3..348fb21f 100644 --- a/src/View/LateralContributionsAdisTS/Window.py +++ b/src/View/LateralContributionsAdisTS/Window.py @@ -45,7 +45,7 @@ from View.LateralContributionsAdisTS.Table import ( ) from View.Tools.Plot.PamhyrCanvas import MplCanvas -from View.Geometry.PlotXY import PlotXY +from View.LateralContributionsAdisTS.PlotXY import PlotXY from View.LateralContributionsAdisTS.translate \ import LCTranslate from View.LateralContributionsAdisTS.Edit.Window \