月球大数据地理空间分析展示平台-【前端】-月球2期前端
Surpriseplus
2023-08-22 e2c94dcb58b199eb57c164a67f1b038d401063d7
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
<template>
  <div class="body_box">
    <div id="cesiumContainer">
 
    </div>
    <export-map
      v-if="layerExportshow"
      @SETexportMap="SETexportMap"
    ></export-map>
    <menus></menus>
    <bottom-btn></bottom-btn>
    <mouse-move></mouse-move>
    <spatial-box
      v-if="layerSpatialshow"
      @SETspatialClose="SETspatialClose"
    ></spatial-box>
    <coord-location
      v-if="layerLocationshow"
      @SETcoordClose="setCoordLocation"
    >
 
    </coord-location>
 
  </div>
</template>
 
<script lang="ts" setup>
import {
  ref,
  onMounted,
  onBeforeUnmount,
  reactive,
  defineProps,
  defineEmits,
} from "vue";
import { removeToken, getToken } from "@/utils/auth";
//左侧菜单
import menus from "@/views/menus.vue";
//底部菜单
import bottomBtn from "@/components/bottomBtn.vue";
import exportMap from "./export/exportMap.vue";
import InitMap from "@/assets/js/Map/index.js";
//经纬度显示
import mouseMove from "@/components/mouseMove.vue";
//空间查询
import spatialBox from "@/views/query/SpatialQuery.vue";
//坐标定位
import CoordLocation from "@/views/query/CoordLocation.vue";
//阴影分析
import mapclock from "@/views/mapClock/index.vue";
 
import router from "@/router";
import { useStore } from "vuex"; // 引入useStore 方法
 
let map;
var viewer;
const store = useStore(); // 该方法用于返回store 实例
const layerExportshow = ref(false);
const layerSpatialshow = ref(false);
const layerLocationshow = ref(false);
const init = () => {
  viewer = InitMap.Viewer;
  map = InitMap.sgworld;
  window.setMouseMove(true);
};
//关闭状态
const SETexportMap = (res) => {
  layerExportshow.value = res;
};
const functionForJs = (res) => {
  switch (res.type) {
    case "exportMap":
      store.state.exportImgUrl = res.url;
      layerExportshow.value = res.value;
 
      break;
    case "spatialQuery":
      setSpatialQuery(res);
      break;
    case "closeNavigatBar":
      setCloseNavigatBar();
      break;
    case "coordLocation":
      setCoordLocation(res);
      break;
  }
};
const setCoordLocation = (res) => {
  layerLocationshow.value = res;
};
const setCloseNavigatBar = () => {
  const infobar = document.getElementsByClassName("map-info-bar")[0];
  infobar.style.display = "none";
  const navigation = document.getElementsByClassName("navigation-controls")[0];
  navigation.style.top = "calc(100% - 182px)";
  navigation.style.right = "70px";
  const compass = document.getElementsByClassName("compass")[0];
  compass.style.top = "calc(100% - 280px)";
  compass.style.right = "38px";
};
const setSpatialQuery = async (res) => {
  store.state.spatialQueryData.wkt = res.value;
  layerSpatialshow.value = true;
};
const SETspatialClose = (res) => {
  layerSpatialshow.value = res;
};
 
onMounted(() => {
  var token = getToken();
  if (!token) {
    router.push("/Login");
  }
 
  InitMap.init3DMap();
  init();
  // setCloseNavigatBar();
  window.functionForJs = functionForJs;
});
</script>
<style lang="less" scoped>
.body_box {
  width: 100%;
  height: 100%;
  position: absolute;
}
</style>