```
feat(geofences): 新增地理围栏模块并优化地图瓦片缓存 在 rid-shared 中实现二维 WGS84 地理围栏核心逻辑,支持圆形与多边形 两种几何体,包含坐标合法性校验、边界包含判断及自相交检测。 realtime-core 的 Store 新增观察者回调,在观测数据接受后按到达顺序 通知监听器。 前端方面,新增 geofence-map-adapter.js 提供基于 MapLibre 的围栏绘制 与编辑能力,配套 geofences.css 完成响应式布局样式。map-loader.js 增加懒加载入口,仅在实时工作区按需引入围栏地图模块。 同时引入 map-tile-buffer 瓦片缓冲机制,改善地图切换与刷新时的加载 体验;将默认缩放级别从 11 调整为 15,使初始视图更贴近实际监测场景。 ```
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// Load the map engine only for the approved realtime workspace.
|
||||
if (location.pathname === '/realtime') await import('./map-adapter.js');
|
||||
|
||||
// A separate, lazy map keeps configuration independent of the live receiver map.
|
||||
let settings, generation=0;
|
||||
window.ridMapSettings={
|
||||
@@ -8,3 +8,11 @@ window.ridMapSettings={
|
||||
configure(p){settings?.configure(p);},setBasemap(v){settings?.setBasemap(v);},
|
||||
tool(v){settings?.tool(v);},bounds(v){settings?.bounds(v);},current(){settings?.current();},metrics(){return settings?.metrics();}
|
||||
};
|
||||
|
||||
let fences,fenceGeneration=0;
|
||||
window.ridGeofences={
|
||||
async open(p){const token=++fenceGeneration;try{fences??=await import('./geofence-map-adapter.js');if(token===fenceGeneration){fences.open(p);window.dispatchEvent(new Event('rid-fence-map-ready'));}}catch{window.dispatchEvent(new CustomEvent('rid-fence-map-error',{detail:{message:'围栏地图模块加载失败,可继续使用坐标编辑。'}}));}},
|
||||
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();}
|
||||
};
|
||||
|
||||
if (location.pathname === '/realtime') await import('./map-adapter.js');
|
||||
|
||||
Reference in New Issue
Block a user