From fe0b336af036e874203a978dd8e6391039ec545a Mon Sep 17 00:00:00 2001 From: surprise <15810472099@163.com> Date: 星期日, 28 四月 2024 16:19:18 +0800 Subject: [PATCH] 代码跟新 --- src/components/viewer.vue | 66 ++++++++++++++++++++++++++++++--- 1 files changed, 60 insertions(+), 6 deletions(-) diff --git a/src/components/viewer.vue b/src/components/viewer.vue index 40031bb..6b5273a 100644 --- a/src/components/viewer.vue +++ b/src/components/viewer.vue @@ -1,5 +1,11 @@ <template> <div> + <div class="imgbox" + v-if="showFlyimg"> + <img src="../assets/image/feixingqi.png" + alt="" /> + </div> + <div id="app1"></div> </div> </template> @@ -22,7 +28,9 @@ export default { name: "App", data () { - return {}; + return { + showFlyimg: false, + }; }, methods: { init () { @@ -61,6 +69,7 @@ window.Viewer=webgis.Viewer; window.viewer=webgis.Viewer; window.Cesium=Cesium; + let that=this; window.layers=window.sgworld.Viewer.scene.imageryLayers; // const blackMarble = layers.addImageryProvider( @@ -87,14 +96,42 @@ // }); window.Viewer.camera.flyTo({ destination: Cesium.Cartesian3.fromDegrees( - 120.37492388223879, - 30.91054534935262, - 97611.15133443385 + 109.26943037557801, + 35.94483222064199, + 7052792.362399457 ), orientation: { - heading: 1.249372341578318, - pitch: -0.7222154573481174, + heading: 6.166296249767834, + pitch: -1.564875679684365, roll: 0, + }, + complete: function callback () { + viewer.camera.changed.addEventListener(() => { + // 瑙嗛珮 km + let alt=( + viewer.camera.positionCartographic.height/1000 + ).toFixed(2); + // 鏂逛綅瑙� + let heading=Cesium.Math.toDegrees( + viewer.camera.heading + ).toFixed(2); + // 淇话瑙� + let pitch=Cesium.Math.toDegrees(viewer.camera.pitch).toFixed( + 2 + ); + // 缈绘粴瑙� + let roll=Cesium.Math.toDegrees(viewer.camera.roll).toFixed(2); + // 绾у埆 + let level=0; + let tileRender=viewer.scene._globe._surface._tilesToRender; + if(tileRender&&tileRender.length>0) { + level=viewer.scene._globe._surface._tilesToRender[0]._level; + } + // let str = `绾ф暟锛�${level} 瑙嗛珮锛�${alt}km 鏂逛綅瑙掞細${heading}掳 淇话瑙掞細${pitch}掳 缈绘粴瑙掞細${roll}掳`; + console.log(pitch); + that.showFlyimg=pitch<-60? true:false; + // console.log(that.showFlyimg); + }); }, }); let urldian1= @@ -276,6 +313,10 @@ SC27: () => import("@/components/props/situationComparison10-4"), SC28: () => import("@/components/props/situationComparison7-10"), SC29: () => import("@/components/props/situationComparison7-11"), + SC30: () => import("@/components/props/situationComparison7-12"), + + SC31: () => import("@/components/props/militaryVIdeo"), //鍐涗簨鏍囩粯 + }, }); }, @@ -287,6 +328,19 @@ </script> <style> +.imgbox { + position: absolute; + /* background-color: #fff; */ + /* opacity: 0.2;. */ + /* top:50px; */ + width: 100%; + height: 500px; +} +img { + width: 100%; + height: 100%; + -webkit-user-drag: none; +} #app1 { font-family: "Avenir", Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; -- Gitblit v1.9.3