liuyg
2022-03-10 e8e7b70168d5cc8a465c92da28bdcce52e8bf3cc
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
const urlParameter = {
    state: {
        urlParameterData: {},
        urlParameterLayer: null // 自定义标签图层
    },
    actions: {
        addurlParameterLayerIcon ({
            state,
            commit,
            dispatch
        }, val) {
            const list = val.list
            if (val.clear) {
                //     state.urlParameterLayer.remove();
                state.urlParameterLayer.clear()
            }
            for (const i in list) {
                // console.log(list[i], 112233)
                const divIcon = new global.DC.DivIcon(
                    new global.DC.Position(
                        Number(list[i].jd),
                        Number(list[i].wd),
                        0
                    ),
                    `
                          <div class="tag-entitys-box">
                              <div class="tag-content">
                                  ${list[i].name}
                              </div>
                              <div class="tag-angle-content">
                                  <img src="https://map.hit.edu.cn/images/tarrow_xq.png">
                              </div>
                          </div>
                      `
                )
                divIcon.on(global.DC.MouseEventType.CLICK, (e) => {
                    const lntLat = [+list[i].jd, +list[i].wd]
                    const d = {
                        position: {},
                        lntLat: lntLat,
                        query: {
                            introduce: '自定义标签',
                            address: '',
                            ...(list[i] || {}),
                            lntLat: lntLat
                        },
                        useJWD: true // 仅使用经纬度
                    }
                    dispatch('setMobileWindows', d)
                })
                state.urlParameterLayer.addOverlay(divIcon)
            }
        }
    },
    mutations: {
        initurlParameterLayer (state, val) {
            if (!state.urlParameterLayer) {
                state.urlParameterLayer = new global.DC.HtmlLayer('urlParameterLayer')
                state.mviewer.addLayer(state.urlParameterLayer)
            }
        },
        set_urlParameterData (state, val) {
            state.urlParameterData = val
        },
 
        clearurlParameterLayerIcon (state, val) {
            if (state.urlParameterLayer) {
                state.urlParameterLayer.clear()
            }
        }
    }
}
 
export default urlParameter