| | |
| | | }) |
| | | 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) { |
| | |
| | | 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 |
| | | } |
| | | } |
| | |
| | | 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(';') |
| | |
| | | // 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) |
| | | }) |
| | | }) |
| | | }, |
| | |
| | | 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); |
| | | }, |
| | | |
| | | // 编辑标绘 |
| | |
| | | |
| | | // 保存绘制区域 |
| | | 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 |
| | | }, |
| | | |
| | | // 获取面的中心点 |