| | |
| | | <template> |
| | | <div class="body_box"> |
| | | <div id="cesiumContainer"></div> |
| | | <!-- <button id="btn1" class="layui-btn" @click="cameraInfo()">相机参数</button> --> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | }; |
| | | }, |
| | | methods: { |
| | | cameraInfo() { |
| | | // 获取当前相机位置的xyz坐标 |
| | | var cameraPosition = Viewer.camera.position; |
| | | |
| | | // 获取当前相机的姿态(heading、pitch、roll) |
| | | var cameraHeading = Viewer.camera.heading; |
| | | var cameraPitch = Viewer.camera.pitch; |
| | | var cameraRoll = Viewer.camera.roll; |
| | | |
| | | // 构建警报框中的消息 |
| | | var message = 'Camera Position (x, y, z):\n' + |
| | | cameraPosition.x.toFixed(2) + ', ' + |
| | | cameraPosition.y.toFixed(2) + ', ' + |
| | | cameraPosition.z.toFixed(2) + '\n\n' + |
| | | 'Camera Heading: ' + cameraHeading.toFixed(2) + '\n' + |
| | | 'Camera Pitch: ' + cameraPitch.toFixed(2) + '\n' + |
| | | 'Camera Roll: ' + cameraRoll.toFixed(2); |
| | | |
| | | // 弹出警报框显示相机位置和姿态 |
| | | alert(message); |
| | | }, |
| | | // wmts加载 |
| | | AddWmtesLayer(url, id) { |
| | | var urlTemplateImageryProvider = earthCtrl.factory.createImageryLayer({ |
| | |
| | | ); |
| | | //页面初始化 |
| | | this.earthCtrl = new SmartEarth.EarthCtrl("cesiumContainer", { |
| | | // StaticFileBaseUrl: StaticFileBaseUrl, |
| | | StaticFileBaseUrl: StaticFileBaseUrl, |
| | | ellipsoidCoordinates: "MOON", |
| | | }); |
| | | this.earthCtrl.environment.disableAllEffect(); |
| | |
| | | window.Cesium = SmartEarth.Cesium; |
| | | |
| | | window.sgworld = earthCtrl; |
| | | |
| | | sgworld.Navigate.Stop(); //取消飞行状态 |
| | | sgworld.Creator.SimpleGraphic.edit(true, { editProp: true }); |
| | | sgworld.Navigate.setPosition(-1093596.38, 5729026.12, 4136590.41); |
| | | var token = getToken(); |
| | | var demUrl = `${BASE_URL}/proxy/${token}/24` |
| | | var wmtsUrl = `${BASE_URL}/proxy/${token}/17` |
| | |
| | | // }), |
| | | // }); |
| | | // window.Viewer.terrainProvider = terrain; |
| | | |
| | | |
| | | }, |
| | | }, |
| | | mounted() { |