From dd8e9dd6c63c23101f6dfa0f80fd3789a9add2ad Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Fri, 31 Dec 2021 11:17:13 +0800
Subject: [PATCH] +2.5d 以及3d 应用 视角固定

---
 src/store/modules/mobile.js |   68 +++++++++++++++++++++++++++++-----
 1 files changed, 58 insertions(+), 10 deletions(-)

diff --git a/src/store/modules/mobile.js b/src/store/modules/mobile.js
index e77d54a..1c51a14 100644
--- a/src/store/modules/mobile.js
+++ b/src/store/modules/mobile.js
@@ -38,6 +38,12 @@
         },
         perspectiveControl: '',//视角控制:高度、角度  ()=>{}
         perspectiveControls: '',//视角控制:高度、角度  ()=>{}
+
+        tilesetLayer: null,//3d模型
+        tileset: null,//3d模型
+        tilesetLayer: null,//2.5d模型
+        usetowpointfive: null,
+        tilesetLayer: null,//瀑布流
     },
     mutations: {
         MSET_VIEWER(state, viewer) {
@@ -105,15 +111,44 @@
             if (data == "2D") { // 改数据为3d数据
                 state.dimensionData = {// 维度镜头数据
                     heading: 0,
-                    pitch: -90,
+                    pitch: -45,
                     roll: 0
                 };
+                // console.log(1321)
+                state.wallLayer.show = false;
+                state.mviewer.imageryLayers.remove(state.newLayer);
+                state.newLayer = null;
+                // state.silhouetteBlue.selected = []
+                state.tilesetLayer.changesilhouetteBlue();
+                // console.log(state.tileset)
+                state.tilesetLayer.show = true;
+                state.startPointFn();
+                // state.mviewer.flyTo(state.tileset);
             } else if (data == "2.5D") {
                 state.dimensionData = {// 维度镜头数据
                     heading: 0,
                     pitch: -90,
                     roll: 0
                 };
+                state.tilesetLayer.show = false
+
+                state.newLayer = state.usetowpointfive();
+
+                state.wallLayer.show = true
+
+                state.startPointFn();
+                // state.mviewer.camera.setView({
+                //     // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
+                //     // fromDegrees()方法,将经纬度和高程转换为世界坐标
+                //     destination: global.DC.Namespace.Cesium.Cartesian3.fromDegrees(116.36618337, 27.95911915, 1000.0),
+                //     orientation: {
+                //         // 指向
+                //         heading: global.DC.Namespace.Cesium.Math.toRadians(0, 0),
+                //         // 视角
+                //         pitch: global.DC.Namespace.Cesium.Math.toRadians(-90),
+                //         roll: 0.0
+                //     }
+                // })
             }
         },
         //切换控制
@@ -121,6 +156,13 @@
             state.perspectiveControl = data;
             state.perspectiveControls = !state.perspectiveControls;
         },
+        MSET_MODEOLS(state, data) {
+            state.tilesetLayer = data.tilesetLayer;
+            state.newLayer = data.newLayer;
+            state.wallLayer = data.wallLayer;
+            state.tileset = data.tileset;
+            state.usetowpointfive = data.usetowpointfive;
+        }
     },
     actions: {
         MSET_CREADE({ state, commit, dispatch }) {
@@ -132,27 +174,33 @@
             dispatch("closeMobileWindowsDom");
             let clas, Flys;
             const nowHeight = Math.ceil(state.mviewer.camera.positionCartographic.height);
+            console.log(data)
             if (state.dimension == "2D") {
                 Flys = [
                     +data.lntLat[0] + 0.01197,
-                    +data.lntLat[1] - 0.0001,
-                    nowHeight,
+                    // +data.lntLat[1] - 0.0001,
+                    +data.lntLat[1] - 0.0042,
+                    330,
                 ]
                 clas = [
                     data.from == 'PopupOurOnce' ? +data.lntLat[0] : +data.lntLat[0],
-                    data.from == 'PopupOurOnce' ? +data.lntLat[1] - 0.00108 : +data.lntLat[1],
-                    data.from == 'PopupOurOnce' ? 0 : 0
+                    // data.from == 'PopupOurOnce' ? +data.lntLat[1] - 0.00108 : +data.lntLat[1],
+                    data.from == 'PopupOurOnce' ? +data.lntLat[1] - 0.00108 : +data.lntLat[1] - 0.00048,
+                    data.from == 'PopupOurOnce' ? 0 : 90.648862227
                 ]
             } else if (state.dimension == '2.5D') {
                 Flys = [
                     +data.lntLat[0] + 0.01197,
-                    +data.lntLat[1] - 0.0022,
-                    330
+                    +data.lntLat[1] - 0.0001,
+                    // +data.lntLat[1] - 0.0022,
+                    nowHeight
                 ]
                 clas = [
                     data.from == 'PopupOurOnce' ? +data.lntLat[0] : +data.lntLat[0],
-                    data.from == 'PopupOurOnce' ? +data.lntLat[1] - 0.00108 : +data.lntLat[1] - 0.00048,
-                    data.from == 'PopupOurOnce' ? 0 : 90.648862227
+                    data.from == 'PopupOurOnce' ? +data.lntLat[1] - 0.00108 : +data.lntLat[1],
+                    // data.from == 'PopupOurOnce' ? +data.lntLat[1] - 0.00108 : +data.lntLat[1] - 0.00048,
+                    // data.from == 'PopupOurOnce' ? 0 : 90.648862227
+                    data.from == 'PopupOurOnce' ? 0 : 0
                 ]
             }
 
@@ -270,7 +318,7 @@
                     // pitch: data.pitch,
                     roll: data.roll
                 },
-                duration: 1.6, // 定位的时间间隔
+                duration: 1.5, // 定位的时间间隔
                 complete: () => { // 完成后的回调
                     if (data.fn) { // 自定义回调
                         setTimeout(() => {

--
Gitblit v1.9.3