From 8dc33d1e8da59e87a2be6b921ac96600d7786685 Mon Sep 17 00:00:00 2001
From: chenyabin <Chenab123!>
Date: 星期二, 18 五月 2021 15:43:16 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/develop' into develop

---
 src/components/helpers/MapManager.js |   44 +++++++++++++++++++++++++-------------------
 1 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/src/components/helpers/MapManager.js b/src/components/helpers/MapManager.js
index 9795d33..8399486 100644
--- a/src/components/helpers/MapManager.js
+++ b/src/components/helpers/MapManager.js
@@ -1,6 +1,6 @@
 import AjaxUtils from '../../utils/AjaxUtils'
 import { WMS_URL } from '../../conf/Constants'
-import { openPopup } from './LocateHelper'
+import { highlight, openPropsPopup } from './LocateHelper'
 
 class MapManager {
   constructor () {
@@ -27,27 +27,33 @@
     this.map.on('click', (e) => {
       // console.log(e)
       this.clearHighlight()
-      this.loadWfsDatas(e.latlng)
+      this.loadWfsDatas(e.latlng).then((res) => {
+        console.log(res)
+        highlight(res.features)
+        openPropsPopup(e.latlng, res.features)
+      })
     })
   }
 
-  loadWfsDatas (latlng) {
-    const size = this.map.getSize()
-    var point = this.map.latLngToContainerPoint(latlng, this.map.getZoom())
-    const wmsLayerService = window.layerFactory.wmsLayerService
-    const layers = wmsLayerService.wmsLayerList.getLayers()
-    // const filters = wmsLayerService.wmsLayerList.getFilters()
-    const params = Object.assign({
-      LAYERS: layers,
-      QUERY_LAYERS: layers,
-      WIDTH: size.x,
-      HEIGHT: size.y,
-      X: Math.round(point.x),
-      Y: Math.round(point.y),
-      BBOX: this.map.getBounds().toBBoxString()
-    }, this.defaultWmsParams)
-    AjaxUtils.get4JsonDataByUrl(WMS_URL, params, (res) => {
-      openPopup(latlng, res.data.features)
+  loadWfsDatas (latlng, params) {
+    return new Promise((resolve, reject) => {
+      const size = this.map.getSize()
+      var point = this.map.latLngToContainerPoint(latlng, this.map.getZoom())
+      const wmsLayerService = window.layerFactory.wmsLayerService
+      const layers = wmsLayerService.wmsLayerList.getLayers()
+      // const filters = wmsLayerService.wmsLayerList.getFilters()
+      const wmsParams = Object.assign({
+        LAYERS: layers,
+        QUERY_LAYERS: layers,
+        WIDTH: size.x,
+        HEIGHT: size.y,
+        X: Math.round(point.x),
+        Y: Math.round(point.y),
+        BBOX: this.map.getBounds().toBBoxString()
+      }, this.defaultWmsParams, params)
+      AjaxUtils.get4JsonDataByUrl(WMS_URL, wmsParams, (res) => {
+        resolve(res.data)
+      })
     })
   }
 

--
Gitblit v1.8.0