From db87b1e2142887f2ba5018a5f87dfe37ea64b04c Mon Sep 17 00:00:00 2001
From: Pierre-Antoine Rouby <pierre-antoine.rouby@inrae.fr>
Date: Mon, 13 May 2024 09:56:09 +0200
Subject: [PATCH] Geometry: Add left and right line into XY plot.

---
 src/View/Geometry/PlotXY.py | 39 +++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/src/View/Geometry/PlotXY.py b/src/View/Geometry/PlotXY.py
index 3bf49cbb..6c3a3707 100644
--- a/src/View/Geometry/PlotXY.py
+++ b/src/View/Geometry/PlotXY.py
@@ -61,6 +61,7 @@ class PlotXY(PamhyrPlot):
             return
 
         self.draw_xy()
+        self.draw_lr()
         self.draw_gl()
         self.draw_current()
 
@@ -90,6 +91,37 @@ class PlotXY(PamhyrPlot):
             )
             self.line_xy.append(line)
 
+    def draw_lr(self):
+        lx = []
+        ly = []
+        rx = []
+        ry = []
+
+        self.line_lr = []
+        for x, y in zip(self.data.get_x(),
+                        self.data.get_y()):
+            lx.append(x[0])
+            ly.append(y[0])
+
+            rx.append(x[-1])
+            ry.append(y[-1])
+
+        line = self.canvas.axes.plot(
+            lx, ly,
+            color=self.color_plot_river_bottom,
+            linestyle="dotted",
+            lw=1.,
+        )
+        self.line_lr.append(line)
+
+        line = self.canvas.axes.plot(
+            rx, ry,
+            color=self.color_plot_river_bottom,
+            linestyle="dotted",
+            lw=1.,
+        )
+        self.line_lr.append(line)
+
     def draw_gl(self):
         x_complete = self.data.get_guidelines_x()
         y_complete = self.data.get_guidelines_y()
@@ -139,6 +171,7 @@ class PlotXY(PamhyrPlot):
         if self.data is None:
             return
 
+        self.update_lr()
         self.update_gl()
         self.update_current()
 
@@ -207,3 +240,9 @@ class PlotXY(PamhyrPlot):
                     self.data.profile(after).y()
                 )
                 self.after_plot_selected.set_visible(True)
+
+    def update_lr(self):
+        for line in self.line_lr:
+            line[0].remove()
+
+        self.draw_lr()
-- 
GitLab