1
Surpriseplus
2022-09-16 8d1a91c23df335b090e38b2edd15203aa3b03da9
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<template>
  <div id="sdkContainer"></div>
</template>
 
<script>
export default {
  name: "mapindex",
  data() {
    return {
      earthimg: require("../../../assets/img/Map/earth.jpg")
    }
  },
  methods: {
    init3DMap() {
      //初始化3D场景
      let option = {
        url: this.earthimg,
        fullscreenButton: true,
        infoBox: true,
        selectionIndicator: true,
        sceneModePicker: false,
        minViewHeight: parseFloat(40),
        contextOptions: {
          failIfMajorPerformanceCaveat: false,
          webgl: {
            alpha: true,
            preserveDrawingBuffer: true
          }
        }
      };
 
      //EPSG4326
      // Cesium.ExpandBySmartEarth.Ellipsoid.z = 6356752.3142451793;
 
      window.sgworld = new SmartEarth.SGWorld(
          'sdkContainer',
          Cesium,
          option,
          null,
          function () {
            sgworld.Navigate.jumpTo({
              //跳转视角
              destination: new Cesium.Cartesian3.fromDegrees(
                  117.321786,
                  38.4955423,
                  76968
              )
            });
          });
      window.Viewer = sgworld._Viewer;
      // Viewer.imageryLayers.removeAll()
      // 地球颜色
      Viewer.scene.globe.baseColor = Cesium.Color.fromCssColorString('#27304a')
    }
  },
  mounted() {
    this.init3DMap();
    //   window.sgworld = new SmartEarth.SGWorld("sdkContainer", Cesium, "/SmartEarthSDK/Workers/image/earth.jpg", null, function () {
    //   });
    //   window.Viewer = sgworld._Viewer;
    //   sgworld.Navigate.Stop(); //取消飞行状态
    //   sgworld.Navigate.jumpTo({      //跳转视角
    //     destination: new Cesium.Cartesian3.fromDegrees(120.47058173784418, 31.793114225237154, 7709.279139522159),
    //     orientation: {
    //       heading: 0.6775942765589988,
    //       pitch: -0.6531148539291864
    //     }
    //   });
    //   //显示fps
    //   sgworld._Viewer.scene.debugShowFramesPerSecond = false;
    //
    //   Viewer.imageryLayers.removeAll()
    //   // 地球颜色
    //   // Viewer.scene.globe.baseColor = Cesium.Color.fromCssColorString('#27304a')
    // }
  }
}
</script>
 
<style scoped>
#sdkContainer {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}
</style>