mirror of https://gitlab.com/pamhyr/pamhyr2
IC: Apply new PamhyrPlot features.
parent
4f747f8fa7
commit
bfd166b717
|
|
@ -27,53 +27,66 @@ _translate = QCoreApplication.translate
|
||||||
|
|
||||||
|
|
||||||
class PlotDKP(PamhyrPlot):
|
class PlotDKP(PamhyrPlot):
|
||||||
|
def __init__(self, canvas=None, trad=None, toolbar=None,
|
||||||
|
data=None, parent=None):
|
||||||
|
super(PlotDKP, self).__init__(
|
||||||
|
canvas=canvas,
|
||||||
|
trad=trad,
|
||||||
|
data=data,
|
||||||
|
toolbar=toolbar,
|
||||||
|
parent=parent
|
||||||
|
)
|
||||||
|
|
||||||
|
self.label_x = self._trad["kp"]
|
||||||
|
self.label_y = self._trad["elevation"]
|
||||||
|
|
||||||
|
self._isometric_axis = False
|
||||||
|
|
||||||
|
self._auto_relim_update = True
|
||||||
|
self._autoscale_update = True
|
||||||
|
|
||||||
@timer
|
@timer
|
||||||
def draw(self, highlight=None):
|
def draw(self, highlight=None):
|
||||||
self.canvas.axes.cla()
|
self.init_axes()
|
||||||
self.canvas.axes.grid(color='grey', linestyle='--', linewidth=0.5)
|
|
||||||
|
|
||||||
if self.data is None:
|
if self.data is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
self.canvas.axes.set_ylabel(
|
self.draw_river_bottom()
|
||||||
self._trad["elevation"],
|
self.draw_water()
|
||||||
color='black', fontsize=11
|
|
||||||
)
|
|
||||||
self.canvas.axes.set_xlabel(
|
|
||||||
self._trad["kp"],
|
|
||||||
color='black', fontsize=11
|
|
||||||
)
|
|
||||||
|
|
||||||
|
self.idle()
|
||||||
|
self._init = True
|
||||||
|
|
||||||
|
def draw_river_bottom(self):
|
||||||
kp = self.data.reach.reach.get_kp()
|
kp = self.data.reach.reach.get_kp()
|
||||||
z_min = self.data.reach.reach.get_z_min()
|
z_min = self.data.reach.reach.get_z_min()
|
||||||
|
|
||||||
self.canvas.axes.set_xlim(
|
|
||||||
left=min(kp), right=max(kp)
|
|
||||||
)
|
|
||||||
|
|
||||||
self.line_kp_zmin = self.canvas.axes.plot(
|
self.line_kp_zmin = self.canvas.axes.plot(
|
||||||
kp, z_min,
|
kp, z_min,
|
||||||
color='grey', lw=1.
|
color=self.color_plot_river_bottom,
|
||||||
|
lw=1.
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def draw_water(self):
|
||||||
if len(self.data) != 0:
|
if len(self.data) != 0:
|
||||||
kp = self.data.get_kp()
|
kp = self.data.get_kp()
|
||||||
elevation = self.data.get_elevation()
|
elevation = self.data.get_elevation()
|
||||||
|
|
||||||
self.line_kp_elevation = self.canvas.axes.plot(
|
self.line_kp_elevation = self.canvas.axes.plot(
|
||||||
kp, elevation,
|
kp, elevation,
|
||||||
color='b', marker='+', lw=1.
|
color=self.color_plot_river_water,
|
||||||
|
**self.plot_default_kargs
|
||||||
)
|
)
|
||||||
|
|
||||||
self.canvas.figure.tight_layout()
|
z_min = self.data.reach.reach.get_z_min()
|
||||||
self.canvas.figure.canvas.draw_idle()
|
|
||||||
if self.toolbar is not None:
|
|
||||||
self.toolbar.update()
|
|
||||||
|
|
||||||
# self._init = True
|
self.collection = self.canvas.axes.fill_between(
|
||||||
|
kp, z_min, elevation,
|
||||||
|
color=self.color_plot_river_water_zone,
|
||||||
|
alpha=0.7, interpolate=True
|
||||||
|
)
|
||||||
|
|
||||||
@timer
|
@timer
|
||||||
def update(self, ind=None):
|
def update(self, ind=None):
|
||||||
if not self._init:
|
self.draw()
|
||||||
self.draw()
|
|
||||||
return
|
|
||||||
|
|
|
||||||
|
|
@ -21,47 +21,49 @@ from View.Tools.PamhyrPlot import PamhyrPlot
|
||||||
|
|
||||||
|
|
||||||
class PlotDischarge(PamhyrPlot):
|
class PlotDischarge(PamhyrPlot):
|
||||||
|
def __init__(self, canvas=None, trad=None, toolbar=None,
|
||||||
|
data=None, parent=None):
|
||||||
|
super(PlotDischarge, self).__init__(
|
||||||
|
canvas=canvas,
|
||||||
|
trad=trad,
|
||||||
|
data=data,
|
||||||
|
toolbar=toolbar,
|
||||||
|
parent=parent
|
||||||
|
)
|
||||||
|
|
||||||
|
self.label_x = self._trad["kp"]
|
||||||
|
self.label_y = self._trad["discharge"]
|
||||||
|
|
||||||
|
self._isometric_axis = False
|
||||||
|
|
||||||
|
self._auto_relim_update = True
|
||||||
|
self._autoscale_update = True
|
||||||
|
|
||||||
@timer
|
@timer
|
||||||
def draw(self, highlight=None):
|
def draw(self):
|
||||||
self.canvas.axes.cla()
|
self.init_axes()
|
||||||
self.canvas.axes.grid(color='grey', linestyle='--', linewidth=0.5)
|
|
||||||
|
|
||||||
if self.data is None:
|
if self.data is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
self.canvas.axes.set_ylabel(
|
self.draw_data()
|
||||||
self._trad["discharge"],
|
|
||||||
color='black', fontsize=11
|
|
||||||
)
|
|
||||||
self.canvas.axes.set_xlabel(
|
|
||||||
self._trad["kp"],
|
|
||||||
color='black', fontsize=11
|
|
||||||
)
|
|
||||||
|
|
||||||
|
self.idle()
|
||||||
|
self._init = True
|
||||||
|
|
||||||
|
def draw_data(self):
|
||||||
kp = self.data.reach.reach.get_kp()
|
kp = self.data.reach.reach.get_kp()
|
||||||
|
|
||||||
self.canvas.axes.set_xlim(
|
|
||||||
left=min(kp), right=max(kp)
|
|
||||||
)
|
|
||||||
|
|
||||||
if len(self.data) != 0:
|
if len(self.data) != 0:
|
||||||
kp = self.data.get_kp()
|
kp = self.data.get_kp()
|
||||||
discharge = self.data.get_discharge()
|
discharge = self.data.get_discharge()
|
||||||
|
|
||||||
self.line_kp_zmin = self.canvas.axes.plot(
|
self.line_kp_zmin = self.canvas.axes.plot(
|
||||||
kp, discharge,
|
kp, discharge,
|
||||||
color='r', lw=1.
|
color=self.color_plot,
|
||||||
|
**self.plot_default_kargs
|
||||||
)
|
)
|
||||||
|
|
||||||
self.canvas.figure.tight_layout()
|
|
||||||
self.canvas.figure.canvas.draw_idle()
|
|
||||||
if self.toolbar is not None:
|
|
||||||
self.toolbar.update()
|
|
||||||
|
|
||||||
# self._init = True
|
|
||||||
|
|
||||||
@timer
|
@timer
|
||||||
def update(self, ind=None):
|
def update(self, ind=None):
|
||||||
if not self._init:
|
self.draw()
|
||||||
self.draw()
|
|
||||||
return
|
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,8 @@ class PamhyrPlot(APlot):
|
||||||
color_plot_current = "blue"
|
color_plot_current = "blue"
|
||||||
color_plot_next = "purple"
|
color_plot_next = "purple"
|
||||||
color_plot_river_bottom = "grey"
|
color_plot_river_bottom = "grey"
|
||||||
|
color_plot_river_water = "blue"
|
||||||
|
color_plot_river_water_zone = "skyblue"
|
||||||
|
|
||||||
colors = list(mplcolors.TABLEAU_COLORS)
|
colors = list(mplcolors.TABLEAU_COLORS)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue