| | |
| | | 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) |
| | | } |
| | |
| | | // 叠加一个大尺寸的图标 |
| | | 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, { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 高亮点位图标 |
| | | * @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 查询指定的图层。不指定时,默认为勾选的图层 |