| | |
| | | "popupsDom", |
| | | "MobileWindowsHideFixed", |
| | | "dimension", |
| | | "dimensionData", |
| | | ]), |
| | | }, |
| | | watch: { |
| | |
| | | // console.log(height); |
| | | }); |
| | | |
| | | // viewer.on(that.DC.SceneEventType.CAMERA_MOVE_END, (e) => { |
| | | viewer.on(that.DC.SceneEventType.CAMERA_CHANGED, (e) => { |
| | | //相机移动最后参数 |
| | | //控制高度 |
| | | const height = Math.ceil(viewer.camera.positionCartographic.height); |
| | | let orientation = { |
| | | heading: that.DC.Namespace.Cesium.Math.toRadians(0), // 方向 |
| | | pitch: that.DC.Namespace.Cesium.Math.toRadians( |
| | | that.dimension == "2D" ? -90 : that.dimension == "2.5D" ? -45 : -45 |
| | | ), // 倾斜角度 |
| | | roll: 0, |
| | | let conBack = (height) => { |
| | | viewer.camera.setView({ |
| | | destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians( |
| | | viewer.camera.positionCartographic.longitude, |
| | | viewer.camera.positionCartographic.latitude, |
| | | height |
| | | ), |
| | | orientation: { |
| | | heading: that.DC.Namespace.Cesium.Math.toRadians( |
| | | that.dimensionData.heading |
| | | ), // 方向 |
| | | pitch: that.DC.Namespace.Cesium.Math.toRadians( |
| | | that.dimensionData.pitch |
| | | ), // 倾斜角度 |
| | | roll: that.dimensionData.roll, |
| | | }, |
| | | }); |
| | | }; |
| | | if (height < 300) { |
| | | viewer.camera.setView({ |
| | | destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians( |
| | | viewer.camera.positionCartographic.longitude, |
| | | viewer.camera.positionCartographic.latitude, |
| | | 300 |
| | | ), |
| | | orientation: orientation, |
| | | }); |
| | | // if (height < 300) { |
| | | // conBack(300); |
| | | // } |
| | | // if (height > 2000) { |
| | | // conBack(2000); |
| | | // } |
| | | if (height < 500) { |
| | | conBack(500); |
| | | } |
| | | if (height > 2000) { |
| | | viewer.camera.setView({ |
| | | destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians( |
| | | viewer.camera.positionCartographic.longitude, |
| | | viewer.camera.positionCartographic.latitude, |
| | | 2000 |
| | | ), |
| | | orientation: orientation, |
| | | }); |
| | | if (height > 6000) { |
| | | conBack(6000); |
| | | } |
| | | }); |
| | | |
| | |
| | | //白模型↑ |
| | | |
| | | //精细模型↓ |
| | | // const tilesetLayer = new that.DC.TilesetLayer("tilesetLayer"); |
| | | // viewer.addLayer(tilesetLayer); |
| | | // const tileset = new that.DC.Tileset( |
| | | // "http://data.mars3d.cn/3dtiles/max-shihua/tileset.json", |
| | | // { |
| | | // luminanceAtZenith: 0.5, |
| | | // } |
| | | // ); |
| | | // tilesetLayer.addOverlay(tileset); |
| | | const tilesetLayer = new that.DC.TilesetLayer("tilesetLayer"); |
| | | viewer.addLayer(tilesetLayer); |
| | | const tileset = new that.DC.Tileset( |
| | | "http://data.mars3d.cn/3dtiles/max-shihua/tileset.json", |
| | | { |
| | | luminanceAtZenith: 0.5, |
| | | } |
| | | ); |
| | | tilesetLayer.addOverlay(tileset); |
| | | // tilesetLayer.show = false; |
| | | //精细模型↑ |
| | | |
| | | // 2.5D贴图↓ |
| | |
| | | // 2.5D贴图↑ |
| | | let startPoint; |
| | | if (false) { |
| | | startPoint = () => { |
| | | viewer.flyTo(tileset); |
| | | // that.$store.dispatch("mapFlyTo", { |
| | | // //飞入 |
| | | // lntLat: [115.87988885, 28.72502592, 2100], |
| | | // // lntLat: [115.87186406, 28.74449337, 1200], |
| | | // // lntLat: [121.50492752204283, 31.21567802276832, 2530], |
| | | // heading: 0, |
| | | // pitch: -45, |
| | | // roll: 0, |
| | | // noOpen: true, |
| | | // }); |
| | | }; |
| | | setTimeout((res) => { |
| | | //转圈 |
| | | that.$store.dispatch("mapFlyTo", { |
| | |
| | | // roll: 0, |
| | | // noOpen: true, |
| | | // }); |
| | | startPoint = () => { |
| | | that.$store.dispatch("mapFlyTo", { |
| | | //飞入 |
| | | lntLat: [115.87988885, 28.72502592, 2100], |
| | | // lntLat: [115.87186406, 28.74449337, 1200], |
| | | // lntLat: [121.50492752204283, 31.21567802276832, 2530], |
| | | heading: 0, |
| | | pitch: -45, |
| | | roll: 0, |
| | | noOpen: true, |
| | | }); |
| | | }; |
| | | |
| | | startPoint(); |
| | | }, |
| | | }); |
| | | // viewer.flyTo(tileset); |
| | | }, 2500); |
| | | } else { |
| | | startPoint = (val) => { |
| | | console.log(val); |
| | | startPoint = () => { |
| | | // viewer.zoomToPosition( |
| | | // new DC.Position(115.86798885, 28.72502592, 2100, 0, -45) |
| | | // ); |
| | |
| | | ), |
| | | orientation: { |
| | | // 指向 |
| | | heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0), |
| | | heading: that.DC.Namespace.Cesium.Math.toRadians( |
| | | that.dimensionData.heading |
| | | ), |
| | | // 视角 |
| | | pitch: that.DC.Namespace.Cesium.Math.toRadians( |
| | | val == "2D" ? -90 : val == "2.5D" ? -45 : -45 |
| | | that.dimensionData.pitch |
| | | ), |
| | | roll: 0.0, |
| | | roll: that.dimensionData.roll, |
| | | }, |
| | | }); |
| | | }; |
| | | startPoint(that.dimension); |
| | | startPoint(); |
| | | } |
| | | //传递默认位置 |
| | | that.$store.commit("MSET_MORENWEIZHI", startPoint); |
| | |
| | | viewer.distanceLegend.enable = false; |
| | | if (true) { |
| | | // viewer.scene.screenSpaceCameraController.enableZoom = false; //控制视角缩放 |
| | | viewer.scene.screenSpaceCameraController.enableTilt = false; //控制视角旋转 |
| | | // viewer.scene.screenSpaceCameraController.enableTilt = false; //控制视角旋转 |
| | | // viewer.scene.screenSpaceCameraController.minimumZoomDistance = 200; //最小缩放 |
| | | // viewer.scene.screenSpaceCameraController.maximumZoomDistance = 1900; //最大缩放 |
| | | // 2D和哥伦布视图 |
| | | // 控制视角平移:scene.screenSpaceCameraController.enableTranslate = true; |
| | | // 最小 |
| | | viewer.scene.screenSpaceCameraController.minimumZoomDistance = 500; |
| | | // 最大 |
| | | viewer.scene.screenSpaceCameraController.maximumZoomDistance = 6000; |
| | | // 设置相机缩小时的速率 |
| | | viewer.scene.screenSpaceCameraController._minimumZoomRate = 30000; |
| | | // 设置相机放大时的速率 |
| | | viewer.scene.screenSpaceCameraController._maximumZoomRate = 5906376272000; |
| | | // 视角平移 |
| | | viewer.scene.screenSpaceCameraController.enableRotate = true; |
| | | // 视角缩放 |
| | | viewer.scene.screenSpaceCameraController.enableZoom = true; |
| | | // 视角旋转 |
| | | viewer.scene.screenSpaceCameraController.enableTilt = false; |
| | | } |
| | | } |
| | | |