| | |
| | | import $store from "../index"; |
| | | import axios from "axios"; |
| | | |
| | | import urlParameter from './mobiles/urlParameter' |
| | | const mobile = { |
| | | state: { |
| | | ...urlParameter.state, //url参数 |
| | | mviewer: null, // 地图实体类 |
| | | mBigPopup: false, // 全屏弹窗 |
| | | popupOurOpenData: [], // 全屏弹窗中下拉菜单数据 |
| | |
| | | seeRight: true, //右侧控制栏显影 |
| | | }, |
| | | mutations: { |
| | | ...urlParameter.mutations, //url参数 |
| | | MSET_VIEWER(state, viewer) { |
| | | state.mviewer = viewer; |
| | | }, |
| | |
| | | // roll: 0, |
| | | }; |
| | | //取消3D底图 |
| | | state.mviewer.imageryLayers.remove(state.vecLayer); |
| | | state.vecLayer = null; |
| | | state.mviewer.imageryLayers.remove(state.cvaLayer); |
| | | state.cvaLayer = null; |
| | | // state.mviewer.imageryLayers.remove(state.vecLayer); |
| | | // state.vecLayer = null; |
| | | // state.mviewer.imageryLayers.remove(state.cvaLayer); |
| | | // state.cvaLayer = null; |
| | | //加载底图 |
| | | 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, |
| | | }) |
| | | ); |
| | | state.tilesetLayer.show = false; //隐藏3d图形 |
| | | state.newLayer = state.usetowpointfive(); //添加2.5d图形贴片 |
| | | state.wallLayer.show = false; //打开瀑布 |
| | |
| | | }, |
| | | }, |
| | | actions: { |
| | | MSET_CREADE({ state, commit, dispatch }) { |
| | | ...urlParameter.actions, //url参数 |
| | | MSET_CREADE({ |
| | | state, |
| | | commit, |
| | | dispatch |
| | | }) { |
| | | state.pointLayer = new global.DC.VectorLayer("pointLayer"); // 创建图标实体类 |
| | | state.mviewer.addLayer(state.pointLayer); // 添加到地图 |
| | | }, |
| | | setMobileWindows({ state, commit, dispatch }, data) { |
| | | setMobileWindows({ |
| | | state, |
| | | commit, |
| | | dispatch |
| | | }, data) { |
| | | // 打开随地图移动窗口 |
| | | let clas, Flys; |
| | | const nowHeight = Math.ceil( |
| | |
| | | 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] - 0.00108 |
| | | : +data.lntLat[1] - 0.00048, |
| | | data.from == "PopupOurOnce" ? |
| | | +data.lntLat[1] - 0.00108 : |
| | | +data.lntLat[1] - 0.00048, |
| | | data.from == "PopupOurOnce" ? 0 : 30.648862227, |
| | | ]; |
| | | } else if (state.dimension == "2.5D") { |
| | |
| | | // }) |
| | | commit("MSET_POPUPDOM", popupsDom); |
| | | }, |
| | | closeMobileWindowsDom({ state, commit, dispatch }) { |
| | | closeMobileWindowsDom({ |
| | | state, |
| | | commit, |
| | | dispatch |
| | | }) { |
| | | commit("CLOSE_NOWPOSITION"); //中断定位获取 |
| | | if (!state.MobileWindowsHide && state.popupsDom) { |
| | | state.popupsDom.closeOur(); |
| | |
| | | } |
| | | } //cancel |
| | | }, |
| | | CHANGETOC3({ state, commit }, data) { |
| | | CHANGETOC3({ |
| | | state, |
| | | commit |
| | | }, data) { |
| | | // //转换经纬度坐标 成世界坐标cartesian3 |
| | | var ellipsoid = state.mviewer.scene.globe.ellipsoid; |
| | | var cartographic = global.DC.Namespace.Cesium.Cartographic.fromDegrees( |
| | |
| | | var position = ellipsoid.cartographicToCartesian(cartographic); |
| | | return position; |
| | | }, |
| | | SET_OPENWIDOWFIXED({ state, commit }, data) { |
| | | SET_OPENWIDOWFIXED({ |
| | | state, |
| | | commit |
| | | }, data) { |
| | | // 传递响应数据 |
| | | commit("MSET_QUERY", data); |
| | | // 显示窗口 |
| | |
| | | ) |
| | | ); |
| | | }, |
| | | CLOSE_WIDOWFIXED({ state, commit }) { |
| | | CLOSE_WIDOWFIXED({ |
| | | state, |
| | | commit |
| | | }) { |
| | | // 隐藏窗口 |
| | | if (!state.MobileWindowsHideFixed) { |
| | | console.log(state.MobileWindowsHideFixed); |
| | |
| | | } |
| | | }, |
| | | // 加入当时的选点 |
| | | JOIN_POINT({ state, commit }, data) {}, |
| | | JOIN_POINT({ |
| | | state, |
| | | commit |
| | | }, data) {}, |
| | | // flyTo |
| | | mapFlyTo({ state, commit, dispatch }, data) { |
| | | mapFlyTo({ |
| | | state, |
| | | commit, |
| | | dispatch |
| | | }, data) { |
| | | state.mviewer.camera.flyTo({ |
| | | destination: global.DC.Namespace.Cesium.Cartesian3.fromDegrees( |
| | | data.lntLat[0] - 0.012, |
| | |
| | | // pitch: data.pitch, |
| | | roll: data.roll, |
| | | }, |
| | | duration: 1.5, // 定位的时间间隔 |
| | | duration: 1, // 定位的时间间隔 |
| | | complete: () => { |
| | | // 完成后的回调 |
| | | if (data.fn) { |
| | |
| | | // }); |
| | | }, |
| | | // 飞入点加入位置 |
| | | MSET_POINTDATA({ state, commit, dispatch }, data) { |
| | | MSET_POINTDATA({ |
| | | state, |
| | | commit, |
| | | dispatch |
| | | }, data) { |
| | | // 加入坐标 |
| | | const positions = new global.DC.Position( |
| | | data[0] - 0.0119, |
| | |
| | | billboard.on(DC.MouseEventType.CLICK, (e) => { |
| | | // 定制化窗体 |
| | | console.log(e); |
| | | const query = { name: "选择点" }; |
| | | const query = { |
| | | name: "选择点" |
| | | }; |
| | | const intLat = [e.wgs84Position.lng, e.wgs84Position.lat]; |
| | | const d = { |
| | | position: null, |
| | | lntLat: intLat, |
| | | query: { ...(query || {}), introduce: null, address: intLat }, |
| | | query: { |
| | | ...(query || {}), |
| | | introduce: null, |
| | | address: intLat |
| | | }, |
| | | useJWD: true, // 仅使用经纬度 |
| | | }; |
| | | dispatch("setMobileWindows", d); |
| | |
| | | state.pointLayer.addOverlay(billboard); // 实景 |
| | | // commit("MSET_OPENPOINTEL", true); |
| | | }, |
| | | MSET_LOCKPERSPECTIVEL({ state, commit, dispatch }, val) { |
| | | MSET_LOCKPERSPECTIVEL({ |
| | | state, |
| | | commit, |
| | | dispatch |
| | | }, val) { |
| | | // 锁定 |
| | | state.mviewer.camera.lookAtTransform( |
| | | global.DC.Namespace.Cesium.Matrix4.IDENTITY |
| | | ); |
| | | // console.log(global.DC.Namespace.Cesium.Matrix4.IDENTITY) |
| | | }, |
| | | MSET_DIMENSIONS({ state, commit, dispatch }, val) { |
| | | MSET_DIMENSIONS({ |
| | | state, |
| | | commit, |
| | | dispatch |
| | | }, val) { |
| | | //关闭弹窗 |
| | | dispatch("closeMobileWindowsDom"); |
| | | //3d,2.5d转换事件 |
| | |
| | | }, |
| | | }); |
| | | }, |
| | | MSET_GOTOCC({ state, commit, dispatch }, val) { |
| | | MSET_GOTOCC({ |
| | | state, |
| | | commit, |
| | | dispatch |
| | | }, val) { |
| | | //测试移动位置 |
| | | // commit("MSET_DIMENSION", val); |
| | | //控制高度 |
| | |
| | | }); |
| | | }, |
| | | //文字转语音控制↓ |
| | | MSET_GETAUDIO({ state, commit, dispatch }, val) { |
| | | MSET_GETAUDIO({ |
| | | state, |
| | | commit, |
| | | dispatch |
| | | }, val) { |
| | | state.audioData = new window.SpeechSynthesisUtterance(); |
| | | state.audioData.text = val; |
| | | state.audioData.onstart = function (e) { |
| | |
| | | state.audioState = false; |
| | | }; |
| | | }, |
| | | MSET_GETAUDIOBEGIN({ state, commit, dispatch }, val) { |
| | | MSET_GETAUDIOBEGIN({ |
| | | state, |
| | | commit, |
| | | dispatch |
| | | }, val) { |
| | | if (state.audioState) { |
| | | window.speechSynthesis.cancel(); |
| | | state.audioState = false; |
| | |
| | | }, |
| | | //文字转语音控制↑ |
| | | //导航系统↓ |
| | | MSET_GOTOWHERE({ state, commit, dispatch }, val) { |
| | | MSET_GOTOWHERE({ |
| | | state, |
| | | commit, |
| | | dispatch |
| | | }, val) { |
| | | state.routerS = []; //清空存着的路径 |
| | | //单条步行 |
| | | //本地图使用的是WGS84坐标,而高德使用的是火星坐标GCJ02,所以需要转换参数过去 |
| | |
| | | // data["strategy"] = strategyType[index]; |
| | | axios |
| | | .get(url, { |
| | | params: { ...data }, |
| | | params: { |
| | | ...data |
| | | }, |
| | | }) |
| | | .then((res) => { |
| | | //回调 |
| | |
| | | }, |
| | | //导航系统↑ |
| | | //绘画线路 |
| | | MSET_DRAWALINELAYER({ state, commit, dispatch }, value) { |
| | | MSET_DRAWALINELAYER({ |
| | | state, |
| | | commit, |
| | | dispatch |
| | | }, value) { |
| | | let Str = value[0]; |
| | | //检查是否存在路线 |
| | | commit("removePolyline"); |
| | |
| | | "img/dingwei/dingwei1.png" |
| | | ); //加入绘画点 |
| | | billboard.setStyle({ |
| | | pixelOffset: { x: 0, y: -17 }, //偏移像素 |
| | | pixelOffset: { |
| | | x: 0, |
| | | y: -17 |
| | | }, //偏移像素 |
| | | }); |
| | | //订阅事件 |
| | | billboard.on(global.DC.MouseEventType.CLICK, (e) => { |
| | |
| | | // commit("cameraSetView", state.navigationStartLngLat); //移动 |
| | | }, |
| | | //绘画线路活动多条 |
| | | MSET_DRAWALINELAYERMANY({ state, commit, dispatch }, value) { |
| | | MSET_DRAWALINELAYERMANY({ |
| | | state, |
| | | commit, |
| | | dispatch |
| | | }, value) { |
| | | //检查是否存在路线 |
| | | commit("removePolylineMany"); |
| | | commit("removePolyline"); |
| | |
| | | color: red, |
| | | speed: 60, |
| | | image: "img/icon/right.png", |
| | | repeat: { x: 320, y: 1 }, |
| | | repeat: { |
| | | x: 320, |
| | | y: 1 |
| | | }, |
| | | }); |
| | | let drawALineLayerMany = new global.DC.VectorLayer("manyLinePointLayer"); |
| | | state.mviewer.addLayer(drawALineLayerMany); |
| | |
| | | let windowData = { |
| | | position, |
| | | lntLat, |
| | | query: { ...(value[2] || {}), position, lntLat }, |
| | | query: { |
| | | ...(value[2] || {}), |
| | | position, |
| | | lntLat |
| | | }, |
| | | useJWD: true, //仅使用经纬度 |
| | | }; |
| | | dispatch("setMobileWindows", windowData); |
| | |
| | | }, |
| | | }; |
| | | |
| | | export default mobile; |
| | | export default mobile; |