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

Method _findTopLayerBeforeId

src/common/mapping/WebMapV2.js:3039–3059  ·  view source on GitHub ↗
(selfAppreciableLayers)

Source from the content-addressed store, hash-verified

3037 }
3038
3039 _findTopLayerBeforeId(selfAppreciableLayers) {
3040 // fix 追加图层,异步的图层回来排序错乱
3041 const selfLayerIds = selfAppreciableLayers
3042 .filter((item) => !item.reused)
3043 .reduce((ids, item) => ids.concat(item.renderLayers), []);
3044 const firstSelfLayerIdOnMap = selfLayerIds.find((id) => this.map.style._layers[id]);
3045 if (!firstSelfLayerIdOnMap) {
3046 return;
3047 }
3048 const layersOnMap = this.map.getStyle().layers;
3049 const firstSelfLayerIndex = layersOnMap.findIndex((item) => item.id === firstSelfLayerIdOnMap);
3050 const extraLayerIdsOnMap = layersOnMap
3051 .filter((item) => !selfLayerIds.some((id) => id === item.id))
3052 .map((item) => item.id);
3053 for (const layerId of extraLayerIdsOnMap) {
3054 const matchIndex = layersOnMap.findIndex((item) => item.id === layerId);
3055 if (matchIndex > firstSelfLayerIndex) {
3056 return layerId;
3057 }
3058 }
3059 }
3060
3061 _changeSourceListModel() {
3062 const layersFromMapInfo = [];

Callers 1

_setCacheLayerMethod · 0.95

Calls 4

filterMethod · 0.80
mapMethod · 0.80
findMethod · 0.45
getStyleMethod · 0.45

Tested by

no test coverage detected