import mapClick from "./mapClick"; import store from "@/store"; import mapDobule from "@/assets/js/mapDobule"; const mapView = { init() { window.earthCtrl = new SmartEarth.EarthCtrl("cesiumContainer", { printLog: false, }); window.Viewer = earthCtrl._Viewer; window.Cesium = SmartEarth.Cesium; earthCtrl.camera.stop(); //取消飞行状态 // 飞行定位 this.setMapFly({ lon: 120.862482, lat: 44.7786221, alt: 300000, heading: 6.283185307179586, pitch: -1.5707963267948966, roll: 0, }); // 120.923461, 44.232539 mapClick.Init(); }, setMapFly(res) { //设置初始视图位置 Viewer.camera.flyTo({ // fromDegrees()方法,将经纬度和高程转换为世界坐标 destination: Cesium.Cartesian3.fromDegrees(res.lon, res.lat, res.alt), orientation: { // 方向 heading: res.heading ? res.heading : 0, // 视角 pitch: res.pitch ? res.pitch : 0, // 倾斜角度 roll: res.roll ? res.roll : 0, }, }); }, }; export default mapView;