2023西安数博会CIM演示-【前端】-Web
AdaKing88
2023-08-21 bc03b832caa49bbcd2674fe4cae3701b5059bf95
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
89
90
<!--
 * @Descripttion: 
 * @version: 1.0.0
 * @Author: glc
 * @Date: 2023-04-06 15:43:01
 * @LastEditors: Andy
 * @LastEditTime: 2023-04-13 14:54:15
-->
<template>
  <div class="home">
    <div id="sdkContainerEx"></div>
  </div>
</template>
 
<script>
import Vue from "vue";
import * as SmartEarth from "../../../public/CimSDK/index.js";
export default {
  name: "mapviewEx",
  data() {
    return {
      tableStatus:false,
    };
  },
  methods: {
    init3DMap() {
      window.Cesium = SmartEarth.Cesium;
      window.SmartEarth = SmartEarth;
      let imageryProvider = new SmartEarth.Cesium.TileMapServiceImageryProvider(
        {
          //url: "http://192.168.31.100:8082/gisserver/tmsserver/earth_tms",
          url: "http://103.85.165.99:9001/gisserver/tmsserver/earth_tms",
        }
      );
      window.sgworldEx = Vue.prototype.$earthCtrlEx = new SmartEarth.EarthCtrl(
        "sdkContainerEx",
        {
          licenseServer: LICENSE_URL, //服务器地址
          imageryProvider: imageryProvider,
          StaticFileBaseUrl: "./CimSDK/",
          shouldAnimate:true,
        }
      );
      // 使用单张地图图片
      // window.sgworldEx = Vue.prototype.$earthCtrlEx = new SmartEarth.SGWorld(
      //   "sdkContainerEx",
      //   Cesium,
      //   {
      //     licenseServer: LICENSE_URL,
      //     url: SmartEarthRootUrl + "Workers/image/earth.jpg", //不含单张地图图片url则使用在线地图
      //   }
      // );
      window.ViewerEx = sgworldEx._Viewer;
      // sgworldEx.Navigate.Stop(); //取消飞行状态
      sgworldEx.Navigate.jumpTo({
        //跳转视角
        destination: new Cesium.Cartesian3.fromDegrees(110, 32, 8000000),
      });
      $("#distanceLegendDiv").attr("id", "distanceLegendDiv2");
    },
  },
  mounted() {
    // this.init3DMap();
  },
  watch:{
    "$store.state.tableStatus": function(newValue, oldValue) {
      console.log("console0",newValue)
      if(newValue) this.init3DMap()
      else {window.ViewerEx && window.ViewerEx.destroy();window.ViewerEx = null}
    }
  },
};
</script>
 
<style scoped lang="less">
.home {
  height: 100%;
  width: 100%;
  margin: 0px;
  padding: 0px;
  overflow: hidden;
 
  #sdkContainerEx {
    width: 100%;
    height: 99%;
    margin: 0;
    overflow: hidden;
  }
}
</style>