页面隐藏 断websocket 修改map中points的数据结构
This commit is contained in:
@@ -189,9 +189,10 @@ export default function CesiumMap({ realtimePosition, realtimeType, pathPoints =
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(points, "4324345")
|
||||
const validPoints = points.filter(p => {
|
||||
const lon = Number(p.lon);
|
||||
|
||||
const lon = Number(p.lng);
|
||||
const lat = Number(p.lat);
|
||||
return (
|
||||
!isNaN(lon) &&
|
||||
@@ -207,7 +208,7 @@ export default function CesiumMap({ realtimePosition, realtimeType, pathPoints =
|
||||
|
||||
const positions = validPoints.map(point =>
|
||||
Cesium.Cartesian3.fromDegrees(
|
||||
Number(point.lon),
|
||||
Number(point.lng),
|
||||
Number(point.lat)
|
||||
)
|
||||
);
|
||||
@@ -235,8 +236,8 @@ export default function CesiumMap({ realtimePosition, realtimeType, pathPoints =
|
||||
let minLat = 90, maxLat = -90;
|
||||
|
||||
validPoints.forEach(p => {
|
||||
minLon = Math.min(minLon, p.lon);
|
||||
maxLon = Math.max(maxLon, p.lon);
|
||||
minLon = Math.min(minLon, p.lng);
|
||||
maxLon = Math.max(maxLon, p.lng);
|
||||
minLat = Math.min(minLat, p.lat);
|
||||
maxLat = Math.max(maxLat, p.lat);
|
||||
});
|
||||
@@ -251,7 +252,7 @@ export default function CesiumMap({ realtimePosition, realtimeType, pathPoints =
|
||||
viewer.scene.requestRender();
|
||||
viewer.camera.flyTo({
|
||||
destination: Cesium.Cartesian3.fromDegrees(
|
||||
p.lon,
|
||||
p.lng,
|
||||
p.lat,
|
||||
800
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user