guanqb
2023-03-30 9ee5bafa0d00816fad6793a470f1b570c99cce1b
Merge branch 'master' of http://s16s652780.51mypc.cn:49896/r/srs-police-affairs
7 files modified
2 files added
163 ■■■■■ changed files
public/img/draw/blue.png patch | view | raw | blame | history
public/img/draw/red.png patch | view | raw | blame | history
src/components/map/index.vue 46 ●●●●● patch | view | raw | blame | history
src/permission.js 3 ●●●● patch | view | raw | blame | history
src/styles/base/index.scss 8 ●●●● patch | view | raw | blame | history
src/utils/tools/EditTool.js 2 ●●● patch | view | raw | blame | history
src/views/activity/components/drawBtnBox.vue 89 ●●●● patch | view | raw | blame | history
src/views/activity/components/twoDrawBtnBox.vue 9 ●●●●● patch | view | raw | blame | history
vue.config.js 6 ●●●● patch | view | raw | blame | history
public/img/draw/blue.png
public/img/draw/red.png
src/components/map/index.vue
@@ -2,7 +2,7 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2022-08-18 17:00:30
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2023-03-30 15:46:06
 * @LastEditTime: 2023-03-30 16:23:23
 * @FilePath: \srs-police-affairs\src\components\map\index.vue
 * @Description: 公用地图组件
 * 
@@ -326,21 +326,20 @@
            // global.viewer.addTerrain(terrain)
            // 内网
            // that.switchImg()
            that.switchImg()
            // that.highOrLightChange('light')
            // 外网
            // global.viewer.imageryLayers.addImageryProvider(
            //     new global.DC.Namespace.Cesium.UrlTemplateImageryProvider({
            //         url: 'http://t{s}.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=e45274b0235bb913eceb393aabbf9c9c',
            //         subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
            //         format: 'image/jpeg',
            //         show: true,
            //         maximumLevel: 18
            //     })
            // )
            global.viewer.imageryLayers.addImageryProvider(
                new global.DC.Namespace.Cesium.UrlTemplateImageryProvider({
                    url: 'http://t{s}.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=e45274b0235bb913eceb393aabbf9c9c',
                    subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
                    format: 'image/jpeg',
                    show: true,
                    maximumLevel: 18
                })
            )
            // 设置地图初始位置,角度等
            global.viewer.camera.setView({
@@ -370,8 +369,6 @@
            })
            // 原生Cesium加载多边体
            // let floorPositions = positions.reduce((prev, curr, index, arr) => {
            //     curr.forEach(item => {
            //         prev.push(item)
