| | |
| | | * @Author: shuishen 1109946754@qq.com |
| | | * @Date: 2022-08-18 16:18:17 |
| | | * @LastEditors: shuishen 1109946754@qq.com |
| | | * @LastEditTime: 2023-03-03 15:48:24 |
| | | * @LastEditTime: 2023-03-06 11:29:13 |
| | | * @FilePath: \srs-police-affairs\src\views\activity\index.vue |
| | | * @Description: 安保活动 |
| | | * |
| | |
| | | </li> |
| | | <li> |
| | | <button @click="drawArrow('tailed_attack_arrow')" title="燕尾箭头">燕尾箭头</button> |
| | | </li> |
| | | <li> |
| | | <button @click="drawArrow('polygon')" title="多边形">多边形</button> |
| | | </li> |
| | | <li> |
| | | <button @click="drawArrow('polygon')" title="多边形">多边形</button> |
| | | </li> |
| | | <li> |
| | | <button @click="drawArrow('billboard','icon1')" title="头像1">头像1</button> |
| | | </li> |
| | | <li> |
| | | <button @click="drawArrow('billboard', 'icon1')" title="头像1">头像1</button> |
| | | </li> |
| | | </ul> |
| | | </div> |
| | | <div> |
| | |
| | | <ul> |
| | | <li> |
| | | <!-- <el-button |
| | | ></el-button>--> |
| | | ></el-button>--> |
| | | <button @click="draw('polyline', 'policecar')" title="巡逻路线"> |
| | | <img src="../../../public/img/icon/route1.png" style="height:100%" /> |
| | | </button> |
| | |
| | | |
| | | <el-dialog :title="polygonAddTitle" :modal="false" :visible.sync="polygonAddVisible" :close-on-click-modal="true" |
| | | class="add-polygon-box" :before-close="cancelSavePolygon"> |
| | | <!-- <div class="line" v-show="isNeedName"> |
| | | <div class="value-name-box">设置名称:</div> |
| | | <div> |
| | | <input type="text" v-model="polygonName" /> |
| | | </div> |
| | | </div> --> |
| | | <div class="line" v-show="isNeedPolygonType"> |
| | | <div class="value-name-box">选择类型:</div> |
| | | <div class="select-type"> |
| | | <el-select size="small" v-model="polygonAreaType" placeholder="请选择区域类型"> |
| | | <el-option v-for="item in polygonAreaOption" :key="item.value" :label="item.label" |
| | | :value="item.value"></el-option> |
| | | <el-option v-for="item in polygonAreaOption" :key="item.value" :label="item.label" |
| | | :value="item.value"></el-option> |
| | | </el-select> |
| | | </div> |
| | | </div> |
| | |
| | | |
| | | <el-dialog title="修改标绘" :modal="false" :visible.sync="editPlotVisible" :close-on-click-modal="true" |
| | | class="edit-plot-box"> |
| | | <!-- <div v-show="polygonName"> |
| | | <div class="value-name-box">设置名称:</div> |
| | | <div> |
| | | <input type="text" v-model="polygonName" /> |
| | | </div> |
| | | </div> --> |
| | | <div> |
| | | <div class="value-name-box">设置透明度:</div> |
| | | <div class="alpha"> |
| | |
| | | let plot = undefined |
| | | let arrowPlot = undefined |
| | | let lineLayer = undefined |
| | | |
| | | let tc = undefined |
| | | let track = undefined |
| | | let loading = null |
| | |
| | | polygonName: '', |
| | | polygonPositionStr: '', |
| | | chooseColor: '#1CA085', |
| | | choosePlotColor: '#409EFF', |
| | | choosePlotColorAlpha:48, |
| | | choosePlotColor: '#409EFF', |
| | | choosePlotColorAlpha: 48, |
| | | chooseCarColor: '#1CA085', |
| | | choosePoliceColor: '#1CA085', |
| | | chooseLineData: {}, |
| | |
| | | video3: false, |
| | | video4: false, |
| | | }, |
| | | polygonAreaType:1, |
| | | polygonAreaOption:[{ |
| | | value: 1, |
| | | label: '核心区' |
| | | polygonAreaType: 1, |
| | | polygonAreaOption: [{ |
| | | value: 1, |
| | | label: '核心区' |
| | | }, { |
| | | value: 2, |
| | | label: '缓冲区' |
| | | value: 2, |
| | | label: '缓冲区' |
| | | }], |
| | | isNeedPolygonType:false, |
| | | plotPointPositionStr:'', |
| | | isNeedPolygonType: false, |
| | | plotPointPositionStr: '', |
| | | } |
| | | }, |
| | | |
| | |
| | | polylineAreaLayer = new global.DC.VectorLayer('polylineAreaLayer') |
| | | global.viewer.addLayer(polylineAreaLayer) |
| | | } |
| | | |
| | | tc = new global.DC.TrackController(global.viewer) |
| | | |
| | | // 轨迹 |
| | | // 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" |
| | |
| | | overlay.icon = '/img/policeCar.jfif' |
| | | } |
| | | |
| | | |
| | | if (overlay) { |
| | | drawLayers.addOverlay(overlay) |
| | | |
| | | plot.edit(overlay, (e) => { |
| | | drawLayers.addOverlay(overlay) |
| | | // drawLayers.addOverlay(overlay) |
| | | |
| | | flag = true |
| | | |
| | | overlay.on(global.DC.MouseEventType.CLICK, this.overlayTypeClick) |
| | | |
| | | overlay.drawType = poltType |
| | | |
| | | overlay.policeType = policeType |
| | | |
| | | this.overlayObj = overlay |
| | | |
| | | document.oncontextmenu = function () { |
| | | if (flag == true && poltType == 'billboard') { |
| | | if (policeType == 'policeman') { |
| | |
| | | drawLayers.clear() |
| | | }, |
| | | |
| | | drawArrow (type,iconType) { |
| | | drawArrow (type, iconType) { |
| | | if (type == 'polygon') { |
| | | const that = this |
| | | let flag = false |
| | |
| | | // overlay.on(global.DC.MouseEventType.CLICK, this.polygonClick) |
| | | document.oncontextmenu = function () { |
| | | if (flag) { |
| | | that.choosePlotColor = '#409EFF' |
| | | that.choosePlotColor = '#409EFF' |
| | | that.choosePlotColorAlpha = 48 |
| | | that.polygonAreaType = 1 |
| | | that.isNeedName = true |
| | |
| | | }) |
| | | } |
| | | }, { material: global.DC.Color.RED }) |
| | | } else if (type == 'billboard'){ |
| | | console.log(11); |
| | | const that = this |
| | | let flag = false |
| | | |
| | | } else if (type == 'billboard') { |
| | | console.log(11) |
| | | const that = this |
| | | let flag = false |
| | | |
| | | plot && plot.draw(type, overlay => { |
| | | if (iconType == 'icon1') { |
| | | overlay.icon = '/img/icon/icon1.png' |
| | | } |
| | | if (overlay) { |
| | | drawArrowLayers.addOverlay(overlay) |
| | | plot.edit(overlay, (e) => { |
| | | flag = true |
| | | this.plotPointPositionStr = overlay._positions._lng + ' ' + overlay._positions._lat |
| | | document.oncontextmenu = function () { |
| | | drawArrowLayers.addOverlay(overlay) |
| | | plot.edit(overlay, (e) => { |
| | | flag = true |
| | | this.plotPointPositionStr = overlay._positions._lng + ' ' + overlay._positions._lat |
| | | document.oncontextmenu = function () { |
| | | if (flag) { |
| | | that.choosePlotColor = '#409EFF' |
| | | that.choosePlotColor = '#409EFF' |
| | | that.choosePlotColorAlpha = 48 |
| | | that.polygonAddVisible = true |
| | | flag = false |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | }else { |
| | | } else { |
| | | const that = this |
| | | let flag = false |
| | | arrowPlot && arrowPlot.draw(type, overlay => { |
| | |
| | | drawArrowLayers.addOverlay(overlay) |
| | | document.oncontextmenu = function () { |
| | | if (flag) { |
| | | that.choosePlotColor = '#409EFF' |
| | | that.choosePlotColor = '#409EFF' |
| | | that.isNeedName = false |
| | | that.isNeedPolygonType = false |
| | | that.polygonAddVisible = true |
| | |
| | | } else if (item.type == 5) { |
| | | chooseArrow = new global.DC.Polygon(position) |
| | | // 缓存区的话需要扣去包含的核心区 |
| | | if(item.areaType == 2){ |
| | | if (item.areaType == 2) { |
| | | let itemPositionArr = item.position.slice(11, item.position.length - 1).replace(/,/g, ';').replace(/ /g, ',').split(';') |
| | | itemPositionArr.push(itemPositionArr[0]) |
| | | itemPositionArr = itemPositionArr.map(item=>{ |
| | | itemPositionArr = itemPositionArr.map(item => { |
| | | return item.split(',').map(Number) |
| | | }) |
| | | let cachePolygon = this.$turf.polygon([itemPositionArr]) |
| | | plotList.forEach(inItem => { |
| | | // 查询被包含的核心区 |
| | | if(inItem.areaType == 1 && inItem.type == 5){ |
| | | if (inItem.areaType == 1 && inItem.type == 5) { |
| | | let inItemPositionArr = inItem.position.slice(11, inItem.position.length - 1).replace(/,/g, ';').replace(/ /g, ',').split(';') |
| | | inItemPositionArr.push(inItemPositionArr[0]) |
| | | inItemPositionArr = inItemPositionArr.map(item=>{ |
| | | inItemPositionArr = inItemPositionArr.map(item => { |
| | | return item.split(',').map(Number) |
| | | }) |
| | | let carePolygon = this.$turf.polygon([inItemPositionArr]) |
| | | let isContains = this.$turf.booleanContains(cachePolygon, carePolygon); |
| | | let isContains = this.$turf.booleanContains(cachePolygon, carePolygon) |
| | | // 如果完全包含就作为洞面扣去 |
| | | if(isContains){ |
| | | if (isContains) { |
| | | chooseArrow.holes = [inItem.position.slice(11, inItem.position.length - 1).replace(/,/g, ';').replace(/ /g, ',')] |
| | | } |
| | | |
| | |
| | | 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) |
| | | 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 } |
| | | chooseArrow.attrParams = { 'id': item.id, 'color': item.color, item } |
| | | arrowsListLayer.addOverlay(chooseArrow) |
| | | chooseArrow.setStyle({ |
| | | "material": color, |
| | |
| | | // 单击。标绘箭头 |
| | | reeditArrowClick (e) { |
| | | this.plotOverlayData = e |
| | | this.choosePlotColor = e.overlay.attrParams.color != '' ? e.overlay.attrParams.color.slice(0,7) : '#409EFF' |
| | | this.choosePlotColorAlpha = e.overlay.attrParams.color != '' ? Number(e.overlay.attrParams.color.split(',')[1]) : 48 |
| | | if(e.overlay.attrParams.item.type == 5){ |
| | | this.choosePlotColor = e.overlay.attrParams.color != '' ? e.overlay.attrParams.color.slice(0, 7) : '#409EFF' |
| | | this.choosePlotColorAlpha = e.overlay.attrParams.color != '' ? Number(e.overlay.attrParams.color.split(',')[1]) : 48 |
| | | if (e.overlay.attrParams.item.type == 5) { |
| | | this.polygonAreaType = e.overlay.attrParams.item.areaType != '' ? e.overlay.attrParams.item.areaType : 1 |
| | | this.isNeedPolygonType = true |
| | | }else{ |
| | | } else { |
| | | this.isNeedPolygonType = false |
| | | } |
| | | // this.polygonName = e.overlay.attrParams.name |
| | |
| | | tc.clear() |
| | | } |
| | | |
| | | tc = new global.DC.TrackController(global.viewer) |
| | | |
| | | /** |
| | | * @description: |
| | | * @param {*} position 当前行驶位置信息 |
| | |
| | | // 保存绘制区域 |
| | | savePolygonInfo () { |
| | | if (this.isNeedName) { |
| | | this.addSecurityPlot({ securityId: this.showingSecurityId, position: this.polygonPositionStr, type: 5, color: this.choosePlotColor + ',' + this.choosePlotColorAlpha,areaType:this.polygonAreaType }) |
| | | 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 }) |
| | |
| | | |
| | | // 树形数据传数组 |
| | | filterTree (tree, arr = []) { |
| | | if (!tree.length) return [] |
| | | arr.push(...tree) |
| | | for(let item of tree){ |
| | | if(item.children && item.children.length){ |
| | | this.filterTree(item.children,arr) |
| | | if (!tree.length) return [] |
| | | arr.push(...tree) |
| | | for (let item of tree) { |
| | | if (item.children && item.children.length) { |
| | | this.filterTree(item.children, arr) |
| | | } |
| | | } |
| | | } |
| | | return arr |
| | | return arr |
| | | }, |
| | | |
| | | // 计算透明度值 |
| | | formatTooltip(val) { |
| | | return val / 100; |
| | | formatTooltip (val) { |
| | | return val / 100 |
| | | }, |
| | | |
| | | }, |
| | |
| | | type: 'VectorLayer' |
| | | }) |
| | | |
| | | analyseLayer.clear() |
| | | arrowsListLayer.clear() |
| | | lineLayer.clear() |
| | | analyseLayer.remove() |
| | | arrowsListLayer.remove() |
| | | lineLayer.remove() |
| | | if (pointCircleManLayer != null) { |
| | | pointCircleManLayer.clear() |
| | | pointCircleManLayer.remove() |
| | | } |
| | | |
| | | if (pointCircleCarLayer != null) { |
| | | pointCircleCarLayer.clear() |
| | | pointCircleCarLayer.remove() |
| | | } |
| | | this.removeAll() |
| | | this.removeAllArrow() |
| | | if (tc) { |
| | | tc.clear() |
| | | tc.remove() |
| | | } |
| | | if (polylineAreaLayer) { |
| | | polylineAreaLayer.clear() |
| | | polylineAreaLayer.remove() |
| | | } |
| | | |
| | | this.$parent.$parent.resize('0px') |