guanqb
2023-01-03 5f98a497ff3da7955902c452b958fa64948f83ab
对接箭头接口
1 files modified
41 ■■■■ changed files
src/views/activity/index.vue 41 ●●●● patch | view | raw | blame | history
src/views/activity/index.vue
@@ -351,6 +351,7 @@
let analysePolygon = null
let drawLayers = null
let drawArrowLayers = null
let arrowsListLayer = null
let plot = undefined
let arrowPlot = undefined
let tc = undefined
@@ -564,6 +565,12 @@
                global.viewer.addLayer(drawArrowLayers)
                arrowPlot = new global.DC.Plot(global.viewer)
            }
            if (arrowsListLayer == null) {
                arrowsListLayer = new global.DC.VectorLayer('arrowsListLayer')
                global.viewer.addLayer(arrowsListLayer)
            }
            // 轨迹
            let positions = "116.023042, 28.684732; 116.023402, 28.679067; 116.023475, 28.678843; 116.023697, 28.678647; 116.024121, 28.678391; 116.026906, 28.678461; 116.027065, 28.676867; 116.033252, 28.676165"
            tc = new global.DC.TrackController(global.viewer)
@@ -891,6 +898,8 @@
        // 点击活动列表活动
        activityListClick (item, index) {
            this.removeAll()
            this.removeAllArrow()
            arrowsListLayer.clear()
            this.showingSecurityId = item.id
            this.$EventBus.$emit('mapClearLayer', {
                layerName: 'newDrawLayers',
@@ -1014,7 +1023,6 @@
                }
                if (overlay) {
                    drawLayers.addOverlay(overlay)
                    plot.edit(overlay, (e) => {
                        flag = true
@@ -1055,7 +1063,6 @@
        drawArrow (type) {
            arrowPlot && arrowPlot.draw(type, overlay => {
                if (overlay) {
                    console.log(overlay._positions, 123)
                    let plotType = ''
                    if (type == 'attack_arrow') {
                        plotType = 1
@@ -1072,13 +1079,9 @@
                    })
                    position = position.slice(0, position.length - 1)
                    console.log(position, 123445)
                    drawArrowLayers.addOverlay(overlay)
                    plot.edit(overlay, (e) => {
                        this.addSecurityPlot(this.showingSecurityId, '102.371 35.0049,102.249 33.8775,102.227 33.9519,102.34 35.0212', '1')
                        this.addSecurityPlot(this.showingSecurityId, position, plotType)
                    })
                }
            })
@@ -1197,14 +1200,32 @@
        // 保存活动标绘箭头
        addSecurityPlot (securityId, position, type) {
            addSecurityPlot(securityId, position, type).then(res => {
                console.log(res, '保存标绘返回值')
                this.getSecurityPlotList(securityId)
            })
        },
        // 获取活动标绘箭头列表
        getSecurityPlotList (securityId) {
            arrowsListLayer.clear()
            getSecurityPlotList(securityId).then(res => {
                console.log(res, '标绘列表')
                res.data.data.forEach(item => {
                    let position = item.position.slice(11, item.position.length - 1).replace(/,/g, ';').replace(/ /g, ',')
                    let chooseArrow = null
                    console.log(position, 2323)
                    if (item.type == 1) {
                        chooseArrow = new global.DC.AttackArrow(position)
                    } else if (item.type == 2) {
                        chooseArrow = new global.DC.DoubleArrow(position)
                    } else if (item.type == 3) {
                        chooseArrow = new global.DC.FineArrow(position)
                    } else if (item.type == 4) {
                        chooseArrow = new global.DC.TailedAttackArrow(position)
                    }
                    arrowsListLayer.addOverlay(chooseArrow)
                    chooseArrow.setStyle({
                        "material": global.DC.Color.RED,
                    })
                })
            })
        }
    },
@@ -1240,8 +1261,10 @@
        })
        analyseLayer.clear()
        arrowsListLayer.clear()
        this.removeAll()
        this.removeAllArrow()
        tc.clear()
        this.$parent.$parent.resize('0px')