mirror of https://gitlab.com/pamhyr/pamhyr2
Results: Add data: Move update to plot class.
parent
19c72892a8
commit
6ac268b668
|
|
@ -210,6 +210,31 @@ class PlotRKC(PamhyrPlot):
|
||||||
linestyle='dotted',
|
linestyle='dotted',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def draw_additional_data(self, res_id):
|
||||||
|
results = self.results[res_id]
|
||||||
|
|
||||||
|
self._add_data_lines = []
|
||||||
|
|
||||||
|
for data in results.get("additional_data"):
|
||||||
|
data = data._data
|
||||||
|
x, y = data['x'], data['y']
|
||||||
|
legend = data['legend']
|
||||||
|
unit = data['unit']
|
||||||
|
|
||||||
|
if (
|
||||||
|
data['type_x'] == 'water_elevation' and
|
||||||
|
data['type_y'] == 'time'
|
||||||
|
):
|
||||||
|
|
||||||
|
line, = self.canvas.axes.plot(
|
||||||
|
x, y, marker="+",
|
||||||
|
label=legend + ' ' + unit
|
||||||
|
)
|
||||||
|
|
||||||
|
self._add_data_lines.append(line)
|
||||||
|
|
||||||
|
self.canvas.draw_idle()
|
||||||
|
|
||||||
def draw_current(self, reach):
|
def draw_current(self, reach):
|
||||||
rk = reach.geometry.get_rk()
|
rk = reach.geometry.get_rk()
|
||||||
z_min = reach.geometry.get_z_min()
|
z_min = reach.geometry.get_z_min()
|
||||||
|
|
@ -332,6 +357,10 @@ class PlotRKC(PamhyrPlot):
|
||||||
alpha=0.7, interpolate=True
|
alpha=0.7, interpolate=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def update_additional_data(self):
|
||||||
|
self.draw_additional_data(0)
|
||||||
|
self.update_idle()
|
||||||
|
|
||||||
def update_current(self):
|
def update_current(self):
|
||||||
results = self.results[self._current_res_id]
|
results = self.results[self._current_res_id]
|
||||||
reach = results.river.reach(self._current_reach_id)
|
reach = results.river.reach(self._current_reach_id)
|
||||||
|
|
|
||||||
|
|
@ -1398,25 +1398,9 @@ class ResultsWindow(PamhyrWindow):
|
||||||
def update_plot_additional_data(self):
|
def update_plot_additional_data(self):
|
||||||
results = self._results[self._current_results[0]]
|
results = self._results[self._current_results[0]]
|
||||||
|
|
||||||
|
self.plot_rkc.update_additional_data()
|
||||||
|
self.plot_h.update_additional_data()
|
||||||
|
|
||||||
for data in results.get("additional_data"):
|
for data in results.get("additional_data"):
|
||||||
data = data._data
|
|
||||||
x, y = data['x'], data['y']
|
|
||||||
legend = data['legend']
|
|
||||||
unit = data['unit']
|
|
||||||
|
|
||||||
if (
|
|
||||||
data['type_x'] == 'water_elevation' and
|
|
||||||
data['type_y'] == 'time'
|
|
||||||
):
|
|
||||||
line = self.canvas_2.axes.plot(
|
|
||||||
x, y, marker="+",
|
|
||||||
label=legend + ' ' + unit
|
|
||||||
)
|
|
||||||
self.plot_rkc.canvas.draw_idle()
|
|
||||||
self.plot_rkc.update_idle()
|
|
||||||
|
|
||||||
if data['type_x'] == 'time' and data['type_y'] == 'discharge':
|
|
||||||
self.plot_h.update_additional_data()
|
|
||||||
|
|
||||||
for p in self._additional_plot:
|
for p in self._additional_plot:
|
||||||
self._additional_plot[p].add_imported_plot(data)
|
self._additional_plot[p].add_imported_plot(data)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue