| | |
| | | //配置文件地址 |
| | | // import config from "../../../../public/config/config"; |
| | | //服务加载配置文件 |
| | | import { Store } from "vuex"; |
| | | import server from "./server"; |
| | | |
| | | import store from "@/store"; |
| | | const InitMap = { |
| | | earthCtrl: null, |
| | | Viewer: null, |
| | |
| | | |
| | | window.sgworld = earthCtrl; |
| | | |
| | | sgworld.Creator.SimpleGraphic.edit(true, { editProp: true }); |
| | | sgworld.Creator.SimpleGraphic.edit(true, { editProp: false }); |
| | | //======================= |
| | | window.Viewer.imageryLayers.removeAll(); |
| | | // window.Viewer.imageryLayers.removeAll(); |
| | | window.setLayer(); |
| | | |
| | | Viewer.scene.globe.depthTestAgainstTerrain = false; // 开启深度测试 |
| | |
| | | sgworld._Viewer.scene.debugShowFramesPerSecond = false; |
| | | sgworld.Navigate.Stop(); //取消飞行状态 |
| | | sgworld.Navigate.setPosition(-1093596.38, 5729026.12, 4136590.41); |
| | | this.addMouseLeftClickEvents(); |
| | | }, |
| | | |
| | | //鼠标左键点击事件添加 |
| | |
| | | window.handleLeftClick = new Cesium.ScreenSpaceEventHandler( |
| | | window.Viewer.scene.canvas |
| | | ); |
| | | var that = this; |
| | | window.handleLeftClick.setInputAction(function (event) { |
| | | let cartesian = window.Viewer.camera.pickEllipsoid(event.position); |
| | | if (cartesian) { |
| | | let cartographic = Cesium.Cartographic.fromCartesian(cartesian); |
| | | let lng = Cesium.Math.toDegrees(cartographic.longitude); // 经度 |
| | | let lat = Cesium.Math.toDegrees(cartographic.latitude); // 纬度 |
| | | let alt = cartographic.height; // 高度,椭球面height永远等于0 |
| | | let coordinate = { |
| | | longitude: Number(lng.toFixed(6)), |
| | | latitude: Number(lat.toFixed(6)), |
| | | altitude: Number(alt.toFixed(2)), |
| | | }; |
| | | let cartesian = window.Viewer.scene.pick(event.position); |
| | | if (Cesium.defined(cartesian)) { |
| | | |
| | | if (cartesian.id.shpType && cartesian.id.shpType == 'temporaryLayer') { |
| | | that.setEditTemporaryLayer() |
| | | } |
| | | |
| | | } |
| | | }, Cesium.ScreenSpaceEventType.LEFT_CLICK); |
| | | }, |
| | | |
| | | setEditTemporaryLayer(res) { |
| | | // store.state.editTemporaryId = res; |
| | | // console.log(store.state.editTemporaryId) |
| | | if (store.state.editTemporaryId) { |
| | | store.state.setEditTemporaryShow = true; |
| | | } |
| | | }, |
| | | addMouseMouseMoveEvents() { |
| | | if (window.handleMouseMove) { |
| | | window.handleMouseMove.removeInputAction( |