MCPcopy Create free account
hub / github.com/SuperMap/iClient-JavaScript / _addLayersToMap

Method _addLayersToMap

src/common/mapping/MapStyle.js:84–97  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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));

Callers 1

initializeMapMethod · 0.95

Calls 7

_setUniqueIdMethod · 0.95
_sendMapToUserMethod · 0.95
forEachMethod · 0.80
addSourceMethod · 0.80
findMethod · 0.45
getSourceMethod · 0.45
addLayerMethod · 0.45

Tested by

no test coverage detected