feat(receiver): 持久化接收机发现端点并支持位置备注信息

This commit is contained in:
zyp
2026-11-30 09:29:33 +08:00
parent 1d6d7a277e
commit 5e761fc064
95 changed files with 15744 additions and 701 deletions
+62 -7
View File
@@ -1,4 +1,5 @@
// Load the map engine only for the approved realtime workspace.
import '/workbench/drone-map.js';
// A separate, lazy map keeps configuration independent of the live receiver map.
let settings, generation=0;
@@ -15,13 +16,67 @@ window.ridGeofences={
close(){fenceGeneration++;fences?.close();},render(p){fences?.render(p);},targets(p){fences?.targets(p);},tool(v){fences?.tool(v);},locate(){fences?.locate();},setBasemap(v){fences?.setBasemap(v);},metrics(){return fences?.metrics();}
};
let history,historyGeneration=0,historyPoints=[],historyIndex=0;
window.ridHistory={
async open(p){const token=++historyGeneration;try{history??=await import('./history-map-adapter.js');if(token===historyGeneration){history.open(p);history.setPoints(historyPoints);history.setIndex(historyIndex);}}catch{window.dispatchEvent(new Event('rid-history-map-error'));}},
close(){historyGeneration++;history?.close();},
setPoints(value){historyPoints=Array.isArray(value)?value:[];historyIndex=0;history?.setPoints(historyPoints);},
setIndex(value){historyIndex=value;history?.setIndex(value);},
metrics(){return history?.metrics();}
let history, historyGeneration = 0, historyPoints = [], historyIndex = 0, historyProgress = 0;
let historyTarget, historyMapOptions;
let playbackFrame, playbackTimestamp, playbackGeneration = 0;
document.addEventListener('visibilitychange', () => { playbackTimestamp = undefined; });
function stopHistoryClock() {
playbackGeneration += 1;
if (playbackFrame !== undefined) cancelAnimationFrame(playbackFrame);
playbackFrame = undefined;
playbackTimestamp = undefined;
}
window.ridHistory = {
async open(p) {
const token = ++historyGeneration;
try {
history ??= await import('./history-map-adapter.js');
if (token === historyGeneration) {
history.open({...p, ...historyMapOptions});
history.setPoints(historyPoints, historyTarget);
history.setCursor(historyIndex, historyProgress);
}
} catch {
window.dispatchEvent(new Event('rid-history-map-error'));
}
},
close() {
historyGeneration += 1;
stopHistoryClock();
history?.close();
},
prepareTrack(value) { return window.ridDroneMap.prepareTrack(value); },
setPoints(value, target) {
historyPoints = Array.isArray(value) ? value : [];
historyTarget = target;
historyIndex = 0;
historyProgress = 0;
history?.setPoints(historyPoints, historyTarget);
},
setMapOptions(value) {
historyMapOptions = value;
if (value) history?.setMapOptions(value);
},
setCursor(index, progress) {
historyIndex = index;
historyProgress = progress;
history?.setCursor(index, progress);
},
startClock(tick) {
stopHistoryClock();
const token = playbackGeneration;
function frame(timestamp) {
if (token !== playbackGeneration) return;
const elapsed = playbackTimestamp === undefined ? 0 : Math.max(0, timestamp - playbackTimestamp);
playbackTimestamp = timestamp;
if (tick(elapsed) && token === playbackGeneration) {
playbackFrame = requestAnimationFrame(frame);
}
}
playbackFrame = requestAnimationFrame(frame);
},
stopClock: stopHistoryClock,
metrics() { return history?.metrics(); }
};
if (location.pathname === '/realtime') await import('./map-adapter.js');