sunzehao 2 hete
szülő
commit
da0126a21b

BIN
public/static/model/dixing/terrain.glb


BIN
src/assets/cesiumImg/backPng.png


+ 11 - 11
src/views/cesiumComponents/fjLonLat1.json

@@ -1418,7 +1418,7 @@
             "name": "F02号风机",
             "aname": "F02",
             "status": 2,
-            "height": 13500
+            "height": 8500
         },
         {
             "nemCode": "F03",
@@ -1427,7 +1427,7 @@
             "name": "F03号风机",
             "aname": "F03",
             "status": 7,
-            "height": 13500
+            "height": 8500
         },
         {
             "nemCode": "F04",
@@ -1436,7 +1436,7 @@
             "name": "F04号风机",
             "aname": "F04",
             "status": 3,
-            "height": 7500
+            "height": 4500
         },
         {
             "nemCode": "F05",
@@ -1445,7 +1445,7 @@
             "name": "F05号风机",
             "aname": "F05",
             "status": 7,
-            "height": 14000
+            "height": 9000
         },
         {
             "nemCode": "F06",
@@ -1454,7 +1454,7 @@
             "name": "F06号风机",
             "aname": "F06",
             "status": 3,
-            "height": 11000
+            "height": 6500
         },
         {
             "nemCode": "F07",
@@ -1463,7 +1463,7 @@
             "name": "F07号风机",
             "aname": "F07",
             "status": 4,
-            "height": 10000
+            "height": 4800
         },
         {
             "nemCode": "F08",
@@ -1472,7 +1472,7 @@
             "name": "F08号风机",
             "aname": "F08",
             "status": 5,
-            "height": 14500
+            "height": 9500
         },
         {
             "nemCode": "F09",
@@ -1481,7 +1481,7 @@
             "name": "F09号风机",
             "aname": "F09",
             "status": 4,
-            "height": 15500
+            "height": 9500
         },
         {
             "nemCode": "F10",
@@ -1490,7 +1490,7 @@
             "name": "F10号风机",
             "aname": "F10",
             "status": 5,
-            "height": 13000
+            "height": 6000
         },
         {
             "nemCode": "F11",
@@ -1499,7 +1499,7 @@
             "name": "F11号风机",
             "aname": "F11",
             "status": 7,
-            "height": 12500
+            "height": 8500
         },
         {
             "nemCode": "F12",
@@ -1508,7 +1508,7 @@
             "name": "F12号风机",
             "aname": "F12",
             "status": 6,
-            "height": 14500
+            "height": 9000
         },
         {
             "nemCode": "F13",

+ 67 - 40
src/views/cesiumComponents/windMap3D.vue

@@ -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;
           // 找到实体,显示包含实体信息的弹框