From 18db6fdcd0bed3b9db803591b6057a98dd47c597 Mon Sep 17 00:00:00 2001 From: 陈泽平 <chenzeping> Date: 星期四, 20 五月 2021 10:55:17 +0800 Subject: [PATCH] 横断面数据修改 --- src/components/helpers/LocateHelper.js | 69 ++++++++++++++++++++++------------ 1 files changed, 44 insertions(+), 25 deletions(-) diff --git a/src/components/helpers/LocateHelper.js b/src/components/helpers/LocateHelper.js index edfc65c..0d9935b 100644 --- a/src/components/helpers/LocateHelper.js +++ b/src/components/helpers/LocateHelper.js @@ -10,21 +10,30 @@ export const locate = function (feature, config, filter) { fitBounds(feature) highlight(feature, config.icon) + const centerPoint = getCenterPoint(feature) + const params = { LAYERS: config.layerGroup || config.typeName, QUERY_LAYERS: config.layerGroup || config.typeName } + const filters = [] + if (config.filter) { + filters[filters.length] = config.filter + } + if (filter) { + filters[filters.length] = filter + } + if (filters.length > 0) { + params.CQL_FILTER = filters.join(' AND ') + } + loadPointWfs(centerPoint, params) +} + +/** + * 鍔犺浇鐐硅寖鍥寸殑wfs鏁版嵁骞跺脊绐� + * @param latlng 鐐圭殑缁忕含搴﹀潗鏍� + * @param params + */ +export const loadPointWfs = function (latlng, params) { setTimeout(() => { - const centerPoint = getCenterPoint(feature) - const params = { LAYERS: config.layerGroup || config.typeName, QUERY_LAYERS: config.layerGroup || config.typeName } - const filters = [] - if (config.filter) { - filters[filters.length] = config.filter - } - if (filter) { - filters[filters.length] = filter - } - if (filters.length > 0) { - params.CQL_FILTER = filters.join(' AND ') - } - window.mapManager.loadWfsDatas(centerPoint, params).then((res) => { - openPropsPopup(centerPoint, res.features) + window.mapManager.loadWfsDatas(latlng, params).then((res) => { + openPropsPopup(latlng, res.features) }) }, 1000) } @@ -38,7 +47,7 @@ if (type === 'Point') { var point = feature.geometry.coordinates point = [point[1], point[0]] - window.map.setView(point, 17) + window.map.setView(point, 19) } else { window.map.fitBounds(window.L.geoJSON(feature).getBounds()) } @@ -58,16 +67,7 @@ // 鍙犲姞涓�涓ぇ灏哄鐨勫浘鏍� let point = feature.geometry.coordinates point = [point[1], point[0]] - - if (icon) { - L.marker(point, { - icon: L.icon({ - iconUrl: '/assets/images/map/' + icon, - iconSize: [30, 30], - iconAnchor: [15, 15] - }) - }).addTo(highlightLayer) - } + pointZoom(point, icon) pulseEffect(point) } else { L.geoJSON(feature, { @@ -81,6 +81,25 @@ } /** + * 楂樹寒鐐逛綅鍥炬爣 + * @param latlng 缁忕含搴� + * @param icon 鍥炬爣 + */ +export const pointZoom = function (latlng, icon) { + const L = window.L + const highlightLayer = window.mapManager.hightlightLayer + if (icon) { + L.marker(latlng, { + icon: L.icon({ + iconUrl: '/assets/images/map/' + icon, + iconSize: [30, 30], + iconAnchor: [15, 15] + }) + }).addTo(highlightLayer) + } +} + +/** * 寮瑰嚭灞炴�у垪琛ㄥ睍绀虹獥鍙� * @param xy 寮瑰嚭绐楀彛璺熼殢瑕佺礌鐨勭粡绾害 * @param layer 鏌ヨ鎸囧畾鐨勫浘灞傘�備笉鎸囧畾鏃讹紝榛樿涓哄嬀閫夌殑鍥惧眰 -- Gitblit v1.8.0