diff --git a/src/View/Geometry/Profile/Plot.py b/src/View/Geometry/Profile/Plot.py index b4ec78e11fa74fb20b7628f3ea16c98221b129ae..475158d2855e357875fddc4b5db6b92e2caa560b 100644 --- a/src/View/Geometry/Profile/Plot.py +++ b/src/View/Geometry/Profile/Plot.py @@ -66,8 +66,7 @@ class Plot(PamhyrPlot): self._isometric_axis = False self.hl_points = [] - self.highlight = None # Hydrolic values (z, wet_area, - # wet_preimeter, water_width) + self.highlight = None # (z, wet_area, wet_preimeter, water_width) self._colors = [] self._onpickevent = None @@ -133,7 +132,6 @@ class Plot(PamhyrPlot): z = self._get_z_from_click(event) if z < self.data.z_min() or event.button.value == 2: self.highlight = None - #self.update() self.draw_highligth() self.update_idle() return @@ -144,27 +142,13 @@ class Plot(PamhyrPlot): self.highlight = (z, a, p, w) - #self.update() self.draw_highligth() self.update_idle() return def select_points_from_indices(self, indices): - #data = self.data - #_, hyd = self.highlight - - #points = list( - #map( - #lambda e: e[1], - #filter( - #lambda e: e[0] in indices, - #enumerate( - #zip(data.get_station(), data.z()) - #) - #) - #) - #) - self.update() + self.draw_highligth() + # self.update() def _select_in_table(self, ind): if self._table is not None: @@ -212,11 +196,6 @@ class Plot(PamhyrPlot): x = event.artist.get_xdata() y = event.artist.get_ydata() - - # points = filter( - # lambda e: e[0] in points_ind, - # enumerate(zip(x, y)) - # ) points = enumerate(zip(x, y)) mx = event.mouseevent.xdata @@ -377,6 +356,7 @@ class Plot(PamhyrPlot): self._z_note.set_visible(False) self._z_line.set_visible(False) self._z_fill_between.set_visible(False) + self.idle() def draw_highligth_z_line(self, z, a, p, w): text = ( @@ -395,42 +375,30 @@ class Plot(PamhyrPlot): ) y = self.data.z() - if 1 == 1: - #if self._z_note is None: - if self._z_note is not None: - self._z_note.remove() - if self._z_line is not None: - self._z_line.remove() - self.draw_highligth_z_line_fill(x, y, z) - - self._z_line, = self.canvas.axes.plot( - xlim, [z, z], - color=self.color_plot_river_water - ) - self._z_line.set_visible(True) - self._z_fill_between.set_visible(True) + if self._z_note is not None: + self._z_note.remove() + if self._z_line is not None: + self._z_line.remove() + self.draw_highligth_z_line_fill(x, y, z) - self._z_note = self.canvas.axes.annotate( - text, pos, - horizontalalignment='left', - verticalalignment='top', - annotation_clip=True, - color=self.color_plot_river_water, - fontsize=9, - fontweight='bold', - alpha=0.7 - ) - self._z_note.set_visible(True) - #else: - #self.draw_highligth_z_line_fill(x, y, z) - - #self._z_line.set_data(xlim, [z, z]) - #self._z_note.set_position(pos) - #self._z_note.set_text(text) - #self._z_line.set_visible(True) - #self._z_note.set_visible(True) - #self._z_fill_between.set_visible(True) - #self.update_idle() + self._z_line, = self.canvas.axes.plot( + xlim, [z, z], + color=self.color_plot_river_water + ) + self._z_line.set_visible(True) + self._z_fill_between.set_visible(True) + + self._z_note = self.canvas.axes.annotate( + text, pos, + horizontalalignment='left', + verticalalignment='top', + annotation_clip=True, + color=self.color_plot_river_water, + fontsize=9, + fontweight='bold', + alpha=0.7 + ) + self._z_note.set_visible(True) def draw_highligth_z_line_fill(self, x, y, z): if self._z_fill_between is not None: