cesium polyline转角处平滑
时间: 2023-12-01 13:42:12 浏览: 248
为了使Cesium的Polyline在转角处平滑,可以使用PolylineGlowMaterialProperty和PolylineOutlineMaterialProperty。这两个属性可以使Polyline在转角处平滑,并且可以自定义线条的颜色和宽度。以下是一个使用PolylineGlowMaterialProperty的示例代码:
```javascript
// 创建Polyline
var polyline = viewer.entities.add({
name: 'Polyline',
polyline: {
positions: Cesium.Cartesian3.fromDegreesArray([
-75, 35,
-125, 35
]),
width: 10,
material: new Cesium.PolylineGlowMaterialProperty({
glowPower: 0.2,
color: Cesium.Color.YELLOW
})
}
});
```
以下是一个使用PolylineOutlineMaterialProperty的示例代码:
```javascript
// 创建Polyline
var polyline = viewer.entities.add({
name: 'Polyline',
polyline: {
positions: Cesium.Cartesian3.fromDegreesArray([
-75, 35,
-125, 35
]),
width: 10,
material: new Cesium.PolylineOutlineMaterialProperty({
color: Cesium.Color.YELLOW,
outlineWidth: 2,
outlineColor: Cesium.Color.BLACK
})
}
});
```
阅读全文