1
guanqb
2024-01-20 f13afcb61276061871b30bce17a7877287df0b67
src/views/activity/components/publicIndex.vue
@@ -14,7 +14,8 @@
            :policeSwitch="policeSwitch" :polylineBtnSwitch="polylineBtnSwitch" :arrowBtnSwitch="arrowBtnSwitch"
            :policeIconId="policeIconId" :lineWidth="lineWidth" @setPoliceOption="setPoliceOption"></two-draw-btn-box>
        <polygon-plot ref="PolygonPlotPage" :showingSecurityId="showingSecurityId"></polygon-plot>
        <polygon-plot ref="PolygonPlotPage" :showingSecurityId="showingSecurityId"
            :activityDeptId="activityDeptId"></polygon-plot>
        <polyline-plot ref="PolylinePlotPage" :showingSecurityId="showingSecurityId"></polyline-plot>
@@ -49,6 +50,7 @@
import policePersonChange from './policePersonChange.vue'
import activityDetail from './activityDetail.vue'
import videoControlBox from './videoControlBox.vue'
import { getLineSpeed } from '@/utils/turfPolygon'
// 要素的
let pointCircleCarLayer = null
@@ -61,6 +63,8 @@
export default {
    inject: ['userInfo'],
    props: ['activityDeptId'],
    data () {
        return {
@@ -158,6 +162,10 @@
        // 作战标绘的添加
        addArrowsListLayer (overlay) {
            arrowsListLayer.addOverlay(overlay)
        },
        removeArrowsListLayer (overlay) {
            arrowsListLayer.removeOverlay(overlay)
        },
        addSaveNewDrawLine (positions, altitude) {
@@ -315,27 +323,6 @@
            this.arrowBtnSwitch = true
            this.polylineBtnSwitch = true
            // 加载当前活动区域
            if (params.item.activityArea && params.item.activityArea.length > 0) {
                let polyGonData = params.item.activityArea.slice(11, params.item.activityArea.length - 1)
                polyGonData = polyGonData.replace(/,/g, ";")
                polyGonData = polyGonData.replace(/ /g, ",")
                let newPolyData = polyGonData.split(';').map(item => {
                    let lngOrlat = item.split(',')
                    lngOrlat.push(140)
                    lngOrlat = lngOrlat.join(',')
                    return lngOrlat
                }).join(';')
                this.$EventBus.$emit('layerWallAdd', {
                    layerName: 'polygonWallLayer',
                    positions: newPolyData
                })
            }
            this.getPolicemanTree({ deptId: params.deptId })
            this.getCarList({ deptId: params.deptId })
@@ -365,7 +352,6 @@
        // 获取标绘箭头列表
        getSecurityPlotList (securityId) {
            getSecurityPlotList(securityId).then(res => {
                // 要素资源
                this.$parent.normalPeopleList = res.data.data.filter(item => item.type == 6)
@@ -415,13 +401,12 @@
                        this.initLayersCoverage('Polygon', color, item, position, altitude)
                        continue
                    } else if (item.type == 6 || item.type == 7 || item.type == 8 || item.type == 11) {
                        let iconImgName = item.type == 6 ? 'ptqz' : item.type == 7 ? 'bhdx' : 'wxrw'
                        let icon = ''
                        if (item.type == 11) {
                            icon = item.iconUrl
                        } else {
                            icon = `/img/icon/${iconImgName}.png`
                            icon = `/img/icon/rest.png`
                        }
                        const height = item.altitude.split(',')
@@ -459,28 +444,78 @@
                let a = Math.floor(Number(color.split(',')[1]) * 2.55) ? Math.floor(Number(color.split(',')[1]) * 2.55) : 255
                curColor = global.DC.Namespace.Cesium.Color.fromBytes(r, g, b, a)
                outColor = global.DC.Namespace.Cesium.Color.fromBytes(r, g, b, 255)
            }
            return { curColor, outColor }
        },
        initLayersCoverage (type, color, params, position, altitude) {
            if (altitude && altitude.length) position = position.split(';').map((item, index) => `${item},${altitude[index]}`).join(';')
            let coverage = new global.DC[type](position)
            let positions = position
            if (altitude && altitude.length) {
                positions = position.split(';').map((item, index) => `${item},${altitude[index]}`).join(';')
            } else {
                positions = position
            }
            let coverage = new global.DC[type](positions)
            if (type == 'Polygon') {
                coverage.setStyle({
                    material: color.curColor,
                    extrudedHeight: null,
                    perPositionHeight: this.currentPlotType == 3 ? true : false,
                    closeTop: false,
                    closeBottom: false,
                    // classificationType: global.DC.Namespace.Cesium.ClassificationType.TERRAIN
                    outline: true,
                    outlineColor: color.outColor,
                    outlineWidth: 4.0,
                })
                if (params.areaType == 1) {
                    coverage.setStyle({
                        material: color.curColor,
                        extrudedHeight: null,
                        perPositionHeight: this.currentPlotType == 3 ? true : false,
                        closeTop: false,
                        closeBottom: false,
                        // classificationType: global.DC.Namespace.Cesium.ClassificationType.TERRAIN
                        outline: true,
                        outlineColor: color.outColor,
                        outlineWidth: 4.0,
                    })
                } else {
                    let maxHeight = Math.max(...altitude) + 5
                    positions = position.split(';').map((item, index) => `${item},${maxHeight}`)
                    positions.push(positions[0])
                    positions = positions.join(';')
                    coverage = new global.DC.Wall(positions)
                    let multiple, speed
                    if (params.iconUrl.indexOf('1') != -1) {
                        multiple = 250
                        speed = 3
                    } else if (params.iconUrl.indexOf('2') != -1) {
                        multiple = 195
                        speed = 3
                    } else {
                        multiple = 50
                        speed = 10
                    }
                    if (params.areaType == 2) {
                        coverage.setStyle({
                            material: new global.DC.WallImageTrailMaterialProperty({
                                image: params.iconUrl,
                                color: color.curColor,
                                repeat: {
                                    x: getLineSpeed(position.split(';').map(item => {
                                        item.split(',')
                                        return [Number(item.split(',')[0]), Number(item.split(',')[1])]
                                    }), multiple), y: 1
                                },
                                speed: speed
                            })
                        })
                    } else {
                        coverage.setStyle({
                            material: new global.DC.WallTrailMaterialProperty({
                                color: color.curColor,
                                speed: 10
                            })
                        })
                    }
                }
                coverage.customType = 'polygon'
            } else if (type == 'Polyline') {
@@ -502,9 +537,9 @@
            }
            coverage.attrParams = { id: params.id, color: params.color, item: params }
            coverage.on(global.DC.MouseEventType.CLICK, this.reeditArrowClick)
            coverage.on(global.DC.MouseEventType.MOUSE_OVER, this.pointMouseOver)
            coverage.on(global.DC.MouseEventType.MOUSE_OUT, this.pointMouseOut)
            arrowsListLayer.addOverlay(coverage)
            return coverage
        },
@@ -597,9 +632,16 @@
            if (
                e.overlay.attrParams.item && e.overlay.attrParams.item.type &&
                (e.overlay.attrParams.item.type == 6 ||
                (
                    e.overlay.attrParams.item.type == 1 ||
                    e.overlay.attrParams.item.type == 2 ||
                    e.overlay.attrParams.item.type == 3 ||
                    e.overlay.attrParams.item.type == 4 ||
                    e.overlay.attrParams.item.type == 5 ||
                    e.overlay.attrParams.item.type == 6 ||
                    e.overlay.attrParams.item.type == 7 ||
                    e.overlay.attrParams.item.type == 8 ||
                    e.overlay.attrParams.item.type == 10 ||
                    e.overlay.attrParams.item.type == 11)) {
                hoverData.billboard = true
            } else {
@@ -651,6 +693,8 @@
         * @return {*}
         */
        addMapLineLayers (data) {
            this.$parent.chooseActivityLineList = data
            data.forEach(item => {
                let maxHeight = item.altitude.split(',').reduce((pre, cur) => {
                    return cur > pre ? cur : pre
@@ -684,9 +728,9 @@
                let lineObj = new global.DC.Polyline(positionNewArr)
                lineObj.customType = 'polyline'
                lineObj.setStyle({
                    material: lineColor,
                    material: new global.DC.PolylineArrowMaterialProperty(lineColor),
                    clampToGround: this.currentPlotType == 3 ? false : true,
                    width: 3
                    width: 10
                })
                lineLayer.addOverlay(lineObj)
@@ -695,13 +739,12 @@
                    layerName: 'newCarDrawLineLayers',
                    positions: positionStr,
                    material: color,
                    params: { ...item, lineObj },
                    incident: this.lineOverlayTypeClick
                    params: { ...item, lineObj, item, data: item },
                    incident: this.lineOverlayTypeClick,
                    mouseOverIncident: this.pointMouseOver,
                    mouseOutIncident: this.pointMouseOut
                })
            })
            this.$parent.chooseActivityLineList = data
        },
        clearOrRemoveLayerAll (type) {