const draw = new Draw({ view: window.customMap })
const graphicsLayer = new GraphicsLayer({
id: 'custom-draw-layer'
})
window.customMap.map.add(graphicsLayer)
// 画线
const action = draw.create('polyline', { mode: 'click' })
action.on(['vertex-add'], (event) => {
const paths = event.vertices.map((item) => webMercatorUtils.xyToLngLat(item[0], item[1]))
const polylineGraphic = new Graphic()
polylineGraphic.geometry = {
type: 'polyline',
paths
}
polylineGraphic.symbol = new SimpleLineSymbol({
color: '#ff0000',
width: '3px',
style: 'solid'
})
graphicsLayer.add(polylineGraphic)
})
vue3 + arcgis.js4.x---new Draw画板功能(画线)
2024-06-08 08:50:02 9 阅读