From 5f24e37b78a9880f44692e802c459bf9595e0d12 Mon Sep 17 00:00:00 2001 From: mmc <1556375442@qq.com> Date: Mon, 21 Sep 2026 15:16:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E6=97=B6=E7=9B=91=E6=8E=A7=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=E7=82=B9=E5=87=BB=20=E8=AE=BE=E5=A4=87=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E6=B6=88=E5=A4=B1=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?=E5=B9=B6=E4=B8=94=E6=B5=8B=E8=AF=95=20=20=E4=B8=8B=E5=8F=91?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Map.jsx | 39 ++--------------------------------- src/pages/RealTimeMonitor.tsx | 2 ++ 2 files changed, 4 insertions(+), 37 deletions(-) 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) {