| | |
| | | _loadLayers(mapConfig, isAddToMap = true) { |
| | | console.debug('ServiceLayerHelper加载参数:', mapConfig) |
| | | for (let i = 0, len = mapConfig.mapConfig.ServiceLayers.length; i < len; ++i) { |
| | | let opt = mapConfig.mapConfig.ServiceLayers[i] |
| | | const opt = mapConfig.mapConfig.ServiceLayers[i] |
| | | if (opt.type === 'wmts') { |
| | | this.loadWmtsLayer(opt, isAddToMap, mapConfig.mapConfig.ServiceLayers[i]) |
| | | } else if (opt.type === 'wms') { |
| | |
| | | * @param {*} isAddToMap |
| | | */ |
| | | loadWmtsLayer(options, isAddToMap = true, config) { |
| | | const layer = this.L.tileLayer(options.url, options.option); |
| | | const layer = this.L.tileLayer(options.url, options.option) |
| | | layer.config = config |
| | | |
| | | if (isAddToMap) { |
| | |
| | | * @param {*} isAddToMap |
| | | */ |
| | | loadWmsLayer(options, isAddToMap = true, config) { |
| | | const layer = this.L.tileLayer.wms(options.url, options.option); |
| | | const layer = this.L.tileLayer.wms(options.url, options.option) |
| | | layer.config = config |
| | | |
| | | if (isAddToMap) { |
| | |
| | | loadTileLayer(options, isAddToMap = true, config) { |
| | | const layer = this.L.tileLayer(options.url, { |
| | | layers: options.layers || 'all',//country |
| | | format: options.format || "image/png", |
| | | format: options.format || 'image/png', |
| | | transparent: options.true || true, |
| | | crs: options.crs || L.CRS.EPSG4326, |
| | | maxZoom: options.maxZoom || 21, |
| | | minZoom: options.minZoom || 1, |
| | | zoomOffset: options.zoomOffset || 0 |
| | | }); |
| | | }) |
| | | layer.config = config |
| | | |
| | | if (isAddToMap) { |
| | |
| | | */ |
| | | hideTileLayer(code) { |
| | | if (this.tileLayersMap) { |
| | | let tileLayer = this.tileLayersMap.get(code) |
| | | const tileLayer = this.tileLayersMap.get(code) |
| | | this.map.removeLayer(tileLayer) |
| | | } |
| | | } |
| | |
| | | */ |
| | | showTileLayer(code) { |
| | | if (this.tileLayersMap) { |
| | | let tileLayer = this.tileLayersMap.get(code) |
| | | const tileLayer = this.tileLayersMap.get(code) |
| | | this.map.addLayer(tileLayer) |
| | | } |
| | | } |
| | |
| | | * @param {} code wms服务配置的code |
| | | */ |
| | | getWMSConfig(code) { |
| | | let mc = this.mapConfig |
| | | const mc = this.mapConfig |
| | | for (let i = 0, len = mc.mapConfig.ServiceLayers.length; i < len; ++i) { |
| | | if (code == mc.mapConfig.ServiceLayers[i].code && mc.mapConfig.ServiceLayers[i].type === 'wms') { |
| | | return mc.mapConfig.ServiceLayers[i] |