From 9e43f80d96bda7f1108dcfcfd7340e567f2e48d0 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Thu, 23 Dec 2021 13:57:03 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/school-web
---
src/store/modules/mobile.js | 168 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 159 insertions(+), 9 deletions(-)
diff --git a/src/store/modules/mobile.js b/src/store/modules/mobile.js
index 3cca045..dd9a9c0 100644
--- a/src/store/modules/mobile.js
+++ b/src/store/modules/mobile.js
@@ -14,9 +14,20 @@
popupsDom: '',//mobileDivForms的实体类
query: {},//传输数据
openmobileGoTo: false,//测试
+ ccDataState: false,//测试
openmobilePanorama: false,//实景显影
MobileWindowsHideFixed: true,//改变点击窗口的显示状态--固定窗口
MobileWindowChangeDataFixed: false,//改变点击窗口的数据--固定窗口
+ //在每次飞行弹窗中 加入自己的点
+ pointLayer: null,
+ pointLayerData: {
+ flag: false,
+ label: "选择点",
+ img: "/img/leftnav/way.png",
+ normal: "/img/leftnav/way.png",
+ checked: "/img/leftnav/way-checked.png",
+ layer: "pointLayer",
+ },
},
mutations: {
MSET_VIEWER(state, viewer) {
@@ -43,6 +54,10 @@
state.MobileWindowChangeData = !state.MobileWindowChangeData;
state.MobileWindowsHide = viewer
},
+ MSETCC_SETCC(state, viewer) {
+ state.ccDataState = !state.ccDataState;//专门测试
+ state.query = viewer;
+ },
MSET_POPUPDOM(state, viewer) {
state.popupsDom = viewer
},
@@ -60,15 +75,35 @@
state.MobileWindowsHideFixed = viewer
console.log(state.MobileWindowChangeDataFixed);
},
+ //开关飞入点图标
+ MSET_OPENPOINTEL(state, val) {
+ if (val) {
+ state.pointLayerData.img = state.pointLayerData.checked;
+ state[state.pointLayerData.layer].show = true;
+ } else {
+ state.pointLayerData.img = state.pointLayerData.normal;
+ state[state.pointLayerData.layer].show = false;
+ }
+ }
},
actions: {
- setMobileWindows({ state, commit, }, data) {//打开随地图移动窗口,暂不使用
+ MSET_CREADE({ state, commit, dispatch }) {
+ state.pointLayer = new global.DC.VectorLayer("pointLayer");//创建图标实体类
+ state.mviewer.addLayer(state.pointLayer);//添加到地图
+ },
+ setMobileWindows({ state, commit, dispatch }, data) {//打开随地图移动窗口
+ // 关闭前一个弹窗?
+ dispatch("closeMobileWindowsDom");
+ let clnt = data.from == "PopupOurOnce" ? +data.lntLat[0] : +data.lntLat[0],
+ clat = data.from == "PopupOurOnce" ? +data.lntLat[1] - 0.00008 : +data.lntLat[1] - 0.00048,
+ calt = data.from == "PopupOurOnce" ? 0 : 90.648862227;
if (data.useJWD) {
var ellipsoid = state.mviewer.scene.globe.ellipsoid;
var cartographic = global.DC.Namespace.Cesium.Cartographic.fromDegrees(
- data.lntLat[0],
- data.lntLat[1] - 0.00006,
- "90.648862227"
+ // data.lntLat[0],
+ // data.lntLat[1] - 0.00048,//数值增大是下
+ // "90.648862227"
+ clnt, clat, calt
);
data.position = ellipsoid.cartographicToCartesian(cartographic);
}
@@ -82,10 +117,43 @@
content: document.getElementById("mobile-map_content_content"),
position: [data.position],
});
- commit("MSET_MOBILEWINDOWSHIDE", false)
- state.mviewer.zoomToPosition(
- new global.DC.Position(data.lntLat[0], data.lntLat[1] - 0.012, 1530, 0, -45)
+ // commit("MSET_MOBILEWINDOWSHIDE", false)//显示弹窗
+ // dispatch("CHANGETOC3", { // 转换坐标
+ // lnt: data.lntLat[0],
+ // lat: data.lntLat[1]
+ // }).then(res => {
+ // console.log(res)
+
+ //基于高度基础设置
+ // h:1530
+ // lnt: + 0.01187 x轴 大是向左
+ // Lat: - 0.0108 y轴 减是上
+ // h:4000
+ // lnt: + 0.01187 x轴
+ // Lat: - 0.0308 y轴
+ // h:330
+ // lnt: + 0.01197 x轴
+ // Lat: - 0.0021 y轴
+ let Flys = [
+ data.from == "PopupOurOnce" ? +data.lntLat[0] + 0.01197 : +data.lntLat[0] + 0.01197,
+ data.from == "PopupOurOnce" ? +data.lntLat[1] - 0.0021 : +data.lntLat[1] - 0.0021,
+ data.from == "PopupOurOnce" ? 330 : 330,
+ ]
+ let Position = new global.DC.Position(//转坐标
+ // +data.lntLat[0] + 0.01197,
+ // +data.lntLat[1] - 0.0021,
+ // 330,
+ ...Flys,
+ 0,
+ -45
);
+ dispatch("mapFlyTo", {//飞入
+ lntLat: [Position.lng, Position.lat, Position.alt],
+ heading: Position.heading,
+ pitch: Position.pitch,
+ roll: Position.roll,
+ })
+ // })
commit("MSET_POPUPDOM", popupsDom)
},
closeMobileWindowsDom({ state, commit }) {
@@ -98,7 +166,7 @@
var ellipsoid = state.mviewer.scene.globe.ellipsoid;
var cartographic = global.DC.Namespace.Cesium.Cartographic.fromDegrees(
data.lnt,
- data.lat - 0.0004,
+ data.lat - 0.00006,
data.alt || "90.648862227"
);
var position = ellipsoid.cartographicToCartesian(cartographic);
@@ -124,7 +192,89 @@
//加入当时的选点
JOIN_POINT({ state, commit }, data) {
- }
+ },
+ //flyTo
+ mapFlyTo({ state, commit, dispatch }, data) {
+ state.mviewer.camera.flyTo({
+ destination: global.DC.Namespace.Cesium.Cartesian3.fromDegrees(
+ data.lntLat[0] - 0.012, data.lntLat[1],
+ data.lntLat[2] || 15000.0
+ ),
+ // destination: data.res,
+ orientation: {
+ heading: global.DC.Namespace.Cesium.Math.toRadians(data.heading),
+ pitch: global.DC.Namespace.Cesium.Math.toRadians(data.pitch),
+ // heading: data.heading,
+ // pitch: data.pitch,
+ roll: data.roll
+ },
+ duration: 1.6, //定位的时间间隔
+ complete: () => {//完成后的回调
+ if (!data.noOpen) {
+ setTimeout(() => {
+ // dispatch("MSET_POINTDATA", data.lntLat);//传入标记点
+ !state.MobileWindowsHide ||
+ commit("MSET_MOBILEWINDOWSHIDE", false)//显示弹窗
+ }, 0);
+ }
+ }
+ });
+ //官网flyto使用方法
+ // 1. Fly to a position with a top-down view
+ // viewer.camera.flyTo({
+ // destination : Cesium.Cartesian3.fromDegrees(-117.16, 32.71, 15000.0)
+ // });
+
+ // // 2. Fly to a Rectangle with a top-down view
+ // viewer.camera.flyTo({
+ // destination : Cesium.Rectangle.fromDegrees(west, south, east, north)
+ // });
+
+ // // 3. Fly to a position with an orientation using unit vectors.
+ // viewer.camera.flyTo({
+ // destination : Cesium.Cartesian3.fromDegrees(-122.19, 46.25, 5000.0),
+ // orientation : {
+ // direction : new Cesium.Cartesian3(-0.04231243104240401, -0.20123236049443421, -0.97862924300734),
+ // up : new Cesium.Cartesian3(-0.47934589305293746, -0.8553216253114552, 0.1966022179118339)
+ // }
+ // });
+
+ // // 4. Fly to a position with an orientation using heading, pitch and roll.
+ // viewer.camera.flyTo({
+ // destination : Cesium.Cartesian3.fromDegrees(-122.19, 46.25, 5000.0),
+ // orientation : {
+ // heading : Cesium.Math.toRadians(175.0),
+ // pitch : Cesium.Math.toRadians(-35.0),
+ // roll : 0.0
+ // }
+ // });
+ },
+ // 飞入点加入位置
+ MSET_POINTDATA({ state, commit, dispatch }, data) {
+ //加入坐标
+ const positions = new global.DC.Position(data[0] - 0.0119, data[1] + 0.0111, 0);
+ const billboard = new global.DC.Billboard(
+ positions,
+ "/img/leftnav/map-panorama.png"
+ );
+ billboard.size = [16, 16];
+ //订阅事件3
+ billboard.on(DC.MouseEventType.CLICK, (e) => {
+ // 定制化窗体
+ console.log(e)
+ let query = { name: "选择点" },
+ intLat = [e.wgs84Position.lng, e.wgs84Position.lat];
+ let d = {
+ position: null,
+ lntLat: intLat,
+ query: { ...(query || {}), introduce: null, address: intLat },
+ useJWD: true, //仅使用经纬度
+ };
+ dispatch("setMobileWindows", d);
+ });
+ state.pointLayer.addOverlay(billboard); //实景
+ // commit("MSET_OPENPOINTEL", true);
+ },
}
}
--
Gitblit v1.9.3