| | |
| | | pitch?: number |
| | | roll?: number |
| | | } |
| | | |
| | | interface ellipseOption { |
| | | longitude: number |
| | | latitude: number |
| | | } |
| | | |
| | | // 定义全局的viewer变量防止重复生成 |
| | | // eslint-disable-next-line no-var |
| | | var viewer: Cesium.Viewer | null = null |
| | |
| | | label: pointOption.label, |
| | | id: pointOption.id, |
| | | }) |
| | | } |
| | | // 添加半径为7公里的范围的圆 |
| | | const addEllipse = ({ longitude, latitude }: ellipseOption) => { |
| | | if (!longitude && !latitude) return |
| | | const position = Cesium.Cartesian3.fromDegrees(longitude, latitude) |
| | | viewer?.entities.add({ |
| | | position, |
| | | id: 'rangeEllipse', |
| | | name: 'rangeEllipse', |
| | | ellipse: { |
| | | semiMinorAxis: 7000.0, |
| | | semiMajorAxis: 7000.0, |
| | | material: Cesium.Color.CORNFLOWERBLUE.withAlpha(0.3), |
| | | } |
| | | }) |
| | | console.log(viewer?.entities) |
| | | } |
| | | |
| | | // 添加线段 |
| | |
| | | getEntityById, |
| | | updateEntityPosition, |
| | | addPolyline, |
| | | addEllipse, |
| | | loadGeoJson, |
| | | removeAllDataSource |
| | | } |