()
| 82 | } |
| 83 | |
| 84 | _addLayersToMap() { |
| 85 | const { sources, layers, layerIdMapList } = this._setUniqueId(this.mapOptions.style); |
| 86 | layers.forEach((layer) => { |
| 87 | const matchRenameLayer = layerIdMapList.find(sub => sub.renderId === layer.id); |
| 88 | if (matchRenameLayer && matchRenameLayer.reused) { |
| 89 | return; |
| 90 | } |
| 91 | layer.source && !this.map.getSource(layer.source) && this.map.addSource(layer.source, sources[layer.source]); |
| 92 | this.map.addLayer(layer); |
| 93 | }); |
| 94 | Object.assign(this.mapOptions.style, { layers, sources }); |
| 95 | this._layerIdRenameMapList = layerIdMapList; |
| 96 | this._sendMapToUser(); |
| 97 | } |
| 98 | |
| 99 | _setUniqueId(style) { |
| 100 | const layersToMap = JSON.parse(JSON.stringify(style.layers)); |
no test coverage detected