feat: reverse flight
This commit is contained in:
@@ -225,8 +225,12 @@ class VisualizationManager:
|
||||
if all_points:
|
||||
points = np.vstack(all_points)
|
||||
margin = 50
|
||||
self.ax_route_map.set_xlim(points[:, 0].min() - margin, points[:, 0].max() + margin)
|
||||
self.ax_route_map.set_ylim(points[:, 1].min() - margin, points[:, 1].max() + margin)
|
||||
x_center = (points[:, 0].min() + points[:, 0].max()) / 2
|
||||
y_center = (points[:, 1].min() + points[:, 1].max()) / 2
|
||||
half_range = max(points[:, 0].max() - points[:, 0].min(), points[:, 1].max() - points[:, 1].min()) / 2 + margin
|
||||
self.ax_route_map.set_xlim(x_center - half_range, x_center + half_range)
|
||||
self.ax_route_map.set_ylim(y_center - half_range, y_center + half_range)
|
||||
self.ax_route_map.set_aspect('equal', adjustable='box')
|
||||
|
||||
self.ax_route_map.legend(loc='best')
|
||||
|
||||
@@ -682,9 +686,10 @@ class VisualizationManager:
|
||||
|
||||
def show_final(self):
|
||||
"""Показывает финальное состояние окна"""
|
||||
plt.ioff()
|
||||
print("Симуляция завершена. Окно визуализации остается открытым для анализа.")
|
||||
plt.pause(100000)
|
||||
self.fig.canvas.draw_idle()
|
||||
self.fig.canvas.flush_events()
|
||||
plt.pause(0.5)
|
||||
|
||||
def pause(self, duration: float):
|
||||
plt.pause(duration)
|
||||
@@ -708,5 +713,8 @@ class VisualizationManager:
|
||||
for filename, axes_item in axes.items():
|
||||
if axes_item is None:
|
||||
continue
|
||||
bbox = axes_item.get_tightbbox(renderer).expanded(1.08, 1.15)
|
||||
self.fig.savefig(output_dir / filename, dpi=150, bbox_inches=bbox)
|
||||
try:
|
||||
bbox = axes_item.get_tightbbox(renderer).transformed(self.fig.dpi_scale_trans.inverted()).expanded(1.08, 1.15)
|
||||
self.fig.savefig(output_dir / filename, dpi=150, bbox_inches=bbox)
|
||||
except Exception as exc:
|
||||
print(f"Не удалось сохранить {filename}: {exc}")
|
||||
|
||||
Reference in New Issue
Block a user