fix
This commit is contained in:
parent
77d3af2f1b
commit
9edef5775d
@ -2,14 +2,22 @@ import { Button } from "antd";
|
|||||||
import { useCallback } from "react";
|
import { useCallback } from "react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import NavBarButton from "./NavBarButton";
|
import NavBarButton from "./NavBarButton";
|
||||||
|
import { useDispatch } from "react-redux";
|
||||||
|
|
||||||
function NavBar() {
|
function NavBar() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
const navigateHandler = useCallback(
|
const navigateHandler = useCallback(
|
||||||
(type) => {
|
(type) => {
|
||||||
navigate(`/map/${type}`, { replace: true });
|
navigate(`/map/${type}`, { replace: true });
|
||||||
|
if (type !== 1 && type !== 2) {
|
||||||
|
dispatch.data.update({
|
||||||
|
toolbar: { showPanel: true },
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
[navigate]
|
[navigate, dispatch]
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -61,7 +61,8 @@ function CustomToolbar() {
|
|||||||
|
|
||||||
const navigateHandler = useCallback(() => {
|
const navigateHandler = useCallback(() => {
|
||||||
navigate("/home", { replace: true });
|
navigate("/home", { replace: true });
|
||||||
}, [navigate]);
|
dispatch.data.resetState();
|
||||||
|
}, [navigate, dispatch]);
|
||||||
|
|
||||||
const showPanelHandler = useCallback(
|
const showPanelHandler = useCallback(
|
||||||
(value) => {
|
(value) => {
|
||||||
|
@ -18,6 +18,7 @@ function LayerLabToQTP() {
|
|||||||
const [index, setIndex] = useState(0);
|
const [index, setIndex] = useState(0);
|
||||||
|
|
||||||
//viewer.clock?.shouldAnimate
|
//viewer.clock?.shouldAnimate
|
||||||
|
console.log("viewer.clock?.shouldAnimate :>> ", viewer.clock?.shouldAnimate);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const { labrador } = imageLayer;
|
const { labrador } = imageLayer;
|
||||||
@ -52,14 +53,19 @@ function LayerLabToQTP() {
|
|||||||
|
|
||||||
useInterval(() => {
|
useInterval(() => {
|
||||||
setIndex((index) => index + 1);
|
setIndex((index) => index + 1);
|
||||||
if (!viewer.clock?.shouldAnimate) {
|
|
||||||
|
if (index >= nameList.length) {
|
||||||
|
setTimeout(() => {
|
||||||
|
setIndex(0);
|
||||||
|
setDelay(1000);
|
||||||
|
}, (60 - nameList.length) * 1000);
|
||||||
setDelay(undefined);
|
setDelay(undefined);
|
||||||
}
|
}
|
||||||
if (index >= nameList.length) setDelay(undefined);
|
|
||||||
}, delay);
|
}, delay);
|
||||||
|
|
||||||
return <></>;
|
if (!viewer.clock?.shouldAnimate) return;
|
||||||
// return layers[index];
|
|
||||||
|
return layers[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
export default LayerLabToQTP;
|
export default LayerLabToQTP;
|
||||||
|
@ -22,12 +22,12 @@ function Barotropic() {
|
|||||||
stopTime.secondsOfDay - currentTime.secondsOfDay
|
stopTime.secondsOfDay - currentTime.secondsOfDay
|
||||||
);
|
);
|
||||||
|
|
||||||
if (leftTime <= 10) {
|
if (leftTime < 10) {
|
||||||
setShow(true);
|
setShow(true);
|
||||||
} else if (show) setShow(false);
|
} else if (show) setShow(false);
|
||||||
}, [show]);
|
}, [show]);
|
||||||
|
|
||||||
useInterval(showAnimate, 1000);
|
useInterval(showAnimate, 100);
|
||||||
|
|
||||||
if (type !== "1") return <></>;
|
if (type !== "1") return <></>;
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ function Cyclone() {
|
|||||||
|
|
||||||
if (type !== "1") return <></>;
|
if (type !== "1") return <></>;
|
||||||
|
|
||||||
|
// 自转
|
||||||
// const position = new Cesium.SampledPositionProperty();
|
// const position = new Cesium.SampledPositionProperty();
|
||||||
|
|
||||||
// const velocityVectorProperty = new Cesium.VelocityVectorProperty(
|
// const velocityVectorProperty = new Cesium.VelocityVectorProperty(
|
||||||
@ -63,6 +64,7 @@ function Cyclone() {
|
|||||||
uri={arrowRound}
|
uri={arrowRound}
|
||||||
minimumPixelSize={64}
|
minimumPixelSize={64}
|
||||||
// nodeTransformations={{
|
// nodeTransformations={{
|
||||||
|
// 自转
|
||||||
// group_0: new Cesium.NodeTransformationProperty({
|
// group_0: new Cesium.NodeTransformationProperty({
|
||||||
// rotation: rotationProperty,
|
// rotation: rotationProperty,
|
||||||
// }),
|
// }),
|
||||||
|
@ -1,20 +1,38 @@
|
|||||||
import { Fragment } from "react";
|
import { useCallback, useState } from "react";
|
||||||
import { Entity, PolygonGraphics } from "resium";
|
import { useParams } from "react-router-dom";
|
||||||
import WavePoint from "./WavePoint";
|
import { Entity, PolygonGraphics, useCesium } from "resium";
|
||||||
|
import { useInterval } from "ahooks";
|
||||||
|
|
||||||
function PlateauPolygon() {
|
function PlateauPolygon() {
|
||||||
|
const { type } = useParams();
|
||||||
|
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 < (type === "1" ? 10 : 20)) {
|
||||||
|
setShow(true);
|
||||||
|
} else if (show) setShow(false);
|
||||||
|
}, [show, type]);
|
||||||
|
|
||||||
|
useInterval(showAnimate, 100);
|
||||||
|
|
||||||
|
if (type !== "1" && type !== "2") return <></>;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Entity id="plateau" show={show}>
|
||||||
{/* <WavePoint stationLat={32.5} stationLon={88} /> */}
|
<PolygonGraphics
|
||||||
<Entity id="plateau">
|
hierarchy={Cesium.Cartesian3.fromDegreesArray([
|
||||||
<PolygonGraphics
|
// 85, 30, 91, 30, 91, 35, 85, 35,
|
||||||
hierarchy={Cesium.Cartesian3.fromDegreesArray([
|
80, 31, 84, 29.5, 87.4, 28, 91, 28, 98, 29, 94, 35, 79, 34.4, 80, 31,
|
||||||
85, 30, 91, 30, 91, 35, 85, 35,
|
])}
|
||||||
])}
|
material={new Cesium.Color(1, 0, 0, 0.1)}
|
||||||
material={new Cesium.Color(1, 0, 0, 0.1)}
|
/>
|
||||||
/>
|
</Entity>
|
||||||
</Entity>
|
|
||||||
</Fragment>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ function TPTT() {
|
|||||||
data: ["观测结果", "预测结果"],
|
data: ["观测结果", "预测结果"],
|
||||||
textStyle: { color: "#04fbfd", cursor: "point" },
|
textStyle: { color: "#04fbfd", cursor: "point" },
|
||||||
},
|
},
|
||||||
animationDuration: 3000,
|
animationDuration: years.length * 1000,
|
||||||
animationEasing: "cubicInOut",
|
animationEasing: "cubicInOut",
|
||||||
grid: {
|
grid: {
|
||||||
left: "3%",
|
left: "3%",
|
||||||
|
@ -83,7 +83,7 @@ function TripolarTemperature() {
|
|||||||
data: ["南极", "北极", "青藏高原"],
|
data: ["南极", "北极", "青藏高原"],
|
||||||
textStyle: { color: "#04fbfd", cursor: "point" },
|
textStyle: { color: "#04fbfd", cursor: "point" },
|
||||||
},
|
},
|
||||||
animationDuration: 3000,
|
animationDuration: years.length * 500,
|
||||||
animationEasing: "cubicInOut",
|
animationEasing: "cubicInOut",
|
||||||
grid: {
|
grid: {
|
||||||
left: "3%",
|
left: "3%",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Viewer, Scene } from "resium";
|
import { Viewer } from "resium";
|
||||||
import CustomClock from "./CustomClock";
|
import CustomClock from "./CustomClock";
|
||||||
import CustomFlyTo from "./CustomFlyTo";
|
import CustomFlyTo from "./CustomFlyTo";
|
||||||
import CustomToolbar from "./CustomToolbar";
|
import CustomToolbar from "./CustomToolbar";
|
||||||
|
@ -21,6 +21,18 @@ export const data = {
|
|||||||
const { imageLayer } = state;
|
const { imageLayer } = state;
|
||||||
return { ...state, imageLayer: { ...imageLayer, ...payload } };
|
return { ...state, imageLayer: { ...imageLayer, ...payload } };
|
||||||
},
|
},
|
||||||
|
resetState(state, payload) {
|
||||||
|
return {
|
||||||
|
showSite: false,
|
||||||
|
toolbar: {
|
||||||
|
showPanel: undefined,
|
||||||
|
},
|
||||||
|
imageLayer: {
|
||||||
|
labrador: undefined,
|
||||||
|
indianOcean: undefined,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
},
|
},
|
||||||
effects: (dispatch) => ({}),
|
effects: (dispatch) => ({}),
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user