From 5e47738f99e307bab1c8a5ee9ecd96d8c7f4a968 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Sat, 08 Jan 2022 10:43:01 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/school-web
---
src/store/modules/mobile.js | 141 ++++++++++++++++++++++++++++++++++++++---------
1 files changed, 114 insertions(+), 27 deletions(-)
diff --git a/src/store/modules/mobile.js b/src/store/modules/mobile.js
index 28ff95a..19643e4 100644
--- a/src/store/modules/mobile.js
+++ b/src/store/modules/mobile.js
@@ -30,7 +30,7 @@
},
// 默认起始点函数
startPointFn: "",
- dimension: "3D", // 维度
+ dimension: "2.5D", // 维度
dimensionData: {
// 维度镜头数据
heading: 0,
@@ -45,6 +45,12 @@
tilesetLayer: null, //2.5d模型
usetowpointfive: null,
tilesetLayer: null, //瀑布流
+
+ vecLayer: null, //3D底图
+ cvaLayer: null, //3D底图
+
+ audioData: null, //语音
+ audioState: false, //语音状态
},
mutations: {
MSET_VIEWER(state, viewer) {
@@ -110,6 +116,7 @@
// },
//切换2D和2.5D
MSET_DIMENSION(state, data) {
+ //关闭弹窗
//3d,2.5d转换事件
state.dimension = data;
if (data == "3D") {
@@ -120,25 +127,50 @@
pitch: -45,
roll: 0,
};
+ //加载底图
+ state.vecLayer = state.mviewer.imageryLayers.addImageryProvider(
+ new global.DC.Namespace.Cesium.WebMapTileServiceImageryProvider({
+ url: " http://t1.tianditu.gov.cn/vec_w/wmts?tk=9ae78c51a0a28f06444d541148496e36",
+ type: "wmts",
+ layer: "vec",
+ style: "default",
+ format: "tiles",
+ tileMatrixSetID: "w",
+ show: true,
+ maximumLevel: 18,
+ })
+ );
+ state.cvaLayer = state.mviewer.imageryLayers.addImageryProvider(
+ new global.DC.Namespace.Cesium.WebMapTileServiceImageryProvider({
+ url: " http://t1.tianditu.gov.cn/cva_w/wmts?tk=9ae78c51a0a28f06444d541148496e36",
+ type: "wmts",
+ layer: "cva",
+ style: "default",
+ format: "tiles",
+ tileMatrixSetID: "w",
+ show: true,
+ maximumLevel: 18,
+ })
+ );
// console.log(1321)
state.wallLayer.show = false; //关闭瀑布 以及2.5d图形贴片
state.mviewer.imageryLayers.remove(state.newLayer);
state.newLayer = null;
// state.silhouetteBlue.selected = []
- state.tilesetLayer.changesilhouetteBlue(); //清空silhouetteBlue.selected = [];
+ // state.tilesetLayer.changesilhouetteBlue(); //清空silhouetteBlue.selected = [];
// console.log(state.tileset)
state.tilesetLayer.show = true; //显示3d图形
state.startPointFn(); //移动默认视角
// state.mviewer.flyTo(state.tileset);
//3D视角不限制
- state.mviewer.scene.screenSpaceCameraController.minimumZoomDistance = 100;
+ state.mviewer.scene.screenSpaceCameraController.minimumZoomDistance = 80;
// 最大
- state.mviewer.scene.screenSpaceCameraController.maximumZoomDistance = 999999999999;
+ state.mviewer.scene.screenSpaceCameraController.maximumZoomDistance = 4000000;
// 设置相机缩小时的速率
- state.mviewer.scene.screenSpaceCameraController._minimumZoomRate = 3000;
+ state.mviewer.scene.screenSpaceCameraController._minimumZoomRate = 10000;
// 设置相机放大时的速率
- state.mviewer.scene.screenSpaceCameraController._maximumZoomRate = 3000;
+ state.mviewer.scene.screenSpaceCameraController._maximumZoomRate = 5906376272000;
// 视角平移
state.mviewer.scene.screenSpaceCameraController.enableRotate = true;
// 视角缩放
@@ -152,17 +184,22 @@
pitch: -90,
roll: 0,
};
+ //取消3D底图
+ state.mviewer.imageryLayers.remove(state.vecLayer);
+ state.vecLayer = null;
+ state.mviewer.imageryLayers.remove(state.cvaLayer);
+ state.cvaLayer = null;
state.tilesetLayer.show = false; //隐藏3d图形
state.newLayer = state.usetowpointfive(); //添加2.5d图形贴片
- state.wallLayer.show = true; //打开瀑布
+ state.wallLayer.show = false; //打开瀑布
state.startPointFn(); //移动默认视角
//2.5D视角限制
- state.mviewer.scene.screenSpaceCameraController.minimumZoomDistance = 500;
+ state.mviewer.scene.screenSpaceCameraController.minimumZoomDistance = 0;
// 最大
- state.mviewer.scene.screenSpaceCameraController.maximumZoomDistance = 6000;
+ state.mviewer.scene.screenSpaceCameraController.maximumZoomDistance = 4000;
// 设置相机缩小时的速率
- state.mviewer.scene.screenSpaceCameraController._minimumZoomRate = 30000;
+ // state.mviewer.scene.screenSpaceCameraController._minimumZoomRate = 30000;
// 设置相机放大时的速率
state.mviewer.scene.screenSpaceCameraController._maximumZoomRate = 5906376272000;
// 视角平移
@@ -193,8 +230,6 @@
},
setMobileWindows({ state, commit, dispatch }, data) {
// 打开随地图移动窗口
- // 关闭前一个弹窗?
- dispatch("closeMobileWindowsDom");
let clas, Flys;
const nowHeight = Math.ceil(
state.mviewer.camera.positionCartographic.height
@@ -213,20 +248,20 @@
data.from == "PopupOurOnce"
? +data.lntLat[1] - 0.00108
: +data.lntLat[1] - 0.00048,
- data.from == "PopupOurOnce" ? 0 : 90.648862227,
+ data.from == "PopupOurOnce" ? 0 : 30.648862227,
];
} else if (state.dimension == "2.5D") {
Flys = [
+data.lntLat[0] + 0.01197,
- +data.lntLat[1] - 0.0001,
+ +data.lntLat[1] + 0.00048,
// +data.lntLat[1] - 0.0022,
- nowHeight,
+ // nowHeight,
+ 360,
];
+ // console.log(nowHeight);
clas = [
data.from == "PopupOurOnce" ? +data.lntLat[0] : +data.lntLat[0],
- data.from == "PopupOurOnce"
- ? +data.lntLat[1] - 0.00108
- : +data.lntLat[1],
+ data.from == "PopupOurOnce" ? +data.lntLat[1] : +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,
@@ -286,21 +321,51 @@
0,
state.dimensionData.pitch
);
- dispatch("mapFlyTo", {
- //飞入
- lntLat: [Position.lng, Position.lat, Position.alt],
- heading: Position.heading,
- pitch: Position.pitch,
- roll: Position.roll,
- });
+ if (state.dimension != "2.5D") {
+ // if (true) {
+ dispatch("mapFlyTo", {
+ //飞入
+ lntLat: [Position.lng, Position.lat, Position.alt],
+ heading: Position.heading,
+ pitch: Position.pitch,
+ roll: Position.roll,
+ });
+ } else {
+ // console.log(17878);
+ state.mviewer.camera.setView({
+ // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
+ // fromDegrees()方法,将经纬度和高程转换为世界坐标
+ destination: new global.DC.Namespace.Cesium.Cartesian3.fromDegrees(
+ // 114.0351,
+ // 27.6314,
+ // 200.0
+ Position.lng - 0.012,
+ Position.lat,
+ Position.alt || 15000.0
+ ),
+ orientation: {
+ heading: global.DC.Namespace.Cesium.Math.toRadians(
+ Position.heading
+ ),
+ pitch: global.DC.Namespace.Cesium.Math.toRadians(Position.pitch),
+ // heading: data.heading,
+ // pitch: data.pitch,
+ roll: Position.roll,
+ },
+ });
+ commit("MSET_MOBILEWINDOWSHIDE", false); // 显示弹窗
+ }
// })
commit("MSET_POPUPDOM", popupsDom);
},
- closeMobileWindowsDom({ state, commit }) {
+ closeMobileWindowsDom({ state, commit, dispatch }) {
if (!state.MobileWindowsHide && state.popupsDom) {
state.popupsDom.closeOur();
commit("MSET_MOBILEWINDOWSHIDE", true);
- }
+ if (state.audioData) {
+ dispatch("MSET_GETAUDIOBEGIN", "notOpen");
+ }
+ } //cancel
},
CHANGETOC3({ state, commit }, data) {
// //转换经纬度坐标 成世界坐标cartesian3
@@ -440,6 +505,8 @@
// console.log(global.DC.Namespace.Cesium.Matrix4.IDENTITY)
},
MSET_DIMENSIONS({ state, commit, dispatch }, val) {
+ //关闭弹窗
+ dispatch("closeMobileWindowsDom");
//3d,2.5d转换事件
commit("MSET_DIMENSION", val);
//控制高度
@@ -481,6 +548,26 @@
},
});
},
+ MSET_GETAUDIO({ state, commit, dispatch }, val) {
+ state.audioData = new window.SpeechSynthesisUtterance();
+ state.audioData.text = val;
+ state.audioData.onstart = function (e) {
+ state.audioState = true;
+ };
+ state.audioData.onend = function (event) {
+ state.audioState = false;
+ };
+ },
+ MSET_GETAUDIOBEGIN({ state, commit, dispatch }, val) {
+ if (state.audioState) {
+ window.speechSynthesis.cancel();
+ state.audioState = false;
+ } else {
+ if (val != "notOpen") {
+ window.speechSynthesis.speak(state.audioData);
+ }
+ }
+ },
},
};
--
Gitblit v1.9.3