月球大数据地理空间分析展示平台-【中台】
WX
2023-08-15 da15329c0e7532231f567fc1c33ea8604f587350
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
 <template>
  <div class="body_box">
    <div id="cesiumContainer"></div>
  </div>
</template>
 
<script>
import { getToken } from "../../utils/auth.js";
export default {
  components: {},
  data() {
    return {
      earthCtrl: null,
      Viewer: null,
    };
  },
  methods: {
    // wmts加载
    AddWmtesLayer(url, id) {
    var urlTemplateImageryProvider = earthCtrl.factory.createImageryLayer({
      sourceType: "wmts",
      url: url,
      layer: "",
      format: "image/png",
      tileMatrixSetID: "GoogleCRS84Quad01",
      tileMatrixLabels: [
        "0",
        "1",
        "2",
        "3",
        "4",
        "5",
        "6",
        "7",
        "8",
        "9",
        "10",
        "11",
        "12",
        "13",
        "14",
        "15",
        "16",
        "17",
        "18",
      ],
      style: "",
      tilingScheme: new Cesium.GeographicTilingScheme({
        ellipsoid: Cesium.Ellipsoid.MOON,
      }),
    });
    console.log(urlTemplateImageryProvider);
    // this.layerList.push({
    //   id: id,
    //   layerData: urlTemplateImageryProvider._primitive,
    //   type: "wmts",
    // });
  },
  // 地形加载
    AddDemLayer(url, id) {
    var terrain = new Cesium.CesiumTerrainProvider({
      url: url,
      // url: url,
      tilingScheme: new Cesium.GeographicTilingScheme({
        ellipsoid: Cesium.Ellipsoid.MOON,
      }),
    });
    window.Viewer.terrainProvider = terrain;
 
    // let img_layer = Viewer.imageryLayers.addImageryProvider(layer);
    // this.layerList.push({ id: id, type: "dem" });
  },
    //地图初始化
    init3DMap() {
      //设置月球坐标系
      SmartEarth.Cesium.Ellipsoid.WGS84 = new SmartEarth.Cesium.Ellipsoid(
        1737400.0,
        1737400.0,
        1737400.0
      );
      //页面初始化
      this.earthCtrl = new SmartEarth.EarthCtrl("cesiumContainer", {
        // StaticFileBaseUrl: StaticFileBaseUrl,
        ellipsoidCoordinates: "MOON",
      });
      this.earthCtrl.environment.disableAllEffect();
 
      this.Viewer = this.earthCtrl._Viewer;
 
      // this.Viewer.scene.skyAtmosphere.show = false;
 
      this.Viewer.scene.globe.depthTestAgainstTerrain = false;
 
      window.earthCtrl = this.earthCtrl;
 
      window.Viewer = this.earthCtrl._Viewer;
 
      window.Cesium = SmartEarth.Cesium;
 
      window.sgworld = earthCtrl;
 
      sgworld.Creator.SimpleGraphic.edit(true, { editProp: true });
      var token = getToken();
      var demUrl = `${BASE_URL}/proxy/${token}/24`
      var wmtsUrl = `${BASE_URL}/proxy/${token}/17`
 
      this.AddDemLayer(demUrl)
      this.AddWmtesLayer(wmtsUrl)
      //=======================
      // window.Viewer.imageryLayers.removeAll();
      //=======================
      // Viewer.scene.globe.showGroundAtmosphere = false;
 
      // var terrain = new Cesium.CesiumTerrainProvider({
      //   url: config.moonTerrain,
      //   tilingScheme: new Cesium.GeographicTilingScheme({
      //     ellipsoid: Cesium.Ellipsoid.MOON,
      //   }),
      // });
      // window.Viewer.terrainProvider = terrain;
    },
  },
  mounted() {
    this.init3DMap();
  },
  created() {},
};
</script>
 
<style lang="less" scoped>
.body_box {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  .cesiumContainer {
    width: 100%;
    height: 100%;
  }
}
 
</style>
<style>
.cesium-viewer-animationContainer{
  display: none !important;
}
</style>