Koishi 1 tydzień temu
rodzic
commit
86a1fb5461

+ 1 - 1
src/assets/main.css

@@ -1,7 +1,7 @@
 @import './base.css';
 
 #app {
-  max-width: 1920px;
+  /* max-width: 1920px; */
   overflow: hidden;
   /* margin: 0 auto;
   padding: 2rem;

+ 157 - 102
src/views/cesiumComponents/windMap3D.vue

@@ -68,6 +68,7 @@
     />
     <windView
       v-if="showWindDetail"
+      :cesiumViewer="viewer"
       @coverOnChange="coverOnChange"
       :currentHeight="currentHeight"
       @showDetail="menuComTSty"
@@ -82,13 +83,15 @@ import "../../Cesium/Widgets/widgets.css";
 import fjMYLonLatJson from "../fjLonLatJson/fj_MY1.json";
 import fjWHZLonLatJson from "../fjLonLatJson/fj_WHZ.json"; //京能旺海庄
 import fjYPLLonLatJson from "../fjLonLatJson/fj_YPL.json"; //京能营盘梁
-import mountainPosJson from "../fjLonLatJson/mountainPos.json"; 
+import mountainPosJson from "../fjLonLatJson/mountainPos.json";
 import allStationJson from "./allStationJson.json";
 import basicGeoJson from "../../assets/geoJson/basic.json";
 import comModelDialog from "@/components/comModelDialog.vue";
 import windView from "./windView.vue";
 import menuCom from "../menuCom.vue";
 
+import dayjs from "dayjs";
+
 import cloudJson from "/public/static/exportData/cloud/layer.json";
 import rainJson from "/public/static/exportData/rain/layer.json";
 import tempJson from "/public/static/exportData/tmp/layer.json";
@@ -122,23 +125,23 @@ export default {
   },
   data() {
     return {
-        restLatLon: [
-            {
-                longitude: 107.034945,
-                latitude: 37.309099,
-                name: "MYFDC"
-            },
-            {
-                longitude: 112.88355172,
-                latitude: 40.46617836,
-                name: "JNWHZ"
-            },
-            {
-                longitude: 112.5270545,
-                latitude: 40.35920334,
-                name: "JNYPL"
-            }
-        ],
+      restLatLon: [
+        {
+          longitude: 107.034945,
+          latitude: 37.309099,
+          name: "MYFDC",
+        },
+        {
+          longitude: 112.88355172,
+          latitude: 40.46617836,
+          name: "JNWHZ",
+        },
+        {
+          longitude: 112.5270545,
+          latitude: 40.35920334,
+          name: "JNYPL",
+        },
+      ],
       loading: true,
       viewer: null,
       windLayer: null, // 风场图
@@ -203,13 +206,36 @@ export default {
 
       viewer._cesiumWidget._creditContainer.style.display = "none";
       //   this.csceneElliposid(viewer)
+
+      const utcStart = dayjs(
+        `${dayjs().format("YYYY-MM-DD")} 00:00:00`
+      ).subtract(4, "hour");
+      const startTime = Cesium.JulianDate.fromDate(new Date(utcStart));
+
+      const utcStop = dayjs(
+        `${dayjs().format("YYYY-MM-DD")} 23:59:59`
+      ).subtract(4, "hour");
+      const stopTime = Cesium.JulianDate.fromDate(new Date(utcStop));
+
+      const utcNow = dayjs().subtract(4, "hour");
+      const nowTime = Cesium.JulianDate.fromDate(new Date(utcNow));
+
+      // dayjs().format("YYYY-MM-DD")} 00:00:00
+      viewer.clock.startTime = startTime;
+      viewer.clock.stopTime = stopTime;
+      viewer.clock.currentTime = nowTime;
+      viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP; // 循环模式:到达结束时跳回开始
+      // viewer.clock.multiplier = 10000; // 时间流逝速度(加快模拟)
+      viewer.clock.shouldAnimate = true;
+
       this.viewer = viewer;
+
       // 展示场站
       // this.showAllStation(viewer)
       // 展示风机
-    //   this.initCesiumTerrain();
+      this.initCesiumTerrain();
       this.initCesiumBaseMapImage();
-    //   this.initGeoJsonData();
+      //   this.initGeoJsonData();
       this.showWindFromStation(viewer);
     },
 
@@ -422,25 +448,25 @@ export default {
     },
     // 展示所选风场的风机
     showWindFromStation(viewer) {
-        let stationName = this.$route.query.nameEn
-        let fjLonLatJson = []
-        if (stationName === "MYFDC") {
-            fjLonLatJson = fjMYLonLatJson
-        } else if (stationName === "JNWHZ") {
-            fjLonLatJson = fjWHZLonLatJson
-        } else if (stationName === "JNYPL") {
-            fjLonLatJson = fjYPLLonLatJson
-        }
+      let stationName = this.$route.query.nameEn;
+      let fjLonLatJson = [];
+      if (stationName === "MYFDC") {
+        fjLonLatJson = fjMYLonLatJson;
+      } else if (stationName === "JNWHZ") {
+        fjLonLatJson = fjWHZLonLatJson;
+      } else if (stationName === "JNYPL") {
+        fjLonLatJson = fjYPLLonLatJson;
+      }
       fjLonLatJson.data.forEach((e, index) => {
         this.showStatuswind(viewer, e);
       });
 
-    //   let mountainMsg = mountainPosJson.data.find(it => it.stationName === stationName)
+      //   let mountainMsg = mountainPosJson.data.find(it => it.stationName === stationName)
 
-    //     this.addTreeain(
-    //         viewer, 
-    //         mountainMsg
-    //     );
+      //     this.addTreeain(
+      //         viewer,
+      //         mountainMsg
+      //     );
       this.resetWindViewport();
     },
     // 根据状态展示不同颜色风机贴图
@@ -488,39 +514,51 @@ export default {
       }
     },
     addTreeain(viewer, mountainMsg) {
-        const hpRoll = new Cesium.HeadingPitchRoll(90.0, 0.0, 0.0);
-        const position = Cesium.Cartesian3.fromDegrees(
-            mountainMsg.longitude, 
-            mountainMsg.latitude, 
-            mountainMsg.height || 0
-        );
+      const hpRoll = new Cesium.HeadingPitchRoll(90.0, 0.0, 0.0);
+      const position = Cesium.Cartesian3.fromDegrees(
+        mountainMsg.longitude,
+        mountainMsg.latitude,
+        mountainMsg.height || 0
+      );
 
-        const orientation = Cesium.Transforms.headingPitchRollQuaternion(
-            position,
-            hpRoll
-        );
+      const orientation = Cesium.Transforms.headingPitchRollQuaternion(
+        position,
+        hpRoll
+      );
 
-        const offsetLocal = new Cesium.Cartesian3(mountainMsg.east, mountainMsg.north, mountainMsg.up); // E, N, U
-
-        const transform = Cesium.Transforms.eastNorthUpToFixedFrame(position);
-        const offsetGlobal = new Cesium.Cartesian3();
-        Cesium.Matrix4.multiplyByPointAsVector(transform, offsetLocal, offsetGlobal);
-
-        const finalPos = Cesium.Cartesian3.add(position, offsetGlobal, new Cesium.Cartesian3());
-
-        const terrain = viewer.entities.add({
-            name: mountainMsg.modelName, // 模型名称
-            position: finalPos, // 模型位置
-            orientation, // 模型朝向
-            animation: false,
-            model: {
-            uri: `/public/static/model/dixing/${mountainMsg.modelNameEn}.glb`,
-            // uri: "/public/static/model/dixing/terrain.glb",
-            scale: mountainMsg.scale,
-            // 模型贴地
-            heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
-            },
-        });
+      const offsetLocal = new Cesium.Cartesian3(
+        mountainMsg.east,
+        mountainMsg.north,
+        mountainMsg.up
+      ); // E, N, U
+
+      const transform = Cesium.Transforms.eastNorthUpToFixedFrame(position);
+      const offsetGlobal = new Cesium.Cartesian3();
+      Cesium.Matrix4.multiplyByPointAsVector(
+        transform,
+        offsetLocal,
+        offsetGlobal
+      );
+
+      const finalPos = Cesium.Cartesian3.add(
+        position,
+        offsetGlobal,
+        new Cesium.Cartesian3()
+      );
+
+      const terrain = viewer.entities.add({
+        name: mountainMsg.modelName, // 模型名称
+        position: finalPos, // 模型位置
+        orientation, // 模型朝向
+        animation: false,
+        model: {
+          uri: `/public/static/model/dixing/${mountainMsg.modelNameEn}.glb`,
+          // uri: "/public/static/model/dixing/terrain.glb",
+          scale: mountainMsg.scale,
+          // 模型贴地
+          heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
+        },
+      });
     },
     //添加模型
     addModel(viewer, name, lon, lat, status, height, model) {
@@ -542,26 +580,43 @@ export default {
         orientation, // 模型朝向
         animation: false,
         model: {
-        //   uri: this.dixingAdd
-        //     ? // ? "/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/terrain.glb",
-        uri: `/public/static/model/fjStatus/fj_${statueFJ}.glb`,
-          scale: 0.5,
+          //   uri: this.dixingAdd
+          //     ? // ? "/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/terrain.glb",
+          uri: `/public/static/model/fjStatus/fj_${statueFJ}.glb`,
+          // scale: 0.5,
+          scale: 5,
           // 模型贴地
           //   heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
-          //   heightReference: Cesium.HeightReference.NONE,
+          // heightReference: Cesium.HeightReference.NONE,
           //   silhouetteSize: this.dixingAdd ? 2 : 0,
           //   silhouetteColor: Cesium.Color.fromCssColorString(statueColor),
           //   runAnimations: wtStatue !== 7 ? false : true,
+          customShader: new Cesium.CustomShader({
+            uniforms: {
+              u_exaggeration: {
+                type: Cesium.UniformType.FLOAT,
+                value: 10.0, // 与verticalExaggeration相同
+              },
+            },
+            vertexShaderText: `
+      void vertexMain(VertexInput vsInput, inout czm_modelVertexOutput vsOutput) {
+        // 抵消垂直夸张
+        vsOutput.positionMC.y /= u_exaggeration;
+        // 如果需要保持模型在世界坐标中的位置不变
+        // 需要更复杂的矩阵计算
+      }
+    `,
+          }),
+        },
+        label: {
+          text: name,
+          font: "14px sans-serif",
+          fillColor: Cesium.Color.fromBytes(255, 255, 255),
         },
-        label: { 
-            text: name,
-            font: '14px sans-serif',
-            fillColor: Cesium.Color.fromBytes(255, 255, 255),
-        }
       });
 
       // 使用高级灯牌生成器
@@ -591,18 +646,18 @@ export default {
         borderGradient: ["#00e5ff", "#2979ff"],
       });
 
-    //   const entityxy = viewer.entities.add({
-    //     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,
-    //     },
-    //   });
+      //   const entityxy = viewer.entities.add({
+      //     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,
+      //     },
+      //   });
 
       this.dixingAdd = true;
 
@@ -930,7 +985,7 @@ export default {
       let fromLon = this.$route.query.longitude * 1;
       let fromLat = this.$route.query.latitude * 1;
       let fromheight = this.$route.query.height * 1;
-      let fromname = this.$route.query.nameEn
+      let fromname = this.$route.query.nameEn;
       // 设置镜头到指定的经纬度(度)、高度(米)
       this.viewer.camera.setView({
         destination: Cesium.Cartesian3.fromDegrees(
@@ -945,16 +1000,16 @@ export default {
         },
       });
       // 目标位置:经度、纬度、高度
-    //   const targetLon = 107.034945;
-    //   const targetLat = 37.309099;
-        let targetLon = null
-        let targetLat = null
-        this.restLatLon.forEach(it => {
-            if (it.name === fromname) {
-                targetLon = it.longitude
-                targetLat = it.latitude
-            }
-        })
+      //   const targetLon = 107.034945;
+      //   const targetLat = 37.309099;
+      let targetLon = null;
+      let targetLat = null;
+      this.restLatLon.forEach((it) => {
+        if (it.name === fromname) {
+          targetLon = it.longitude;
+          targetLat = it.latitude;
+        }
+      });
       const targetHeight = 10000;
 
       const draggableHeightTolerance = 5000; // 允许拖拽的高度范围:20,000 ~ 30,000

Plik diff jest za duży
+ 1656 - 1413
src/views/cesiumComponents/windView.vue


Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików