(layers)
| 68 | copyLayer() {} |
| 69 | |
| 70 | cleanLayers(layers) { |
| 71 | const sourceList = []; |
| 72 | for (const item of layers) { |
| 73 | item.renderLayers.forEach((layerId) => { |
| 74 | const layer = this.map.getLayer(layerId); |
| 75 | if (layer) { |
| 76 | this.map.removeLayer(layerId); |
| 77 | if (!item.l7Layer && layer.source && typeof layer.source === 'string') { |
| 78 | sourceList.push(layer.source); |
| 79 | } |
| 80 | } |
| 81 | }); |
| 82 | if (this.map.getSource(item.renderSource.id) && !item.l7Layer) { |
| 83 | sourceList.push(item.renderSource.id); |
| 84 | } |
| 85 | } |
| 86 | Array.from(new Set(sourceList)).forEach((sourceId) => { |
| 87 | this.map.removeSource(sourceId); |
| 88 | }); |
| 89 | } |
| 90 | }; |
| 91 | } |
no test coverage detected