MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / cleanLayers

Method cleanLayers

src/common/mapping/MapBase.js:70–89  ·  view source on GitHub ↗
(layers)

Source from the content-addressed store, hash-verified

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}

Callers 10

callbackFunction · 0.45
WebMapV2Spec.jsFile · 0.45
callbackFunction · 0.45
callbackFunction · 0.45
WebMapV3Spec.jsFile · 0.45
callbackFunction · 0.45
WebMapV2Spec.jsFile · 0.45
callbackFunction · 0.45
callbackFunction · 0.45
WebMapV3Spec.jsFile · 0.45

Calls 6

forEachMethod · 0.80
pushMethod · 0.80
getLayerMethod · 0.45
removeLayerMethod · 0.45
getSourceMethod · 0.45
removeSourceMethod · 0.45

Tested by

no test coverage detected