preview di waypoint 0 quando creo nuova traiettoria
This commit is contained in:
parent
717d6b63de
commit
c3eeca21d8
@ -184,6 +184,13 @@ class PPIDisplay(ttk.Frame):
|
|||||||
# (la preview spline cancella la classica)
|
# (la preview spline cancella la classica)
|
||||||
thetas = [math.radians(getattr(wp, 'target_azimuth_deg', 0)) for wp in waypoints]
|
thetas = [math.radians(getattr(wp, 'target_azimuth_deg', 0)) for wp in waypoints]
|
||||||
rs = [getattr(wp, 'target_range_nm', 0) for wp in waypoints]
|
rs = [getattr(wp, 'target_range_nm', 0) for wp in waypoints]
|
||||||
|
if len(thetas) == 1:
|
||||||
|
# Mostra solo il punto iniziale
|
||||||
|
self._preview_artist.set_data([], [])
|
||||||
|
self._waypoints_plot.set_data(thetas, rs)
|
||||||
|
self._start_plot.set_data(thetas, rs)
|
||||||
|
self.canvas.draw()
|
||||||
|
return
|
||||||
if len(thetas) < 2:
|
if len(thetas) < 2:
|
||||||
self.canvas.draw()
|
self.canvas.draw()
|
||||||
return
|
return
|
||||||
|
|||||||
@ -54,6 +54,20 @@ class TrajectoryEditorWindow(tk.Toplevel):
|
|||||||
self._populate_waypoint_list()
|
self._populate_waypoint_list()
|
||||||
# Aggiorna la preview in base allo stato della checkbox spline
|
# Aggiorna la preview in base allo stato della checkbox spline
|
||||||
self.after(10, self._update_static_preview)
|
self.after(10, self._update_static_preview)
|
||||||
|
# Se c'è almeno un waypoint, mostra subito la preview del punto iniziale
|
||||||
|
if self.waypoints:
|
||||||
|
self.ppi_preview.clear_previews()
|
||||||
|
if self.use_spline_var.get():
|
||||||
|
temp_target = Target(
|
||||||
|
target_id=self.target_id,
|
||||||
|
trajectory=copy.deepcopy(self.waypoints),
|
||||||
|
use_spline=True
|
||||||
|
)
|
||||||
|
temp_target.reset_simulation()
|
||||||
|
self.ppi_preview.draw_trajectory_preview(temp_target)
|
||||||
|
else:
|
||||||
|
self.ppi_preview.draw_trajectory_preview([self.waypoints[0]])
|
||||||
|
self.ppi_preview.canvas.draw()
|
||||||
#self._center_window()
|
#self._center_window()
|
||||||
|
|
||||||
self.protocol("WM_DELETE_WINDOW", self._on_cancel)
|
self.protocol("WM_DELETE_WINDOW", self._on_cancel)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user