This commit is contained in:
Aifeilong 2023-09-08 20:16:15 +08:00
parent 800d43ebe6
commit fbf38619e1
40 changed files with 85690 additions and 60 deletions

24
.gitignore vendored Normal file
View File

@ -0,0 +1,24 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
/.yarn
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*

34384
.pnp.cjs generated Executable file

File diff suppressed because one or more lines are too long

2042
.pnp.loader.mjs generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,92 +1,70 @@
# cesium-arrow # Getting Started with Create React App
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
## Getting started In the project directory, you can run:
To make it easy for you to get started with GitLab, here's a list of recommended next steps. ### `npm start`
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)! Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
## Add your files The page will reload when you make changes.\
You may also see any lint errors in the console.
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files ### `npm test`
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
``` Launches the test runner in the interactive watch mode.\
cd existing_repo See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
git remote add origin http://git.phitrellis.com/Aifeilong/cesium-arrow.git
git branch -M main
git push -uf origin main
```
## Integrate with your tools ### `npm run build`
- [ ] [Set up project integrations](http://git.phitrellis.com/Aifeilong/cesium-arrow/-/settings/integrations) Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.
## Collaborate with your team The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/) See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
## Test and Deploy ### `npm run eject`
Use the built-in continuous integration in GitLab. **Note: this is a one-way operation. Once you `eject`, you can't go back!**
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html) If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
*** Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
# Editing this README You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template. ## Learn More
## Suggestions for a good README You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
## Name To learn React, check out the [React documentation](https://reactjs.org/).
Choose a self-explaining name for your project.
## Description ### Code Splitting
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
## Badges This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
## Visuals ### Analyzing the Bundle Size
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
## Installation This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
## Usage ### Making a Progressive Web App
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
## Support This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
## Roadmap ### Advanced Configuration
If you have ideas for releases in the future, it is a good idea to list them in the README.
## Contributing This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
State if you are open to contributions and what your requirements are for accepting them.
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. ### Deployment
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser. This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
## Authors and acknowledgment ### `npm run build` fails to minify
Show your appreciation to those who have contributed to the project.
## License This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
For open source projects, say how it is licensed.
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.

41
craco.config.js Normal file
View File

@ -0,0 +1,41 @@
const CracoLessPlugin = require("craco-less");
const CracoCesiumPlugin = require("craco-cesium");
const path = require("path");
module.exports = {
webpack: {
alias: {
["@"]: path.resolve(__dirname, "src"),
},
},
plugins: [
{
plugin: CracoLessPlugin,
options: {
lessLoaderOptions: {
lessOptions: {
modifyVars: { "@primary-color": "#016bbb" },
javascriptEnabled: true,
},
},
},
},
{
plugin: CracoLessPlugin,
options: {
modifyLessRule: function (lessRule, _context) {
lessRule.test = /\.(module)\.(less)$/;
lessRule.exclude = /node_modules/;
return lessRule;
},
cssLoaderOptions: {
modules: { localIdentName: "[local]_[hash:base64:5]" },
},
},
},
{
plugin: CracoCesiumPlugin(),
},
],
};

30214
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

44
package.json Normal file
View File

@ -0,0 +1,44 @@
{
"name": "cesium-arrow",
"version": "0.1.0",
"private": true,
"dependencies": {
"@ant-design/colors": "^7.0.0",
"@craco/craco": "^7.1.0",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"ahooks": "^3.7.8",
"antd": "^5.8.4",
"cesium": "^1.108.0",
"craco-cesium": "^1.2.0",
"craco-less": "^3.0.1",
"lodash-es": "^4.17.21",
"node-polyfill-webpack-plugin": "^2.0.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-redux": "^8.1.2",
"react-router-dom": "^6.15.0",
"react-scripts": "5.0.1",
"resium": "^1.17.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "craco start",
"build": "craco build",
"test": "craco test"
},
"eslintConfig": {},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

43
public/index.html Normal file
View File

@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>

BIN
public/logo192.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

BIN
public/logo512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

25
public/manifest.json Normal file
View File

@ -0,0 +1,25 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

3
public/robots.txt Normal file
View File

@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:

16
src/App.js Normal file
View File

@ -0,0 +1,16 @@
import { Routes, Route, Navigate } from "react-router-dom";
import HomeLayout from "@/components/HomeLayout";
import PolygonLayout from "@/components/PolygonLayout";
import "./App.less";
function App() {
return (
<Routes>
<Route path="/" element={<HomeLayout />} />
<Route path="polygon" element={<PolygonLayout />} />
<Route path="*" element={<Navigate to={"/"} replace={true} />} />
</Routes>
);
}
export default App;

8
src/App.less Normal file
View File

@ -0,0 +1,8 @@
// @import "~antd/dist/antd.less";
html,
body,
#root {
height: 100%;
width: 100%;
}

