| | |
| | | /** |
| | | * 业务相关矢量图管理助手,负责业务相关矢量图创建及开关 |
| | | */ |
| | | function VectorLayerHelper(options) { |
| | | this.map = options.map |
| | | this.L = options.L |
| | | this.vectorLayerMap = new Map() |
| | | this.vectorLayerList = [] |
| | | this.vectorLayerGroup = null |
| | | this.vueState = {} // 用户图层权限 |
| | | /** |
| | | function VectorLayerHelper (options) { |
| | | this.map = options.map |
| | | this.L = options.L |
| | | this.vectorLayerMap = new Map() |
| | | this.vectorLayerList = [] |
| | | this.vectorLayerGroup = null |
| | | this.vueState = {} // 用户图层权限 |
| | | /** |
| | | * 该方法负责各种底图加载到地图上 |
| | | * 不同页面加载图层不同根据模块类型选择加载不同图层 |
| | | * @param map |
| | | */ |
| | | this.initVectorLayers = (vueState) => { |
| | | this.vectorLayerGroup = options.L.layerGroup().addTo(options.map) |
| | | this.vueState = vueState |
| | | } |
| | | this.initVectorLayers = (vueState) => { |
| | | this.vectorLayerGroup = options.L.layerGroup().addTo(options.map) |
| | | this.vueState = vueState |
| | | } |
| | | |
| | | /** |
| | | /** |
| | | * 获取所有的图层列表 |
| | | * @returns {null} 结构:[{名称, 图层引用}] |
| | | */ |
| | | this.getVectorLayerList = () => { |
| | | return this.vectorLayerList |
| | | } |
| | | this.getVectorLayerList = () => { |
| | | return this.vectorLayerList |
| | | } |
| | | |
| | | /** |
| | | /** |
| | | * 通过名称获取图层对象 |
| | | * @param name 名称 |
| | | */ |
| | | this.getVectorLayer = (code) => { |
| | | return this.vectorLayerMap[code] |
| | | } |
| | | this.getVectorLayer = (code) => { |
| | | return this.vectorLayerMap[code] |
| | | } |
| | | |
| | | /** |
| | | /** |
| | | * 显示某个图层 |
| | | * @param name 图层名称 |
| | | */ |
| | | this.showVectorLayer = (code) => { |
| | | let layer = this.vectorLayerMap.get(code) |
| | | this.map.addLayer(layer) |
| | | } |
| | | this.showVectorLayer = (code) => { |
| | | const layer = this.vectorLayerMap.get(code) |
| | | this.map.addLayer(layer) |
| | | } |
| | | |
| | | /** |
| | | /** |
| | | * 隐藏某个图层 |
| | | * @param name 图层名称 |
| | | */ |
| | | this.hideVectorLayer = (code) => { |
| | | let layer = this.vectorLayerMap.get(code) |
| | | this.map.removeLayer(layer) |
| | | } |
| | | this.hideVectorLayer = (code) => { |
| | | const layer = this.vectorLayerMap.get(code) |
| | | this.map.removeLayer(layer) |
| | | } |
| | | } |
| | | |
| | | export default VectorLayerHelper |