页面显示定位质量等数据,接收到结束信号并显示机器人下发任务 执行 暂停恢复成功 控制地图是否绘制实时轨迹
This commit is contained in:
@@ -25,7 +25,7 @@ const CYAN_GLOW_COLOR = new window.Cesium.Color(
|
||||
);
|
||||
window.Cesium.Ion.defaultAccessToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJmNjk0NjI1MC0wZGYyLTQ1YzItYjJmZi0wY2M5ODEwODllYzIiLCJpZCI6Mzk3MTQxLCJpYXQiOjE3NzI1MjkwMjV9.U6qmakhDgXJVXwLFyWzSxAUOFZRrDkIsRUPP6CCdnKg";
|
||||
|
||||
export default function CesiumMap({ realtimePosition, realtimeType, pathPoints = [], devices = [], onCameraClick, focusLocation, points = [], onPathChange, from, onClearDraw }) {
|
||||
export default function CesiumMap({ drawRealTime, realtimePosition, realtimeType, pathPoints = [], devices = [], onCameraClick, focusLocation, points = [], onPathChange, from, onClearDraw }) {
|
||||
const containerRef = useRef(null);
|
||||
const viewerRef = useRef(null);
|
||||
const tooltipRef = useRef(null);
|
||||
@@ -1222,6 +1222,15 @@ export default function CesiumMap({ realtimePosition, realtimeType, pathPoints =
|
||||
return;
|
||||
}
|
||||
|
||||
if (!drawRealTime) {
|
||||
if (realtimeLineEntityRef.current) {
|
||||
viewer.entities.remove(realtimeLineEntityRef.current);
|
||||
realtimeLineEntityRef.current = null;
|
||||
}
|
||||
// 轨迹点数组也清空
|
||||
realtimeCartesianRef.current = [];
|
||||
}
|
||||
|
||||
// ====================================
|
||||
// 情况2:有实时数据 -> 隐藏 focusEntity
|
||||
// ====================================
|
||||
@@ -1263,7 +1272,7 @@ export default function CesiumMap({ realtimePosition, realtimeType, pathPoints =
|
||||
|
||||
const dist = Math.sqrt(dx * dx + dy * dy);
|
||||
|
||||
if (dist < 0.00001) {
|
||||
if (dist < 0.0000001) {
|
||||
shouldAdd = false;
|
||||
}
|
||||
|
||||
@@ -1283,9 +1292,9 @@ export default function CesiumMap({ realtimePosition, realtimeType, pathPoints =
|
||||
// 限制轨迹长度(防止内存爆)
|
||||
// ====================================
|
||||
|
||||
if (realtimeCartesianRef.current.length > 2000) {
|
||||
realtimeCartesianRef.current.shift();
|
||||
}
|
||||
//if (realtimeCartesianRef.current.length > 2000) {
|
||||
// realtimeCartesianRef.current.shift();
|
||||
//}
|
||||
|
||||
// ====================================
|
||||
// 第一次进入 realtime -> 隐藏所有设备
|
||||
@@ -1360,6 +1369,7 @@ export default function CesiumMap({ realtimePosition, realtimeType, pathPoints =
|
||||
const callbackPositions = new Cesium.CallbackProperty(() => {
|
||||
return realtimeCartesianRef.current;
|
||||
}, false);
|
||||
if (!drawRealTime) return;
|
||||
|
||||
realtimeLineEntityRef.current = viewer.entities.add({
|
||||
|
||||
@@ -1396,7 +1406,7 @@ export default function CesiumMap({ realtimePosition, realtimeType, pathPoints =
|
||||
destination: Cesium.Cartesian3.fromDegrees(
|
||||
lon,
|
||||
lat,
|
||||
1200
|
||||
30
|
||||
),
|
||||
|
||||
orientation: {
|
||||
|
||||
Reference in New Issue
Block a user