From 88b928e3999748b94dda1d7e21d4025c2e763b54 Mon Sep 17 00:00:00 2001 From: Aifeilong <2993607249@qq.com> Date: Thu, 26 Oct 2023 11:03:48 +0800 Subject: [PATCH] fix 4.2 --- src/components/domain/One/Legend.jsx | 8 +-- src/components/domain/Two/CustomFlyTo.jsx | 13 +---- src/components/domain/Two/HadleyCell.jsx | 58 +++++++++++-------- src/components/domain/Two/Labels.jsx | 4 +- src/components/domain/Two/Legend.jsx | 8 +-- .../domain/Two/MoistureTransport.jsx | 4 +- src/components/domain/Two/Site/index.jsx | 24 +++++++- 7 files changed, 69 insertions(+), 50 deletions(-) diff --git a/src/components/domain/One/Legend.jsx b/src/components/domain/One/Legend.jsx index 30ef9b8..9ac960d 100644 --- a/src/components/domain/One/Legend.jsx +++ b/src/components/domain/One/Legend.jsx @@ -44,16 +44,16 @@ function Legend() { key={`colorbar-item-${index}`} className="colorbar-item" style={{ backgroundColor: color }} - title={`${(-3.2 + index * 0.2).toFixed(1)}~${( - -3.2 + - (index + 1) * 0.2 + title={`${(-1.6 + index * 0.1).toFixed(1)}~${( + -1.6 + + (index + 1) * 0.1 ).toFixed(1)}`} /> ); })}
- {[-2.4, -1.6, -0.8, 0, 0.8, 1.6, 2.4, ""].map((item, index) => { + {[-1.2, -0.8, -0.4, 0, 0.4, 0.8, 1.2, ""].map((item, index) => { return (
{item} diff --git a/src/components/domain/Two/CustomFlyTo.jsx b/src/components/domain/Two/CustomFlyTo.jsx index e91c26a..daefe13 100644 --- a/src/components/domain/Two/CustomFlyTo.jsx +++ b/src/components/domain/Two/CustomFlyTo.jsx @@ -24,7 +24,6 @@ function CustomFlyTo() { const area2Options = { destination: Cartesian3.fromDegrees(-30, -85, 10000000), - // destination: Cartesian3.fromDegrees(-30, -65, 10000000), duration: 5, complete: function () { camera.flyTo(area3Options); @@ -88,24 +87,16 @@ function CustomFlyTo() { }; const QTPlateauOption = { - destination: Cartesian3.fromDegrees(88, 18, 5000000), + destination: Cartesian3.fromDegrees(92, 8, 5000000), duration: 2, orientation: { heading: 6, - pitch: -1.3, + pitch: -1.2, roll: -6, }, easingFunction: EasingFunction.LINEAR_NONE, }; - const xx = { - destination: Cartesian3.fromDegrees(95, -35, 10000000), - duration: 4, - - easingFunction: EasingFunction.LINEAR_NONE, - }; - - // camera.flyTo(xx); camera.flyTo(area1Options); } cameraFlyToLine(); diff --git a/src/components/domain/Two/HadleyCell.jsx b/src/components/domain/Two/HadleyCell.jsx index 34b3965..b728fbf 100644 --- a/src/components/domain/Two/HadleyCell.jsx +++ b/src/components/domain/Two/HadleyCell.jsx @@ -1,33 +1,40 @@ -import { Cartesian3, Color, PolylineArrowMaterialProperty } from "cesium"; -import { Fragment } from "react"; -import { Entity, PolylineGraphics } from "resium"; +import { useInterval } from "ahooks"; +import { + CallbackProperty, + Cartesian3, + Color, + PolylineArrowMaterialProperty, +} from "cesium"; +import { Fragment, useCallback, useState } from "react"; +import { Entity, PolylineGraphics, useCesium } from "resium"; export default function HadleyCell() { + const { viewer } = useCesium(); + const [show, setShow] = useState(false); + + const showAnimate = useCallback(() => { + const { currentTime, stopTime } = viewer.clock; + const leftTime = Math.floor( + stopTime.secondsOfDay - currentTime.secondsOfDay + ); + + if (leftTime < 3) { + setShow(true); + } else if (show) setShow(false); + }, [show]); + + useInterval(showAnimate, 100); + + if (!show) return; + return ( {/* 右下部分 */} - {/* + - - - - */} - - {/* 左上部分 */} - + - + ); })}
- {[-2.4, -1.6, -0.8, 0, 0.8, 1.6, 2.4, ""].map((item, index) => { + {[-1.2, -0.8, -0.4, 0, 0.4, 0.8, 1.2, ""].map((item, index) => { return (
{item} diff --git a/src/components/domain/Two/MoistureTransport.jsx b/src/components/domain/Two/MoistureTransport.jsx index d5929d6..d1a027c 100644 --- a/src/components/domain/Two/MoistureTransport.jsx +++ b/src/components/domain/Two/MoistureTransport.jsx @@ -13,12 +13,12 @@ function MoistureTransport() { stopTime.secondsOfDay - currentTime.secondsOfDay ); - if (leftTime < 5) { + if (leftTime < 3) { setShow(true); } else if (show) setShow(false); }, [show]); - useInterval(showAnimate, 100); + useInterval(showAnimate, 300); return ( diff --git a/src/components/domain/Two/Site/index.jsx b/src/components/domain/Two/Site/index.jsx index def881d..aecd7c1 100644 --- a/src/components/domain/Two/Site/index.jsx +++ b/src/components/domain/Two/Site/index.jsx @@ -1,6 +1,8 @@ -import Site from "./Site"; +import { useCallback, useState } from "react"; +import { useCesium } from "resium"; +import { useInterval } from "ahooks"; import { chunk } from "lodash-es"; -import { useSelector } from "react-redux"; +import Site from "./Site"; const positions = [ 98, 38, 95, 37, 97, 37, 101, 37, 94, 36, 96, 36, 98, 36, 100, 36, 101, 36, @@ -15,6 +17,24 @@ const positions = [ ]; function Sites() { + const { viewer } = useCesium(); + const [show, setShow] = useState(false); + + const showAnimate = useCallback(() => { + const { currentTime, stopTime } = viewer.clock; + const leftTime = Math.floor( + stopTime.secondsOfDay - currentTime.secondsOfDay + ); + + if (leftTime < 3) { + setShow(true); + } else if (show) setShow(false); + }, [show]); + + useInterval(showAnimate, 100); + + if (!show) return; + return chunk(positions, 2).map((position, index) => { return ; });