8
src/App.test.js Normal file
View File

@ -0,0 +1,8 @@
import { render, screen } from '@testing-library/react';
import App from './App';
test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});

BIN
src/assets/link.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 924 KiB

BIN
src/assets/title.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
src/assets/wave.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

View File

@ -0,0 +1,21 @@
import { Button } from "antd";
import { useCallback } from "react";
import { useNavigate } from "react-router-dom";
import NavBarButton from "./NavBarButton";
function NavBar() {
const navigate = useNavigate();
const navigateHandler = useCallback(() => {
navigate("/polygon", { replace: true });
}, [navigate]);
return (
<div className="nav-bar">
<NavBarButton text={"两极协同-拉布拉多海"} onClick={navigateHandler} />
<NavBarButton text={"两极协同-南极青藏高原"} onClick={navigateHandler} />
<NavBarButton text={"两极协同-大西洋"} onClick={navigateHandler} />
</div>
);
}
export default NavBar;

View File

@ -0,0 +1,13 @@
function NavBarButton({ text, onClick }) {
return (
<div className="nav-bar-button" onClick={onClick}>
<div className="btn-table left-top" />
<div className="btn-table right-top" />
<div className="btn-table left-bottom" />
<div className="btn-table right-bottom" />
<div className="nav-bar-content">{text}</div>
</div>
);
}
export default NavBarButton;

View File

@ -0,0 +1,13 @@
import NavBar from "./NavBar";
import styles from "./index.module.less";
function HomeLayout() {
return (
<div className={styles.homeLayout}>
<div className="title">时空三级环境大数据平台</div>
<NavBar />
</div>
);
}
export default HomeLayout;

View File

@ -0,0 +1,133 @@
.mapContainer :global {
width: 100%;
height: 100%;
.cesium-container {
width: 100%;
height: 100%;
position: relative;
.cesium-widget-credits {
display: none !important;
visibility: hide !important;
}
.viewer-toolbar {
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
position: absolute;
height: 159px;
right: 5px;
top: 5px;
.ant-image {
width: 50px;
height: 50px;
border: none;
img {
border-radius: 14%;
}
}
}
.viewer-toolbar :hover {
cursor: pointer;
color: #fff;
fill: #fff;
background: #48b;
border-color: #aef;
box-shadow: 0 0 8px #fff;
}
}
}
.homeLayout :global {
height: 100%;
background: url("../../assets/link.png") 50% no-repeat;
background-size: 100% 100%;
display: flex;
flex-direction: column;
.title {
height: 72px;
background: url("../../assets/title.png") 50% no-repeat;
margin-bottom: 8px;
color: #04fbfd;
display: flex;
align-items: center;
justify-content: center;
font-size: 42px;
font-weight: 700;
}
.nav-bar {
width: 100%;
max-width: 1200px;
margin: 300px auto;
height: 72px;
padding: 0 12px;
color: #fff;
display: flex;
align-items: center;
gap: 8px;
// justify-content: space-between;
justify-content: space-evenly;
.nav-bar-button {
// border: 1px solid #4096ff;
position: relative;
cursor: pointer;
@btn-table-color: #04fbfd;
transition: all 0.3s ease;
flex: 1;
text-align: center;
max-width: 248px;
.btn-table {
width: 20px;
height: 10px;
position: absolute;
background-color: transparent;
&.left-top {
left: 0;
top: 0;
border-left: 1px solid @btn-table-color;
border-top: 1px solid @btn-table-color;
}
&.left-bottom {
left: 0;
bottom: 0;
border-left: 1px solid @btn-table-color;
border-bottom: 1px solid @btn-table-color;
}
&.right-top {
right: 0;
top: 0;
border-right: 1px solid @btn-table-color;
border-top: 1px solid @btn-table-color;
}
&.right-bottom {
right: 0;
bottom: 0;
border-right: 1px solid @btn-table-color;
border-bottom: 1px solid @btn-table-color;
}
}
.nav-bar-content {
padding: 20px;
font-size: 20px;
color: @btn-table-color;
background-color: #081633;
}
&:hover {
transform: translate(0, -4px);
.nav-bar-content {
background-color: #112f6a;
}
}
}
}
}

