shuishen
2022-09-20 9d967228f25d0eb4635c4438576b139f2d8fe257
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: 2022-09-20 16:25:50
 * @LastEditTime: 2022-09-20 17:07:27
 * @FilePath: \srs-police-affairs\src\components\map\index.vue
 * @Description: 公用地图组件
 * 
@@ -341,6 +341,10 @@
            that.layerPolygonAdd(params.layerName, params.positions, params.material)
        })
        this.$EventBus.$on('layerPolylineAdd', (params) => {
            that.layerPolylineAdd(params.layerName, params.positions, params.material, params.width)
        })
        this.$EventBus.$on('layerShow', (params) => {
            that.layerShow(params.layerName, params.flag)
        })
@@ -514,6 +518,31 @@
        },
        /**
         * 图层线添加
         * @param {*} layerName 图层名称
         * @param {*} positions 图层位置数据
         * @param {*} material 颜色
         * @param {*} width 宽度
         */
        layerPolylineAdd (layerName, positions, material, width) {
            if (!layersObjcect[layerName] || layersObjcect[layerName] == null) {
                this.mapAddLayer(layerName, 'VectorLayer')
                layersObjcect[layerName].allowDrillPicking = true
            }
            let polyline = new global.DC.Polyline(positions)
            polyline.setStyle({
                width: width,
                material: material,
                clampToGround: false
            })
            layersObjcect[layerName].addOverlay(polyline)
        },
        /**
         * 图层显示隐藏
         * @param {*} layerName 图层名称
         * @param {*} flag 显示隐藏