From 3f2090824cbb38a846e4f3037efb323b8c176418 Mon Sep 17 00:00:00 2001
From: mayisheng <admin>
Date: Thu, 11 Aug 2022 17:37:24 +0800
Subject: [PATCH] 修改标签错乱等问题

---
 src/components/map/components/dimension.vue |    5 +
 src/api/pc/public/arc.js                    |    2 
 src/components/serviceNavBar/index.vue      |  121 ++++++++++++++++++++++++++++++++--------
 3 files changed, 101 insertions(+), 27 deletions(-)

diff --git a/src/api/pc/public/arc.js b/src/api/pc/public/arc.js
index f2e7e7d..f59b7e8 100644
--- a/src/api/pc/public/arc.js
+++ b/src/api/pc/public/arc.js
@@ -45,4 +45,4 @@
         method: 'get',
         params: params
     })
-}
+}
\ No newline at end of file
diff --git a/src/components/map/components/dimension.vue b/src/components/map/components/dimension.vue
index 84312c0..6f8fd0b 100644
--- a/src/components/map/components/dimension.vue
+++ b/src/components/map/components/dimension.vue
@@ -383,6 +383,7 @@
 
                     global.viewer.on(global.DC.MouseEventType.MOUSE_MOVE, that.mouseMoveEvent)
 
+                    // 房屋轮廓对应的点击事件
                     global.viewer.on(global.DC.MouseEventType.CLICK, (e) => {
                         if (that.closeMapClick) {
                             return
@@ -873,15 +874,17 @@
             })
         },
 
