| | |
| | | outlineWidth: number, |
| | | [key: string]: any |
| | | } |
| | | interface polyline { |
| | | width?: number |
| | | material?: Cesium.Color |
| | | [key: string]: any |
| | | } |
| | | interface pointOption { |
| | | longitude: number |
| | | latitude: number |
| | | point?: pointSetting |
| | | billboard?: billboardSetting |
| | | polyline?: polyline |
| | | label?: labelSetting |
| | | id?: string |
| | | heading?: number |
| | |
| | | }) |
| | | } |
| | | |
| | | // 添加线段 |
| | | const addPolyline = (pointOption: pointOption) => { |
| | | viewer?.entities.add({ |
| | | polyline: pointOption.polyline, |
| | | id: pointOption.id, |
| | | }) |
| | | } |
| | | |
| | | // 通过点ID删除 |
| | | function removeById (id:string) { |
| | | viewer?.entities.removeById(id) |
| | |
| | | } |
| | | } |
| | | // 飞行 flyto |
| | | const flyTo = (pointOption: pointOption, time: number = 4) => { |
| | | const flyTo = (pointOption: pointOption, time: number = 4, height:number = 3000) => { |
| | | if (!pointOption.longitude && !pointOption.latitude) return |
| | | const destination = Cesium.Cartesian3.fromDegrees(pointOption.longitude, pointOption.latitude, 3000) |
| | | const destination = Cesium.Cartesian3.fromDegrees(pointOption.longitude, pointOption.latitude, height) |
| | | const duration = time |
| | | viewer?.camera.flyTo({ |
| | | destination, |
| | |
| | | roadPattern, |
| | | patternMap, |
| | | getEntityById, |
| | | updateEntityPosition |
| | | updateEntityPosition, |
| | | addPolyline |
| | | } |
| | | } |