Commit 69e94e97 authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

Geometry: Fix plot update at meshing.

Showing with 99 additions and 100 deletions
+99 -100
...@@ -340,36 +340,36 @@ class PlotAC(PamhyrPlot): ...@@ -340,36 +340,36 @@ class PlotAC(PamhyrPlot):
self.color_complete_gl = self.get_line_gl_colors(line_2d) self.color_complete_gl = self.get_line_gl_colors(line_2d)
self.color_incomplete_gl = 2 * ["#000000"] self.color_incomplete_gl = 2 * ["#000000"]
if ind is not None: # if ind is not None:
before = ind - 1 # before = ind - 1
after = ind + 1 # after = ind + 1
self.before_plot_selected.set_data([], []) # self.before_plot_selected.set_data([], [])
self.plot_selected.set_data([], []) # self.plot_selected.set_data([], [])
self.after_plot_selected.set_data([], []) # self.after_plot_selected.set_data([], [])
if 0 <= before < self.data.number_profiles: # if 0 <= before < self.data.number_profiles:
self.before_plot_selected.set_data( # self.before_plot_selected.set_data(
self.data.profile(before).get_station(), # self.data.profile(before).get_station(),
self.data.profile(before).z() # self.data.profile(before).z()
) # )
if 0 <= ind < self.data.number_profiles: # if 0 <= ind < self.data.number_profiles:
self.plot_selected.set_data( # self.plot_selected.set_data(
self.data.profile(ind).get_station(), # self.data.profile(ind).get_station(),
self.data.profile(ind).z() # self.data.profile(ind).z()
) # )
if 0 <= after < self.data.number_profiles: # if 0 <= after < self.data.number_profiles:
self.after_plot_selected.set_data( # self.after_plot_selected.set_data(
self.data.profile(after).get_station(), # self.data.profile(after).get_station(),
self.data.profile(after).z() # self.data.profile(after).z()
) # )
self.update_annotate_full(ind) # self.update_annotate_full(ind)
else: # else:
self.update_full() self.update_full()
self.update_annotate_full(0) self.update_annotate_full(0)
self.canvas.axes.relim() self.canvas.axes.relim()
self.canvas.axes.autoscale() self.canvas.axes.autoscale()
......
...@@ -185,76 +185,76 @@ class PlotKPZ(PamhyrPlot): ...@@ -185,76 +185,76 @@ class PlotKPZ(PamhyrPlot):
self.draw() self.draw()
return return
if ind is not None: # if ind is not None:
before = ind - 1 # before = ind - 1
after = ind + 1 # after = ind + 1
self.before_plot_selected.set_visible(False) # self.before_plot_selected.set_visible(False)
self.plot_selected.set_visible(False) # self.plot_selected.set_visible(False)
self.after_plot_selected.set_visible(False) # self.after_plot_selected.set_visible(False)
if 0 <= before < self.data.number_profiles: # if 0 <= before < self.data.number_profiles:
profile = self.data.profile(before) # profile = self.data.profile(before)
if len(profile) > 0: # if len(profile) > 0:
kp_i = profile.kp # kp_i = profile.kp
z_min_i = profile.z_min() # z_min_i = profile.z_min()
z_max_i = profile.z_max() # z_max_i = profile.z_max()
self.before_plot_selected.set_data( # self.before_plot_selected.set_data(
(kp_i, kp_i), # (kp_i, kp_i),
(z_min_i, z_max_i) # (z_min_i, z_max_i)
) # )
self.before_plot_selected.set_visible(True) # self.before_plot_selected.set_visible(True)
if 0 <= ind < self.data.number_profiles: # if 0 <= ind < self.data.number_profiles:
profile = self.data.profile(ind) # profile = self.data.profile(ind)
if len(profile) > 0: # if len(profile) > 0:
kp_i = profile.kp # kp_i = profile.kp
z_min_i = profile.z_min() # z_min_i = profile.z_min()
z_max_i = profile.z_max() # z_max_i = profile.z_max()
self.plot_selected.set_data( # self.plot_selected.set_data(
(kp_i, kp_i), # (kp_i, kp_i),
(z_min_i, z_max_i) # (z_min_i, z_max_i)
) # )
self.plot_selected.set_visible(True) # self.plot_selected.set_visible(True)
if 0 <= after < self.data.number_profiles: # if 0 <= after < self.data.number_profiles:
profile = self.data.profile(after) # profile = self.data.profile(after)
if len(profile) > 0: # if len(profile) > 0:
kp_i = profile.kp # kp_i = profile.kp
z_min_i = profile.z_min() # z_min_i = profile.z_min()
z_max_i = profile.z_max() # z_max_i = profile.z_max()
self.after_plot_selected.set_data( # self.after_plot_selected.set_data(
(kp_i, kp_i), # (kp_i, kp_i),
(z_min_i, z_max_i) # (z_min_i, z_max_i)
) # )
self.after_plot_selected.set_visible(True) # self.after_plot_selected.set_visible(True)
self.canvas.figure.canvas.draw_idle() # self.canvas.figure.canvas.draw_idle()
else: # else:
kp = self.data.get_kp_complete_profiles() kp = self.data.get_kp_complete_profiles()
z_min = self.data.get_z_min() z_min = self.data.get_z_min()
z_max = self.data.get_z_max() z_max = self.data.get_z_max()
self.line_kp_zmin.set_data(kp, z_min) self.line_kp_zmin.set_data(kp, z_min)
self.line_kp_zmin_zmax.remove() self.line_kp_zmin_zmax.remove()
self.line_kp_zmin_zmax = self.canvas.axes.vlines( self.line_kp_zmin_zmax = self.canvas.axes.vlines(
x=kp, x=kp,
ymin=z_min, ymax=z_max, ymin=z_min, ymax=z_max,
color='r', lw=1. color='r', lw=1.
) )
z_complete = self.data.get_guidelines_z() z_complete = self.data.get_guidelines_z()
try: try:
for i in range(len(self.line_kp_zgl)): for i in range(len(self.line_kp_zgl)):
self.line_kp_zgl[i][0].set_data( self.line_kp_zgl[i][0].set_data(
kp, z_complete[i] kp, z_complete[i]
) )
except Exception as e: except Exception as e:
logger.warning(f"Failed to update graphic KPZ: {e}") logger.warning(f"Failed to update graphic KPZ: {e}")
self.canvas.axes.autoscale_view(True, True, True) self.canvas.axes.autoscale_view(True, True, True)
self.canvas.figure.canvas.draw_idle() self.canvas.figure.canvas.draw_idle()
...@@ -356,7 +356,6 @@ class GeometryWindow(PamhyrWindow): ...@@ -356,7 +356,6 @@ class GeometryWindow(PamhyrWindow):
def select_plot_ac(self, ind: int): def select_plot_ac(self, ind: int):
self.tableView.model().blockSignals(True) self.tableView.model().blockSignals(True)
logger.info(f"select_plot_ac(self, {ind})")
self._plot_ac.update(ind=ind) self._plot_ac.update(ind=ind)
self.tableView.model().blockSignals(False) self.tableView.model().blockSignals(False)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment