sunzehao преди 3 месеца
родител
ревизия
79e224ca20
променени са 1 файла, в които са добавени 32 реда и са изтрити 0 реда
  1. 32 0
      src/views/cesium.vue

+ 32 - 0
src/views/cesium.vue

@@ -898,6 +898,36 @@ export default {
         },
       });
     },
+    resetViewport1(height = 0) {
+      // 设置初始视图为宁夏
+      const that = this;
+      this.viewer.camera.flyTo({
+        destination: Cesium.Cartesian3.fromDegrees(
+          121.47,
+          31.23,
+          10000000
+        ),
+        // orientation: {
+        //   heading: 1,
+        //   pitch: -0.2,
+        //   roll: 0,
+        // },
+        // duration: 3,
+        orientation: {
+          heading: Cesium.Math.toRadians(0),
+          pitch: Cesium.Math.toRadians(-90),
+          roll: 0.0,
+        },
+        duration: 1.0,
+        complete() {
+          // 为什么要加这个?因为破库地球没完全加载完成时如果执行了监听鼠标滑动事件会光速报错滑跪
+          if (!that.loadDone) {
+            that.initEventInputAction();
+            that.loadDone = true;
+          }
+        },
+      });
+    },
 
     // 添加风场图
     showWindLayer() {
@@ -973,6 +1003,7 @@ export default {
       cloudLayer.contrast = 1; // 对比度
 
       this.cloudLayer = cloudLayer;
+      this.resetViewport1()
     },
     //显示降雨图
     showRainLayer() {
@@ -998,6 +1029,7 @@ export default {
       this.viewer.imageryLayers.addImageryProvider(rainLayer);
       this.csceneElliposid(this.viewer, "rain");
       this.rainLayer = rainLayer;
+      this.resetViewport1()
     },
 
     showTemperatureLayer() {