电站概览地图定位到 龙源
This commit is contained in:
@@ -401,7 +401,7 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
||||
}
|
||||
|
||||
function displayPublishedLayers(publishedLayers, baseUrl) {
|
||||
console.log('已发布的图层:', publishedLayers)
|
||||
//console.log('已发布的图层:', publishedLayers)
|
||||
publishedLayers.forEach((layer, index) => {
|
||||
const [workspace, layerName] = layer.name.split(':');
|
||||
if (workspace && layerName) {
|
||||
@@ -490,9 +490,9 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
||||
const layerIdentifier = `${workspace}:${layerName}`;
|
||||
let baseUrl = wmsUrl;
|
||||
const cesiumLayers = [];
|
||||
//if (index == 2) {
|
||||
// flyToLayer(layerIdentifier, baseUrl);
|
||||
//}
|
||||
if (index == 2) {
|
||||
flyToLayer(layerIdentifier, baseUrl, 100);
|
||||
}
|
||||
//getLayerBoundsAndFit(wmsUrl, layerName);
|
||||
|
||||
if (baseUrl.includes('/gwc/service/wms')) {
|
||||
@@ -597,10 +597,8 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
||||
}
|
||||
}
|
||||
|
||||
function flyToLayer(layerIdentifier, baseUrl) {
|
||||
console.log('定位到图层范围:', layerIdentifier);
|
||||
if (!viewerRef.current) return;
|
||||
|
||||
function flyToLayer(layerIdentifier, baseUrl, flyHeight = 1000) {
|
||||
//console.log('开始获取图层范围', layerIdentifier);
|
||||
const url = `${baseUrl}/wms?service=WMS&version=1.1.1&request=GetCapabilities`;
|
||||
|
||||
fetch(url)
|
||||
@@ -608,6 +606,7 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
||||
.then(xmlText => {
|
||||
const xml = new DOMParser().parseFromString(xmlText, 'text/xml');
|
||||
const layerElements = xml.getElementsByTagName('Layer');
|
||||
let targetBbox = null;
|
||||
|
||||
for (let i = 0; i < layerElements.length; i++) {
|
||||
const layer = layerElements[i];
|
||||
@@ -620,16 +619,36 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
||||
const miny = parseFloat(bboxElement.getAttribute('miny'));
|
||||
const maxx = parseFloat(bboxElement.getAttribute('maxx'));
|
||||
const maxy = parseFloat(bboxElement.getAttribute('maxy'));
|
||||
|
||||
const rectangle = window.Cesium.Rectangle.fromDegrees(minx, miny, maxx, maxy);
|
||||
viewerRef.current.camera.flyTo({
|
||||
destination: rectangle,
|
||||
duration: 2
|
||||
});
|
||||
targetBbox = [minx, miny, maxx, maxy];
|
||||
console.log('读取到图层bbox', targetBbox);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!targetBbox) {
|
||||
console.warn('该图层未找到BoundingBox,无法飞行', layerIdentifier);
|
||||
return;
|
||||
}
|
||||
|
||||
const [minx, miny, maxx, maxy] = targetBbox;
|
||||
// 取图层中心点
|
||||
const centerLon = (minx + maxx) / 2;
|
||||
const centerLat = (miny + maxy) / 2;
|
||||
|
||||
viewerRef.current.camera.flyTo({
|
||||
// 固定高度,第三个参数就是高度(单位米)
|
||||
destination: window.Cesium.Cartesian3.fromDegrees(centerLon, centerLat, flyHeight),
|
||||
orientation: {
|
||||
heading: 0,
|
||||
pitch: window.Cesium.Math.toRadians(-90), // 垂直俯视
|
||||
roll: 0
|
||||
},
|
||||
duration: 2
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('获取WMS Capabilities失败', err);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -998,7 +1017,6 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
||||
viewer.scene.requestRender();
|
||||
return;
|
||||
}
|
||||
console.log(tracePoints, tracePointRef.current.getMode(), "mode1111111111");
|
||||
|
||||
const validPoints = tracePoints.filter(p => {
|
||||
const lng = Number(p.lng);
|
||||
|
||||
@@ -266,7 +266,6 @@ export default function DeviceOverviewPage({ onViewStatus, selectedSn, onDeviceS
|
||||
...persistentDroneData,
|
||||
};
|
||||
}, [selectedDevice, uavState, persistentHostData, persistentDroneData?.wind_speed]);
|
||||
console.log('实时设备数据:', realtimeDevice);
|
||||
|
||||
// MQTT消息处理
|
||||
const handleMqttMessage = (topic, message) => {
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
RobotOutlined
|
||||
} from '@ant-design/icons';
|
||||
import { Line, Bar, Pie } from '@ant-design/charts';
|
||||
import CesiumMap from '../components/Map';
|
||||
import { getWeatherData, getWeatherType } from '../lib/utils';
|
||||
import WeatherDisplay from '../components/Weather';
|
||||
import bgMain from '../assets/images/bgmain.jpg';
|
||||
@@ -335,13 +336,16 @@ export default function StationDashboard() {
|
||||
bodyStyle={{ padding: 0, position: 'relative', overflow: 'hidden', height: 500 }}
|
||||
>
|
||||
<div style={{ height: "100%", background: '#111827', borderRadius: 8, width: '100%', overflow: 'hidden', position: "relative" }}>
|
||||
<iframe
|
||||
{/*<iframe
|
||||
src="https://pvs.satabot.com/?platform=web"
|
||||
style={{ width: '100%', height: '100%', border: 'none', borderRadius: '8px', position: "absolute" }}
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowFullScreen
|
||||
title="外部系统"
|
||||
/>
|
||||
/>*/}
|
||||
|
||||
<CesiumMap />
|
||||
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
import { Line, Bar, Pie } from '@ant-design/charts';
|
||||
import bgMain from '../assets/images/bgmain.jpg';
|
||||
import { UniversalBarChart, UniversalLineChart, UniversalPieChart } from '../components/recharts';
|
||||
import CesiumMap from '../components/Map';
|
||||
|
||||
const { Option } = Select;
|
||||
const { Search } = Input;
|
||||
@@ -122,7 +123,7 @@ const RealTimeMonitorPage = () => {
|
||||
bodyStyle={{ padding: 0, position: 'relative', height: 400, overflow: 'hidden' }}
|
||||
>
|
||||
<div style={{ height: "100%", background: '#111827', borderRadius: 8, width: '100%', overflow: 'hidden', position: "relative" }}>
|
||||
<iframe
|
||||
{/*<iframe
|
||||
src="https://pvs.satabot.com/?platform=web"
|
||||
style={{
|
||||
width: '100%',
|
||||
@@ -134,7 +135,11 @@ const RealTimeMonitorPage = () => {
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowFullScreen
|
||||
title="外部系统"
|
||||
/>
|
||||
/>*/}
|
||||
|
||||
|
||||
<CesiumMap />
|
||||
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user