View File

@ -0,0 +1,20 @@
import WavePoint from "./WavePoint";
function AntarcticaPolygon() {
return (
// <Entity>
// <PolygonGraphics
// hierarchy={Cesium.Cartesian3.fromDegreesArray([
// 20, -85, -20, -85, -20, -88, 20, -88,
// ])}
// material={Cesium.Color.PINK}
// outline={true}
// outlineColor={Cesium.Color.RED}
// outlineWidth={20}
// />
// </Entity>
<WavePoint stationLat={-85} stationLon={88} />
);
}
export default AntarcticaPolygon;

View File

@ -0,0 +1,27 @@
import { Clock, useCesium } from "resium";
function CustomClock({ start, stop }) {
const { viewer } = useCesium();
return (
<Clock
multiplier={1}
shouldAnimate={true}
startTime={start.clone()}
stopTime={stop.clone()}
currentTime={start.clone()}
clockRange={Cesium.ClockRange.LOOP_STOP}
onStop={() => {
// const move = viewer.entities.values.filter(
// (entity) => entity.id === "move"
// )[0];
// viewer.trackedEntity = move;
// viewer.camera.flyTo({
// destination: Cesium.Cartesian3.fromDegrees(88, -89, 20000000),
// });
}}
/>
);
}
export default CustomClock;

View File

@ -0,0 +1,25 @@
import { CameraFlyTo, useCesium } from "resium";
import { useEffect, useState } from "react";
function CustomFlyTo() {
const { viewer } = useCesium();
const [destination, setDestination] = useState(
Cesium.Cartesian3.fromDegrees(88, -89, 20000000)
);
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 <CameraFlyTo destination={destination} />;
}
export default CustomFlyTo;

View File

@ -0,0 +1,24 @@
import { Fragment } from "react";
import { Entity, PolygonGraphics } from "resium";
import WavePoint from "./WavePoint";
function PlateauPolygon() {
return (
<Fragment>
<WavePoint stationLat={32.5} stationLon={88} />
<Entity>
<PolygonGraphics
hierarchy={Cesium.Cartesian3.fromDegreesArray([
85, 30, 91, 30, 91, 35, 85, 35,
])}
// height={1}
material={new Cesium.Color(1, 0, 0, 0.1)}
// outline={true}
// outlineColor={Cesium.Color.LIGHTBLUE}
/>
</Entity>
</Fragment>
);
}
export default PlateauPolygon;

View File

