管道基础大数据平台系统开发-【前端】-新系統界面
Surpriseplus
2023-04-17 7263216c2d1ae22523a5cac666bb172fd0f539f5
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<template>
  <div class="ParentCentermapdiv">
    <div id="Centermapdiv"></div>
  </div>
</template>
 
<script>
let yunxuanLayer = null
export default {
  name: "",
  components: {},
  data() {
    return {}
  },
  mounted() {
    this.init3DMap()
    // this.$bus.$on("changeProject", name => {
    //   if (!yunxuanLayer) {
    //     var urls = "https://tiles3.geovisearth.com/base/v1/ter"
    //     // 星图地球地形晕渲
    //     yunxuanLayer = sgworld.Creator.createUrlTemplateImageryProvider(
    //       "星图地球地形晕渲",
    //       {
    //         url:
    //           urls +
    //           "/{z}/{x}/{y}?format=webp&token=486dac3bec56d7d7c2a581c150be2bd937462f1e8f3bc9c78b5658b396122405",
    //       },
    //       "0",
    //       undefined,
    //       true,
    //       ""
    //     )
    //   }
    //   if (name == '全球项目') {
    //     yunxuanLayer.item.show = true
    //   } else {
    //     yunxuanLayer.item.show = false
    //   }
    // })
  },
  methods: {
    init3DMap() {
      //地图初始化
      // window.sgworld = new SmartEarth.SGWorld("Centermapdiv", {
      //   licenseServer: window.sceneConfig.licenseServer,
      // })
      // window.sgworld = new SmartEarth.SGWorld(
      //   "Centermapdiv",
      //   function () { }
      // )
      window.sgworld = new SmartEarth.SGWorld("Centermapdiv", {
        url: SmartEarthRootUrl + "Workers/image/earth.jpg",
        licenseServer: window.sceneConfig.licenseServer,
      });
      window.viewer = window.Viewer = window.sgworld._Viewer;
      // Viewer.imageryLayers._layers[0].show = false
      sgworld.Navigate.jumpTo({      //跳转视角
        destination: new Cesium.Cartesian3.fromDegrees(110, 32, 50000000)
      });
      setTimeout(() => {
        window.viewer.camera.flyTo({
          destination: new Cesium.Cartesian3.fromDegrees(110, 32, 20000000),
          orientation: {
            heading: Cesium.Math.toRadians(0),
            pitch: Cesium.Math.toRadians(-90),
          }
        })
      }, 1000);
 
      // Viewer.imageryLayers.addImageryProvider(
      //   new Cesium.UrlTemplateImageryProvider({
      //     url: gaoDeBaseUrl[0].url,
      //   })
      // )
      //
 
      var base_ulr = window.sceneConfig.baseUrl;
      if (base_ulr.indexOf('{host}') > -1) {
        base_ulr = base_ulr.replace("{host}", iisHost)
      }
 
      window.BaseMapLayer = Viewer.imageryLayers.addImageryProvider(
        new Cesium.UrlTemplateImageryProvider({
          url: base_ulr,
          maximumLevel: 22,
        })
      );
 
      var base_ulr_sl = window.sceneConfig.baseUrl_sl;
      if (base_ulr_sl.indexOf('{host}') > -1) {
        base_ulr_sl = base_ulr_sl.replace("{host}", iisHost)
      }
 
      window.BaseMapLayer = Viewer.imageryLayers.addImageryProvider(
        new Cesium.UrlTemplateImageryProvider({
          url: base_ulr_sl,
          maximumLevel: 22,
        })
      );
 
      Viewer.imageryLayers._layers[2].show = false
 
      // Viewer.imageryLayers.addImageryProvider(
      //   new Cesium.UrlTemplateImageryProvider({
      //     url: gaoDeBaseUrl[1].url,
      //   })
      // )
      // Viewer.imageryLayers.addImageryProvider(
      //   new Cesium.UrlTemplateImageryProvider({
      //     url: gaoDeBaseUrl[2].url,
      //   })
      // )
 
      Viewer._enableInfoOrSelection = false
      //显示fps
      Viewer.scene.debugShowFramesPerSecond = false
      //导航控件
      window.sgworld.navControl("nav", false)
      //比例尺
      window.sgworld.navControl("scale", false)
      //开启深度检测
      sgworld.Analysis.depthTestAgainstTerrain(true)
 
      // Viewer.terrainProvider = new Cesium.CesiumTerrainProvider({
      //   url: demLayer,
      // })
      var option = {
        url: window.sceneConfig.SGUrl,
        layerName: window.sceneConfig.mptName,
        requestVertexNormals: true,
      };
      window.terrainLayer = sgworld.Creator.sfsterrainprovider("", option, "", true, "");
      //改变天空颜色为黑色
      Viewer.scene.skyBox.show = false //关闭天空盒,否则会显示天空颜色
      //背景透明
      Viewer.scene.backgroundColor = new Cesium.Color(0.0, 0.0, 0.0, 0.0)
    },
  },
}
</script>
 
<style scoped lang="less">
.ParentCentermapdiv {
  display: fixed;
  height: 100%;
  width: 100%;
}
#Centermapdiv {
  height: 100%;
  width: 100%;
}
</style>