@@ -578,12 +575,31 @@
    },
    methods: {
        // 获取当前地图中心的经纬度
        getSceneCenterPosition (viewer) {
            let centerResult = viewer.camera.pickEllipsoid(
                new global.DC.Namespace.Cesium.Cartesian2(
                    viewer.canvas.clientWidth / 2,
                    viewer.canvas.clientHeight / 2,
                ),
            )
            let curPosition = global.DC.Namespace.Cesium.Ellipsoid.WGS84.cartesianToCartographic(centerResult)
            let curLongitude = (curPosition.longitude * 180) / Math.PI
            let curLatitude = (curPosition.latitude * 180) / Math.PI
            return {
                lon: curLongitude,
                lat: curLatitude,
            }
        },
        overLookClick () {
            const position = this.getSceneCenterPosition(global.viewer)
            global.viewer.camera.setView({
                // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
                // fromDegrees()方法,将经纬度和高程转换为世界坐标
                destination: global.DC.Namespace.Cesium.Cartesian3.fromDegrees(
                    118.04, 28.46938164123123, 60000
                    position.lon, position.lat, global.viewer.camera.positionCartographic.height * 1.5
                ),
                orientation: {
                    // 指向
src/permission.js
@@ -2,7 +2,7 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2022-08-18 16:16:10
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2023-03-24 17:16:46
 * @LastEditTime: 2023-03-30 16:30:30
 * @FilePath: \srs-police-affairs\src\permission.js
 * @Description: 路由守卫
 * 
@@ -19,7 +19,6 @@
        delete window._axiosPromiseArr[index]
        console.clear()
    })
    const meta = to.meta || {}
    // next()
src/styles/base/index.scss
@@ -76,13 +76,17 @@
}
::-webkit-scrollbar-thumb {
    background-color: rgba(17, 38, 163, .5);
    background-color: hsla(0, 0%, 84.7%, .5);
    padding-left: 2px;
    padding-right: 2px;
}
::-webkit-scrollbar-thumb:hover {
    cursor: pointer !important;
}
::-webkit-scrollbar-track {
    background-color: hsla(0, 0%, 84.7%, .2);
    background-color: rgba(17, 38, 163, .5);
}
.car-video-box {
src/utils/tools/EditTool.js
@@ -139,7 +139,7 @@
                image: image,
                width: 12,
                height: 12,
                eyeOffset: new global.DC.Namespace.Cesium.Cartesian3(0, 0, -100),
                eyeOffset: new global.DC.Namespace.Cesium.Cartesian3(0, 0, -4),
                heightReference:
                    this._viewer.scene.mode === global.DC.Namespace.Cesium.SceneMode.SCENE3D &&
                        !this._options.clampToModel
src/views/activity/components/drawBtnBox.vue
@@ -82,7 +82,10 @@
        this.$nextTick(() => {
            drawThreeTool = new Plot(global.viewer, {
                clampToModel: true
                clampToModel: true,
                icon_center: "/img/draw/red.png", // 自定义的中心点图标
                icon_anchor: "/img/draw/red.png", //自定义的锚点图标
                icon_midAnchor: "/img/draw/blue.png", //自定义的中心锚点图标
            })
            // global.viewer.scene.globe.depthTestAgainstTerrain = true
@@ -135,34 +138,46 @@
                    break
            }
            if (type == 'polygon') {
                drawThreeTool && drawThreeTool.draw(type, overlay => {
                    if (drawFlag) return
                    if (overlay) {
                        addPlotOverlayData = overlay
                        overlay.customType = 'polygon'
                        that.$parent.addArrowsListLayer(overlay)
                        let polygonPosition = overlay.positions.map(item => `${item.lng} ${item.lat}`).join()
                        const altitude = overlay.positions.map(item => item.alt).join()
                        setTimeout(() => {
                            that.$parent.addSaveNewDraw(polygonPosition, 5, altitude)
                        }, 100)
                        global.viewer.scene.globe.depthTestAgainstTerrain = false
                        currentStatus = ''
                        that.startDrawFlag = false
                    }
                }, {
            let drawConfig = {}
            if (type == 'polygon') {
                drawConfig = {
                    material: global.DC.Namespace.Cesium.Color.fromBytes(64, 158, 255, 122),
                    perPositionHeight: true,
                    outline: true,
                    outlineColor: global.DC.Namespace.Cesium.Color.fromBytes(64, 158, 255, 255),
                    outlineWidth: 4.0,
                }, true)
                }
            } else if (type == 'billboard') {
                drawThreeTool && drawThreeTool.draw(type, overlay => {
                    if (drawFlag) return
                    if (overlay) {
                drawConfig = {
                    size: [32, 32],
                    verticalOrigin: global.DC.Namespace.Cesium.VerticalOrigin.BOTTOM,
                    color: material,
                    // eyeOffset: new global.DC.Namespace.Cesium.Cartesian3(0, 0, -10),
                    billboardImage: `/img/icon/${imgUrl}.png`
                }
            } else if (type == 'polyline') {
                drawConfig = {
                    material: global.DC.Namespace.Cesium.Color.fromBytes(28, 160, 133, 122),
                }
            }
            drawThreeTool.draw(type, overlay => {
                if (drawFlag) return
                if (overlay) {
                    if (type == 'polygon') {
                        addPlotOverlayData = overlay
                        overlay.customType = 'polygon'
                        that.$parent.addArrowsListLayer(overlay)
                        let polygonPosition = overlay.positions.map(item => `${item.lng} ${item.lat}`).join()
                        const altitude = overlay.positions.map(item => item.alt).join()
                        setTimeout(() => {
                            that.$parent.addSaveNewDraw(polygonPosition, 5, altitude)
                        }, 100)
                    }
                    if (type == 'billboard') {
                        addPlotOverlayData = overlay
                        overlay.customType = 'billboard'
                        that.$parent.addPointCircleCarLayer(overlay)
@@ -171,21 +186,9 @@
                        } else {
                            that.$parent.addPointPopupShow(typeValue, overlay.position)
                        }
                        global.viewer.scene.globe.depthTestAgainstTerrain = false
                        currentStatus = ''
                        that.startDrawFlag = false
                    }
                }, {
                    size: [32, 32],
                    verticalOrigin: global.DC.Namespace.Cesium.VerticalOrigin.BOTTOM,
                    color: material,
                    // eyeOffset: new global.DC.Namespace.Cesium.Cartesian3(0, 0, -10),
                    billboardImage: `/img/icon/${imgUrl}.png`
                }, true)
            } else if (type == 'polyline') {
                drawThreeTool && drawThreeTool.draw(type, overlay => {
                    if (drawFlag) return
                    if (overlay) {
                    if (type == 'polyline') {
                        addPlotOverlayData = overlay
                        overlay.customType = 'polyline'
                        that.$parent.addLineLayer(overlay)
@@ -194,14 +197,13 @@
                        setTimeout(() => {
                            that.$parent.addSaveNewDrawLine(polylinePosition, altitude)
                        }, 100)
                        global.viewer.scene.globe.depthTestAgainstTerrain = false
                        currentStatus = ''
                        that.startDrawFlag = false
                    }
                }, {
                    material: global.DC.Namespace.Cesium.Color.fromBytes(28, 160, 133, 122),
                }, true)
            }
                    global.viewer.scene.globe.depthTestAgainstTerrain = false
                    currentStatus = ''
                    that.startDrawFlag = false
                }
            }, drawConfig, true)
        },
        removeDrawArrow () {
@@ -553,6 +555,7 @@
        stopDraw () {
            if (drawThreeTool) {
                drawFlag = true
                currentStatus == 'draw' && drawThreeTool.stop()
                currentStatus == 'emit' && drawThreeTool.stop(currentEmitEl)
            }
src/views/activity/components/twoDrawBtnBox.vue
@@ -76,7 +76,6 @@
let currentEmitEl = null
let drawThreeTool = null
let stopDrawflag = false
let drawFlag = false
let drawTwoFlag = false
@@ -623,12 +622,10 @@
            })
        },
        startDraw () {
            stopDrawflag = true
        },
        stopDraw () {
            stopDrawflag = false
            drawFlag = true
            drawTwoFlag = true
            if (plotDrawEmit) {
                plotDrawEmit.stop()
vue.config.js
@@ -2,7 +2,7 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2022-09-07 09:37:07
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2023-03-29 08:54:06
 * @LastEditTime: 2023-03-30 15:49:22
 * @FilePath: \srs-police-affairs\vue.config.js
 * @Description:
 *
@@ -161,8 +161,8 @@
        proxy: {
            "/api": {
                // target用于配置你允许访问数据的计算机名称,即是你的api接口的服务器地址
                // target: "http://localhost:82",
                target: "http://192.168.0.100:82",
                target: "http://localhost:82",
                // target: "http://192.168.0.100:82",
                // target: "http://17.20.10.3:82",
                // target: "http://10.141.11.11:8081/api",
                // ws: true, //启用webSocket6566