实时监控中心点击 设备图标消失的问题,并且测试 下发任务
This commit is contained in:
@@ -1318,43 +1318,8 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
|||||||
viewer.entities.remove(focusEntityRef.current);
|
viewer.entities.remove(focusEntityRef.current);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 隐藏同位置的设备实体,避免重复显示(同一设备出现两个图标和 label)
|
// 点击设备后仅做地图相机定位:不隐藏其他设备图标、不创建额外的 focusEntity
|
||||||
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)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
flyToView(viewer, FLIGHT_PRIORITY.focus, {
|
flyToView(viewer, FLIGHT_PRIORITY.focus, {
|
||||||
destination: Cesium.Cartesian3.fromDegrees(Number(focusLocation.lon), Number(focusLocation.lat), focusLocation.height || 800),
|
destination: Cesium.Cartesian3.fromDegrees(Number(focusLocation.lon), Number(focusLocation.lat), focusLocation.height || 800),
|
||||||
|
|||||||
@@ -438,6 +438,7 @@ const RealTimeMonitorPage = () => {
|
|||||||
lat: Number(dev.lastRunningStatus?.latitude || dev.locationMessage?.latitude || dev.latitude),
|
lat: Number(dev.lastRunningStatus?.latitude || dev.locationMessage?.latitude || dev.latitude),
|
||||||
type: isDroneDevice ? 'plane' : 'robot',
|
type: isDroneDevice ? 'plane' : 'robot',
|
||||||
name: dev.deviceAlias || dev.deviceName || dev.drone_callsign || dev.serialNumber || dev.device_sn,
|
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),
|
lat: Number(pos.latitude),
|
||||||
type: 'plane',
|
type: 'plane',
|
||||||
name: dev.deviceAlias || dev.device_sn,
|
name: dev.deviceAlias || dev.device_sn,
|
||||||
|
sn: dev.device_sn || dev.serialNumber || dev.id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user