实时监控中心点击 设备图标消失的问题,并且测试 下发任务

This commit is contained in:
mmc
2026-09-21 15:16:46 +08:00
parent 1e516414d7
commit 5f24e37b78
2 changed files with 4 additions and 37 deletions

View File

@@ -1318,43 +1318,8 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
viewer.entities.remove(focusEntityRef.current);
}
// 隐藏同位置的设备实体,避免重复显示(同一设备出现两个图标和 label)
const focusLon = Number(focusLocation.lon);
const focusLat = Number(focusLocation.lat);
entityMapRef.current.forEach((entity) => {
const robotData = entity.properties?.robot?.getValue?.();
if (!robotData) return;
const raw = robotData?.locationMessage || robotData?.lastRunningStatus || {};
const entLon = Number(raw.longitude);
const entLat = Number(raw.latitude);
if (!isFinite(entLon) || !isFinite(entLat)) return;
// 经纬度相近(容差 0.0001 度)则视为同一设备
if (Math.abs(entLon - focusLon) < 0.0001 && Math.abs(entLat - focusLat) < 0.0001) {
if (entity.billboard) entity.billboard.show = false;
if (entity.label) entity.label.show = false;
hiddenByFocusRef.current.push(entity);
}
});
// 添加新的 focusEntity
focusEntityRef.current = viewer.entities.add({
position: Cesium.Cartesian3.fromDegrees(Number(focusLocation.lon), Number(focusLocation.lat), 0),
billboard: {
image: image,
width: 30,
height: 30,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
disableDepthTestDistance: Number.POSITIVE_INFINITY,
},
label: {
text: focusLocation.name,
font: "12px sans-serif",
pixelOffset: new Cesium.Cartesian2(0, -80),
fillColor: Cesium.Color.YELLOW,
showBackground: true,
backgroundColor: Cesium.Color.BLACK.withAlpha(0.6)
}
});
// 点击设备后仅做地图相机定位:不隐藏其他设备图标、不创建额外的 focusEntity
// 所有设备图标与光圈保持原样显示,由侧边抽屉展示详情
flyToView(viewer, FLIGHT_PRIORITY.focus, {
destination: Cesium.Cartesian3.fromDegrees(Number(focusLocation.lon), Number(focusLocation.lat), focusLocation.height || 800),