|
|
@@ -97,6 +97,8 @@ import hd from "@/assets/windimgs/fanSvg/hd.png";
|
|
|
//光伏电站展示图标
|
|
|
import gf from "@/assets/windimgs/fanSvg/gf.png";
|
|
|
|
|
|
+import backPng from "@/assets/cesiumImg/backPng.png";
|
|
|
+
|
|
|
import windHome from "@/components/windHome/index.vue";
|
|
|
import windPro from "@/components/windProDetail/windProblem.vue";
|
|
|
import ModelUnpack from "@/components/modelUnpack.vue";
|
|
|
@@ -147,6 +149,8 @@ export default {
|
|
|
urlTiles: "/public/static/tiles/{z}/{x}/{y}.jpg",
|
|
|
verticalExaggeration: 1.0,
|
|
|
dixingAdd: false,
|
|
|
+ infoBoxes: [],
|
|
|
+ entityxy: {}
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
@@ -397,10 +401,11 @@ export default {
|
|
|
},
|
|
|
// 展示所选风场的风机
|
|
|
showWindFromStation(viewer) {
|
|
|
- fjLonLatJson.data.forEach((e, index) => {
|
|
|
- this.showStatuswind(viewer, e);
|
|
|
- });
|
|
|
- this.resetWindViewport();
|
|
|
+ this.infoBoxes = [];
|
|
|
+ fjLonLatJson.data.forEach((e, index) => {
|
|
|
+ this.showStatuswind(viewer, e);
|
|
|
+ });
|
|
|
+ this.resetWindViewport();
|
|
|
},
|
|
|
// 根据状态展示不同颜色风机贴图
|
|
|
showStatuswind(viewer, e) {
|
|
|
@@ -410,40 +415,40 @@ export default {
|
|
|
e.longitude,
|
|
|
e.latitude,
|
|
|
e.status,
|
|
|
- e.height || 0,
|
|
|
+ e.height || -5000,
|
|
|
e
|
|
|
);
|
|
|
},
|
|
|
//给模型上描边
|
|
|
- getWtStatue(code) {
|
|
|
+ getWtStatue(code, type) {
|
|
|
if (code === 1) {
|
|
|
//待机
|
|
|
// return "#05bb4c";
|
|
|
- return "dj";
|
|
|
+ return type === "en" ? "dj" : "待机";
|
|
|
} else if (code === 2) {
|
|
|
//故障
|
|
|
// return "#d83238";
|
|
|
- return "gz";
|
|
|
+ return type === "en" ? "gz" : "故障";
|
|
|
} else if (code === 3) {
|
|
|
//检修
|
|
|
// return "#ff8300";
|
|
|
- return "jx";
|
|
|
+ return type === "en" ? "jx" : "检修";
|
|
|
} else if (code === 4) {
|
|
|
//限电
|
|
|
// return "#c732ca";
|
|
|
- return "xd";
|
|
|
+ return type === "en" ? "xd" : "限电";
|
|
|
} else if (code === 5) {
|
|
|
//离线
|
|
|
// return "#6f7881";
|
|
|
- return "lx";
|
|
|
+ return type === "en" ? "lx" : "离线";
|
|
|
} else if (code === 6) {
|
|
|
//受累
|
|
|
// return "#cbd1d7";
|
|
|
- return "sl";
|
|
|
+ return type === "en" ? "sl" : "受累";
|
|
|
} else {
|
|
|
//并网
|
|
|
// return "#42a7f9";
|
|
|
- return "bw";
|
|
|
+ return type === "en" ? "bw" : "并网";
|
|
|
}
|
|
|
},
|
|
|
//添加模型
|
|
|
@@ -456,7 +461,8 @@ export default {
|
|
|
);
|
|
|
|
|
|
// const statueColor = this.getWtStatue(wtStatue);
|
|
|
- const statueFJ = this.getWtStatue(status);
|
|
|
+ const statueFJ = this.getWtStatue(status, 'en');
|
|
|
+ const statueZh = this.getWtStatue(status, 'zh');
|
|
|
|
|
|
// 获取这些位置的精确地形高度
|
|
|
Cesium.sampleTerrainMostDetailed(this.viewer.terrainProvider, position)
|
|
|
@@ -464,7 +470,7 @@ export default {
|
|
|
.catch(function (error) {
|
|
|
console.log("获取地形高度时发生错误:", error);
|
|
|
});
|
|
|
-
|
|
|
+ let that = this
|
|
|
const entity = viewer.entities.add({
|
|
|
name, // 模型名称
|
|
|
position, // 模型位置
|
|
|
@@ -475,50 +481,71 @@ export default {
|
|
|
// ? "/public/static/model/fjSolo/model.glb"
|
|
|
// ? "/public/static/model/fjStatus/fj_anmation_bw.glb"
|
|
|
? `/public/static/model/fjStatus/fj_${statueFJ}.glb`
|
|
|
- : "/public/static/model/dixing/model.glb",
|
|
|
+ : "/public/static/model/dixing/model.glb",
|
|
|
+ // : "/public/static/model/dixing/terrain.glb",
|
|
|
scale: this.dixingAdd ? 20 : 10000,
|
|
|
// 模型贴地
|
|
|
- // heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
|
- heightReference: Cesium.HeightReference.NONE,
|
|
|
+ // heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
|
+ // heightReference: Cesium.HeightReference.NONE,
|
|
|
// silhouetteSize: this.dixingAdd ? 2 : 0,
|
|
|
// silhouetteColor: Cesium.Color.fromCssColorString(statueColor),
|
|
|
// runAnimations: wtStatue !== 7 ? false : true,
|
|
|
},
|
|
|
+ });
|
|
|
+ const entityxy = viewer.entities.add({
|
|
|
+ name, // 模型名称
|
|
|
+ position, // 模型位置
|
|
|
+ orientation, // 模型朝向
|
|
|
//添加标签
|
|
|
label: {
|
|
|
- text: name,
|
|
|
+ text: `${name}\n\n风速: 10m/s\n\n状态: ${statueZh}`,
|
|
|
font: "14px sans-serif",
|
|
|
fillColor: Cesium.Color.fromBytes(255, 255, 255),
|
|
|
- // heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
|
- pixelOffset:
|
|
|
- name === "F10号风机"
|
|
|
- ? new Cesium.Cartesian3(40, -20, height + 1000)
|
|
|
- : new Cesium.Cartesian3(0, 10, height + 1000),
|
|
|
+ pixelOffset: new Cesium.Cartesian2(-50, -20)
|
|
|
+ },
|
|
|
+ billboard: {
|
|
|
+ image: backPng,
|
|
|
+ scale: 0.2,
|
|
|
+ verticalOrigin: Cesium.VerticalOrigin.CENTER,
|
|
|
+ pixelOffset: new Cesium.Cartesian2(-50, -20)
|
|
|
+ // heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
|
|
|
},
|
|
|
});
|
|
|
|
|
|
this.dixingAdd = true;
|
|
|
- let that = this;
|
|
|
+
|
|
|
+ viewer.camera.moveEnd.addEventListener(() => {
|
|
|
+ // 获取相机的笛卡尔3D坐标
|
|
|
+ const position = viewer.camera.position;
|
|
|
+
|
|
|
+ // 将笛卡尔坐标转换为地理坐标(弧度)
|
|
|
+ const cartographic = Cesium.Cartographic.fromCartesian(position);
|
|
|
+
|
|
|
+ // 高度(以米为单位)
|
|
|
+ // 注意:这个高度是相对于WGS84椭球体的高度,不是海拔高度(MSL)
|
|
|
+ const height = Cesium.Math.toDegrees(cartographic.height);
|
|
|
+ if (height > 3000000) {
|
|
|
+ entityxy.show = false
|
|
|
+ console.log("entityxy false", entityxy.show);
|
|
|
+ }
|
|
|
+ if (height < 3000000) {
|
|
|
+ entityxy.show = true
|
|
|
+ console.log("entityxy true", entityxy.show);
|
|
|
+ }
|
|
|
+ // 强制请求一次场景重绘
|
|
|
+ if (viewer && viewer.scene) {
|
|
|
+ viewer.scene.requestRender();
|
|
|
+ }
|
|
|
+ console.log('相机高度 (椭球体高):', height, '米');
|
|
|
+ });
|
|
|
+
|
|
|
// 创建事件处理器
|
|
|
const handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
|
|
|
- // handler.setInputAction(function(click) {
|
|
|
- // const picked = viewer.scene.pick(click.position);
|
|
|
- // if (picked && picked.id === entity) {
|
|
|
- // console.log('你点击了标签或模型!', entity);
|
|
|
- // console.log('标签或模型数据!', val);
|
|
|
- // // alert('你点击了: ' + entity.label.text.getValue());
|
|
|
- // // this.$refs.comModelDialog.init(val)
|
|
|
- // if (name !== '光伏') {
|
|
|
- // that.showcomModelDia = true
|
|
|
- // that.modelVal = val
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
|
|
handler.setInputAction(function (movement) {
|
|
|
var position = movement.position;
|
|
|
var pickedObject = viewer.scene.pick(position);
|
|
|
- if (pickedObject && pickedObject.id === entity) {
|
|
|
- // console.log("你点击了标签或模型!", entity);
|
|
|
+ if (pickedObject && pickedObject.id === entity) {
|
|
|
+ console.log("你点击了标签或模型!", entity);
|
|
|
// console.log("标签或模型数据!", val);
|
|
|
that.modelVal = model;
|
|
|
// 找到实体,显示包含实体信息的弹框
|