| | |
| | | this.$nextTick(() => { |
| | | |
| | | drawThreeTool = new Plot(global.viewer, { |
| | | clampToModel: true |
| | | clampToModel: true, |
| | | icon_center: "/img/draw/red.png", // 自定义的中心点图标 |
| | | icon_anchor: "/img/draw/red.png", //自定义的锚点图标 |
| | | icon_midAnchor: "/img/draw/blue.png", //自定义的中心锚点图标 |
| | | }) |
| | | |
| | | // global.viewer.scene.globe.depthTestAgainstTerrain = true |
| | |
| | | break |
| | | } |
| | | |
| | | if (type == 'polygon') { |
| | | drawThreeTool && drawThreeTool.draw(type, overlay => { |
| | | if (drawFlag) return |
| | | if (overlay) { |
| | | addPlotOverlayData = overlay |
| | | overlay.customType = 'polygon' |
| | | that.$parent.addArrowsListLayer(overlay) |
| | | |
| | | let polygonPosition = overlay.positions.map(item => `${item.lng} ${item.lat}`).join() |
| | | const altitude = overlay.positions.map(item => item.alt).join() |
| | | setTimeout(() => { |
| | | that.$parent.addSaveNewDraw(polygonPosition, 5, altitude) |
| | | }, 100) |
| | | global.viewer.scene.globe.depthTestAgainstTerrain = false |
| | | currentStatus = '' |
| | | that.startDrawFlag = false |
| | | } |
| | | }, { |
| | | let drawConfig = {} |
| | | |
| | | if (type == 'polygon') { |
| | | drawConfig = { |
| | | material: global.DC.Namespace.Cesium.Color.fromBytes(64, 158, 255, 122), |
| | | perPositionHeight: true, |
| | | outline: true, |
| | | outlineColor: global.DC.Namespace.Cesium.Color.fromBytes(64, 158, 255, 255), |
| | | outlineWidth: 4.0, |
| | | }, true) |
| | | } |
| | | } else if (type == 'billboard') { |
| | | drawThreeTool && drawThreeTool.draw(type, overlay => { |
| | | if (drawFlag) return |
| | | if (overlay) { |
| | | drawConfig = { |
| | | size: [32, 32], |
| | | verticalOrigin: global.DC.Namespace.Cesium.VerticalOrigin.BOTTOM, |
| | | color: material, |
| | | // eyeOffset: new global.DC.Namespace.Cesium.Cartesian3(0, 0, -10), |
| | | billboardImage: `/img/icon/${imgUrl}.png` |
| | | } |
| | | } else if (type == 'polyline') { |
| | | drawConfig = { |
| | | material: global.DC.Namespace.Cesium.Color.fromBytes(28, 160, 133, 122), |
| | | } |
| | | } |
| | | |
| | | drawThreeTool.draw(type, overlay => { |
| | | if (drawFlag) return |
| | | if (overlay) { |
| | | if (type == 'polygon') { |
| | | addPlotOverlayData = overlay |
| | | overlay.customType = 'polygon' |
| | | that.$parent.addArrowsListLayer(overlay) |
| | | let polygonPosition = overlay.positions.map(item => `${item.lng} ${item.lat}`).join() |
| | | const altitude = overlay.positions.map(item => item.alt).join() |
| | | setTimeout(() => { |
| | | that.$parent.addSaveNewDraw(polygonPosition, 5, altitude) |
| | | }, 100) |
| | | } |
| | | |
| | | if (type == 'billboard') { |
| | | addPlotOverlayData = overlay |
| | | overlay.customType = 'billboard' |
| | | that.$parent.addPointCircleCarLayer(overlay) |
| | |
| | | } else { |
| | | that.$parent.addPointPopupShow(typeValue, overlay.position) |
| | | } |
| | | global.viewer.scene.globe.depthTestAgainstTerrain = false |
| | | currentStatus = '' |
| | | that.startDrawFlag = false |
| | | } |
| | | }, { |
| | | size: [32, 32], |
| | | verticalOrigin: global.DC.Namespace.Cesium.VerticalOrigin.BOTTOM, |
| | | color: material, |
| | | // eyeOffset: new global.DC.Namespace.Cesium.Cartesian3(0, 0, -10), |
| | | billboardImage: `/img/icon/${imgUrl}.png` |
| | | }, true) |
| | | } else if (type == 'polyline') { |
| | | drawThreeTool && drawThreeTool.draw(type, overlay => { |
| | | if (drawFlag) return |
| | | if (overlay) { |
| | | |
| | | if (type == 'polyline') { |
| | | addPlotOverlayData = overlay |
| | | overlay.customType = 'polyline' |
| | | that.$parent.addLineLayer(overlay) |
| | |
| | | setTimeout(() => { |
| | | that.$parent.addSaveNewDrawLine(polylinePosition, altitude) |
| | | }, 100) |
| | | global.viewer.scene.globe.depthTestAgainstTerrain = false |
| | | currentStatus = '' |
| | | that.startDrawFlag = false |
| | | } |
| | | }, { |
| | | material: global.DC.Namespace.Cesium.Color.fromBytes(28, 160, 133, 122), |
| | | }, true) |
| | | } |
| | | |
| | | global.viewer.scene.globe.depthTestAgainstTerrain = false |
| | | currentStatus = '' |
| | | that.startDrawFlag = false |
| | | } |
| | | }, drawConfig, true) |
| | | }, |
| | | |
| | | removeDrawArrow () { |
| | |
| | | |
| | | stopDraw () { |
| | | if (drawThreeTool) { |
| | | drawFlag = true |
| | | currentStatus == 'draw' && drawThreeTool.stop() |
| | | currentStatus == 'emit' && drawThreeTool.stop(currentEmitEl) |
| | | } |