| | |
| | | let drawLabelStatus = 'end' |
| | | let labelPositionChange = false |
| | | |
| | | let labelOverLayerID = [] |
| | | |
| | | let eventLast = 0 |
| | | |
| | | export default { |
| | | props: [ |
| | | 'dialogVisible', 'isShowActivityEditBox', 'showingSecurityId', |
| | |
| | | addLabelVisible: false,// 文字标注的窗口(内容是名称) |
| | | labelInput: '', |
| | | addLabelPosition: null, |
| | | labelPopupTitle:'添加文字标注', |
| | | labelId:'', |
| | | labelPopupTitle: '添加文字标注', |
| | | labelId: '', |
| | | } |
| | | }, |
| | | |
| | |
| | | |
| | | removeDrawArrow () { |
| | | drawArrowLayers != null && drawArrowLayers.clear() |
| | | |
| | | labelOverLayerID = [] |
| | | }, |
| | | |
| | | plotEdit (overlayData, type) { |
| | |
| | | type: 'error' |
| | | }) |
| | | } else { |
| | | if(this.labelPopupTitle == "添加文字标注"){ |
| | | if (this.labelPopupTitle == "添加文字标注") { |
| | | this.$parent.addSecurityPlot({ securityId: this.showingSecurityId, position: this.addLabelPosition, type: 9, name: this.labelInput }) |
| | | }else{ |
| | | } else { |
| | | this.updateSecurityPlot({ id: this.labelId, name: this.labelInput }) |
| | | } |
| | | this.cancelSaveLabel() |
| | |
| | | }, |
| | | |
| | | lableAllEvent (label) { |
| | | labelOverLayerID.push(label.attrParams.id) |
| | | label.on(global.DC.MouseEventType.CLICK, this.reEditLabel) |
| | | label.on(global.DC.MouseEventType.LEFT_DOWN, this.labelDowm) |
| | | }, |
| | | |
| | | labelDowm (e) { |
| | | labelPositionChange = true |
| | | curLabelOverLayer = e.overlay |
| | | global.viewer.scene.screenSpaceCameraController.enableRotate = false |
| | | global.viewer.on(global.DC.MouseEventType.MOUSE_MOVE, this.updateLableMove) |
| | | eventLast = 0 |
| | | |
| | | setTimeout(() => { |
| | | if (eventLast == 0) { |
| | | labelPositionChange = true |
| | | curLabelOverLayer = e.overlay |
| | | global.viewer.scene.screenSpaceCameraController.enableRotate = false |
| | | global.viewer.on(global.DC.MouseEventType.MOUSE_MOVE, this.updateLableMove) |
| | | } |
| | | }, 500) |
| | | }, |
| | | |
| | | labelUp (e) { |
| | | eventLast = new Date().getTime() |
| | | |
| | | if (labelPositionChange == true) { |
| | | global.viewer.scene.screenSpaceCameraController.enableRotate = true |
| | | global.viewer.off(global.DC.MouseEventType.MOUSE_MOVE, this.updateLableMove) |
| | | |
| | | // curLabelOverLayer 中的位置就是移动后的位置 |
| | | let position = curLabelOverLayer._position._lng + ' ' + curLabelOverLayer._position._lat + ',' + curLabelOverLayer._position._lng + ' ' + curLabelOverLayer._position._lat |
| | | let position = curLabelOverLayer._position._lng + ' ' + curLabelOverLayer._position._lat + ',' + curLabelOverLayer._position._lng + ' ' + curLabelOverLayer._position._lat |
| | | this.updateSecurityPlot({ id: curLabelOverLayer.attrParams.id, position: position }) |
| | | labelPositionChange = false |
| | | } |
| | | }, |
| | | |
| | | updateLableMove (e) { |
| | | global.viewer.tooltip.enable = false |
| | | |
| | | curLabelOverLayer.position = { |
| | | lng: e.wgs84SurfacePosition.lng, |
| | | lat: e.wgs84SurfacePosition.lat, |
| | |
| | | }, |
| | | |
| | | viewerLableMove (e) { |
| | | isAddLabel == true && global.viewer.tooltip.showAt(e.windowPosition, '单击选择文字标注位置') |
| | | if (isAddLabel == true) { |
| | | global.viewer.tooltip.showAt(e.windowPosition, '单击选择文字标注位置') |
| | | } else { |
| | | if (e.overlay) { |
| | | const flag = labelOverLayerID.some(item => item == e.overlay.attrParams.id) |
| | | |
| | | if (flag == true) { |
| | | global.viewer.tooltip.enable = true |
| | | |
| | | global.viewer.tooltip.showAt(e.windowPosition, '长按开启拖拽,单击修改名称') |
| | | } |
| | | } else { |
| | | global.viewer.tooltip.enable = false |
| | | } |
| | | } |
| | | }, |
| | | |
| | | // 关闭添加标注弹窗 |
| | |
| | | }, |
| | | |
| | | // 单击文字标绘 |
| | | reEditLabel(e){ |
| | | console.log(66,e); |
| | | reEditLabel (e) { |
| | | global.viewer.tooltip.enable = false |
| | | this.labelId = e.overlay.attrParams.id |
| | | this.labelPopupTitle = "修改文字标注" |
| | | this.labelInput = e.overlay.attrParams.item.name |
| | |
| | | drawArrowLayers.clear() |
| | | drawArrowLayers = null |
| | | |
| | | labelOverLayerID = [] |
| | | |
| | | global.viewer.off(global.DC.MouseEventType.CLICK, this.viewerClick) |
| | | global.viewer.off(global.DC.MouseEventType.MOUSE_MOVE, this.viewerLableMove) |
| | | global.viewer.off(global.DC.MouseEventType.LEFT_UP, this.labelUp) |
| | |
| | | position: fixed; |
| | | display: flex; |
| | | // left: 50%; |
| | | left: calc(810 / 1920 * 100vw); |
| | | bottom: 40px; |
| | | color: #fff; |
| | | background: $bg-one-color; |