| | |
| | | } |
| | | } |
| | | |
| | | function removeAllDataSource() { |
| | | viewer.dataSources.removeAll(); |
| | | } |
| | | |
| | | // 清除所有标记点 |
| | | function removeAllPoint () { |
| | | if (viewer) { |
| | |
| | | viewer?.imageryLayers.addImageryProvider(annotation) |
| | | } |
| | | } |
| | | |
| | | //加载json文件 |
| | | const loadGeoJson = (url:string)=>{ |
| | | const option = { |
| | | stroke: Cesium.Color.HOTPINK, |
| | | fill: Cesium.Color.PINK, |
| | | strokeWidth: 3, |
| | | } |
| | | const promise = Cesium.GeoJsonDataSource.load(url,option) |
| | | |
| | | promise.then(dataSource=>{ |
| | | console.log(dataSource) |
| | | viewer.dataSources.add(dataSource); |
| | | }) |
| | | } |
| | | |
| | | // 切换不同背景图层 |
| | | const patternMap = () => { |
| | | const imageryLayers = viewer?.scene.imageryLayers |
| | |
| | | patternMap, |
| | | getEntityById, |
| | | updateEntityPosition, |
| | | addPolyline |
| | | addPolyline, |
| | | loadGeoJson, |
| | | removeAllDataSource |
| | | } |
| | | } |