|
|
@@ -130,7 +130,9 @@ import windGridData from "./windGridData.json";
|
|
|
|
|
|
import AdvancedBillboardGenerator from "@/tools/lightsign.js";
|
|
|
|
|
|
-import { useWebSocket } from "@/tools/websocket.js";
|
|
|
+// import { useWebSocket } from "@/tools/websocket.js";
|
|
|
+
|
|
|
+import webSocketService from "@/tools/ws.js";
|
|
|
|
|
|
export default {
|
|
|
name: "windMap2D",
|
|
|
@@ -197,6 +199,9 @@ export default {
|
|
|
allStationentitys: [],
|
|
|
allWindEntitys: [],
|
|
|
urlTiles: "/public/static/tiles/{z}/{x}/{y}.jpg",
|
|
|
+ entityxyArray: [],
|
|
|
+ isFakeData: false,
|
|
|
+ fakeDataTimmer: null,
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
@@ -205,6 +210,11 @@ export default {
|
|
|
this.loading = false;
|
|
|
}, 1000);
|
|
|
},
|
|
|
+
|
|
|
+ unmounted() {
|
|
|
+ clearInterval(this.fakeDataTimmer);
|
|
|
+ this.fakeDataTimmer = null;
|
|
|
+ },
|
|
|
methods: {
|
|
|
async initCesium() {
|
|
|
const box = document.getElementById("cesiumContainer");
|
|
|
@@ -228,8 +238,10 @@ export default {
|
|
|
// minimumLevel: 11,
|
|
|
maximumLevel: 18,
|
|
|
// url: this.urlTiles,
|
|
|
- // url: "/static/ditu/{z}/{x}/{y}.png",
|
|
|
- url: "https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}",
|
|
|
+ url:
|
|
|
+ import.meta.env.VITE_APP_ENV_NAME === "dev"
|
|
|
+ ? "https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}"
|
|
|
+ : "/static/ditu/{z}/{x}/{y}.png",
|
|
|
credit: "影像地图",
|
|
|
});
|
|
|
imageryProvider.alpha = 0.55; // 透明度
|
|
|
@@ -397,56 +409,164 @@ export default {
|
|
|
let fjLonLatJson = [];
|
|
|
this.fjLonLatJsonArr = [];
|
|
|
let url = "";
|
|
|
+
|
|
|
// 旺海庄:DHWH 苏木山:DHSM 营盘梁:DHYP 迈越:HZMY
|
|
|
+ // if (stationName === "MYFDC") {
|
|
|
+ // fjLonLatJson = fjMYLonLatJson;
|
|
|
+ // url = "ws://10.121.128.117:8431/ws/HZMY";
|
|
|
+ // } else if (stationName === "JNWHZ") {
|
|
|
+ // fjLonLatJson = fjWHZLonLatJson;
|
|
|
+ // url = "ws://10.121.128.117:8431/ws/DHWH";
|
|
|
+ // } else if (stationName === "JNYPL") {
|
|
|
+ // fjLonLatJson = fjYPLLonLatJson;
|
|
|
+ // url = "ws://10.121.128.117:8431/ws/DHYP";
|
|
|
+ // } else if (stationName === "JNSMS") {
|
|
|
+ // fjLonLatJson = fjSMSLonLatJson;
|
|
|
+ // url = "ws://10.121.128.117:8431/ws/DHSM";
|
|
|
+ // }
|
|
|
+
|
|
|
+ webSocketService.connect({
|
|
|
+ url: `ws/${this.getWsUrl(stationName)}`,
|
|
|
+ autoReconnect: true,
|
|
|
+ maxReconnectAttempts: 5,
|
|
|
+ reconnectInterval: 3000,
|
|
|
+ onOpen: (event) => {
|
|
|
+ console.log("✅ WebSocket 连接成功", event);
|
|
|
+ },
|
|
|
+ onError: (error) => {
|
|
|
+ console.log("❌ WebSocket 错误:", error);
|
|
|
+ return;
|
|
|
+ if (stationName === "MYFDC") {
|
|
|
+ fjLonLatJson = JSON.parse(JSON.stringify(fjMYLonLatJson));
|
|
|
+ } else if (stationName === "JNWHZ") {
|
|
|
+ fjLonLatJson = JSON.parse(JSON.stringify(fjWHZLonLatJson));
|
|
|
+ } else if (stationName === "JNYPL") {
|
|
|
+ fjLonLatJson = JSON.parse(JSON.stringify(fjYPLLonLatJson));
|
|
|
+ } else if (stationName === "JNSMS") {
|
|
|
+ fjLonLatJson = JSON.parse(JSON.stringify(fjSMSLonLatJson));
|
|
|
+ }
|
|
|
+
|
|
|
+ let wtArray = wsRes.windMachineList;
|
|
|
+ this.isFakeData = true;
|
|
|
+
|
|
|
+ this.fakeDataTimmer = setInterval(() => {
|
|
|
+ fjLonLatJson.data.forEach((e) => {
|
|
|
+ let fjItem =
|
|
|
+ wtArray.find((findEle) => {
|
|
|
+ return findEle.fjbh === e.fjbh;
|
|
|
+ }) || {};
|
|
|
+ const fjMix = Object.assign({}, e, fjItem);
|
|
|
+ fjMix.status = this.getStatus(fjMix.fjzt);
|
|
|
+ e = fjMix;
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ this.fjLonLatJsonArr = fjLonLatJson;
|
|
|
+ }, 1000);
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+ webSocketService.on("message", (res) => {
|
|
|
+ if (stationName === "MYFDC") {
|
|
|
+ fjLonLatJson = fjMYLonLatJson;
|
|
|
+ } else if (stationName === "JNWHZ") {
|
|
|
+ fjLonLatJson = fjWHZLonLatJson;
|
|
|
+ } else if (stationName === "JNYPL") {
|
|
|
+ fjLonLatJson = fjYPLLonLatJson;
|
|
|
+ } else if (stationName === "JNSMS") {
|
|
|
+ fjLonLatJson = fjSMSLonLatJson;
|
|
|
+ }
|
|
|
+
|
|
|
+ let wtArray = res.windMachineList;
|
|
|
+ fjLonLatJson.data.forEach((e, index) => {
|
|
|
+ let fjItem =
|
|
|
+ wtArray.find((findEle) => {
|
|
|
+ return findEle.fjbh === e.fjbh;
|
|
|
+ }) || {};
|
|
|
+ const fjMix = Object.assign({}, e, fjItem);
|
|
|
+ fjMix.status = this.getStatus(fjMix);
|
|
|
+ e = fjMix;
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ this.fjLonLatJsonArr = fjLonLatJson;
|
|
|
+ });
|
|
|
+
|
|
|
+ // const ws = useWebSocket(url);
|
|
|
+ // let wtArray = ws.messages.windMachineList;
|
|
|
+ // this.fjLonLatJsonArr = fjLonLatJson;
|
|
|
+
|
|
|
+ this.resetWindViewport();
|
|
|
+ },
|
|
|
+
|
|
|
+ getWsUrl(stationName) {
|
|
|
+ let wsurl = "";
|
|
|
if (stationName === "MYFDC") {
|
|
|
- fjLonLatJson = fjMYLonLatJson;
|
|
|
- url = "ws://10.121.128.117:8431/ws/HZMY";
|
|
|
+ wsurl = "HZMY";
|
|
|
} else if (stationName === "JNWHZ") {
|
|
|
- fjLonLatJson = fjWHZLonLatJson;
|
|
|
- url = "ws://10.121.128.117:8431/ws/DHWH";
|
|
|
+ wsurl = "DHWH";
|
|
|
} else if (stationName === "JNYPL") {
|
|
|
- fjLonLatJson = fjYPLLonLatJson;
|
|
|
- url = "ws://10.121.128.117:8431/ws/DHYP";
|
|
|
+ wsurl = "DHYP";
|
|
|
} else if (stationName === "JNSMS") {
|
|
|
- fjLonLatJson = fjSMSLonLatJson;
|
|
|
- url = "ws://10.121.128.117:8431/ws/DHSM";
|
|
|
+ wsurl = "DHSM";
|
|
|
}
|
|
|
+ return wsurl;
|
|
|
+ },
|
|
|
|
|
|
- const ws = useWebSocket(url);
|
|
|
- // let wtArray = ws.messages.windMachineList
|
|
|
- // this.fjLonLatJsonArr = fjLonLatJson;
|
|
|
-
|
|
|
- let wtArray = wsRes.windMachineList;
|
|
|
- this.fjLonLatJsonArr = wsRes.windMachineList;
|
|
|
-
|
|
|
- console.log(789789, wtArray);
|
|
|
- fjLonLatJson.data.forEach((e, index) => {
|
|
|
- let fjItem =
|
|
|
- wtArray.find((findEle) => {
|
|
|
- return findEle.fjbh === e.fjbh;
|
|
|
- }) || {};
|
|
|
- const dataMix = Object.assign({}, e, fjItem);
|
|
|
- if (dataMix.status) {
|
|
|
- if (dataMix.status === 1) {
|
|
|
- this.showStatuswind(viewer, dataMix, dj);
|
|
|
- } else if (dataMix.status === 2) {
|
|
|
- this.showStatuswind(viewer, dataMix, gz);
|
|
|
- } else if (dataMix.status === 3) {
|
|
|
- this.showStatuswind(viewer, dataMix, jx);
|
|
|
- } else if (dataMix.status === 4) {
|
|
|
- this.showStatuswind(viewer, dataMix, xd);
|
|
|
- } else if (dataMix.status === 5) {
|
|
|
- this.showStatuswind(viewer, dataMix, lx);
|
|
|
- } else if (dataMix.status === 6) {
|
|
|
- this.showStatuswind(viewer, dataMix, sl);
|
|
|
- } else {
|
|
|
- //并网风机
|
|
|
- this.showAnimatewind(viewer, dataMix);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- this.resetWindViewport();
|
|
|
+ getStatus(sName) {
|
|
|
+ let status = 0;
|
|
|
+ if (/待机/.test(sName)) {
|
|
|
+ status = 1;
|
|
|
+ } else if (/故障/.test(sName)) {
|
|
|
+ status = 2;
|
|
|
+ } else if (/检修/.test(sName)) {
|
|
|
+ status = 3;
|
|
|
+ } else if (/限电/.test(sName)) {
|
|
|
+ status = 4;
|
|
|
+ } else if (/离线/.test(sName)) {
|
|
|
+ status = 5;
|
|
|
+ } else if (/受累/.test(sName)) {
|
|
|
+ status = 6;
|
|
|
+ } else if (/并网/.test(sName)) {
|
|
|
+ status = 7;
|
|
|
+ }
|
|
|
+ return status;
|
|
|
},
|
|
|
+
|
|
|
// 根据状态展示不同颜色风机贴图
|
|
|
showStatuswind(viewer, e, type, index) {
|
|
|
this.addSvg(
|
|
|
@@ -458,6 +578,7 @@ export default {
|
|
|
Math.random().toFixed(4) * 10000
|
|
|
);
|
|
|
},
|
|
|
+
|
|
|
// 风机柱与扇叶分开展示转动效果贴图
|
|
|
showAnimatewind(viewer, e, index) {
|
|
|
this.addSvgs(
|
|
|
@@ -477,116 +598,202 @@ export default {
|
|
|
Math.random().toFixed(3) * 2000
|
|
|
);
|
|
|
},
|
|
|
+
|
|
|
//添加svg或png贴图
|
|
|
addSvg(viewer, uri, lon, lat, val, index) {
|
|
|
- console.log(3333, val);
|
|
|
let that = this;
|
|
|
- let ids = that.generateUniqueId(val.id);
|
|
|
- const position = Cesium.Cartesian3.fromDegrees(lon, lat);
|
|
|
+ const findRes =
|
|
|
+ that.entityxyArray.find((findEle) => {
|
|
|
+ return findEle.fjbh === val.fjbh;
|
|
|
+ }) || null;
|
|
|
+ if (findRes) {
|
|
|
+ this.changeFjData(val);
|
|
|
+ } else {
|
|
|
+ let ids = that.generateUniqueId(val.id);
|
|
|
+ const position = Cesium.Cartesian3.fromDegrees(lon, lat);
|
|
|
+
|
|
|
+ // 使用高级灯牌生成器
|
|
|
+ const advancedGenerator = new AdvancedBillboardGenerator();
|
|
|
+
|
|
|
+ let statusItems = [
|
|
|
+ {
|
|
|
+ label: "功率",
|
|
|
+ value: `${
|
|
|
+ this.isFakeData
|
|
|
+ ? this.randomNum(100, 1000)
|
|
|
+ : val.actualPower.toFixed(2)
|
|
|
+ }MW`,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "风速",
|
|
|
+ value: `${
|
|
|
+ this.isFakeData
|
|
|
+ ? this.randomNum(100, 1000)
|
|
|
+ : val.windSpeed.toFixed(1)
|
|
|
+ }m/s`,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "转速",
|
|
|
+ value: `${
|
|
|
+ this.isFakeData
|
|
|
+ ? this.randomNum(100, 1000)
|
|
|
+ : val.rotateSpeed.toFixed(1)
|
|
|
+ }p`,
|
|
|
+ },
|
|
|
+ // { label: "其他参数A", value: "...." },
|
|
|
+ // { label: "其他参数B", value: "...." },
|
|
|
+ // { label: "其他参数C", value: "...." },
|
|
|
+ // { label: "其他参数D", value: "...." },
|
|
|
+ // { label: "其他参数E", value: "...." },
|
|
|
+ // { label: "其他参数F", value: "...." },
|
|
|
+ ];
|
|
|
+
|
|
|
+ const billboardImage = advancedGenerator.generateAdvancedBillboard({
|
|
|
+ title: val.fjbh,
|
|
|
+ statusItems,
|
|
|
+ // borderGradient: ["#00e5ff", "#2979ff"],
|
|
|
+ borderGradient: ["#ccc", "#ccc"],
|
|
|
+ backgroundColor: "transparent",
|
|
|
+ padding: 6,
|
|
|
+ titleHeight: 22,
|
|
|
+ itemHeight: 17,
|
|
|
+ titleColor: "#1890ff",
|
|
|
+ titleStrokeStyle: "#000",
|
|
|
+ titleStrokeWidth: 1,
|
|
|
+ labelStrokeStyle: "#000",
|
|
|
+ labelStrokeWidth: 1,
|
|
|
+ valueStrokeStyle: "#000",
|
|
|
+ valueStrokeWidth: 1,
|
|
|
+ });
|
|
|
|
|
|
- // 使用高级灯牌生成器
|
|
|
- const advancedGenerator = new AdvancedBillboardGenerator();
|
|
|
-
|
|
|
- let statusItems = [];
|
|
|
- const statusArray = [
|
|
|
- { label: "功率", value: `${val.actualPower.toFixed(2)}MW` },
|
|
|
- { label: "风速", value: `${val.windSpeed.toFixed(1)}m/s` },
|
|
|
- { label: "转速", value: `${val.rotateSpeed.toFixed(1)}p` },
|
|
|
- // { label: "其他参数A", value: "...." },
|
|
|
- // { label: "其他参数B", value: "...." },
|
|
|
- // { label: "其他参数C", value: "...." },
|
|
|
- // { label: "其他参数D", value: "...." },
|
|
|
- // { label: "其他参数E", value: "...." },
|
|
|
- // { label: "其他参数F", value: "...." },
|
|
|
- ];
|
|
|
-
|
|
|
- statusItems = statusArray;
|
|
|
-
|
|
|
- const billboardImage = advancedGenerator.generateAdvancedBillboard({
|
|
|
- title: val.name,
|
|
|
- statusItems,
|
|
|
- // borderGradient: ["#00e5ff", "#2979ff"],
|
|
|
- borderGradient: ["#ccc", "#ccc"],
|
|
|
- backgroundColor: "transparent",
|
|
|
- padding: 6,
|
|
|
- titleHeight: 22,
|
|
|
- itemHeight: 17,
|
|
|
- titleColor: "#1890ff",
|
|
|
- titleStrokeStyle: "#000",
|
|
|
- titleStrokeWidth: 1,
|
|
|
- labelStrokeStyle: "#000",
|
|
|
- labelStrokeWidth: 1,
|
|
|
- valueStrokeStyle: "#000",
|
|
|
- valueStrokeWidth: 1,
|
|
|
- });
|
|
|
+ const entityxy = viewer.entities.add({
|
|
|
+ name: val.name,
|
|
|
+ position,
|
|
|
+ billboard: {
|
|
|
+ image: billboardImage,
|
|
|
+ scale: 1,
|
|
|
+ verticalOrigin: Cesium.VerticalOrigin.BOTTOM, // 原来已经是CENTER,现在改为BOTTOM
|
|
|
+ pixelOffset: new Cesium.Cartesian2(80, -50), // 原来是-20,现在改为30,向上移动
|
|
|
+ eyeOffset: new Cesium.Cartesian3(0, 0, 0), // 保持固定大小
|
|
|
+ // heightReference: Cesium.HeightReference.NONE,
|
|
|
+ // 近大远小
|
|
|
+ scaleByDistance: new Cesium.NearFarScalar(
|
|
|
+ 6000, // 5010米内
|
|
|
+ 1.2, // 1倍大小
|
|
|
+ 9000, // 10000米外
|
|
|
+ 1 // 0.1倍大小
|
|
|
+ ),
|
|
|
+
|
|
|
+ // 透明度渐变
|
|
|
+ // translucencyByDistance: new Cesium.NearFarScalar(
|
|
|
+ // 6000, // 500米内
|
|
|
+ // 1.0, // 完全不透明
|
|
|
+ // 9000, // 3000米外
|
|
|
+ // 0.5 // 完全透明
|
|
|
+ // ),
|
|
|
+ },
|
|
|
+ });
|
|
|
|
|
|
- const entityxy = viewer.entities.add({
|
|
|
- name: val.name,
|
|
|
- position,
|
|
|
- billboard: {
|
|
|
- image: billboardImage,
|
|
|
- scale: 1,
|
|
|
- verticalOrigin: Cesium.VerticalOrigin.BOTTOM, // 原来已经是CENTER,现在改为BOTTOM
|
|
|
- pixelOffset: new Cesium.Cartesian2(80, -50), // 原来是-20,现在改为30,向上移动
|
|
|
- eyeOffset: new Cesium.Cartesian3(0, 0, 0), // 保持固定大小
|
|
|
- // heightReference: Cesium.HeightReference.NONE,
|
|
|
- // 近大远小
|
|
|
- scaleByDistance: new Cesium.NearFarScalar(
|
|
|
- 6000, // 5010米内
|
|
|
- 1.2, // 1倍大小
|
|
|
- 9000, // 10000米外
|
|
|
- 1 // 0.1倍大小
|
|
|
- ),
|
|
|
-
|
|
|
- // 透明度渐变
|
|
|
- // translucencyByDistance: new Cesium.NearFarScalar(
|
|
|
- // 6000, // 500米内
|
|
|
- // 1.0, // 完全不透明
|
|
|
- // 9000, // 3000米外
|
|
|
- // 0.5 // 完全透明
|
|
|
- // ),
|
|
|
- },
|
|
|
- });
|
|
|
+ const btn = document.getElementById("windBtn");
|
|
|
|
|
|
- const btn = document.getElementById("windBtn");
|
|
|
+ btn.addEventListener("click", function (event) {
|
|
|
+ entityxy.show = !entityxy.show;
|
|
|
+ });
|
|
|
|
|
|
- btn.addEventListener("click", function (event) {
|
|
|
- entityxy.show = !entityxy.show;
|
|
|
- });
|
|
|
+ const entity = viewer.entities.add({
|
|
|
+ id: ids,
|
|
|
+ position, // 模型位置
|
|
|
+ billboard: {
|
|
|
+ image: uri, // 也可以是 SVG 路径,如 'icon.svg'
|
|
|
+ scale: 0.5,
|
|
|
+ verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
|
|
|
+ horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
|
|
|
+ // 模型贴地
|
|
|
+ // heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
|
+ },
|
|
|
+ label: {
|
|
|
+ // text: val.name ? val.name : val.plantname,
|
|
|
+ text: val.name,
|
|
|
+ font: "14px sans-serif",
|
|
|
+ fillColor: Cesium.Color.fromBytes(255, 255, 255),
|
|
|
+ },
|
|
|
+ });
|
|
|
+ // 创建事件处理器
|
|
|
+ const handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
|
|
|
+ handler.setInputAction(function (movement) {
|
|
|
+ var position = movement.position;
|
|
|
+ var pickedObject = viewer.scene.pick(position);
|
|
|
+ if (pickedObject && pickedObject.id.id === ids) {
|
|
|
+ console.log("你点击了标签或模型!", entity);
|
|
|
+ console.log("标签或模型数据!", val);
|
|
|
+ that.modelVal = val;
|
|
|
+ // 找到实体,显示包含实体信息的弹框
|
|
|
+ that.showRightClickPopup(position, val);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
|
|
|
+ this.allWindEntitys.push({ entity, handler });
|
|
|
|
|
|
- const entity = viewer.entities.add({
|
|
|
- id: ids,
|
|
|
- position, // 模型位置
|
|
|
- billboard: {
|
|
|
- image: uri, // 也可以是 SVG 路径,如 'icon.svg'
|
|
|
- scale: 0.5,
|
|
|
- verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
|
|
|
- horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
|
|
|
- // 模型贴地
|
|
|
- // heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
|
- },
|
|
|
- label: {
|
|
|
- // text: val.name ? val.name : val.plantname,
|
|
|
- text: val.name,
|
|
|
- font: "14px sans-serif",
|
|
|
- fillColor: Cesium.Color.fromBytes(255, 255, 255),
|
|
|
- },
|
|
|
- });
|
|
|
- // 创建事件处理器
|
|
|
- const handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
|
|
|
- handler.setInputAction(function (movement) {
|
|
|
- var position = movement.position;
|
|
|
- var pickedObject = viewer.scene.pick(position);
|
|
|
- if (pickedObject && pickedObject.id.id === ids) {
|
|
|
- console.log("你点击了标签或模型!", entity);
|
|
|
- console.log("标签或模型数据!", val);
|
|
|
- that.modelVal = val;
|
|
|
- // 找到实体,显示包含实体信息的弹框
|
|
|
- that.showRightClickPopup(position, val);
|
|
|
- return;
|
|
|
- }
|
|
|
- }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
|
|
|
- this.allWindEntitys.push({ entity, handler });
|
|
|
+ entityxy.fjbh = val.fjbh;
|
|
|
+ this.entityxyArray.push(entityxy);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ changeFjData(fjItem) {
|
|
|
+ const findRes =
|
|
|
+ this.entityxyArray.find((findEle) => {
|
|
|
+ return findEle.fjbh === fjItem.fjbh;
|
|
|
+ }) || null;
|
|
|
+ if (findRes) {
|
|
|
+ const statusItems = [
|
|
|
+ {
|
|
|
+ label: "功率",
|
|
|
+ value: `${
|
|
|
+ this.isFakeData
|
|
|
+ ? this.randomNum(100, 1000)
|
|
|
+ : fjItem.actualPower.toFixed(2)
|
|
|
+ }MW`,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "风速",
|
|
|
+ value: `${
|
|
|
+ this.isFakeData
|
|
|
+ ? this.randomNum(100, 1000)
|
|
|
+ : fjItem.windSpeed.toFixed(1)
|
|
|
+ }m/s`,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "转速",
|
|
|
+ value: `${
|
|
|
+ this.isFakeData
|
|
|
+ ? this.randomNum(100, 1000)
|
|
|
+ : fjItem.rotateSpeed.toFixed(1)
|
|
|
+ }p`,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+
|
|
|
+ // 使用高级灯牌生成器
|
|
|
+ const advancedGenerator = new AdvancedBillboardGenerator();
|
|
|
+ const billboardImage = advancedGenerator.generateAdvancedBillboard({
|
|
|
+ title: findRes.fjbh,
|
|
|
+ statusItems,
|
|
|
+ // borderGradient: ["#00e5ff", "#2979ff"],
|
|
|
+ borderGradient: ["#ccc", "#ccc"],
|
|
|
+ backgroundColor: "transparent",
|
|
|
+ padding: 6,
|
|
|
+ titleHeight: 22,
|
|
|
+ itemHeight: 17,
|
|
|
+ titleColor: "#1890ff",
|
|
|
+ titleStrokeStyle: "#000",
|
|
|
+ titleStrokeWidth: 1,
|
|
|
+ labelStrokeStyle: "#000",
|
|
|
+ labelStrokeWidth: 1,
|
|
|
+ valueStrokeStyle: "#000",
|
|
|
+ valueStrokeWidth: 1,
|
|
|
+ });
|
|
|
+
|
|
|
+ findRes.billboard.image._value = billboardImage;
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
randomNum(minNum, maxNum) {
|