| 3059 | } |
| 3060 | |
| 3061 | _changeSourceListModel() { |
| 3062 | const layersFromMapInfo = []; |
| 3063 | const layerList = [this._mapInfo.baseLayer].concat(this._mapInfo.layers); |
| 3064 | if (this._graticuleLayer) { |
| 3065 | const { id: layerID, visible } = this._graticuleLayer; |
| 3066 | layerList.push({ layerID, visible, name: 'GraticuleLayer' }); |
| 3067 | } |
| 3068 | // this._mapInfo.layers 是有序的 |
| 3069 | layerList.forEach((layerInfo) => { |
| 3070 | const targetLayerId = layerInfo.layerID || layerInfo.name; |
| 3071 | const targetLayerVisible = |
| 3072 | layerInfo.visible === void 0 || layerInfo.visible === 'visible' || layerInfo.visible === true; |
| 3073 | const matchCacheData = this._cacheLayerId.get(targetLayerId); |
| 3074 | if (matchCacheData) { |
| 3075 | const renderLayers = matchCacheData.renderLayers.map((item) => item.layerId); |
| 3076 | if (!renderLayers.length) { |
| 3077 | return; |
| 3078 | } |
| 3079 | layersFromMapInfo.push({ |
| 3080 | ...layerInfo, |
| 3081 | ...matchCacheData, |
| 3082 | id: targetLayerId, |
| 3083 | visible: targetLayerVisible, |
| 3084 | renderLayers, |
| 3085 | reused: matchCacheData.renderLayers.some((item) => item.reused) |
| 3086 | }); |
| 3087 | } |
| 3088 | }); |
| 3089 | if (!this._sourceListModel) { |
| 3090 | this._sourceListModel = new SourceListModelV2({ |
| 3091 | map: this.map, |
| 3092 | layers: layersFromMapInfo, |
| 3093 | appendLayers: this._appendLayers |
| 3094 | }); |
| 3095 | this._sourceListModel.on({ |
| 3096 | layerupdatechanged: (params) => { |
| 3097 | this.fire('layerupdatechanged', params); |
| 3098 | } |
| 3099 | }); |
| 3100 | return; |
| 3101 | } |
| 3102 | this._sourceListModel.setLayers(layersFromMapInfo); |
| 3103 | } |
| 3104 | |
| 3105 | _getSelfAppreciableLayers(appreciableLayers) { |
| 3106 | return { |