From 145b971fddfc3f85a10769555f4cab56ae1fcb57 Mon Sep 17 00:00:00 2001 From: shijing Date: Wed, 3 Apr 2024 17:07:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E9=A6=96=E9=A1=B5=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/bigScreen/cesiumtest.vue | 39 +- src/views/bigScreen/index_enp_blue.vue | 2167 ++++++++++++++---------- 2 files changed, 1259 insertions(+), 947 deletions(-) diff --git a/src/views/bigScreen/cesiumtest.vue b/src/views/bigScreen/cesiumtest.vue index ea65cff6..861c6f8d 100644 --- a/src/views/bigScreen/cesiumtest.vue +++ b/src/views/bigScreen/cesiumtest.vue @@ -418,11 +418,13 @@ export default { var url = "photon_tree.glb"; var height = 0; viewer.entities.removeAll(); //加载之前先清楚所有entity - // 88.64349, + // 88.64349, // 42.72285, var position = Cesium.Cartesian3.fromDegrees( - 88.69159, - 42.73185, + 88.64349, + 42.72285, + // 88.69159, + // 42.73185, height ); var heading = Cesium.Math.toRadians(191); //310度转弧度 @@ -447,13 +449,29 @@ export default { maximumScale: 20000, //模型的最大比例尺大小。minimumPixelSize的上限 }, }); - // that.setTrees(viewer, orientation); - viewer.trackedEntity = modelEntity; // 聚焦模型 - //设置相机位置 - viewer.zoomTo( - modelEntity, - new Cesium.HeadingPitchRange(0.3, -0.5, 900) + var destination_tree = Cesium.Cartesian3.fromDegrees( + 88.64349, + 42.72285, + 900 ); + var roll_tree = Cesium.Math.toRadians(-100); + var hpr_tree = new Cesium.HeadingPitchRoll(heading, pitch, roll_tree); + var orientation_camer = Cesium.Transforms.headingPitchRollQuaternion( + destination_tree, + hpr_tree + ); + viewer.camera.setView({ + destination: destination_tree, + orientation: orientation_camer, + }); + + // that.setTrees(viewer, orientation); + // viewer.trackedEntity = modelEntity; // 聚焦模型 + // //设置相机位置 + // viewer.zoomTo( + // modelEntity, + // new Cesium.HeadingPitchRange(0.3, -0.5, 900) + // ); that.getEquipmentList(); // 监听鼠标左键点击事件 var handler = new Cesium.ScreenSpaceEventHandler(viewer.canvas); @@ -820,10 +838,9 @@ export default { }, beforeUnmount() { // viewer.destroy(); - this.viewer.entities.removeAll() + this.viewer.entities.removeAll(); this.viewer = null; }, - }; \ No newline at end of file +