Update GUI 2.4.1

This commit is contained in:
2026-05-20 20:28:19 +08:00
parent d2aef78a4b
commit 003f8988c5
2 changed files with 57 additions and 16 deletions
+6 -4
View File
@@ -340,6 +340,7 @@ class DroneMap:
var markers = {};
var idLabels = {};
var trajectories = {};
const maxTrajectoryPoints = 300;
var trajectoryLines = {};
var focusedId = null;
var initialized = false;
@@ -702,11 +703,12 @@ class DroneMap:
const point = [lat, lon];
trajectories[id].push(point);
if (trajectories[id].length > 1000) {
if (trajectories[id].length > maxTrajectoryPoints) {
trajectories[id].shift();
trajectoryLines[id].setLatLngs(trajectories[id]);
} else {
trajectoryLines[id].addLatLng(point);
}
trajectoryLines[id].setLatLngs([...trajectories[id]]);
}
function focusOn(id) {
@@ -878,7 +880,7 @@ class DroneMap:
# 設置地圖更新計時器
self.map_update_timer = QTimer()
self.map_update_timer.timeout.connect(self.update_map_positions)
self.map_update_timer.start(200) # 每 200ms 更新一次
self.map_update_timer.start(100) # 每 100ms 更新一次(10Hz)
def _on_map_loaded(self, ok: bool):
"""地圖加載完成回調"""