From c0222139729eb9b133f77581a429b9b56323e74f Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期二, 14 六月 2022 17:00:24 +0800 Subject: [PATCH] 设备支持设置地理坐标系,并将级联输出坐标系统一为wgs84 --- web_src/src/components/map.vue | 23 +++++++++++++++++++---- 1 files changed, 19 insertions(+), 4 deletions(-) diff --git a/web_src/src/components/devicePosition.vue b/web_src/src/components/map.vue similarity index 93% rename from web_src/src/components/devicePosition.vue rename to web_src/src/components/map.vue index db19677..caf36d4 100644 --- a/web_src/src/components/devicePosition.vue +++ b/web_src/src/components/map.vue @@ -49,7 +49,7 @@ import queryTrace from './dialog/queryTrace.vue' export default { - name: "devicePosition", + name: "map", components: { MapComponent, DeviceTree, @@ -183,12 +183,27 @@ this.clean() this.closeInfoBox() let params = []; + let longitudeStr; + let latitudeStr; + if (window.mapParam.coordinateSystem == "GCJ-02") { + longitudeStr = "longitudeGcj02"; + latitudeStr = "latitudeGcj02"; + }else if (window.mapParam.coordinateSystem == "WGS84") { + longitudeStr = "longitudeWgs84"; + latitudeStr = "latitudeWgs84"; + }else { + longitudeStr = "longitude"; + latitudeStr = "latitude"; + } + for (let i = 0; i < channels.length; i++) { - if (channels[i].longitude * channels[i].latitude === 0) { + let longitude = channels[i][longitudeStr]; + let latitude = channels[i][latitudeStr]; + if (longitude * latitude === 0) { continue; } let item = { - position: [channels[i].longitude, channels[i].latitude], + position: [longitude, latitude], image: { src: this.getImageByChannel(channels[i]), anchor: [0.5, 1] @@ -202,7 +217,7 @@ this.layer = this.$refs.map.addLayer(params, this.featureClickEvent) console.log(4) if (params.length === 1) { - this.$refs.map.panTo([channels[0].longitude, channels[0].latitude], mapParam.maxZoom) + this.$refs.map.panTo([channels[0][longitudeStr], channels[0][latitudeStr]], mapParam.maxZoom) } else if (params.length > 1) { this.$refs.map.fit(this.layer) } else { -- Gitblit v1.8.0