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/mobileCortrolButtom/index.vue | 111 +++++++++++++++++++++++++++++--------------------------
1 files changed, 59 insertions(+), 52 deletions(-)
diff --git a/src/components/mobileCortrolButtom/index.vue b/src/components/mobileCortrolButtom/index.vue
index 3501810..8ed7256 100644
--- a/src/components/mobileCortrolButtom/index.vue
+++ b/src/components/mobileCortrolButtom/index.vue
@@ -26,9 +26,9 @@
<div class="m-l-inbut" @click="zoomIns">
<i class="el-icon-refresh"></i>
</div>
- <!-- <div class="m-l-inbut" @click="goOns">
+ <div class="m-l-inbut" @click="goOns">
<i class="el-icon-location"></i>
- </div> -->
+ </div>
<div class="m-l-inbut" @click="openOurSee">
<i class="el-icon-map-location"></i>
</div>
@@ -42,9 +42,47 @@
import { getActivity } from '@/api/mobile/hd/hd'
import { GCJ02ToWGS84 } from '@/utils/CoordTransform'
+import { textHeights } from 'ol/render/canvas'
+
+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
+ },
+
+ u: (x, y) => {
+ return 295.4321 - 3.4878 * x + 3.775 * y
+ },
+ },
+]
export default {
name: 'mobileCortrolButtom',
+
data () {
return {
tabTable: [],
@@ -110,48 +148,37 @@
var options = { timeout: 8000 }// 设置定位超时
window.geolocation.getLocation(showPosition, showErrow, options)
- this.$store.commit('GET_NOWPOSITION', (res) => {
- that.$store.dispatch('pcMoveView', {
- jd: res[0],
- wd: res[1],
- viewer: global.viewer
- })
- const data = [
- {
- name: '我的位置',
- jd: res[0],
- wd: res[1]
- }
- ]
-
- that.$store.dispatch('addLabelLayerIconMobelUse', {
- list: data,
- clear: true,
- mviewer: global.viewer
- })
- })
+ let cur = extent.find((item) => item.key == this.mobileMapElement.campusValue)
function showPosition (result) {
- const position = GCJ02ToWGS84(result.lng, result.lat)
+ let positionWgs = GCJ02ToWGS84(result.lng, result.lat)
+
+ let position = {
+ lng: positionWgs[0],
+ lat: positionWgs[1],
+ }
const data = {
name: '我的位置',
- jd: position[0],
- wd: position[1]
+ jd: position.lng,
+ wd: position.lat
}
- // 经管
- 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
+ clear: true
})
} else {
that.$message({
@@ -159,26 +186,6 @@
type: 'warning'
})
}
-
- // 师大
- // if (position[0] > 116.009836 && position[0] < 116.045022 && position[1] > 28.664168 && position[1] < 28.699788) {
- // that.$store.dispatch('pcMoveView', {
- // jd: position[0],
- // wd: position[1],
- // viewer: global.viewer
- // })
-
- // that.$store.dispatch('addLabelLayerIconMobelUse', {
- // list: data,
- // clear: true,
- // mviewer: global.viewer
- // })
- // } else {
- // that.$message({
- // message: '您当前位置超出学校范围',
- // type: 'warning'
- // })
- // }
}
function showErrow (result) {
--
Gitblit v1.9.3