基于亦庄一张图系统为模板创建的Demo系统
surprise
2024-04-16 f51e0da4c397110b2916a9dc371b6d745042029d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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;