| | |
| | | }, |
| | | |
| | | mounted () { |
| | | drawLabelStatus = 'end' |
| | | |
| | | this.$nextTick(() => { |
| | | if (drawLayers == null) { |
| | | drawLayers = new global.DC.VectorLayer('drawLayers') |
| | | global.viewer.addLayer(drawLayers) |
| | | plot = new global.DC.Plot(global.viewer) |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | drawArrowLayers = new global.DC.VectorLayer('drawArrowLayers') |
| | | global.viewer.addLayer(drawArrowLayers) |
| | | arrowPlot = new global.DC.Plot(global.viewer) |
| | | |
| | | } |
| | | |
| | | global.viewer.on(global.DC.MouseEventType.CLICK, this.viewerClick) |
| | | global.viewer.on(global.DC.MouseEventType.MOUSE_MOVE, this.viewerLableMove) |
| | | global.viewer.on(global.DC.MouseEventType.LEFT_UP, this.labelUp) |
| | | |
| | | }) |
| | | }, |
| | | |
| | |
| | | // 地图元素绘制 |
| | | draw (poltType, policeType) { |
| | | |
| | | labelPositionChange = false |
| | | drawLabelStatus = 'end' |
| | | isAddLabel = false |
| | | |
| | | let flag = false |
| | | |
| | | const that = this |
| | | |
| | | global.viewer.tooltip.enable = true |
| | | |
| | | // this.policeType = '' // ? |
| | | |
| | | plot && plot.draw(poltType, overlay => { |
| | | if (isAddLabel) return |
| | | |
| | | if (poltType == 'billboard' && policeType == 'policeman') { |
| | | overlay.icon = '/img/icon/police-people.png' |
| | |
| | | }, |
| | | |
| | | drawArrow (type, iconType) { |
| | | labelPositionChange = false |
| | | drawLabelStatus = 'end' |
| | | isAddLabel = false |
| | | |
| | | global.viewer.tooltip.enable = true |
| | | |
| | | if (type == 'polygon') { |
| | | |
| | |
| | | let flag = false |
| | | |
| | | plot && plot.draw(type, overlay => { |
| | | if (isAddLabel) return |
| | | |
| | | if (overlay) { |
| | | drawArrowLayers.addOverlay(overlay) |
| | | plot.edit(overlay, (e) => { |
| | |
| | | let flag = false |
| | | |
| | | plot && plot.draw(type, overlay => { |
| | | if (isAddLabel) return |
| | | |
| | | if (iconType == 'icon1') { |
| | | that.$parent.plotSaveType = 6 |
| | | overlay.size = [24, 24] |
| | |
| | | const that = this |
| | | let flag = false |
| | | arrowPlot && arrowPlot.draw(type, overlay => { |
| | | if (isAddLabel) return |
| | | |
| | | if (overlay) { |
| | | let plotType = '' |
| | | if (type == 'attack_arrow') { |
| | |
| | | } else if (type == 'tailed_attack_arrow') { |
| | | plotType = 4 |
| | | } |
| | | |
| | | that.$parent.plotSaveType = plotType |
| | | |
| | | plot.edit(overlay, (e) => { |
| | | flag = true |
| | | let positionStr = '' |
| | |
| | | }, |
| | | |
| | | drawArrowLabel () { |
| | | this.labelPopupTitle = "" |
| | | global.viewer.tooltip.enable = false |
| | | plot != null && plot.stop() |
| | | arrowPlot != null && arrowPlot.stop() |
| | | |
| | | isAddLabel = true |
| | | this.labelPopupTitle = "" |
| | | drawLabelStatus = 'start' |
| | | global.viewer.tooltip.enable = true |
| | | |
| | | this.$emit('drawLabel', drawLabelStatus) |
| | | }, |
| | |
| | | }, |
| | | |
| | | labelShowPopup (e) { |
| | | this.labelPopupTitle = '添加文字标注' |
| | | this.addLabelVisible = true |
| | | this.addLabelPosition = e.wgs84SurfacePosition.lng + ' ' + e.wgs84SurfacePosition.lat + ',' + e.wgs84SurfacePosition.lng + ' ' + e.wgs84SurfacePosition.lat |
| | | global.viewer.tooltip.enable = true |
| | | }, |
| | | |
| | | // 文字标注窗口的添加按钮 |
| | |
| | | |
| | | setTimeout(() => { |
| | | if (eventLast == 0) { |
| | | global.viewer.tooltip.enable = false |
| | | this.$EventBus.$emit('closeTooltip') |
| | | |
| | | labelPositionChange = true |
| | | curLabelOverLayer = e.overlay |
| | | global.viewer.scene.screenSpaceCameraController.enableRotate = false |
| | |
| | | }, |
| | | |
| | | updateLableMove (e) { |
| | | global.viewer.tooltip.enable = false |
| | | this.$EventBus.$emit('closeTooltip') |
| | | |
| | | curLabelOverLayer.position = { |
| | | lng: e.wgs84SurfacePosition.lng, |
| | |
| | | |
| | | viewerLableMove (e) { |
| | | if (isAddLabel == true) { |
| | | global.viewer.tooltip.showAt(e.windowPosition, '单击选择文字标注位置') |
| | | this.$EventBus.$emit('showTooltip', { |
| | | position: e.windowPosition, |
| | | text: '单击选择文字标注位置' |
| | | }) |
| | | } else { |
| | | if (e.overlay && e.overlay.attrParams && e.overlay.attrParams.id) { |
| | | const flag = labelOverLayerID.some(item => item == e.overlay.attrParams.id) |
| | | |
| | | if (flag == true) { |
| | | global.viewer.tooltip.enable = true |
| | | |
| | | global.viewer.tooltip.showAt({ |
| | | x: e.windowPosition.x + 10, |
| | | y: e.windowPosition.y |
| | | }, '长按开启拖拽,单击修改名称') |
| | | if (flag == true && labelPositionChange != true) { |
| | | this.$EventBus.$emit('showTooltip', { |
| | | position: e.windowPosition, |
| | | text: '长按开启拖拽,单击修改名称' |
| | | }) |
| | | } |
| | | } else { |
| | | global.viewer.tooltip.enable = false |
| | | this.$EventBus.$emit('closeTooltip') |
| | | } |
| | | } |
| | | }, |
| | |
| | | isAddLabel = false |
| | | this.addLabelVisible = false |
| | | drawLabelStatus = 'end' |
| | | |
| | | this.$EventBus.$emit('closeTooltip') |
| | | }, |
| | | |
| | | // 单击文字标绘 |
| | | reEditLabel (e) { |
| | | global.viewer.tooltip.enable = false |
| | | this.$EventBus.$emit('closeTooltip') |
| | | |
| | | this.labelId = e.overlay.attrParams.id |
| | | this.labelPopupTitle = "修改文字标注" |
| | | this.labelInput = e.overlay.attrParams.item.name |
| | |
| | | }, |
| | | |
| | | destroyed () { |
| | | plot.stop() |
| | | plot != null && plot.stop() |
| | | arrowPlot != null && arrowPlot.stop() |
| | | |
| | | drawLayers.remove() |
| | | drawLayers = null |