Appearance
概述
Cesium中的三维几何实体(3D Entities)是基于 Entity API 封装的体积图形,能够在球面地球上构建可视化的三维形状,例如:球体,锥体,走廊,外墙等。
| 几何类型 | Entity 属性名 | 关键参数 | 用途场景(建筑 / 分析 / 可视化) | 特点 |
|---|---|---|---|---|
| 立方体 / 长方体 | box | dimensions(x, y, z) | 建筑体块、设备箱体、空间区域 | 固定尺寸体积,可旋转、可悬浮 |
| 圆柱体 | cylinder | length、 topRadius、 bottomRadius | 水塔、柱子、管道、塔体 | top = bottom 得圆柱,支持透明材质 |
| 圆锥体 | cylinder | topRadius = 0 | 塔尖、信号塔、锥形体 | 通过 topRadius=0 实现锥体 |
| 椭球体(球) | ellipsoid | radii(x, y, z) | 球体、感知范围、雷达可视域 | 可模拟球体 / 椭球体,支持透明材质 |
| 墙体(Wall) | wall | positions、 minHeights、 maxHeights | 围墙、建筑外墙、剖面墙、竖直面 | 沿路径生成竖直墙面,可不规则高度 |
| 拉伸多边形(Extruded Polygon) | polygon | hierarchy、 extrudedHeight | 建筑体量、地块立体化、围栏 | 直接从面拉成建筑,非常常用 |
| 拉伸矩形(Extruded Rectangle) | rectangle | coordinates、 extrudedHeight | 建筑框体、立方空间 | 规则平面 → 立体高度 |
| 拉伸椭圆(Extruded Ellipse) | ellipse | semiMajorAxis、 semiMinorAxis、 extrudedHeight | 圆形建筑、仓库、筒体结构 | 规则圆形 → 柱状立体,可代替 cylinder |
| 走廊(Corridor)(非严格体,但常用于 3D) | corridor | positions、 width | 道路、河道、管廊可视化 | 有厚度的带状区域,可拉伸 |
javascript
// 圆柱体、圆锥体
viewer.entities.add({
position: Cesium.Cartesian3.fromDegrees(121.47, 31.23, 100),
cylinder: {
length: 40000.0,
topRadius: 20000.0,
bottomRadius: 20000.0,
material: Cesium.Color.GREEN.withAlpha(0.5),
outline: true,
outlineColor: Cesium.Color.BLACK,
},
})
// 走廊
viewer.entities.add({
position: Cesium.Cartesian3.fromDegrees(123.47, 31.23, 100),
corridor: {
positions: Cesium.Cartesian3.fromDegreesArray([
123.47, 31.23,
122.47, 31.23,
122.47, 30.23,
]),
width: 20000.0,
material: Cesium.Color.RED.withAlpha(0.5),
},
})
// 围墙
viewer.entities.add({
wall: {
positions: Cesium.Cartesian3.fromDegreesArrayHeights([
124.47, 31.23, 50000,
125.47, 31.23, 50000,
125.47, 28.23, 50000,
124.47, 28.23, 50000,
124.47, 31.23, 50000,
]),
material: Cesium.Color.BLUE,
outline: true,
},
})