| | |
| | | var viewer: Cesium.Viewer | null = null |
| | | export function cesiumOperation () { |
| | | let handler: Cesium.ScreenSpaceEventHandler |
| | | const dimension = ref(3) |
| | | const _init = () => { |
| | | if (viewer) return |
| | | // Cesium Token |
| | |
| | | duration |
| | | }) |
| | | } |
| | | |
| | | // 二维三维切换 |
| | | // 切换为二三维模式 |
| | | const switchModel = (type: string) => { |
| | | switch (type) { |
| | | case '2D': |
| | | viewer?.scene.camera.setView({ |
| | | orientation: { |
| | | pitch: Cesium.Math.toRadians(-60), |
| | | heading: Cesium.Math.toRadians(0), |
| | | } |
| | | }) |
| | | dimension.value = 2 |
| | | break |
| | | case '3D': |
| | | viewer?.scene.camera.setView({ |
| | | orientation: { |
| | | pitch: Cesium.Math.toRadians(-90), |
| | | heading: Cesium.Math.toRadians(0), |
| | | } |
| | | }) |
| | | dimension.value = 3 |
| | | } |
| | | } |
| | | onMounted(() => { |
| | | if (viewer) return |
| | | _init() |
| | |
| | | addPoint, |
| | | removeAllPoint, |
| | | flyTo, |
| | | removeById |
| | | removeById, |
| | | switchModel, |
| | | dimension |
| | | } |
| | | } |