原文链接及内容

示例代码如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const viewer = new Cesium.Viewer("cesiumContainer");

const redCorridor = viewer.entities.add({
name: "位于地表的红色走廊,带圆角",
corridor: {
positions: Cesium.Cartesian3.fromDegreesArray([
-100.0, 40.0, -105.0, 40.0, -105.0, 35.0,
]),
width: 200000.0,
material: Cesium.Color.RED.withAlpha(0.5),
},
});

const greenCorridor = viewer.entities.add({
name: "有一定高度的绿色走廊,带有斜接角和轮廓线",
corridor: {
positions: Cesium.Cartesian3.fromDegreesArray([
-90.0, 40.0, -95.0, 40.0, -95.0, 35.0,
]),
height: 100000.0,
width: 200000.0,
cornerType: Cesium.CornerType.MITERED,
material: Cesium.Color.GREEN,
outline: true,//必须设置高度才能显示轮廓
},
});

const blueCorridor = viewer.entities.add({
name: "蓝色拉伸的走廊,带有斜切角和轮廓线",
corridor: {
positions: Cesium.Cartesian3.fromDegreesArray([
-80.0, 40.0, -85.0, 40.0, -85.0, 35.0,
]),
height: 200000.0,
extrudedHeight: 100000.0,
width: 200000.0,
cornerType: Cesium.CornerType.BEVELED,
material: Cesium.Color.BLUE.withAlpha(0.5),
outline: true, // 必须设置高度或拉伸高度才能显示轮廓
outlineColor: Cesium.Color.WHITE,
},
});

viewer.zoomTo(viewer.entities);