在cesium中,我們可以改變其entity線段材質,這里以直線為例.
首先我們先創建一條直線
const redLine = viewer.entities.add({polyline: {positions: Cesium.Cartesian3.fromDegreesArray([-75,35,-125,35,]),width: 5,material:material,
保存后可看到在地圖上創建了一條線段
我們使用cesium提供的方法
//設置虛線材質let material = new Cesium.PolylineDashMaterialProperty({dashLength:16,color: Cesium.Color.RED,})const redLine = viewer.entities.add({polyline: {positions: Cesium.Cartesian3.fromDegreesArray([-75,35,-125,35,]),width: 5,material:material,}})
保存后可見