| | |
| | | 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: { |
| | |
| | | } |
| | | }, |
| | | |
| | | inject: ['mobileMapElement'], |
| | | |
| | | mounted () { |
| | | this.$EventBus.$on('clearTimoutTime', () => { |
| | | if (this.navigationFlag == true) { |
| | | window.geolocation.clearWatch() |
| | | // window.geolocation.clearWatch() |
| | | |
| | | this.$store.dispatch('removeLabelLayerIconMobelUse') |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | // 需要传入路网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 |
| | |
| | | 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 { |