@ -0,0 +1,172 @@
import { Entity, PointGraphics, useCesium } from "resium";
import { Fragment, useCallback, useRef, useState } from "react";
import { useNavigate } from "react-router-dom";
import { Select } from "antd";
import styles from "./index.module.less";
const data = [];
const height = 20000;
for (let index = 0; index < 120; index++) {
data.push({
longitude: 88,
latitude: 35 - 120 + index, //
// latitude: 33 -index, //
height:
index > 59
? index === 60
? height * 59
: (119 - index) * height
: height * index,
time: index / 2,
});
}
function Point({ start, stop }) {
const { viewer } = useCesium();
const entityRef = useRef();
const navigate = useNavigate();
const [value, setValue] = useState("sideview");
/**
* 计算飞行路径
* 数据坐标
* {SampledPositionProperty|*}
*/
function createProperty(source) {
let property = new Cesium.SampledPositionProperty();
for (let i = 0; i < source.length; i++) {
let time = Cesium.JulianDate.addSeconds(
start,
source[i].time,
new Cesium.JulianDate()
);
let position = Cesium.Cartesian3.fromDegrees(
source[i].longitude,
source[i].latitude,
source[i].height
);
//
property.addSample(time, position);
}
return property;
}
const property = createProperty(data);
property.setInterpolationOptions({
interpolationDegree: 10,
interpolationAlgorithm: Cesium.LagrangePolynomialApproximation,
});
const navigateHandler = useCallback(() => {
navigate("/home", { replace: true });
}, [navigate]);
const handleChange = (value) => {
setValue(value);
if (!viewer) return;
if (value === "overhead") {
//
viewer.trackedEntity = entityRef.current.cesiumElement;
const destination = entityRef.current.cesiumElement.position.getValue(
viewer.clock.currentTime
);
if (!destination) return;
const newDestination = new Cesium.Cartesian3();
newDestination.x = destination.x;
newDestination.y = destination.y + 13000000;
newDestination.z = destination.z;
viewer.camera.flyTo({
destination: newDestination,
});
} else if (value === "sideview") {
//
viewer.trackedEntity = entityRef.current.cesiumElement;
viewer.camera.flyTo({
destination: Cesium.Cartesian3.fromDegrees(130, -10.5, 20000000),
});
} else {
//
viewer.trackedEntity = entityRef.current.cesiumElement;
const destination = entityRef.current.cesiumElement.position.getValue(
viewer.clock.currentTime
);
if (!destination) return;
const newDestination = new Cesium.Cartesian3();
newDestination.x = destination.x;
newDestination.y = destination.y + 3000000;
newDestination.z = destination.z;
viewer.camera.flyTo({
destination: newDestination,
});
}
};
return (
<Fragment>
<div className={styles.toolbar}>
<div className={"focusBtn"} onClick={navigateHandler}>
返回首页
</div>
<Select
onSelect={handleChange}
value={value}
getPopupContainer={(node) => node}
options={[
// {
// value: "overhead",
// label: "",
// },
{
value: "sideview",
label: "侧视视角",
},
{
value: "follow",
label: "跟随视角",
},
]}
/>
</div>
<Entity
onDoubleClick={(e) => {
if ((viewer.trackedEntity = undefined)) setValue("follow");
}}
ref={entityRef}
availability={
new Cesium.TimeIntervalCollection([
new Cesium.TimeInterval({
start: start,
stop: stop,
}),
])
}
id={"move"}
position={property}
//
orientation={new Cesium.VelocityOrientationProperty(property)}
path={{
resolution: 1,
material: new Cesium.PolylineGlowMaterialProperty({
glowPower: 0.1,
color: Cesium.Color.YELLOW,
}),
// leadTimetrailTime path
leadTime: 0, // 0 path
// trailTime: 0, // 0 path
width: 10,
}}
>
<PointGraphics
show={true}
color={Cesium.Color.SKYBLUE}
pixelSize={10}
outlineColor={Cesium.Color.YELLOW}
outlineWidth={3}
/>
</Entity>
</Fragment>
);
}
export default Point;

View File

