航线任务 无人机实时轨迹优化显示 优化websocket优化 设备状态界面显示
This commit is contained in:
@@ -716,7 +716,14 @@ export default function CesiumMap({ realtimePosition, realtimeType, pathPoints =
|
||||
const focusEntityRef = useRef(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (!viewerRef.current || !focusLocation) {
|
||||
// 如果有 realtimePosition,不显示 focusEntity
|
||||
const hasRealtime =
|
||||
realtimePosition?.lon &&
|
||||
realtimePosition?.lat &&
|
||||
!isNaN(Number(realtimePosition.lon)) &&
|
||||
!isNaN(Number(realtimePosition.lat));
|
||||
|
||||
if (!viewerRef.current || !focusLocation || hasRealtime) {
|
||||
if (focusEntityRef.current) {
|
||||
viewerRef.current?.entities.remove(focusEntityRef.current);
|
||||
focusEntityRef.current = null;
|
||||
@@ -1108,7 +1115,8 @@ export default function CesiumMap({ realtimePosition, realtimeType, pathPoints =
|
||||
}, window.Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
||||
|
||||
handler.setInputAction((movement) => {
|
||||
if (from !== "device-control") return;
|
||||
//if (from !== "device-control")
|
||||
return;
|
||||
const cartesian = viewer.camera.pickEllipsoid(movement.position, viewer.scene.globe.ellipsoid);
|
||||
if (!cartesian) return;
|
||||
const cartographic = window.Cesium.Cartographic.fromCartesian(cartesian);
|
||||
@@ -1214,9 +1222,26 @@ export default function CesiumMap({ realtimePosition, realtimeType, pathPoints =
|
||||
return;
|
||||
}
|
||||
|
||||
// ====================================
|
||||
// 情况2:有实时数据 -> 隐藏 focusEntity
|
||||
// ====================================
|
||||
if (focusEntityRef.current) {
|
||||
viewer.entities.remove(focusEntityRef.current);
|
||||
focusEntityRef.current = null;
|
||||
}
|
||||
|
||||
// ====================================
|
||||
// 解析实时坐标
|
||||
// ====================================
|
||||
entityMapRef.current.forEach((entity) => {
|
||||
if (entity.billboard) entity.billboard.show = false;
|
||||
});
|
||||
alarmMapRef.current.forEach((entity) => {
|
||||
if (entity.billboard) entity.billboard.show = false;
|
||||
});
|
||||
iotMapRef.current.forEach((entity) => {
|
||||
if (entity.billboard) entity.billboard.show = false;
|
||||
});
|
||||
|
||||
const lon = Number(realtimePosition.lon);
|
||||
const lat = Number(realtimePosition.lat);
|
||||
@@ -1302,8 +1327,7 @@ export default function CesiumMap({ realtimePosition, realtimeType, pathPoints =
|
||||
// 需要将地理航向转换为 Cesium rotation
|
||||
// 地理 0° 北 → Cesium 需要 -90° 或者 270°(因为 Cesium 0° 是右/东)
|
||||
let headingDeg = Number(realtimePosition.heading);
|
||||
// 将地理航向转换:北(0°) → 上(270° 或 -90°)
|
||||
rotation = Cesium.Math.toRadians(headingDeg - 90);
|
||||
rotation = Cesium.Math.toRadians(headingDeg);
|
||||
}
|
||||
|
||||
if (!realtimeCarEntityRef.current) {
|
||||
|
||||
Reference in New Issue
Block a user