派生自 wuyushui/SewerAndRainNetwork

wangrui
2020-12-23 3eda2a49edc60f3961604223f557dcd6ab6db94f
src/components/helpers/BasemapHelper.js
@@ -46,30 +46,31 @@
    /**
     * 显示某个图层
     * @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)
    }
    // 公网创建地图部分