@ -0,0 +1,128 @@
import { Fragment } from "react";
import { Entity, EllipseGraphics } from "resium";
import wave from "@/assets/wave.png";
function WavePoint({
stationLon,
stationLat,
value = 360,
deviationR = 5000,
eachInterval = 1500,
maxR = 3600 * 100,
}) {
const data = {
stationLon, //
stationLat, //
value, //
deviationR, //
eachInterval, //
imageUrl: wave,
maxR,
};
var r1 = 0,
r2 = 0;
var r3 = 0,
r4 = 0;
function changeOne() {
//callback
r1 = r1 + data.deviationR;
if (r1 >= data.maxR) {
r1 = 0;
}
return r1;
}
function changeR2() {
r2 = r2 + data.deviationR;
if (r2 >= data.maxR) {
r2 = 0;
}
return r2;
}
const point1 = (
<Entity
position={Cesium.Cartesian3.fromDegrees(
data.stationLon,
data.stationLat,
0
)}
show={true}
>
<EllipseGraphics
semiMinorAxis={new Cesium.CallbackProperty(changeOne, false)}
semiMajorAxis={new Cesium.CallbackProperty(changeR2, false)}
height={10}
material={
new Cesium.ImageMaterialProperty({
image: data.imageUrl,
repeat: Cesium.Cartesian2(1.0, 1.0),
transparent: true,
color: new Cesium.CallbackProperty(function () {
var alp = 1 - r1 / data.maxR;
return Cesium.Color.WHITE.withAlpha(alp);
}, false),
})
}
/>
</Entity>
);
let point2;
//
setTimeout(function () {
function changeTwo() {
//callback
r3 = r3 + data.deviationR;
if (r3 >= data.maxR) {
r3 = 0;
}
return r3;
}
function changeR12() {
r4 = r4 + data.deviationR;
if (r4 >= data.maxR) {
r4 = 0;
}
return r4;
}
point2 = (
<Entity
position={Cesium.Cartesian3.fromDegrees(
data.stationLon,
data.stationLat,
0
)}
show={true}
>
<EllipseGraphics
semiMinorAxis={new Cesium.CallbackProperty(changeTwo, false)}
semiMajorAxis={new Cesium.CallbackProperty(changeR12, false)}
height={10}
material={
new Cesium.ImageMaterialProperty({
image: data.imageUrl,
repeat: Cesium.Cartesian2(1.0, 1.0),
transparent: true,
color: new Cesium.CallbackProperty(function () {
var alp = 1 - r1 / data.maxR;
return Cesium.Color.WHITE.withAlpha(alp);
//entity entity
}, false),
})
}
/>
</Entity>
);
}, data.eachInterval);
return (
<Fragment>
{point1}
{point2}
</Fragment>
);
}
export default WavePoint;

View File

@ -0,0 +1,40 @@
import { Viewer, Camera } from "resium";
import PlateauPolygon from "./PlateauPolygon";
import AntarcticaPolygon from "./AntarcticaPolygon";
import Point from "./Point";
import CustomClock from "./CustomClock";
import CustomFlyTo from "./CustomFlyTo";
import styles from "./index.module.less";
//
let start = Cesium.JulianDate.fromDate(new Date());
//
let stop = Cesium.JulianDate.addSeconds(start, 60, new Cesium.JulianDate());
function PolygonLayout() {
return (
<Viewer
className={styles.cesiumContainer}
full
infoBox={false}
baseLayerPicker={false}
timeline={true}
homeButton={false}
fullscreenButton={false}
sceneModePicker={false}
navigationInstructionsInitiallyVisible={false}
navigationHelpButton={false}
// animation={false}
shouldAnimate={true}
>
<Camera defaultZoomAmount={0} />
<CustomFlyTo />
<Point start={start} stop={stop} />
<PlateauPolygon />
<AntarcticaPolygon />
<CustomClock start={start} stop={stop} />
</Viewer>
);
}
export default PolygonLayout;

View File

@ -0,0 +1,72 @@
.cesiumContainer :global {
.cesium-viewer {
.cesium-viewer-bottom {
display: none;
}
}
}
.toolbar :global {
position: absolute;
top: 8px;
left: 12px;
display: flex;
gap: 8px;
.ant-select {
cursor: pointer;
.ant-select-selector {
color: #02f9ff;
border: 1px solid #04fbfd !important;
background-color: #1f4856;
padding: 4px 12px;
border-radius: 8px;
height: 39px;
font-size: 16px;
.ant-select-selection-item {
color: #02f9ff !important;
}
.ant-select-dropdown {
background-color: #1f4856;
.ant-select-item {
color: rgb(0, 242, 255);
font-size: 16px;
&:hover {
background-color: #33a4a4;
}
}
.ant-select-item-option-selected {
background-color: #33a4a4;
}
}
&:hover {
border: 1px solid #04fbfd !important;
background-color: #078080;
}
}
.ant-select-arrow {
color: #02f9ff;
}
}
.focusBtn {
color: #02f9ff;
border: 1px solid #04fbfd;
background-color: #1f4856;
padding: 8px 12px;
border-radius: 8px;
cursor: pointer;
&:hover {
background-color: #078080;
}
}
}

