|
|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<div class="mapBox">
|
|
|
<div id="cesiumContainer" style="width: 100%; height: 100vh"></div>
|
|
|
- <div :class="!menuComTStyB ? 'menuComTSty' : 'menuComT'">
|
|
|
+ <div :class="!menuComTStyB ? 'menuComTSty' : 'menuComT'" v-if="0">
|
|
|
<menuCom
|
|
|
:showbasemap="false"
|
|
|
:showwindspeed="false"
|
|
|
@@ -37,11 +37,14 @@
|
|
|
<windHome :modelValItem="modelVal" />
|
|
|
</div>
|
|
|
<div class="spjk" v-if="showVideoMsg">
|
|
|
- <iframe
|
|
|
- src="https://www.bilibili.com/video/BV1421DYCELw?t=12.1"
|
|
|
+ <!-- <iframe
|
|
|
+ src="/public/static/windVideo.mp4"
|
|
|
frameborder="0"
|
|
|
style="width: 100%; height: 100%"
|
|
|
- ></iframe>
|
|
|
+ ></iframe> -->
|
|
|
+ <video ref="videoPlayer" controls width="95%">
|
|
|
+ <source src="/public/static/windVideo.mp4" type="video/mp4" />
|
|
|
+ </video>
|
|
|
</div>
|
|
|
<div class="gzck" v-if="showProblemMsg">
|
|
|
<windPro />
|
|
|
@@ -81,8 +84,19 @@ import fc from "@/assets/windimgs/fanSvg/fc.png"
|
|
|
import hd from "@/assets/windimgs/fanSvg/hd.png"
|
|
|
//光伏电站展示图标
|
|
|
import gf from "@/assets/windimgs/fanSvg/gf.png"
|
|
|
+
|
|
|
+//故障
|
|
|
+import gz from "@/assets/windimgs/fanSvg/gz.svg"
|
|
|
//待机
|
|
|
import dj from "@/assets/windimgs/fanSvg/dj.svg"
|
|
|
+//检修
|
|
|
+import jx from "@/assets/windimgs/fanSvg/jx.svg"
|
|
|
+//限电
|
|
|
+import xd from "@/assets/windimgs/fanSvg/xd.svg"
|
|
|
+//离线
|
|
|
+import lx from "@/assets/windimgs/fanSvg/lx.svg"
|
|
|
+//受累
|
|
|
+import sl from "@/assets/windimgs/fanSvg/sl.svg"
|
|
|
//动图使用柱子和扇叶
|
|
|
import bwzhu from "@/assets/windimgs/fanSvg/bwzhu.svg"
|
|
|
import bwshan from "@/assets/windimgs/fanSvg/bwshan.png"
|
|
|
@@ -113,7 +127,7 @@ export default {
|
|
|
showVideoMsg: false,
|
|
|
showProblemMsg: false,
|
|
|
showModelMsg: false,
|
|
|
- showWindDetail: false,
|
|
|
+ showWindDetail: true,
|
|
|
allStationentitys: [],
|
|
|
allWindEntitys: []
|
|
|
};
|
|
|
@@ -153,9 +167,89 @@ export default {
|
|
|
viewer._cesiumWidget._creditContainer.style.display = "none";
|
|
|
// this.csceneElliposid(viewer)
|
|
|
this.viewer = viewer;
|
|
|
- this.showAllStation(viewer)
|
|
|
+ // 展示场站
|
|
|
+ // this.showAllStation(viewer)
|
|
|
+ // 展示风机
|
|
|
+ this.showWindFromStation(viewer)
|
|
|
this.initGeoJsonData()
|
|
|
},
|
|
|
+ //限制相机在区域内活动
|
|
|
+ allowedRectangleFn(viewer) {
|
|
|
+ // 定义允许的区域范围(WGS84 坐标,单位:度)
|
|
|
+ const allowedRectangle = Cesium.Rectangle.fromDegrees(
|
|
|
+ 113.9, // west
|
|
|
+ 34.8, // south
|
|
|
+ 115, // east
|
|
|
+ 35.7 // north
|
|
|
+ );
|
|
|
+ // viewer.scene.preUpdate.addEventListener(function(scene, time) {
|
|
|
+ // const camera = viewer.camera;
|
|
|
+ // const position = camera.positionCartographic;
|
|
|
+
|
|
|
+ // if (position) {
|
|
|
+ // const lon = Cesium.Math.toDegrees(position.longitude);
|
|
|
+ // const lat = Cesium.Math.toDegrees(position.latitude);
|
|
|
+
|
|
|
+ // // 判断是否越界
|
|
|
+ // if (lon < allowedRectangle.west || lon > allowedRectangle.east ||
|
|
|
+ // lat < allowedRectangle.south || lat > allowedRectangle.north) {
|
|
|
+
|
|
|
+ // // 获取当前视角方向,用于保持高度和朝向
|
|
|
+ // const height = position.height;
|
|
|
+ // let targetLon = Cesium.Math.clamp(lon, allowedRectangle.west, allowedRectangle.east);
|
|
|
+ // let targetLat = Cesium.Math.clamp(lat, allowedRectangle.south, allowedRectangle.north);
|
|
|
+
|
|
|
+ // // camera.flyTo({
|
|
|
+ // // destination: Cesium.Cartesian3.fromDegrees(targetLon, targetLat, height),
|
|
|
+ // // duration: 0.1, // 可以设置轻微动画,更自然
|
|
|
+ // // maximumHeight: height,
|
|
|
+ // // complete: function() {
|
|
|
+ // // // 防止连续触发
|
|
|
+ // // }
|
|
|
+ // // });
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ viewer.camera.changed.addEventListener(function() {
|
|
|
+ const cameraPositionCartographic = viewer.camera.positionCartographic;
|
|
|
+
|
|
|
+ // 检查相机是否在允许的区域内
|
|
|
+ if (cameraPositionCartographic) {
|
|
|
+ const lon = Cesium.Math.toDegrees(cameraPositionCartographic.longitude);
|
|
|
+ const lat = Cesium.Math.toDegrees(cameraPositionCartographic.latitude);
|
|
|
+
|
|
|
+ let corrected = false;
|
|
|
+ let correctedLon = lon;
|
|
|
+ let correctedLat = lat;
|
|
|
+
|
|
|
+ // 限制经度
|
|
|
+ if (lon < allowedRectangle.west) {
|
|
|
+ correctedLon = allowedRectangle.west;
|
|
|
+ corrected = true;
|
|
|
+ } else if (lon > allowedRectangle.east) {
|
|
|
+ correctedLon = allowedRectangle.east;
|
|
|
+ corrected = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 限制纬度
|
|
|
+ if (lat < allowedRectangle.south) {
|
|
|
+ correctedLat = allowedRectangle.south;
|
|
|
+ corrected = true;
|
|
|
+ } else if (lat > allowedRectangle.north) {
|
|
|
+ correctedLat = allowedRectangle.north;
|
|
|
+ corrected = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果超出范围,将相机位置纠正
|
|
|
+ if (corrected) {
|
|
|
+ viewer.camera.flyTo({
|
|
|
+ destination: Cesium.Cartesian3.fromDegrees(correctedLon, correctedLat, cameraPositionCartographic.height),
|
|
|
+ duration: 0 // 立即跳转,无动画
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
// 初始化 geoJson 数据
|
|
|
async initGeoJsonData() {
|
|
|
// 创建GeoJSON数据源
|
|
|
@@ -291,9 +385,20 @@ export default {
|
|
|
if (e.status) {
|
|
|
if (e.status === 1) {
|
|
|
this.showStatuswind(viewer, e, dj)
|
|
|
+ } else if (e.status === 2) {
|
|
|
+ this.showStatuswind(viewer, e, gz)
|
|
|
+ } else if (e.status === 3) {
|
|
|
+ this.showStatuswind(viewer, e, jx)
|
|
|
+ } else if (e.status === 4) {
|
|
|
+ this.showStatuswind(viewer, e, xd)
|
|
|
+ } else if (e.status === 5) {
|
|
|
+ this.showStatuswind(viewer, e, lx)
|
|
|
+ } else if (e.status === 6) {
|
|
|
+ this.showStatuswind(viewer, e, sl)
|
|
|
+ } else {
|
|
|
+ //并网风机
|
|
|
+ this.showAnimatewind(viewer, e)
|
|
|
}
|
|
|
- } else {
|
|
|
- this.showAnimatewind(viewer, e)
|
|
|
}
|
|
|
});
|
|
|
this.resetWindViewport()
|
|
|
@@ -445,6 +550,7 @@ export default {
|
|
|
font: '14px sans-serif',
|
|
|
fillColor: Cesium.Color.fromBytes(255, 255, 255),
|
|
|
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
|
+ pixelOffset: val.name === 'F10号风机' ? new Cesium.Cartesian2(40, -20) : new Cesium.Cartesian2(0, 0)
|
|
|
}
|
|
|
});
|
|
|
// 创建事件处理器
|
|
|
@@ -483,7 +589,7 @@ export default {
|
|
|
rotation: new Cesium.CallbackProperty(function(time) {
|
|
|
// 每 3 秒转一圈(可调速度)
|
|
|
const seconds = time.secondsOfDay;
|
|
|
- const angle = Cesium.Math.toRadians((seconds % 3) * 360 / 3); // 每3秒一圈
|
|
|
+ const angle = Cesium.Math.toRadians((seconds % 3) * -360 / 3); // 每3秒一圈
|
|
|
return angle;
|
|
|
}, false),
|
|
|
// 确保绕中心旋转
|
|
|
@@ -763,15 +869,117 @@ export default {
|
|
|
},
|
|
|
// 重置风场中所有风机视角
|
|
|
resetWindViewport() {
|
|
|
- this.viewer.camera.flyTo({
|
|
|
- destination: Cesium.Cartesian3.fromDegrees(114.502778,35.326667, 20000),
|
|
|
- orientation: {
|
|
|
- heading: Cesium.Math.toRadians(0),
|
|
|
- pitch: Cesium.Math.toRadians(-90),
|
|
|
- roll: 0.0,
|
|
|
- },
|
|
|
- duration: 3.0,
|
|
|
- });
|
|
|
+ // 目标位置:经度、纬度、高度
|
|
|
+ const targetLon = 114.502778;
|
|
|
+ const targetLat = 35.326667;
|
|
|
+ const targetHeight = 20000;
|
|
|
+
|
|
|
+ const draggableHeightTolerance = 10000; // 允许拖拽的高度范围:18,000 ~ 22,000
|
|
|
+ const minHeight = 10000; // 最低高度
|
|
|
+ const maxHeight = 100000; // 最高高度
|
|
|
+
|
|
|
+ const allowedOffsetDegrees = 0.2; // 允许拖拽的最大偏移(经纬度)
|
|
|
+
|
|
|
+ const minLon = targetLon - allowedOffsetDegrees;
|
|
|
+ const maxLon = targetLon + allowedOffsetDegrees;
|
|
|
+ const minLat = targetLat - allowedOffsetDegrees;
|
|
|
+ const maxLat = targetLat + allowedOffsetDegrees;
|
|
|
+
|
|
|
+ let that = this
|
|
|
+ that.viewer.camera.flyTo({
|
|
|
+ destination: Cesium.Cartesian3.fromDegrees(targetLon,targetLat, targetHeight),
|
|
|
+ orientation: {
|
|
|
+ heading: Cesium.Math.toRadians(0),
|
|
|
+ pitch: Cesium.Math.toRadians(-90),
|
|
|
+ roll: 0.0,
|
|
|
+ },
|
|
|
+ duration: 3.0,
|
|
|
+ complete: function () {
|
|
|
+ console.log('飞入完成,启用拖拽限制逻辑');
|
|
|
+ enableHeightBasedDragControl();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // ===== 控制逻辑:根据高度决定是否允许拖拽 =====
|
|
|
+ function enableHeightBasedDragControl() {
|
|
|
+ that.viewer.scene.preUpdate.addEventListener(function (scene, time) {
|
|
|
+ const camera = that.viewer.camera;
|
|
|
+ const posCartographic = camera.positionCartographic;
|
|
|
+
|
|
|
+ if (!posCartographic) return;
|
|
|
+
|
|
|
+ const currentHeight = posCartographic.height;
|
|
|
+ const currentLon = Cesium.Math.toDegrees(posCartographic.longitude);
|
|
|
+ const currentLat = Cesium.Math.toDegrees(posCartographic.latitude);
|
|
|
+
|
|
|
+ // === 第一步:限制相机高度不能超出 [10000, 100000] ===
|
|
|
+ if (currentHeight < minHeight) {
|
|
|
+ // 强制拉高到 minHeight,但保持当前水平视角
|
|
|
+ const newPos = Cesium.Cartesian3.fromDegrees(currentLon, currentLat, minHeight);
|
|
|
+ camera.setView({
|
|
|
+ destination: newPos,
|
|
|
+ orientation: {
|
|
|
+ heading: camera.heading,
|
|
|
+ pitch: camera.pitch,
|
|
|
+ roll: camera.roll
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return; // 避免后续逻辑冲突
|
|
|
+ }
|
|
|
+
|
|
|
+ if (currentHeight > maxHeight) {
|
|
|
+ const newPos = Cesium.Cartesian3.fromDegrees(currentLon, currentLat, maxHeight);
|
|
|
+ camera.setView({
|
|
|
+ destination: newPos,
|
|
|
+ orientation: {
|
|
|
+ heading: camera.heading,
|
|
|
+ pitch: camera.pitch,
|
|
|
+ roll: camera.roll
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // === 第二步:判断是否在“可拖拽高度区间” ===
|
|
|
+ const isInDraggableRange =
|
|
|
+ currentHeight >= (targetHeight - draggableHeightTolerance) &&
|
|
|
+ currentHeight <= (targetHeight + draggableHeightTolerance);
|
|
|
+
|
|
|
+ if (isInDraggableRange) {
|
|
|
+ // ✅ 允许拖拽,但限制在指定范围内
|
|
|
+ const correctedLon = Cesium.Math.clamp(currentLon, minLon, maxLon);
|
|
|
+ const correctedLat = Cesium.Math.clamp(currentLat, minLat, maxLat);
|
|
|
+
|
|
|
+ if (Math.abs(correctedLon - currentLon) > 1e-8 ||
|
|
|
+ Math.abs(correctedLat - currentLat) > 1e-8) {
|
|
|
+ // 越界了,纠正位置,保留当前高度和视角
|
|
|
+ camera.setView({
|
|
|
+ destination: Cesium.Cartesian3.fromDegrees(correctedLon, correctedLat, currentHeight),
|
|
|
+ orientation: {
|
|
|
+ heading: camera.heading,
|
|
|
+ pitch: camera.pitch,
|
|
|
+ roll: camera.roll
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // ❌ 不在可拖拽高度:禁止平移,强制回正到目标点
|
|
|
+ const correctedPosition = Cesium.Cartesian3.fromDegrees(
|
|
|
+ targetLon,
|
|
|
+ targetLat,
|
|
|
+ currentHeight // 保留当前缩放高度
|
|
|
+ );
|
|
|
+
|
|
|
+ camera.setView({
|
|
|
+ destination: correctedPosition,
|
|
|
+ orientation: {
|
|
|
+ heading: camera.heading,
|
|
|
+ pitch: camera.pitch,
|
|
|
+ roll: camera.roll
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
switchLayer() {
|
|
|
this.$router.push({
|