zhongrj
2025-03-28 4ff3eee77b41466d08117970970d01be6e48ffe1
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
import { MutationTree } from 'vuex'
import { ControlSource } from '@/types/device'
import cesiumOptions from '@/utils/cesium-tsa'
 
const {
  add3Dtileset,
  remove3Dtileset,
  loadLAYER
} = cesiumOptions()
 
const state = () => ({
  projectId: null as string | null,
  dockSns: null as string | null,
  snList: [] as string[],
  projectName: '' as string,
  // 地图setting
  mapSetting: {
    mode: 2, // 0为标准地图, 1为卫星地图
    roadLine: true,
    visual: '2D',
    isDark: false,
  },
  droneControlSource: ''
})
export type RootStateType = ReturnType<typeof state>
const mutations: MutationTree<RootStateType> = {
  SET_PROJECT_ID (state, projectId: string) {
    state.projectId = projectId
  },
 
  SET_DOCK_SN (state, dockSns: string) {
    state.dockSns = dockSns
  },
 
  SET_SN_LIST (state, snList: string[]) {
    state.snList = snList
  },
  SET_PROJECT_NAME (state, projectName: string) {
    state.projectName = projectName
  },
  // 设置地图模式
  SET_MAP_SETTING_MODE (state, mode: number) {
    state.mapSetting.mode = mode
  },
  // 地图切换2/3d
  SET_MAP_VISUAL_MODE (state, type) {
    state.mapSetting.visual = type
 
    if (type == '2D') {
      remove3Dtileset()
      // this.commit('SET_MAP_SETTING_MODE', 0)
      loadLAYER()
    } else {
      add3Dtileset()
      // this.commit('SET_MAP_SETTING_MODE', 3)
      loadLAYER()
    }
  },
  // 设置地图路网
  SET_MAP_SETTING_ROAD_LINE (state, roadLine: boolean) {
    state.mapSetting.roadLine = roadLine
  },
  // 设置飞行控制
  SET_DRONE_CONTROL_SOURCE (state, droneControlSource: ControlSource) {
    state.droneControlSource = droneControlSource
  }
}
export default {
  state,
  mutations
}