guanqb
2023-03-06 63854032f05197fc192d438edd592e45ef8b490b
作战标绘添加图标
2 files modified
93 ■■■■ changed files
src/styles/media/index.scss 2 ●●● patch | view | raw | blame | history
src/views/activity/index.vue 91 ●●●● patch | view | raw | blame | history
src/styles/media/index.scss
@@ -1513,7 +1513,7 @@
                            padding: countSizeVh(8);
                            bottom: countSizeVh(40);
                            border-radius: countSizeVh(8);
                            width: countSizeVw(480, 1920);
                            width: countSizeVw(520, 1920);
                            z-index: 99;
                            .left,
src/views/activity/index.vue
@@ -1599,6 +1599,7 @@
                            })
                            positionStr = positionStr.slice(0, positionStr.length - 1)
                            this.polygonPositionStr = positionStr
                            this.plotSaveType = 5
                            // overlay.on(global.DC.MouseEventType.CLICK, this.polygonClick)
                            document.oncontextmenu = function () {
                                if (flag) {
@@ -1623,17 +1624,20 @@
                plot && plot.draw(type, overlay => {
                    if (iconType == 'icon1') {
                        overlay.icon = '/img/icon/icon1.png'
                        this.plotSaveType = 6
                    }
                    if (overlay) {
                    drawArrowLayers.addOverlay(overlay)
                    plot.edit(overlay, (e) => {
                        flag = true
                        this.plotPointPositionStr = overlay._positions._lng + ' ' + overlay._positions._lat
                        console.log('overlay',overlay);
                        this.plotPointPositionStr = overlay._position._lng + ' ' + overlay._position._lat
                        document.oncontextmenu = function () {
                                if (flag) {
                                    that.choosePlotColor =  '#409EFF'
                                    that.choosePlotColorAlpha = 48
                                    that.polygonAddVisible = true
                                    that.isNeedName = false
                                    flag = false
                                }
                            }
@@ -1919,16 +1923,31 @@
                    let position = item.position.slice(11, item.position.length - 1).replace(/,/g, ';').replace(/ /g, ',')
                    let chooseArrow = null
                    // let nameLabel = null
                    let color = ''
                    if (item.color == '') {
                        color = global.DC.Namespace.Cesium.Color.fromBytes(255, 69, 0, 173)
                    } else {
                       let r = parseInt(item.color.slice(1, 3), 16)
                         let g = parseInt(item.color.slice(3, 5), 16)
                        let b = parseInt(item.color.slice(5, 7), 16)
                        let a = Math.floor(Number(item.color.split(',')[1])*2.55)
                        color = global.DC.Namespace.Cesium.Color.fromBytes(r, g, b, a)
                    }
                    if (item.type == 1) {
                        chooseArrow = new global.DC.AttackArrow(position)
                        arrowsListLayer.addOverlay(chooseArrow)
                    } else if (item.type == 2) {
                        chooseArrow = new global.DC.DoubleArrow(position)
                        arrowsListLayer.addOverlay(chooseArrow)
                    } else if (item.type == 3) {
                        chooseArrow = new global.DC.FineArrow(position)
                        arrowsListLayer.addOverlay(chooseArrow)
                    } else if (item.type == 4) {
                        chooseArrow = new global.DC.TailedAttackArrow(position)
                        arrowsListLayer.addOverlay(chooseArrow)
                    } else if (item.type == 5) {
                        chooseArrow = new global.DC.Polygon(position)
                        arrowsListLayer.addOverlay(chooseArrow)
                        // 缓存区的话需要扣去包含的核心区
                        if(item.areaType == 2){
                            let itemPositionArr = item.position.slice(11, item.position.length - 1).replace(/,/g, ';').replace(/ /g, ',').split(';')
@@ -1962,25 +1981,39 @@
                        // nameLabel.setStyle({
                        //     "font": "30px",
                        // })
                    } else if (item.type == 6) {
                        let iconImgName = ''
                        if(item.type == 6){
                            iconImgName = 'icon1'
                        }
                        position = position.split(';')[0].split(',')
                        position = new global.DC.Position(Number(position[0]), Number(position[1]))
                        chooseArrow= new global.DC.Billboard(position, `/img/icon/${iconImgName}.png`)
                        arrowsListLayer.addOverlay(chooseArrow)
                        let point = new global.DC.Point(position)
                        arrowsListLayer.addOverlay(point)
                        point.attrParams = { 'id': item.id, 'color': item.color,item }
                        point.on(global.DC.MouseEventType.CLICK, this.reeditArrowClick)
                        point.setStyle({
                            "color": color, //颜色
                            "outlineColor": color, //边框颜色
                            "outlineWidth": 0, //边框大小,
                            "pixelSize": 32,
                        })
                    }
                    let color = ''
                    if (item.color == '') {
                        color = global.DC.Namespace.Cesium.Color.fromBytes(255, 69, 0, 173)
                    } else {
                        let r = parseInt(item.color.slice(1, 3), 16)
                        let g = parseInt(item.color.slice(3, 5), 16)
                        let b = parseInt(item.color.slice(5, 7), 16)
                        let a = Math.floor(Number(item.color.split(',')[1])*2.55)
                        color = global.DC.Namespace.Cesium.Color.fromBytes(r, g, b, a)
                    }
                    // chooseArrow.attrParams = { 'id': item.id, 'color': item.color, 'name': item.name }
                    chooseArrow.attrParams = { 'id': item.id, 'color': item.color,item }
                    arrowsListLayer.addOverlay(chooseArrow)
                    chooseArrow.setStyle({
                        "material": color,
                    })
                    // chooseArrow.on(global.DC.MouseEventType.DB_CLICK, this.reeditArrowDbClick)
                    chooseArrow.on(global.DC.MouseEventType.CLICK, this.reeditArrowClick)
                    // let position1 = new global.DC.Position(117.94218262137659, 28.434842894894153)
                    // let Label = new global.DC.Label(position1, 'test')
                    // Label.on(global.DC.MouseEventType.LEFT_DOWN, this.reeditArrowLeftDown)
                    // Label.on(global.DC.MouseEventType.LEFT_UP, this.reeditArrowLeftUp)
                    // // Label.on(global.DC.MouseEventType.MOUSE_MOVE, this.reeditArrowMouseMove)
                    // arrowsListLayer.addOverlay(Label)
                })
            })
        },
@@ -2015,6 +2048,21 @@
                this.plotId = e.overlay.attrParams.id
                this.editPlotVisible = true
            }
        },
        // 左键按下标绘
        reeditArrowLeftDown(e){
           console.log('reeditArrowLeftDown--ee',e);
        },
        // 左键抬起标绘
        reeditArrowLeftUp(e){
            console.log('reeditArrowLeftUp--ee',e);
        },
        // 移动标绘
        reeditArrowMouseMove(e){
            console.log('reeditArrowMouseMove--ee',e);
        },
        // 编辑标绘
@@ -2447,13 +2495,16 @@
        // 保存绘制区域
        savePolygonInfo () {
            if (this.isNeedName) {
                this.addSecurityPlot({ securityId: this.showingSecurityId, position: this.polygonPositionStr, type: 5, color: this.choosePlotColor + ',' + this.choosePlotColorAlpha,areaType:this.polygonAreaType })
                this.polygonAddVisible = false
            } else {
                this.addSecurityPlot({ securityId: this.showingSecurityId, position: this.arrowPositionStr, type: this.plotSaveType, color: this.choosePlotColor + ',' + this.choosePlotColorAlpha })
                this.polygonAddVisible = false
            let positionStr = ''
            if(this.plotSaveType >=1 &&this.plotSaveType <=4) {
                positionStr = this.arrowPositionStr
            }else if (this.plotSaveType == 5) {
                positionStr = this.polygonPositionStr
            }else if (this.plotSaveType >= 6) {
                positionStr = this.plotPointPositionStr + ',' + this.plotPointPositionStr
            }
            this.addSecurityPlot({ securityId: this.showingSecurityId, position: positionStr, type: this.plotSaveType, color: this.choosePlotColor + ',' + this.choosePlotColorAlpha,areaType:this.polygonAreaType })
            this.polygonAddVisible = false
        },
        // 获取面的中心点