| | |
| | | pitch?: number |
| | | roll?: number |
| | | } |
| | | |
| | | interface ellipseOption { |
| | | longitude: number |
| | | latitude: number |
| | | } |
| | | |
| | | // 定义全局的viewer变量防止重复生成 |
| | | // eslint-disable-next-line no-var |
| | | var viewer: Cesium.Viewer | null = null |
| | |
| | | '&style=default&format=tiles&tk=' + TDT_Token |
| | | // 标准地图注记 |
| | | const TID_STAND = 'https://{s}.tianditu.gov.cn/vec_w/wmts?service=wmts&request=GetTile&version=1.0.0' + |
| | | '&LAYER=img&tileMatrixSet=c&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}' + |
| | | '&style=default&format=tiles&tk=' + TDT_Token |
| | | '&LAYER=img&tileMatrixSet=c&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}' + |
| | | '&style=default&format=tiles&tk=' + TDT_Token |
| | | // 天地图图层变量 |
| | | const imageryProvider_tdt = new Cesium.WebMapTileServiceImageryProvider({ |
| | | url: TDT_IMG_C, |
| | |
| | | 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) |
| | | } |
| | | |
| | | // 添加线段 |
| | |
| | | addPolyline, |
| | | loadGeoJson, |
| | | removeAllDataSource |
| | | addPolyline, |
| | | addEllipse |
| | | } |
| | | } |