| | |
| | | item.dataSource = dataSource // 保存数据源以便后续删除 |
| | | // 获取数据源中的实体 |
| | | const entities = dataSource.entities.values |
| | | |
| | | entities.forEach(entity => { |
| | | let material = new PolyGradientMaterial({ |
| | | color: Cesium.Color.fromCssColorString(getColor()), |
| | |
| | | alphaPower: 1.3 |
| | | }) |
| | | |
| | | entity.polygon.extrudedHeight = (entity.propertyNames.length || 1) * 500 |
| | | |
| | | entity.polygon.material = material |
| | | entity.polygon.outline = false // 显示边框 |
| | | }) |
| | | flyTo && |
| | | viewer.flyTo(dataSource, { |
| | | offset: new Cesium.HeadingPitchRange( |
| | | 0, // heading: 0 (朝向不变) |
| | | Cesium.Math.toRadians(-90), // pitch: -90° (垂直向下) |
| | | 0 // range: 0 (默认距离) |
| | | ), |
| | | duration: 0.5, |
| | | }) |
| | | |
| | | flyTo && viewer.flyTo(dataSource, { |
| | | offset: new Cesium.HeadingPitchRange( |
| | | 0, // heading: 0 (朝向不变) |
| | | Cesium.Math.toRadians(-60), // pitch: -90° (垂直向下) |
| | | 0 // range: 0 (默认距离) |
| | | ), |
| | | duration: 0.5, |
| | | }) |
| | | }) |
| | | } |
| | | |