diff --git a/src/components/PolygonLayout/CustomClock.jsx b/src/components/PolygonLayout/CustomClock.jsx index 9c93197..b45f6a9 100644 --- a/src/components/PolygonLayout/CustomClock.jsx +++ b/src/components/PolygonLayout/CustomClock.jsx @@ -6,7 +6,7 @@ function CustomClock({ start, stop }) { return ( { + camera.flyTo(plateauOptions); + }, 1000); + }, + }; - useEffect(() => { - setTimeout(() => { - setDestination(Cesium.Cartesian3.fromDegrees(88, -89, 20000000)); - }, 1000); - setTimeout(() => { - setDestination(Cesium.Cartesian3.fromDegrees(88, 33, 20000000)); - }, 4000); - setTimeout(() => { - setDestination(Cesium.Cartesian3.fromDegrees(130, -10.5, 20000000)); - }, 7000); - }, []); - return ; + const plateauOptions = { + destination: Cesium.Cartesian3.fromDegrees(90, 20, 1600000), + duration: 10, + orientation: { + heading: Cesium.Math.toRadians(-15.0), + pitch: -Cesium.Math.PI_OVER_FOUR, + roll: 0.0, + }, + complete: function () { + setTimeout(function () { + camera.flyTo(sideViewOptions); + }, 1000); + }, + }; + + const sideViewOptions = { + destination: Cesium.Cartesian3.fromDegrees(130, -10.5, 20000000), + duration: 5, + complete: () => { + viewer.clock.shouldAnimate = true; + }, + }; + + if (adjustPitch) { + antarcticalOptions.pitchAdjustHeight = 1000; + plateauOptions.pitchAdjustHeight = 1000; + sideViewOptions.pitchAdjustHeight = 1000; + } + camera.flyTo(antarcticalOptions); + } + cameraFlyToLine(); + return ; } export default CustomFlyTo; diff --git a/src/components/PolygonLayout/Point.jsx b/src/components/PolygonLayout/Point.jsx index 3e2d871..e75dc5d 100644 --- a/src/components/PolygonLayout/Point.jsx +++ b/src/components/PolygonLayout/Point.jsx @@ -9,7 +9,7 @@ const height = 20000; for (let index = 0; index < 120; index++) { data.push({ longitude: 88, - latitude: 35 - 120 + index, // 由南极到青藏高原 + latitude: 35 - 120 + index * 0.9874, // 由南极到青藏高原 // latitude: 33 -index, // 由青藏高原到南极 height: index > 59 @@ -81,7 +81,8 @@ function Point({ start, stop }) { }); } else if (value === "sideview") { // 侧视 - viewer.trackedEntity = entityRef.current.cesiumElement; + // viewer.trackedEntity = entityRef.current.cesiumElement; + viewer.trackedEntity = undefined; viewer.camera.flyTo({ destination: Cesium.Cartesian3.fromDegrees(130, -10.5, 20000000), }); @@ -92,12 +93,16 @@ function Point({ start, stop }) { viewer.clock.currentTime ); if (!destination) return; - const newDestination = new Cesium.Cartesian3(); - newDestination.x = destination.x; - newDestination.y = destination.y + 3000000; - newDestination.z = destination.z; + const newDestination = Cesium.Cartesian3.clone(destination); + newDestination.y = destination.y + 1000000; viewer.camera.flyTo({ destination: newDestination, + orientation: { + heading: Cesium.Math.toRadians(0.0), + pitch: -Cesium.Math.PI_OVER_FOUR, + roll: 0.0, + }, + duration: 0, }); } }; @@ -109,7 +114,8 @@ function Point({ start, stop }) { 返回首页