diff --git a/src/components/map/Layout/CustomClock.jsx b/src/components/map/Layout/CustomClock.jsx index b45f6a9..bc2865a 100644 --- a/src/components/map/Layout/CustomClock.jsx +++ b/src/components/map/Layout/CustomClock.jsx @@ -1,8 +1,11 @@ -import { Clock, useCesium } from "resium"; +import { Clock } from "resium"; -function CustomClock({ start, stop }) { - const { viewer } = useCesium(); +// 起始时间 +const start = Cesium.JulianDate.fromDate(new Date()); +// 结束时间 +const stop = Cesium.JulianDate.addSeconds(start, 60, new Cesium.JulianDate()); +function CustomClock() { return ( { - // const move = viewer.entities.values.filter( - // (entity) => entity.id === "move" - // )[0]; - // viewer.trackedEntity = move; - // viewer.camera.flyTo({ - // destination: Cesium.Cartesian3.fromDegrees(88, -89, 20000000), - // }); - }} + // onTick={(clock) => { + // if (!clock.shouldAnimate) return; + // }} + // onStop={() => { + // if (toolbar.showPanel === undefined) + // dispatch.data.updateToolbar({ showPanel: true }); + // }} /> ); } diff --git a/src/components/map/Layout/CustomFlyTo copy.jsx b/src/components/map/Layout/CustomFlyTo copy.jsx deleted file mode 100644 index f21c035..0000000 --- a/src/components/map/Layout/CustomFlyTo copy.jsx +++ /dev/null @@ -1,60 +0,0 @@ -import { Camera, useCesium } from "resium"; - -function CustomFlyTo() { - const { viewer } = useCesium(); - const { camera } = viewer; - - function cameraFlyToLine(adjustPitch) { - // 南极 - const antarcticalOptions = { - destination: Cesium.Cartesian3.fromDegrees(88, -89, 1600000), - orientation: { - heading: Cesium.Math.toRadians(15.0), - pitch: Cesium.Math.toRadians(-60), - roll: 0.0, - }, - duration: 10, - complete: function () { - setTimeout(() => { - camera.flyTo(plateauOptions); - }, 1000); - }, - }; - - // 青藏高原 - 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/map/Layout/CustomFlyTo/AntarcticaFlytoQTP.jsx b/src/components/map/Layout/CustomFlyTo/AntarcticaFlytoQTP.jsx new file mode 100644 index 0000000..3660f71 --- /dev/null +++ b/src/components/map/Layout/CustomFlyTo/AntarcticaFlytoQTP.jsx @@ -0,0 +1,106 @@ +import { useCesium } from "resium"; + +function AntarcticaFlytoQTP() { + const { viewer } = useCesium(); + const { camera } = viewer; + + function cameraFlyToLine(adjustPitch) { + // 南极 + const antarcticalOptions = { + destination: Cesium.Cartesian3.fromDegrees(88, -89, 1600000), + orientation: { + heading: Cesium.Math.toRadians(15.0), + pitch: Cesium.Math.toRadians(-60), + roll: 0.0, + }, + duration: 10, + complete: function () { + setTimeout(() => { + camera.flyTo(area1Options); + }, 1000); + }, + }; + + const area1Options = { + destination: Cesium.Cartesian3.fromDegrees(-110, -60, 6000000), + duration: 5, + complete: function () { + setTimeout(function () { + camera.flyTo(area2Options); + }, 1000); + }, + }; + + const area2Options = { + destination: Cesium.Cartesian3.fromDegrees(-30, -55, 6000000), + duration: 5, + complete: function () { + setTimeout(function () { + camera.flyTo(area3Options); + }, 1000); + }, + }; + + const area3Options = { + destination: Cesium.Cartesian3.fromDegrees(30, -40, 6000000), + duration: 5, + complete: function () { + setTimeout(function () { + camera.flyTo(area4Options); + }, 1000); + }, + }; + + const area4Options = { + destination: Cesium.Cartesian3.fromDegrees(65, -35, 6000000), + duration: 5, + complete: function () { + setTimeout(function () { + camera.flyTo(sideViewOptions); + }, 1000); + }, + }; + + // 青藏高原 + const plateauOptions = { + destination: Cesium.Cartesian3.fromDegrees(95, -30, 6000000), + 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(70, -60, 14000000), + // destination: Cesium.Cartesian3.fromDegrees(130, -10.5, 20000000), + duration: 5, + orientation: { + heading: Cesium.Math.toRadians(-10.0), + pitch: Cesium.Math.toRadians(-90), + roll: 6.0, + }, + complete: () => { + viewer.clock.shouldAnimate = true; + }, + }; + + if (adjustPitch) { + antarcticalOptions.pitchAdjustHeight = 1000; + plateauOptions.pitchAdjustHeight = 1000; + sideViewOptions.pitchAdjustHeight = 1000; + } + camera.flyTo(antarcticalOptions); + } + cameraFlyToLine(); + return <>; +} + +export default AntarcticaFlytoQTP; diff --git a/src/components/map/Layout/CustomFlyTo.jsx b/src/components/map/Layout/CustomFlyTo/LabFlytoQTP.jsx similarity index 75% rename from src/components/map/Layout/CustomFlyTo.jsx rename to src/components/map/Layout/CustomFlyTo/LabFlytoQTP.jsx index c61870b..c6cac65 100644 --- a/src/components/map/Layout/CustomFlyTo.jsx +++ b/src/components/map/Layout/CustomFlyTo/LabFlytoQTP.jsx @@ -1,10 +1,40 @@ +import { useDispatch } from "react-redux"; import { Camera, useCesium } from "resium"; -function CustomFlyTo() { +function LabFlytoQTP() { const { viewer } = useCesium(); const { camera } = viewer; + const dispatch = useDispatch(); function cameraFlyToLine(adjustPitch) { + // barotorpic + const barotorpic = { + destination: Cesium.Cartesian3.fromDegrees(42, 46, 15000000), + duration: 30, + complete: () => {}, + }; + + // 俯视看箭头上升 + const sideViewOptions = { + destination: Cesium.Cartesian3.fromDegrees(-50, 46, 2000000), + duration: 5, + orientation: { + heading: Cesium.Math.toRadians(-15.0), + pitch: -Cesium.Math.PI_OVER_FOUR, + roll: 0.0, + }, + complete: () => { + viewer.clock.shouldAnimate = true; + setTimeout(function () { + camera.flyTo(barotorpic); + }, 1000); + dispatch.data.updateImageLayer({ + labrador: true, + }); + dispatch.data.updateToolbar({ showPanel: true }); + }, + }; + // 青藏高原 const plateauOptions = { destination: Cesium.Cartesian3.fromDegrees(90, 20, 1600000), @@ -16,7 +46,7 @@ function CustomFlyTo() { }, complete: function () { setTimeout(function () { - camera.flyTo(step1); + camera.flyTo(sideViewOptions); }, 1000); }, }; @@ -37,43 +67,6 @@ function CustomFlyTo() { }, }; - // barotorpic - const barotorpic = { - destination: Cesium.Cartesian3.fromDegrees(42, 46, 15000000), - duration: 30, - complete: function () {}, - }; - - // // 侧边 - // const sideViewOptions = { - // destination: Cesium.Cartesian3.fromDegrees(-2.5, 32.5, 20000000), - // duration: 5, - // complete: () => { - // const entity = viewer.entities.getById("point"); - // viewer.clock.shouldAnimate = true; - // setTimeout(function () { - // camera.flyTo(step1); - // }, 1000); - // }, - // }; - - // 俯视看箭头上升 - const step1 = { - destination: Cesium.Cartesian3.fromDegrees(-50, 46, 2000000), - duration: 5, - orientation: { - heading: Cesium.Math.toRadians(-15.0), - pitch: -Cesium.Math.PI_OVER_FOUR, - roll: 0.0, - }, - complete: () => { - viewer.clock.shouldAnimate = true; - setTimeout(function () { - camera.flyTo(barotorpic); - }, 1000); - }, - }; - if (adjustPitch) { plateauOptions.pitchAdjustHeight = 1000; sideViewOptions.pitchAdjustHeight = 1000; @@ -81,7 +74,8 @@ function CustomFlyTo() { camera.flyTo(labrador); } cameraFlyToLine(); - return ; + + return <>; } -export default CustomFlyTo; +export default LabFlytoQTP; diff --git a/src/components/map/Layout/CustomFlyTo/index.jsx b/src/components/map/Layout/CustomFlyTo/index.jsx new file mode 100644 index 0000000..cc01abf --- /dev/null +++ b/src/components/map/Layout/CustomFlyTo/index.jsx @@ -0,0 +1,17 @@ +import { useParams } from "react-router-dom"; +import LabFlytoQTP from "./LabFlytoQTP"; +import AntarcticaFlytoQTP from "./AntarcticaFlytoQTP"; + +function CustomFlyTo({}) { + const { type } = useParams(); + + return type === "1" ? ( + + ) : type === "2" ? ( + + ) : ( + <> + ); +} + +export default CustomFlyTo; diff --git a/src/components/map/Layout/CustomToolbar.jsx b/src/components/map/Layout/CustomToolbar.jsx index d7a28b7..ce2d22e 100644 --- a/src/components/map/Layout/CustomToolbar.jsx +++ b/src/components/map/Layout/CustomToolbar.jsx @@ -99,7 +99,7 @@ function CustomToolbar() { /> */}