From 81f54040c2cb65537c6c6e1db8358a39a57dea0d Mon Sep 17 00:00:00 2001
From: mayisheng <admin>
Date: Mon, 15 Aug 2022 16:14:01 +0800
Subject: [PATCH] 1

---
 src/store/modules/mobiles/urlParameter.js |   79 +++++++++++++++++++++++++++------------
 1 files changed, 55 insertions(+), 24 deletions(-)

diff --git a/src/store/modules/mobiles/urlParameter.js b/src/store/modules/mobiles/urlParameter.js
index 0c9b6af..7fa7c22 100644
--- a/src/store/modules/mobiles/urlParameter.js
+++ b/src/store/modules/mobiles/urlParameter.js
@@ -1,14 +1,13 @@
-window.urlParameterLayer = null;
-window.divIcon = null;
-
+window.urlParameterLayer = null
+window.divIcon = null
 
 const urlParameter = {
     state: {
-        urlParameterData: {},
+        urlParameterData: {}
         // urlParameterLayer: null // 自定义标签图层
     },
     actions: {
-        addurlParameterLayerIcon({
+        addurlParameterLayerIcon ({
             state,
             commit,
             dispatch
@@ -19,25 +18,35 @@
                 window.urlParameterLayererLayer.clear()
             }
             for (const i in list) {
-                // console.log(list[i], 112233)
-                window.divIcon = new global.DC.DivIcon(
+                const billboard = new global.DC.Billboard(new global.DC.Position(
+                    Number(list[i].jd),
+                    Number(list[i].wd),
+                    0
+                ), '/img/icon/m-t.png')
+
+                const label = new global.DC.Label(
                     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>
-                      `
+                    list[i].name
                 )
-                window.divIcon.on(global.DC.MouseEventType.CLICK, (e) => {
+
+                label.setStyle({
+                    fillColor: global.DC.Color.RED,
+                    style: global.DC.Namespace.Cesium.LabelStyle.FILL_AND_OUTLINE,
+                    outlineColor: global.DC.Color.WHITE, // 边框颜色
+                    outlineWidth: 8, // 边框大小,
+                    font: '12px sans-serif',
+                    pixelOffset: { x: 0, y: -24 }
+                })
+
+                billboard.on(global.DC.MouseEventType.CLICK, (e) => {
+                    if (state.pinchFlag == true) {
+                        return
+                    }
+
                     const lntLat = [+list[i].jd, +list[i].wd]
                     const d = {
                         position: {},
@@ -52,22 +61,44 @@
                     }
                     dispatch('setMobileWindows', d)
                 })
-                window.urlParameterLayer.addOverlay(window.divIcon)
+
+                label.on(global.DC.MouseEventType.CLICK, (e) => {
+                    if (state.pinchFlag == true) {
+                        return
+                    }
+
+                    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)
+                })
+
+                window.urlParameterLayer.addOverlay(billboard) // 加入图标
+                window.urlParameterLayer.addOverlay(label)
             }
         }
     },
     mutations: {
-        initurlParameterLayer(state, val) {
+        initurlParameterLayer (state, val) {
             if (!window.urlParameterLayer) {
-                window.urlParameterLayer = new global.DC.HtmlLayer('urlParameterLayer')
+                window.urlParameterLayer = new global.DC.VectorLayer('urlParameterLayer')
                 global.viewer.addLayer(window.urlParameterLayer)
             }
         },
-        set_urlParameterData(state, val) {
+        set_urlParameterData (state, val) {
             state.urlParameterData = val
         },
 
-        clearurlParameterLayerIcon(state, val) {
+        clearurlParameterLayerIcon (state, val) {
             if (window.urlParameterLayer) {
                 window.urlParameterLayer.clear()
             }
@@ -75,4 +106,4 @@
     }
 }
 
-export default urlParameter
\ No newline at end of file
+export default urlParameter

--
Gitblit v1.9.3