From 4624a543f7d79d37ec7ed154ff8ea5db17b82632 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 08 Dec 2023 11:28:12 +0800
Subject: [PATCH] 定位更换 底部定位按钮开启 点击绿色搜索条件完善 extent,更新 主要楼宇开启 定位描点BUG修复

---
 src/components/mobileWindow/index.vue |   79 +++++++++++++++++++++++++++++++--------
 1 files changed, 62 insertions(+), 17 deletions(-)

diff --git a/src/components/mobileWindow/index.vue b/src/components/mobileWindow/index.vue
index 239a65b..c41f6f0 100644
--- a/src/components/mobileWindow/index.vue
+++ b/src/components/mobileWindow/index.vue
@@ -74,6 +74,42 @@
 import { mapGetters } from 'vuex'
 import { GCJ02ToWGS84 } from '@/utils/CoordTransform'
 
+let extent = [
+    {
+        key: 1,
+        xMin: 112.51303616638316,
+        yMin: -0.103420786429659,
+        xMax: 112.67880038471827,
+        yMax: 0.000004508906477476281,
+        resolution: 0.00001903568804664224,
+
+        x: (x, y) => {
+            return -250.6503 + 2.0389 * x + 4.4338 * y
+        },
+
+        y: (x, y) => {
+            return 228.1454 - 2.321 * x + 1.4165 * y
+        },
+    },
+
+    {
+        key: 2,
+        xMin: 112.51302551881798,
+        yMin: -0.16235359398493399,
+        xMax: 112.72742295590702,
+        yMax: 0.000004509195932360471,
+        resolution: 0.00001903568804664224,
+
+        x: (x, y) => {
+            return -802.9905 + 6.1504 * x + 7.0694 * y
+        },
+
+        y: (x, y) => {
+            return 295.4321 - 3.4878 * x + 3.775 * y
+        },
+    },
+]
+
 export default {
     name: 'mobileWindow',
     computed: {
@@ -123,10 +159,12 @@
         }
     },
 
+    inject: ['mobileMapElement'],
+
     mounted () {
         this.$EventBus.$on('clearTimoutTime', () => {
             if (this.navigationFlag == true) {
-                window.geolocation.clearWatch()
+                // window.geolocation.clearWatch()
 
                 this.$store.dispatch('removeLabelLayerIconMobelUse')
             }
@@ -242,13 +280,14 @@
                 }
             }
 
+            // 需要传入路网url
             that.$store.dispatch('MSET_GOTOWHERE', ints)
         },
 
         getCurrentLocation (flag = true) {
             const that = this
 
-            window.geolocation.watchPosition(that.showPosition)
+            // window.geolocation.watchPosition(that.showPosition)
 
             window.geolocation.getLocation(that.showPosition, that.showErrow, {
                 timeout: 8000
@@ -258,35 +297,41 @@
         showPosition (result) {
             const that = this
 
-            const position = GCJ02ToWGS84(result.lng, result.lat)
+            let cur = extent.find((item) => item.key == this.mobileMapElement.campusValue)
+
+            let positionWgs = GCJ02ToWGS84(result.lng, result.lat)
+
+            let position = {
+                lng: cur.x(positionWgs[0], positionWgs[1]),
+                lat: cur.y(positionWgs[0], positionWgs[1]),
+            }
 
             const data = {
                 name: '我的位置',
-                jd: position[0],
-                wd: position[1]
+                jd: position.lng,
+                wd: position.lat
             }
-
-            that.$store.dispatch('addLabelLayerIconMobelUse', {
-                data: data,
-                clear: true,
-                mviewer: global.viewer
-            })
 
             if (that.navigationFlag == true) return
 
-            if (position[0] > 115.78815057 && position[0] < 115.80346610 && position[1] > 28.63771847 && position[1] < 28.64981682) {
+            if (
+                position.lng > cur.xMin &&
+                position.lng < cur.xMax &&
+                position.lat > cur.yMin &&
+                position.lat < cur.yMax
+            ) {
                 that.$store.dispatch('pcMoveView', {
-                    jd: position[0],
-                    wd: position[1],
-                    viewer: global.viewer
+                    jd: position.lng,
+                    wd: position.lat,
+                    resolution: cur.resolution,
                 })
 
                 that.$store.dispatch('addLabelLayerIconMobelUse', {
                     data: data,
                     clear: true,
-                    mviewer: global.viewer
                 })
-                that.doit([position[0], position[1]])
+
+                that.doit([position.lng, position.lat])
 
                 that.navigationFlag = true
             } else {

--
Gitblit v1.9.3