13
src/index.css Normal file
View File

@ -0,0 +1,13 @@
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}

20
src/index.js Normal file
View File

@ -0,0 +1,20 @@
import React from "react";
import ReactDOM from "react-dom/client";
import { BrowserRouter } from "react-router-dom";
import "./index.css";
import App from "./App";
import reportWebVitals from "./reportWebVitals";
const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
// <React.StrictMode>
<BrowserRouter>
<App />
</BrowserRouter>
// </React.StrictMode>
);
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();

1
src/logo.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

13
src/reportWebVitals.js Normal file
View File

@ -0,0 +1,13 @@
const reportWebVitals = onPerfEntry => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};
export default reportWebVitals;

0
src/services/index.js Normal file
View File

5
src/setupTests.js Normal file
View File

@ -0,0 +1,5 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';

214
src/util.js Normal file
View File

@ -0,0 +1,214 @@
import { Color } from "cesium";
import { maxBy, minBy, map } from "lodash-es";
import { notification } from "antd";
export function feedback(message) {
if (
Object.prototype.toString.call(message) === "[object Object]" &&
message !== null
) {
Object.keys(message).forEach((key) => {
message[key].forEach((item) => {
notification.error({ message: key, description: item });
});
});
} else if (Array.isArray(message)) {
message.forEach((item) => {
notification.error({ message: "错误", description: item });
});
} else {
notification.error({ message: "错误", description: message });
}
}
export function generateYearsFromRange(start, end) {
const years = [];
for (let i = start; i <= end; i++) {
years.push(i);
}
return years;
}
export function getStep(features, column) {
const max = maxBy(features, (feature) => {
return parseFloat(feature.properties[column]);
});
const min = minBy(features, (feature) => {
return parseFloat(feature.properties[column]);
});
const step = (max.properties[column] - min.properties[column]) / 10;
return {
max: parseFloat(max.properties[column]),
min: parseFloat(min.properties[column]),
step,
};
}
export function getValue(features, column) {
const results = map(features, (feature) => {
return feature.properties[column];
});
return [...new Set(results)].sort((a, b) => a - b);
}
export const COLORS = {
"Color.ALICEBLUE": Color.ALICEBLUE,
"Color.ANTIQUEWHITE": Color.ANTIQUEWHITE,
"Color.AQUA": Color.AQUA,
"Color.AQUAMARINE": Color.AQUAMARINE,
"Color.AZURE": Color.AZURE,
"Color.BEIGE": Color.BEIGE,
"Color.BISQUE": Color.BISQUE,
"Color.BLACK": Color.BLACK,
"Color.BLANCHEDALMOND": Color.BLANCHEDALMOND,
"Color.BLUE": Color.BLUE,
"Color.BLUEVIOLET": Color.BLUEVIOLET,
"Color.BROWN": Color.BROWN,
"Color.BURLYWOOD": Color.BURLYWOOD,
"Color.CADETBLUE": Color.CADETBLUE,
"Color.CHARTREUSE": Color.CHARTREUSE,
"Color.CHOCOLATE": Color.CHOCOLATE,
"Color.CORAL": Color.CORAL,
"Color.CORNFLOWERBLUE": Color.CORNFLOWERBLUE,
"Color.CORNSILK": Color.CORNSILK,
"Color.CRIMSON": Color.CRIMSON,
"Color.CYAN": Color.CYAN,
"Color.DARKBLUE": Color.DARKBLUE,
"Color.DARKCYAN": Color.DARKCYAN,
"Color.DARKGOLDENROD": Color.DARKGOLDENROD,
"Color.DARKGRAY": Color.DARKGRAY,
"Color.DARKGREEN": Color.DARKGREEN,
"Color.DARKGREY": Color.DARKGREY,
"Color.DARKKHAKI": Color.DARKKHAKI,
"Color.DARKMAGENTA": Color.DARKMAGENTA,
"Color.DARKOLIVEGREEN": Color.DARKOLIVEGREEN,
"Color.DARKORANGE": Color.DARKORANGE,
"Color.DARKORCHID": Color.DARKORCHID,
"Color.DARKRED": Color.DARKRED,
"Color.DARKSALMON": Color.DARKSALMON,
"Color.DARKSEAGREEN": Color.DARKSEAGREEN,
"Color.DARKSLATEBLUE": Color.DARKSLATEBLUE,
"Color.DARKSLATEGRAY": Color.DARKSLATEGRAY,
"Color.DARKSLATEGREY": Color.DARKSLATEGREY,
"Color.DARKTURQUOISE": Color.DARKTURQUOISE,
"Color.DARKVIOLET": Color.DARKVIOLET,
"Color.DEEPPINK": Color.DEEPPINK,
"Color.DEEPSKYBLUE": Color.DEEPSKYBLUE,
"Color.DIMGRAY": Color.DIMGRAY,
"Color.DIMGREY": Color.DIMGREY,
"Color.DODGERBLUE": Color.DODGERBLUE,
"Color.FIREBRICK": Color.FIREBRICK,
"Color.FLORALWHITE": Color.FLORALWHITE,
"Color.FORESTGREEN": Color.FORESTGREEN,
"Color.FUCHSIA": Color.FUCHSIA,
"Color.GAINSBORO": Color.GAINSBORO,
"Color.GHOSTWHITE": Color.GHOSTWHITE,
"Color.GOLD": Color.GOLD,
"Color.GOLDENROD": Color.GOLDENROD,
"Color.GRAY": Color.GRAY,
"Color.GREEN": Color.GREEN,
"Color.GREENYELLOW": Color.GREENYELLOW,
"Color.GREY": Color.GREY,
"Color.HONEYDEW": Color.HONEYDEW,
"Color.HOTPINK": Color.HOTPINK,
"Color.INDIANRED": Color.INDIANRED,
"Color.INDIGO": Color.INDIGO,
"Color.IVORY": Color.IVORY,
"Color.KHAKI": Color.KHAKI,
"Color.LAVENDER": Color.LAVENDER,
"Color.LAVENDAR_BLUSH": Color.LAVENDAR_BLUSH,
"Color.LAWNGREEN": Color.LAWNGREEN,
"Color.LEMONCHIFFON": Color.LEMONCHIFFON,
"Color.LIGHTBLUE": Color.LIGHTBLUE,
"Color.LIGHTCORAL": Color.LIGHTCORAL,
"Color.LIGHTCYAN": Color.LIGHTCYAN,
"Color.LIGHTGOLDENRODYELLOW": Color.LIGHTGOLDENRODYELLOW,
"Color.LIGHTGRAY": Color.LIGHTGRAY,
"Color.LIGHTGREEN": Color.LIGHTGREEN,
"Color.LIGHTGREY": Color.LIGHTGREY,
"Color.LIGHTPINK": Color.LIGHTPINK,
"Color.LIGHTSEAGREEN": Color.LIGHTSEAGREEN,
"Color.LIGHTSKYBLUE": Color.LIGHTSKYBLUE,
"Color.LIGHTSLATEGRAY": Color.LIGHTSLATEGRAY,
"Color.LIGHTSLATEGREY": Color.LIGHTSLATEGREY,
"Color.LIGHTSTEELBLUE": Color.LIGHTSTEELBLUE,
"Color.LIGHTYELLOW": Color.LIGHTYELLOW,
"Color.LIME": Color.LIME,
"Color.LIMEGREEN": Color.LIMEGREEN,
"Color.LINEN": Color.LINEN,
"Color.MAGENTA": Color.MAGENTA,
"Color.MAROON": Color.MAROON,
"Color.MEDIUMAQUAMARINE": Color.MEDIUMAQUAMARINE,
"Color.MEDIUMBLUE": Color.MEDIUMBLUE,
"Color.MEDIUMORCHID": Color.MEDIUMORCHID,
"Color.MEDIUMPURPLE": Color.MEDIUMPURPLE,
"Color.MEDIUMSEAGREEN": Color.MEDIUMSEAGREEN,
"Color.MEDIUMSLATEBLUE": Color.MEDIUMSLATEBLUE,
"Color.MEDIUMSPRINGGREEN": Color.MEDIUMSPRINGGREEN,
"Color.MEDIUMTURQUOISE": Color.MEDIUMTURQUOISE,
"Color.MEDIUMVIOLETRED": Color.MEDIUMVIOLETRED,
"Color.MIDNIGHTBLUE": Color.MIDNIGHTBLUE,
"Color.MINTCREAM": Color.MINTCREAM,
"Color.MISTYROSE": Color.MISTYROSE,
"Color.MOCCASIN": Color.MOCCASIN,
"Color.NAVAJOWHITE": Color.NAVAJOWHITE,
"Color.NAVY": Color.NAVY,
"Color.OLDLACE": Color.OLDLACE,
"Color.OLIVE": Color.OLIVE,
"Color.OLIVEDRAB": Color.OLIVEDRAB,
"Color.ORANGE": Color.ORANGE,
"Color.ORANGERED": Color.ORANGERED,
"Color.ORCHID": Color.ORCHID,
"Color.PALEGOLDENROD": Color.PALEGOLDENROD,
"Color.PALEGREEN": Color.PALEGREEN,
"Color.PALETURQUOISE": Color.PALETURQUOISE,
"Color.PALEVIOLETRED": Color.PALEVIOLETRED,
"Color.PAPAYAWHIP": Color.PAPAYAWHIP,
"Color.PEACHPUFF": Color.PEACHPUFF,
"Color.PERU": Color.PERU,
"Color.PINK": Color.PINK,
"Color.PLUM": Color.PLUM,
"Color.POWDERBLUE": Color.POWDERBLUE,
"Color.PURPLE": Color.PURPLE,
"Color.RED": Color.RED,
"Color.ROSYBROWN": Color.ROSYBROWN,
"Color.ROYALBLUE": Color.ROYALBLUE,
"Color.SADDLEBROWN": Color.SADDLEBROWN,
"Color.SALMON": Color.SALMON,
"Color.SANDYBROWN": Color.SANDYBROWN,
"Color.SEAGREEN": Color.SEAGREEN,
"Color.SEASHELL": Color.SEASHELL,
"Color.SIENNA": Color.SIENNA,
"Color.SILVER": Color.SILVER,
"Color.SKYBLUE": Color.SKYBLUE,
"Color.SLATEBLUE": Color.SLATEBLUE,
"Color.SLATEGRAY": Color.SLATEGRAY,
"Color.SLATEGREY": Color.SLATEGREY,
"Color.SNOW": Color.SNOW,
"Color.SPRINGGREEN": Color.SPRINGGREEN,
"Color.STEELBLUE": Color.STEELBLUE,
"Color.TAN": Color.TAN,
"Color.TEAL": Color.TEAL,
"Color.THISTLE": Color.THISTLE,
"Color.TOMATO": Color.TOMATO,
"Color.TURQUOISE": Color.TURQUOISE,
"Color.VIOLET": Color.VIOLET,
"Color.WHEAT": Color.WHEAT,
"Color.WHITE": Color.WHITE,
"Color.WHITESMOKE": Color.WHITESMOKE,
"Color.YELLOW": Color.YELLOW,
"Color.YELLOWGREEN": Color.YELLOWGREEN,
"Color.TRANSPARENT": Color.TRANSPARENT,
};
export const PATH = {
实时视频: "/台站数据/实时视频",
实时监测: "http://chinare.hbaa.cn/iot/yulong.php",
在线数据: "/台站数据/在线数据",
数据申请: "/数据申请",
离线数据: "/manage/offlinedata",
申请审核: "/manage/applydata",
数据分类: "/manage/datatype",
用户管理: "/manage/user",
};

0
src/utils.js Normal file
View File

17846
yarn.lock Normal file

File diff suppressed because it is too large Load Diff