+        // 加载房屋轮廓服务地址
         createdLayers () {
             layerGroup = new global.DC.LayerGroup('modelBox')
             global.viewer.addLayerGroup(layerGroup)
 
             DefaultAreaLayer = new global.DC.VectorLayer('DefaultAreaLayer')
             layerGroup.addLayer(DefaultAreaLayer)
+
             axios
                 .get(
-                    'http://arcgis.jxpskj.com:6080/arcgis/rest/services/lxxqwxq/MapServer/0/query?where=1%3D1&text=&objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelIntersects&relationParam=&outFields=*&returnGeometry=true&maxAllowableOffset=&geometryPrecision=&outSR=&returnIdsOnly=false&returnCountOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&gdbVersion=&returnDistinctValues=false&returnTrueCurves=false&resultOffset=&resultRecordCount=&f=pjson'
+                    'http://arcgis.jxpskj.com:6080/arcgis/rest/services/shidalk/MapServer/0/query?where=1%3D1&text=&objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelIntersects&relationParam=&outFields=*&returnGeometry=true&maxAllowableOffset=&geometryPrecision=&outSR=&returnIdsOnly=false&returnCountOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&gdbVersion=&returnDistinctValues=false&returnTrueCurves=false&resultOffset=&resultRecordCount=&f=pjson'
                 )
                 .then((resultData) => {
                     resultData.data.features.forEach((item) => {
diff --git a/src/components/serviceNavBar/index.vue b/src/components/serviceNavBar/index.vue
index 05aad93..9e12ce1 100644
--- a/src/components/serviceNavBar/index.vue
+++ b/src/components/serviceNavBar/index.vue
@@ -97,13 +97,15 @@
                 if (newData == '三 维') {
                     if (ourLayer != null) {
                         ourLayer.eachOverlay((item) => {
-                            item.position = new global.DC.Position(Number(item.position.lng), Number(item.position.lat), 0)
+                            const position = this.coordinate(item.attrParam.x)
+
+                            item.position = new global.DC.Position(Number(position.lng), Number(position.lat), 0)
                         })
                     }
                 } else {
                     if (ourLayer != null) {
                         ourLayer.eachOverlay((item) => {
-                            item.position = new global.DC.Position(Number(item.position.lng), Number(item.position.lat), 50)
+                            item.position = new global.DC.Position(Number(item.attrParam.jd), Number(item.attrParam.wd), 50)
                         })
                     }
                 }
@@ -113,6 +115,14 @@
     },
     mounted () { },
     methods: {
+        coordinate (item) {
+            const arr = item.split(',')
+
+            return {
+                lng: arr[0],
+                lat: arr[1]
+            }
+        },
         closeModel () {
             this.$parent.closeModel()
         },
@@ -151,13 +161,25 @@
             })
         },
         addDivIcon (item, mylayer) {
+            let obj = {}
+
+            if (item.x && item.x != '') {
+                const position = this.coordinate(item.x)
+                obj = {
+                    lng: position.lng, lat: position.lat
+                }
+            } else {
+                obj = {
+                    lng: item.jd, lat: item.wd
+                }
+            }
             const that = this
 
             let divIcon = null
 
             if (this.twoOrThree == '三 维') {
                 divIcon = new global.DC.DivIcon(
-                    new global.DC.Position(Number(item.jd), Number(item.wd), 0),
+                    new global.DC.Position(Number(obj.lng), Number(obj.lat), 0),
                     `
                               <div class="tag-entitys-box">
                                   <div class="tag-content">
@@ -185,6 +207,8 @@
                 )
             }
 
+            divIcon.attrParam = item
+
             // 订阅事件
             divIcon.on(global.DC.MouseEventType.CLICK, (e) => {
                 // console.log(item, "see");
@@ -198,6 +222,18 @@
             mylayer.addOverlay(divIcon)
         },
         mapPopup (param) {
+            let obj = {}
+
+            if (param.x && param.x != '') {
+                const position = this.coordinate(param.x)
+                obj = {
+                    lng: position.lng, lat: position.lat
+                }
+            } else {
+                obj = {
+                    lng: param.jd, lat: param.wd
+                }
+            }
             var result = param
             this.$store.commit('CLEAR_ALL', null)
 
@@ -205,14 +241,7 @@
 
             this.$store.commit('SET_POPUPBGURL', imgArr[0])
             this.$store.commit('SET_POPUPQRURL', result.codeurl)
-            this.$store.commit('SET_POINTPOSITION', [
-                Number(result.jd),
-                Number(result.wd),
-                Number(result.gd),
-                Number(result.heading),
-                Number(result.pitch),
-                Number(result.roll)
-            ])
+
             this.$store.commit('SET_STATENAME', result.mechanismname)
             this.$store.commit('SET_SITENAME', result.address)
             this.$store.commit('SET_TELEPHONE', result.telephone)
@@ -224,24 +253,66 @@
                 this.$store.commit('SET_MONITORURL', result.videourl)
             }
 
-            this.newPopup(result)
-            global.viewer.flyToPosition(
-                new global.DC.Position(
-                    Number(result.jd),
-                    Number(result.wd),
-                    300,
+            this.newPopup(result, obj)
+
+            if (this.twoOrThree == '三 维') {
+                this.$store.commit('SET_POINTPOSITION', [
+                    Number(obj.lng),
+                    Number(obj.lat),
+                    Number(result.gd),
                     Number(result.heading),
                     Number(result.pitch),
                     Number(result.roll)
-                ),
-                function () { },
-                3
-            )
+                ])
+
+                global.viewer.flyToPosition(
+                    new global.DC.Position(
+                        Number(obj.lng),
+                        Number(obj.lat),
+                        300,
+                        Number(result.heading),
+                        Number(result.pitch),
+                        Number(result.roll)
+                    ),
+                    function () { },
+                    3
+                )
+            } else {
+                this.$store.commit('SET_POINTPOSITION', [
+                    Number(result.jd),
+                    Number(result.wd),
+                    Number(result.gd),
+                    Number(result.heading),
+                    Number(result.pitch),
+                    Number(result.roll)
+                ])
+
+                global.viewer.flyToPosition(
+                    new global.DC.Position(
+                        Number(result.jd),
+                        Number(result.wd),
+                        300,
+                        Number(result.heading),
+                        Number(result.pitch),
+                        Number(result.roll)
+                    ),
+                    function () { },
+                    3
+                )
+            }
         },
-        newPopup (item) {
-            const position = global.DC.Transform.transformWGS84ToCartesian(
-                new global.DC.Position(Number(item.jd), Number(item.wd), Number(item.gd))
-            )
+        newPopup (item, obj) {
+            let position
+            if (this.twoOrThree == '三 维') {
+                position = global.DC.Transform.transformWGS84ToCartesian(
+                    new global.DC.Position(Number(obj.lng), Number(obj.lat), Number(item.gd))
+                )
+            } else {
+                position = global.DC.Transform.transformWGS84ToCartesian(
+                    new global.DC.Position(Number(item.jd), Number(item.wd), Number(item.gd))
+                )
+            }
+
             // eslint-disable-next-line no-unused-vars
             var popup = new global.DC.DivForms(global.viewer, {
                 domId: 'divFormsDomBox',

--
Gitblit v1.9.3