原文链接及内容

效果如下图:

示例代码如下:

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
const czml = [
{
id: "document",
name: "CZML 几何图形: 球体和椭球体",
version: "1.0",
},
{
id: "blueEllipsoid",
name: "蓝色拖球体",
position: {
cartographicDegrees: [-114.0, 40.0, 300000.0],
},
ellipsoid: {
//指定椭球体的半径
radii: {
cartesian: [200000.0, 200000.0, 300000.0],
},
fill: true,
material: {
solidColor: {
color: {
rgba: [0, 0, 255, 255],
},
},
},
},
},
{
id: "redSphere",
name: "红色球体带有黑色轮廓",
position: {
cartographicDegrees: [-107.0, 40.0, 300000.0],
},
ellipsoid: {
radii: {
cartesian: [300000.0, 300000.0, 300000.0],
},
fill: true,
material: {
solidColor: {
color: {
rgba: [255, 0, 0, 100],
},
},
},
outline: true,
outlineColor: {
rgbaf: [0, 0, 0, 1],
},
},
},
{
id: "yellowEllipsoid",
name: "带有黄色轮廓的椭球体",
position: {
cartographicDegrees: [-100.0, 40.0, 300000.0],
},
ellipsoid: {
radii: {
cartesian: [200000.0, 200000.0, 300000.0],
},
fill: false,
outline: true,
outlineColor: {
rgba: [255, 255, 0, 255],
},
slicePartitions: 24,
stackPartitions: 36,
},
},
];

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