diff --git a/src/components/Map.jsx b/src/components/Map.jsx index 2d92643..a57863d 100644 --- a/src/components/Map.jsx +++ b/src/components/Map.jsx @@ -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), diff --git a/src/pages/RealTimeMonitor.tsx b/src/pages/RealTimeMonitor.tsx index 1713a45..06fc2e4 100644 --- a/src/pages/RealTimeMonitor.tsx +++ b/src/pages/RealTimeMonitor.tsx @@ -438,6 +438,7 @@ const RealTimeMonitorPage = () => { lat: Number(dev.lastRunningStatus?.latitude || dev.locationMessage?.latitude || dev.latitude), type: isDroneDevice ? 'plane' : 'robot', name: dev.deviceAlias || dev.deviceName || dev.drone_callsign || dev.serialNumber || dev.device_sn, + sn: dev.serialNumber || dev.device_sn || dev.id, }); } @@ -768,6 +769,7 @@ const RealTimeMonitorPage = () => { lat: Number(pos.latitude), type: 'plane', name: dev.deviceAlias || dev.device_sn, + sn: dev.device_sn || dev.serialNumber || dev.id, }); } } catch (err) {