.
shuishen
2022-03-31 3ffc6c12a3fa1deba2e4e9c85c158f19d309f258
src/store/modules/mobile.js
@@ -2,49 +2,48 @@
import axios from 'axios'
import urlParameter from './mobiles/urlParameter'
window.popupsDom = null; // mobileDivForms的实体类
window.flytoPosition = null; // mobileDivForms的实体类
window.ellipsoid = null;
window.cartographic = null;
window.popupsDom = null // mobileDivForms的实体类
window.flytoPosition = null // mobileDivForms的实体类
window.ellipsoid = null
window.cartographic = null
window.useHeight = null;
window.vecLayer = null;
window.vecLayer = null;
window.pointLayer = null;
window.drawALineLayerMany = null; //活动线
window.drawALineLayerManycolor = null; //活动线颜色
window.drawALineLayerManyStyle = null; //活动线样式
window.drawALineLayerManypolyline = null; //活动线样式
window.drawAPointLayerMany = null; //活动点
window.drawAPointLayerManyposition = null; //活动点位置
window.drawAPointLayerManyLabels = null; //活动点
window.useHeight = null
window.vecLayer = null
window.vecLayer = null
window.pointLayer = null
window.drawALineLayerMany = null // 活动线
window.drawALineLayerManycolor = null // 活动线颜色
window.drawALineLayerManyStyle = null // 活动线样式
window.drawALineLayerManypolyline = null // 活动线样式
window.drawAPointLayerMany = null // 活动点
window.drawAPointLayerManyposition = null // 活动点位置
window.drawAPointLayerManyLabels = null // 活动点
// window.tilesetLayer = null;
// window.wallLayer = null;
window.areaLayer = null;
window.tileset = null;
window.drawALineLayer = null; // 导航路径图层
window.drawALineLayerGCJ02StartLngLat = null; // 导航路径图层转坐标
window.drawALineLayerGCJ02EndLngLat = null; // 导航路径图层转坐标
window.drawALineLayerdrawALine = null; // 导航路径画线方法
window.drawALineLayerIcon = null; // 导航路径图层图标
window.billboarddaohang = null; // 导航点
window.positiondaohang = null; // 导航点位置
window.polylinedaohang = null; // 导航线
window.polylinematerialdaohang = null; // 导航线属性
window.areaLayer = null
window.tileset = null
window.drawALineLayer = null // 导航路径图层
window.drawALineLayerGCJ02StartLngLat = null // 导航路径图层转坐标
window.drawALineLayerGCJ02EndLngLat = null // 导航路径图层转坐标
window.drawALineLayerdrawALine = null // 导航路径画线方法
window.drawALineLayerIcon = null // 导航路径图层图标
window.billboarddaohang = null // 导航点
window.positiondaohang = null // 导航点位置
window.polylinedaohang = null // 导航线
window.polylinematerialdaohang = null // 导航线属性
window.select = {
    // 绿色图层控制显示
    overlay: undefined,
    color: undefined
};
}
window.tancuanPosition = null;
window.tancuanPosition = null
// window.newLayer = null;
// window.usetowpointfive = null;
window.startPointFn = null;
window.startPointFn = null
const mobile = {
    state: {
        ...urlParameter.state, // url参数
@@ -130,45 +129,45 @@
        // MSET_VIEWER (state, viewer) {
        //     global.viewer = viewer
        // },
        MSET_BIGPOPUP(state, viewer) {
        MSET_BIGPOPUP (state, viewer) {
            state.mBigPopup = viewer
            $store.dispatch('closeMobileWindowsDom') // 关闭弹窗
        },
        MSET_BIGPOPUPAFTER(state, viewer) {
        MSET_BIGPOPUPAFTER (state, viewer) {
            state.mBigPopupAfter = viewer
            $store.dispatch('closeMobileWindowsDom') // 关闭弹窗
        },
        MSET_POPUPOUROPENDATA(state, viewer) {
        MSET_POPUPOUROPENDATA (state, viewer) {
            state.popupOurOpenData = viewer
        },
        MSET_ICONHIDE(state, viewer) {
        MSET_ICONHIDE (state, viewer) {
            state.iconHide = viewer
        },
        MSET_POPUPTABLENAME(state, viewer) {
        MSET_POPUPTABLENAME (state, viewer) {
            state.popupTableName = viewer
        },
        MSET_MOBILEWINDOWSHIDE(state, viewer) {
        MSET_MOBILEWINDOWSHIDE (state, viewer) {
            // 随地图移动窗口
            state.MobileWindowChangeData = !state.MobileWindowChangeData
            state.MobileWindowsHide = viewer
        },
        MSETCC_SETCC(state, viewer) {
        MSETCC_SETCC (state, viewer) {
            state.ccDataState = !state.ccDataState // 专门测试
            state.query = viewer
        },
        // MSET_POPUPDOM(state, viewer) {
        //     window.popupsDom = viewer
        // },
        MSET_QUERY(state, viewer) {
        MSET_QUERY (state, viewer) {
            state.query = viewer
        },
        MSET_OPENMOBILEGOTO(state, viewer) {
        MSET_OPENMOBILEGOTO (state, viewer) {
            state.openmobileGoTo = viewer
        },
        MSET_OPENMOBILEPANORAMA(state, viewer) {
        MSET_OPENMOBILEPANORAMA (state, viewer) {
            state.openmobilePanorama = viewer
        },
        MSET_MOBILEWINDOWSHIDEFIXED(state, viewer) {
        MSET_MOBILEWINDOWSHIDEFIXED (state, viewer) {
            // 固定窗口
            state.MobileWindowChangeDataFixed = !state.MobileWindowChangeDataFixed
            state.MobileWindowsHideFixed = viewer
@@ -188,15 +187,15 @@
        //     }
        // },
        // 送入移动端缩放范围
        set_zoomRange(state, data) {
        set_zoomRange (state, data) {
            state.zoomRange = data
        },
        // 送入默认弹窗高度
        set_frislayertHeight(state, data) {
        set_frislayertHeight (state, data) {
            state.frislayertHeight = data
        },
        // 切换2D和2.5D
        MSET_DIMENSION(state, data) {
        MSET_DIMENSION (state, data) {
            // 关闭弹窗
            // 3d,2.5d转换事件
            state.dimension = data
@@ -295,45 +294,57 @@
                        maximumLevel: 18
                    })
                )
                global.viewer.imageryLayers.addImageryProvider(
                    new global.DC.Namespace.Cesium.WebMapTileServiceImageryProvider({
                        url: "http://arcgis.jxpskj.com:6080/arcgis/rest/services/FZ25DMap/MapServer/WMTS",
                        layer: "fzsw2019",
                        style: "default",
                        tileMatrixSetID: "default028mm",
                        format: "image/jpgpng",
                        tilingScheme: new global.DC.Namespace.Cesium.GeographicTilingScheme(),
                        maximumLevel: 19,
                        tileMatrixLabels: [
                            "0",
                            "1",
                            "2",
                            "3",
                            "4",
                            "5",
                            "6",
                            "7",
                            "8",
                            "9",
                            "10",
                            "11",
                            "12",
                            "13",
                            "14",
                            "15",
                            "16",
                            "17",
                            "18",
                            "19",
                        ],
                    })
                );
                window.tilesetLayer.show = false // 隐藏3d图形
                window.newLayer = window.usetowpointfive() // 添加2.5d图形贴片
                window.wallLayer.show = false // 打开瀑布
                window.startPointFn() // 移动默认视角
                window.areaLayer.show = true // 绿布
                // if (state.zoomRange[3]) {
                //     global.viewer.imageryLayers.addImageryProvider(new global.DC.Namespace.Cesium.UrlTemplateImageryProvider({
                //         url: '/fz/{z}/{x}/{y}.png',
                //         fileExtension: 'png'
                //         // minimumLevel: 19
                //     }))
                //     // global.viewer.imageryLayers.addImageryProvider(
                //     //     new global.DC.Namespace.Cesium.WebMapTileServiceImageryProvider({
                //     //         url: "http://arcgis.jxpskj.com:6080/arcgis/rest/services/FZ25DMap/MapServer/WMTS",
                //     //         layer: "fzsw2019",
                //     //         style: "default",
                //     //         tileMatrixSetID: "default028mm",
                //     //         format: "image/jpgpng",
                //     //         tilingScheme: new global.DC.Namespace.Cesium.GeographicTilingScheme(),
                //     //         maximumLevel: 19,
                //     //         tileMatrixLabels: [
                //     //             "0",
                //     //             "1",
                //     //             "2",
                //     //             "3",
                //     //             "4",
                //     //             "5",
                //     //             "6",
                //     //             "7",
                //     //             "8",
                //     //             "9",
                //     //             "10",
                //     //             "11",
                //     //             "12",
                //     //             "13",
                //     //             "14",
                //     //             "15",
                //     //             "16",
                //     //             "17",
                //     //             "18",
                //     //             "19",
                //     //         ],
                //     //     })
                //     // );
                //     // 2.5D视角限制
                //     // global.viewer.scene.screenSpaceCameraController.minimumZoomDistance = 50
                //     // // 最大
                //     // global.viewer.scene.screenSpaceCameraController.maximumZoomDistance = 9999999999
                // } else {
                // }
                // 2.5D视角限制
                global.viewer.scene.screenSpaceCameraController.minimumZoomDistance = state.zoomRange[0]
                // 最大
@@ -351,11 +362,11 @@
            }
        },
        // 绿布
        MSET_areaLayer(state, data) {
            window.areaLayer = data;
        MSET_areaLayer (state, data) {
            window.areaLayer = data
        },
        // 切换控制
        MSET_PERSPECTIVECONTROL(state, data) {
        MSET_PERSPECTIVECONTROL (state, data) {
            state.perspectiveControl = data
            state.perspectiveControls = !state.perspectiveControls
        },
@@ -367,10 +378,11 @@
        //     window.usetowpointfive = data.usetowpointfive
        // },
        // 直接移动
        cameraSetView(state, data) {
        cameraSetView (state, data) {
            global.viewer.camera.setView({
                // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
                // fromDegrees()方法,将经纬度和高程转换为世界坐标
                // eslint-disable-next-line new-cap
                destination: new global.DC.Namespace.Cesium.Cartesian3.fromDegrees(
                    // 114.0351,
                    // 27.6314,
@@ -393,46 +405,46 @@
            })
        },
        // 删除路线
        removePolyline(state) {
        removePolyline (state) {
            if (window.drawALineLayer) {
                window.drawALineLayer.remove()
                window.drawALineLayer = null
                state.isOpenDrawALine = false
            }
        },
        removerPolyLineIcon(state) {
        removerPolyLineIcon (state) {
            if (window.drawALineLayerIcon) {
                window.drawALineLayerIcon.remove()
                window.drawALineLayerIcon = null
            }
        },
        removePolylineMany(state) {
        removePolylineMany (state) {
            if (window.drawALineLayerMany) {
                window.drawALineLayerMany.remove()
                window.drawALineLayerMany = null
                state.isOpenDrawALineMany = false
            }
            if (window.drawALineLayerMany) {
                window.drawALineLayerMany.remove()
                window.drawALineLayerMany = null
            if (window.drawAPointLayerMany) {
                window.drawAPointLayerMany.remove()
                window.drawAPointLayerMany = null
                state.isOpenDrawALineMany = false
            }
        },
        // 显影线路或者点
        showLineOrPoint(state, val) {
        showLineOrPoint (state, val) {
            window[val.layer].show = val.flag
        },
        // 传送终点数据
        set_endPosition(state, data) {
        set_endPosition (state, data) {
            state.isendPosition = !state.isendPosition
            state.endPosition = data
        },
        // 传送当前选择的路径
        set_choiceRouterS(state, data) {
        set_choiceRouterS (state, data) {
            state.choiceRouterS = data
        },
        // 活动窗口是否显示
        set_showActivity(state, data) {
        set_showActivity (state, data) {
            state.showActivity = data
            if (data.state) {
                state.showActivityData = data.value
@@ -442,17 +454,17 @@
                state.showActivity = data.state
            }
        },
        mset_changeSelect(state, data) {
        mset_changeSelect (state, data) {
            window.select.overlay = data[0]
            window.select.color = data[1]
        },
        SET_SeeAndNotSee(state, data) {
        SET_SeeAndNotSee (state, data) {
            state.seeRight = data
        }
    },
    actions: {
        ...urlParameter.actions, // url参数
        MSET_CREADE({
        MSET_CREADE ({
            state,
            commit,
            dispatch
@@ -460,7 +472,7 @@
            window.pointLayer = new global.DC.VectorLayer('pointLayer') // 创建图标实体类
            global.viewer.addLayer(window.pointLayer) // 添加到地图
        },
        setMobileWindows({
        setMobileWindows ({
            state,
            commit,
            dispatch
@@ -473,6 +485,7 @@
            // 传递响应数据
            commit('MSET_QUERY', data)
            // console.log(data);
            // 配置移动和弹窗的偏移   flys是飞行的偏移  clas是弹窗的偏移
            if (state.dimension == '3D') {
                Flys = [
                    +data.lntLat[0] + 0.01197,
@@ -483,9 +496,9 @@
                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') {
@@ -505,7 +518,8 @@
                    data.from == 'PopupOurOnce' ? 0 : 0
                ]
            }
            window.tancuanPosition = data.position;
            window.tancuanPosition = data.position
            // useJWD开启状态  window.tancuanPosition就是根据经纬度来计算出来的 如果有原有的 data.position 把值变为false
            if (data.useJWD) {
                window.ellipsoid = global.viewer.scene.globe.ellipsoid
                window.cartographic = global.DC.Namespace.Cesium.Cartographic.fromDegrees(
@@ -519,6 +533,7 @@
            }
            // 定制化窗体
            // eslint-disable-next-line new-cap
            window.popupsDom = new global.DC.mobileDivForms(global.viewer, {
                domId: 'mobilePopup',
                title: data.query.name || '成教楼  ',
@@ -618,7 +633,7 @@
            // })
            // commit('MSET_POPUPDOM', popupsDom)
        },
        closeMobileWindowsDom({
        closeMobileWindowsDom ({
            state,
            commit,
            dispatch
@@ -646,7 +661,7 @@
        //     var position = ellipsoid.cartographicToCartesian(cartographic)
        //     return position
        // },
        SET_OPENWIDOWFIXED({
        SET_OPENWIDOWFIXED ({
            state,
            commit
        }, data) {
@@ -665,7 +680,7 @@
                )
            )
        },
        CLOSE_WIDOWFIXED({
        CLOSE_WIDOWFIXED ({
            state,
            commit
        }) {
@@ -675,12 +690,12 @@
            }
        },
        // 加入当时的选点
        JOIN_POINT({
        JOIN_POINT ({
            state,
            commit
        }, data) {},
        }, data) { },
        // flyTo
        mapFlyTo({
        mapFlyTo ({
            state,
            commit,
            dispatch
@@ -786,7 +801,7 @@
        //     window.pointLayer.addOverlay(billboard) // 实景
        //     // commit("MSET_OPENPOINTEL", true);
        // },
        MSET_LOCKPERSPECTIVEL({
        MSET_LOCKPERSPECTIVEL ({
            state,
            commit,
            dispatch
@@ -797,7 +812,7 @@
            )
            // console.log(global.DC.Namespace.Cesium.Matrix4.IDENTITY)
        },
        MSET_DIMENSIONS({
        MSET_DIMENSIONS ({
            state,
            commit,
            dispatch
@@ -827,7 +842,7 @@
                }
            })
        },
        MSET_GOTOCC({
        MSET_GOTOCC ({
            state,
            commit,
            dispatch
@@ -850,7 +865,7 @@
            })
        },
        // 文字转语音控制↓
        MSET_GETAUDIO({
        MSET_GETAUDIO ({
            state,
            commit,
            dispatch
@@ -864,7 +879,7 @@
                state.audioState = false
            }
        },
        MSET_GETAUDIOBEGIN({
        MSET_GETAUDIOBEGIN ({
            state,
            commit,
            dispatch
@@ -880,7 +895,7 @@
        },
        // 文字转语音控制↑
        // 导航系统↓
        MSET_GOTOWHERE({
        MSET_GOTOWHERE ({
            state,
            commit,
            dispatch
@@ -939,6 +954,7 @@
                    // window.drawALineLayerdrawALine (paths, res.data.route.paths[0].strategy);
                })
            // }
            // 包装绘画工具
            window.drawALineLayerdrawALine = (pathsour) => {
                const paths = pathsour.steps
                const titles = pathsour.strategy
@@ -980,7 +996,7 @@
        },
        // 导航系统↑
        // 绘画线路
        MSET_DRAWALINELAYER({
        MSET_DRAWALINELAYER ({
            state,
            commit,
            dispatch
@@ -989,19 +1005,7 @@
            // 检查是否存在路线
            commit('removePolyline')
            commit('removePolylineMany')
            const color =
                global.DC.Namespace.Cesium.Color.fromCssColorString('#409EFF')
            window.polylinematerialdaohang = new global.DC.PolylineTrailMaterialProperty({
                // color: color,
                // speed: 10
                color: global.DC.Namespace.Cesium.Color.fromBytes(10, 255, 10),
                speed: 60,
                image: '/img/icon/right.png',
                repeat: {
                    x: 320,
                    y: 1
                }
            })
            window.drawALineLayer = new global.DC.VectorLayer('lineLayer')
            global.viewer.addLayer(window.drawALineLayer)
@@ -1057,7 +1061,7 @@
            // commit("cameraSetView", state.navigationStartLngLat); //移动
        },
        // 绘画线路活动多条
        MSET_DRAWALINELAYERMANY({
        MSET_DRAWALINELAYERMANY ({
            state,
            commit,
            dispatch
@@ -1210,4 +1214,4 @@
    }
}
export default mobile
export default mobile