原文链接及内容

效果如下图所示:

示例代码如下:

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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
const czml = [
{
id: "document",
name: "CZML几何图形: 矩形",
version: "1.0",
},
{
id: "redRectangle",
name: "拉伸后的红色矩形,带有黑色轮廓",
rectangle: {
coordinates: {
wsenDegrees: [-120, 40, -110, 50],
},
height: 600000,
extrudedHeight: 0,
fill: true,
material: {
solidColor: {
color: {
rgba: [255, 0, 0, 100],
},
},
},
outline: true,
outlineColor: {
rgba: [0, 0, 0, 255],
},
},
},
{
id: "stripe(条纹/斑纹)Rectangle",
name: "带有蓝色/绿色条纹的矩形",
rectangle: {
coordinates: {
wsenDegrees: [-105, 40, -95, 50],
},
height: 0,
fill: true,
material: {
stripe: {
orientation: "VERTICAL",//垂直方向
evenColor: { rgba: [0, 255, 0, 255] },
oddColor: { rgba: [0, 0, 255, 255] },
repeat: 5,
},
},
},
},
{
id: "yellowRectangle",
name: "拉伸后的黄色矩形,带有黄色轮廓",
rectangle: {
coordinates: {
wsenDegrees: [-90, 40, -80, 50],
},
height: 600000,
extrudedHeight: 0,
fill: false,
outline: true,
outlineColor: {
rgba: [255, 255, 0, 255],
},
outlineWidth: 2,
rotation: 0.5,
},
},
{
id: "texture(纹理)Rectangle",
name: "使用图片渲染的矩形, 位于地表上方",
rectangle: {
coordinates: {
wsenDegrees: [-75, 40, -50, 45],
},
height: 600000,
fill: true,
material: {
image: {
image: { uri: "../images/Cesium_Logo_Color.jpg" },
color: {
rgba: [255, 255, 255, 128],
},
},
},
},
},
];

const viewer = new Cesium.Viewer("cesiumContainer");
const dataSourcePromise = Cesium.CzmlDataSource.load(czml);
viewer.dataSources.add(dataSourcePromise);
viewer.zoomTo(dataSourcePromise);