| | |
| | | |
| | | /** |
| | | * 显示某个图层 |
| | | * @param map 地图对象 |
| | | * @param layer 待显示图层引用 |
| | | * @param isHideOthers 是否先关闭其他图层,默认是true |
| | | */ |
| | | showBasemap = (map, code, isHideOthers = true) => { |
| | | showBasemap = (code, isHideOthers = true) => { |
| | | debugger |
| | | let basemap = this.basemapMap.get(code) |
| | | if(isHideOthers) { |
| | | for(let i = 0, len = this.basemapList.length; i < len; ++i){ |
| | | map.removeLayer(this.basemapList[i]) |
| | | this.map.removeLayer(this.basemapList[i].layer) |
| | | this.map.removeLayer(this.basemapList[i].annotation) |
| | | } |
| | | } |
| | | map.addLayer(basemap.layer) |
| | | map.addLayer(basemap.annotation) |
| | | this.map.addLayer(basemap.layer) |
| | | this.map.addLayer(basemap.annotation) |
| | | } |
| | | |
| | | /** |
| | | * 隐藏某个图层 |
| | | * @param map 地图对象 |
| | | * @param layer 待关闭图层引用 |
| | | */ |
| | | hideBasemap = (map, code) => { |
| | | hideBasemap = (code) => { |
| | | debugger |
| | | let basemap = this.basemapMap.get(code) |
| | | map.removeLayer(basemap.layer) |
| | | map.removeLayer(basemap.annotation) |
| | | this.map.removeLayer(basemap.layer) |
| | | this.map.removeLayer(basemap.annotation) |
| | | } |
| | | |
| | | // 公网创建地图部分 |
| | |
| | | let internetBasemaps = mapConfig.mapConfig.InternetBaseMaps |
| | | for(let i = 0, len = internetBasemaps.length; i < len; ++i) { |
| | | let basemapConfig = internetBasemaps[i] |
| | | let basemapLayer = this.L.tileLayer(basemapConfig.map.url, basemapConfig.map.options) |
| | | let basemapAnnotationLayer = this.L.tileLayer(basemapConfig.annotation.url, basemapConfig.annotation.options) |
| | | let basemapLayer = this.L.tileLayer(basemapConfig.map.url, basemapConfig.map.option) |
| | | let basemapAnnotationLayer = this.L.tileLayer(basemapConfig.annotation.url, basemapConfig.annotation.option) |
| | | |
| | | let basemap = { |
| | | code: basemapConfig.code, |
| | | name: basemapConfig.name, |
| | | conf: basemapConfig, |
| | | layer: basemapLayer, |
| | | annotation: basemapAnnotationLayer |
| | | } |
| | |
| | | let intranetBasemaps = mapConfig.mapConfig.IntranetBaseMaps |
| | | for(let i = 0, len = intranetBasemaps.length; i < len; ++i) { |
| | | let basemapConfig = intranetBasemaps[i] |
| | | let basemapLayer = this.L.tileLayer(basemapConfig.map.url, basemapConfig.map.options) |
| | | let basemapAnnotationLayer = this.L.tileLayer(basemapConfig.annotation.url, basemapConfig.annotation.options) |
| | | let basemapLayer = this.L.tileLayer(basemapConfig.map.url, basemapConfig.map.option) |
| | | let basemapAnnotationLayer = this.L.tileLayer(basemapConfig.annotation.url, basemapConfig.annotation.option) |
| | | |
| | | let basemap = { |
| | | code: basemapConfig.code, |
| | | name: basemapConfig.name, |
| | | conf: basemapConfig, |
| | | layer: basemapLayer, |
| | | annotation: basemapAnnotationLayer |
| | | } |