mirror of https://gitlab.com/pamhyr/pamhyr2
Geometry: Add hydro. struct. at KPZ plot.
parent
e33c9cb2f0
commit
653a26fee1
|
|
@ -25,8 +25,11 @@ logger = logging.getLogger()
|
||||||
|
|
||||||
|
|
||||||
class PlotKPZ(PamhyrPlot):
|
class PlotKPZ(PamhyrPlot):
|
||||||
def __init__(self, canvas=None, trad=None, data=None, toolbar=None,
|
def __init__(self, canvas=None, trad=None,
|
||||||
|
study=None, data=None, toolbar=None,
|
||||||
parent=None):
|
parent=None):
|
||||||
|
self._study = study
|
||||||
|
|
||||||
super(PlotKPZ, self).__init__(
|
super(PlotKPZ, self).__init__(
|
||||||
canvas=canvas,
|
canvas=canvas,
|
||||||
trad=trad,
|
trad=trad,
|
||||||
|
|
@ -75,6 +78,7 @@ class PlotKPZ(PamhyrPlot):
|
||||||
self.draw_current()
|
self.draw_current()
|
||||||
self.draw_gl()
|
self.draw_gl()
|
||||||
self.draw_bottom()
|
self.draw_bottom()
|
||||||
|
self.draw_profiles_hs(self._data)
|
||||||
|
|
||||||
self.idle()
|
self.idle()
|
||||||
self._init = True
|
self._init = True
|
||||||
|
|
@ -184,6 +188,34 @@ class PlotKPZ(PamhyrPlot):
|
||||||
color='lightgrey'
|
color='lightgrey'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def draw_profiles_hs(self, reach):
|
||||||
|
lhs = filter(
|
||||||
|
lambda hs: hs._input_reach.reach is reach,
|
||||||
|
self._study.river.hydraulic_structures.lst
|
||||||
|
)
|
||||||
|
|
||||||
|
for hs in lhs:
|
||||||
|
x = hs.input_kp
|
||||||
|
z_min = reach.get_z_min()
|
||||||
|
z_max = reach.get_z_max()
|
||||||
|
|
||||||
|
self.canvas.axes.plot(
|
||||||
|
[x, x],
|
||||||
|
[min(z_min), max(z_max)],
|
||||||
|
linestyle="--",
|
||||||
|
lw=1.,
|
||||||
|
color=self.color_plot_previous,
|
||||||
|
)
|
||||||
|
|
||||||
|
self.canvas.axes.annotate(
|
||||||
|
" > " + hs.name,
|
||||||
|
(x, max(z_max)),
|
||||||
|
horizontalalignment='left',
|
||||||
|
verticalalignment='top',
|
||||||
|
annotation_clip=True,
|
||||||
|
fontsize=9, color=self.color_plot_previous,
|
||||||
|
)
|
||||||
|
|
||||||
@timer
|
@timer
|
||||||
def update(self):
|
def update(self):
|
||||||
if not self._init:
|
if not self._init:
|
||||||
|
|
|
||||||
|
|
@ -376,6 +376,7 @@ class GeometryWindow(PamhyrWindow):
|
||||||
|
|
||||||
self._plot_kpc = PlotKPZ(
|
self._plot_kpc = PlotKPZ(
|
||||||
canvas=self._canvas_kpc,
|
canvas=self._canvas_kpc,
|
||||||
|
study=self._study,
|
||||||
data=self._reach,
|
data=self._reach,
|
||||||
trad=self._trad,
|
trad=self._trad,
|
||||||
toolbar=self._toolbar_kpc
|
toolbar=self._toolbar_kpc
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ class PlotKPC(PamhyrPlot):
|
||||||
self.canvas.axes.plot(
|
self.canvas.axes.plot(
|
||||||
[x, x],
|
[x, x],
|
||||||
[min(z_min), max(z_max)],
|
[min(z_min), max(z_max)],
|
||||||
linestyle="solid",
|
linestyle="--",
|
||||||
lw=1.,
|
lw=1.,
|
||||||
color=self.color_plot_previous,
|
color=self.color_plot_previous,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue