Compare commits

...
5 changed files with 56 additions and 13 deletions

No files matched your search

+3 -3
View File
@@ -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)
+3 -3
View File
@@ -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)
@@ -57,6 +57,15 @@ class EditLateralContributionAdisTSWindow(PamhyrWindow):
name = trad[self._pamhyr_name]
if self._data is not None:
pollutant_name = next(
(
pollutant.name
for pollutant in study.river.Pollutants.Pollutants_List
if pollutant.id == self._data.pollutant
),
None
)
if self._data.reach is not None:
reach_name = next(filter(
lambda reach: reach.id == self._data.reach,
@@ -75,12 +84,10 @@ class EditLateralContributionAdisTSWindow(PamhyrWindow):
else:
end_rk = trad['not_associated']
name += (
f" - {study.name} - " +
f"{reach_name} - " +
f"({begin_rk} - " +
f"{end_rk})"
)
name += f" - {study.name}"
if pollutant_name is not None:
name += f" - {pollutant_name}"
name += f" - {reach_name} - ({begin_rk} - {end_rk})"
super(EditLateralContributionAdisTSWindow, self).__init__(
title=name,
@@ -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 <https://www.gnu.org/licenses/>.
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
@@ -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 \