|
|
@ -6,6 +6,12 @@
|
|
|
|
import { onMounted, ref } from 'vue'
|
|
|
|
import { onMounted, ref } from 'vue'
|
|
|
|
import * as Cesium from 'cesium'
|
|
|
|
import * as Cesium from 'cesium'
|
|
|
|
import 'cesium/Build/Cesium/Widgets/widgets.css'
|
|
|
|
import 'cesium/Build/Cesium/Widgets/widgets.css'
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
|
|
|
TDTLayerType,
|
|
|
|
|
|
|
|
TDTProjectionType,
|
|
|
|
|
|
|
|
getTDTProvider,
|
|
|
|
|
|
|
|
getTDTTerrainProvider,
|
|
|
|
|
|
|
|
} from '@/utils/map/TDTProvider'
|
|
|
|
const viewerDivRef = ref<HTMLDivElement>()
|
|
|
|
const viewerDivRef = ref<HTMLDivElement>()
|
|
|
|
window.CESIUM_BASE_URL = 'node_modules/cesium/Build/Cesium/'
|
|
|
|
window.CESIUM_BASE_URL = 'node_modules/cesium/Build/Cesium/'
|
|
|
|
// window.CESIUM_BASE_URL = 'libs/cesium/' //打包部署
|
|
|
|
// window.CESIUM_BASE_URL = 'libs/cesium/' //打包部署
|
|
|
@ -47,12 +53,48 @@ onMounted(async () => {
|
|
|
|
//去除cesium logo,隐藏版本信息
|
|
|
|
//去除cesium logo,隐藏版本信息
|
|
|
|
const creditContainer = viewer.cesiumWidget.creditContainer as HTMLDivElement
|
|
|
|
const creditContainer = viewer.cesiumWidget.creditContainer as HTMLDivElement
|
|
|
|
creditContainer.style.display = 'none'
|
|
|
|
creditContainer.style.display = 'none'
|
|
|
|
|
|
|
|
// 抗锯齿
|
|
|
|
|
|
|
|
// 是否支持图像渲染像素化处理
|
|
|
|
|
|
|
|
// if (Cesium.FeatureDetection.supportsImageRenderingPixelated()) {
|
|
|
|
|
|
|
|
// viewer.resolutionScale = window.devicePixelRatio
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
viewer.scene.postProcessStages.fxaa.enabled = true
|
|
|
|
|
|
|
|
// 水雾特效
|
|
|
|
|
|
|
|
viewer.scene.globe.showGroundAtmosphere = true
|
|
|
|
|
|
|
|
// 关闭太阳,月亮,天空盒,雾等相关特效
|
|
|
|
|
|
|
|
viewer.scene.moon.show = false
|
|
|
|
|
|
|
|
viewer.scene.fog.enabled = false
|
|
|
|
|
|
|
|
viewer.scene.sun.show = false
|
|
|
|
|
|
|
|
viewer.scene.skyBox.show = false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//添加天地图影像
|
|
|
|
|
|
|
|
viewer.imageryLayers.addImageryProvider(
|
|
|
|
|
|
|
|
getTDTProvider(TDTLayerType.Img, TDTProjectionType.WebMercator),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
//添加天地图影像注记
|
|
|
|
|
|
|
|
viewer.imageryLayers.addImageryProvider(
|
|
|
|
|
|
|
|
getTDTProvider(TDTLayerType.Cia, TDTProjectionType.WebMercator),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
// 添加三维地形服务
|
|
|
|
|
|
|
|
viewer.terrainProvider = getTDTTerrainProvider()
|
|
|
|
|
|
|
|
// 将三维球定位到中国
|
|
|
|
|
|
|
|
viewer.camera.flyTo({
|
|
|
|
|
|
|
|
destination: Cesium.Cartesian3.fromDegrees(103.84, 31.15, 12550000),
|
|
|
|
|
|
|
|
orientation: {
|
|
|
|
|
|
|
|
heading: Cesium.Math.toRadians(348.4202942851978),
|
|
|
|
|
|
|
|
pitch: Cesium.Math.toRadians(-89.74026687972041),
|
|
|
|
|
|
|
|
roll: Cesium.Math.toRadians(0),
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
complete: function callback() {
|
|
|
|
|
|
|
|
// 定位完成之后的回调函数
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
<style scoped>
|
|
|
|
#cesium-viewer {
|
|
|
|
#cesium-viewer {
|
|
|
|
width: 100%;
|
|
|
|
width: 100%;
|
|
|
|
height: 100vh;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</style>
|
|
|
|