From e40ee62d3e9b71ffe3432d32a53a00c4097b5708 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Fri, 31 Dec 2021 09:03:28 +0800
Subject: [PATCH] +3d 2.5d
---
src/store/modules/mobile.js | 65 ++++++++++++++++++++++++++++++--
1 files changed, 60 insertions(+), 5 deletions(-)
diff --git a/src/store/modules/mobile.js b/src/store/modules/mobile.js
index 2350f45..b106fc0 100644
--- a/src/store/modules/mobile.js
+++ b/src/store/modules/mobile.js
@@ -30,8 +30,14 @@
},
//默认起始点函数
startPointFn: '',
- dimension: "2D",// 维度
+ dimension: "2.5D",// 维度
+ dimensionData: {// 维度镜头数据
+ heading: 0,
+ pitch: -90,
+ roll: 0
+ },
perspectiveControl: '',//视角控制:高度、角度 ()=>{}
+ perspectiveControls: '',//视角控制:高度、角度 ()=>{}
},
mutations: {
MSET_VIEWER(state, viewer) {
@@ -96,11 +102,25 @@
//切换2D和2.5D
MSET_DIMENSION(state, data) {
state.dimension = data;
+ if (data == "2D") {
+ state.dimensionData = {// 维度镜头数据
+ heading: 0,
+ pitch: -90,
+ roll: 0
+ };
+ } else if (data == "2.5D") {
+ state.dimensionData = {// 维度镜头数据
+ heading: 0,
+ pitch: -90,
+ roll: 0
+ };
+ }
},
//切换控制
MSET_PERSPECTIVECONTROL(state, data) {
state.perspectiveControl = data;
- }
+ state.perspectiveControls = !state.perspectiveControls;
+ },
},
actions: {
MSET_CREADE({ state, commit, dispatch }) {
@@ -111,12 +131,12 @@
// 关闭前一个弹窗?
dispatch("closeMobileWindowsDom");
let clas, Flys;
-
+ const nowHeight = Math.ceil(state.mviewer.camera.positionCartographic.height);
if (state.dimension == "2D") {
Flys = [
+data.lntLat[0] + 0.01197,
+data.lntLat[1] - 0.0001,
- 330,
+ nowHeight,
]
clas = [
data.from == "PopupOurOnce" ? +data.lntLat[0] : +data.lntLat[0],
@@ -190,7 +210,7 @@
// 330,
...Flys,
0,
- state.dimension == "2D" ? -90 : state.dimension == "2.5D" ? -45 : -45
+ state.dimensionData.pitch
);
dispatch("mapFlyTo", {//飞入
lntLat: [Position.lng, Position.lat, Position.alt],
@@ -332,6 +352,41 @@
},
MSET_DIMENSIONS({ state, commit, dispatch }, val) {
commit("MSET_DIMENSION", val);
+ //控制高度
+ const height = Math.ceil(state.mviewer.camera.positionCartographic.height);
+ state.mviewer.camera.setView({
+ destination: global.DC.Namespace.Cesium.Cartesian3.fromRadians(
+ state.mviewer.camera.positionCartographic.longitude,
+ state.mviewer.camera.positionCartographic.latitude,
+ height
+ ),
+ orientation: {
+ heading: global.DC.Namespace.Cesium.Math.toRadians(state.dimensionData.heading), // 方向
+ pitch: global.DC.Namespace.Cesium.Math.toRadians(
+ state.dimensionData.pitch
+ ), // 倾斜角度
+ roll: state.dimensionData.roll,
+ },
+ });
+ },
+ MSET_GOTOCC({ state, commit, dispatch }, val) {
+ // commit("MSET_DIMENSION", val);
+ //控制高度
+ // const height = Math.ceil(state.mviewer.camera.positionCartographic.height);
+ state.mviewer.camera.setView({
+ destination: global.DC.Namespace.Cesium.Cartesian3.fromRadians(
+ state.mviewer.camera.positionCartographic.longitude,
+ state.mviewer.camera.positionCartographic.latitude,
+ val.height
+ ),
+ orientation: {
+ heading: global.DC.Namespace.Cesium.Math.toRadians(val.heading), // 方向
+ pitch: global.DC.Namespace.Cesium.Math.toRadians(
+ val.pitch
+ ), // 倾斜角度
+ roll: val.roll,
+ },
+ });
}
}
}
--
Gitblit v1.9.3