@@ -42,12 +42,6 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo }) {
4242 this . _appendLayers = false ;
4343 }
4444
45- /**
46- * @private
47- * @function WebMapV2.prototype.initializeMap
48- * @description 登陆窗口后添加地图图层。
49- * @param {Object } mapInfo - map 信息。
50- */
5145 initializeMap ( mapInfo , map ) {
5246 if ( map ) {
5347 this . _appendLayers = true ;
@@ -2226,7 +2220,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo }) {
22262220 }
22272221
22282222 _rectifyLayersOrder ( appreciableLayers , topLayerBeforeId ) {
2229- const renderLayers = appreciableLayers . reduce ( ( layers , layer ) => {
2223+ const renderLayers = appreciableLayers . filter ( item => ! item . reused ) . reduce ( ( layers , layer ) => {
22302224 return layers . concat ( layer . renderLayers ) ;
22312225 } , [ ] ) ;
22322226 const labelLayerIds = [ ] ;
@@ -2726,7 +2720,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo }) {
27262720 const { id } = layerInfo ;
27272721 if ( this . map . getLayer ( id ) ) {
27282722 if ( this . checkSameLayer && this . _isSameRasterLayer ( id , layerInfo ) ) {
2729- this . _setCacheLayer ( { layerInfo, parentLayerId, id, ignore : true , beforeId } ) ;
2723+ this . _setCacheLayer ( { layerInfo, parentLayerId, id, reused : true , beforeId } ) ;
27302724 return ;
27312725 }
27322726 this . _updateLayer ( layerInfo ) ;
@@ -2737,8 +2731,8 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo }) {
27372731 this . _setCacheLayer ( { layerInfo, parentLayerId, id, beforeId } ) ;
27382732 }
27392733
2740- _setCacheLayer ( { parentLayerId, layerInfo, ignore = false , beforeId, subRenderLayers } ) {
2741- const renderLayers = subRenderLayers || [ { layerId : layerInfo . id , ignore } ] ;
2734+ _setCacheLayer ( { parentLayerId, layerInfo, reused = false , beforeId, subRenderLayers } ) {
2735+ const renderLayers = subRenderLayers || [ { layerId : layerInfo . id , reused } ] ;
27422736 if ( ! this . _cacheLayerId . has ( parentLayerId ) ) {
27432737 this . _cacheLayerId . set ( parentLayerId , renderLayers ) ;
27442738 } else {
@@ -2763,22 +2757,23 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo }) {
27632757 layerInfo . visible === void 0 || layerInfo . visible === 'visible' || layerInfo . visible === true ;
27642758 const matchLayers = this . _cacheLayerId . get ( targetLayerId ) ;
27652759 if ( matchLayers ) {
2766- const renderLayers = matchLayers . filter ( ( item ) => ! item . ignore ) . map ( ( item ) => item . layerId ) ;
2760+ const renderLayers = matchLayers . map ( ( item ) => item . layerId ) ;
27672761 if ( ! renderLayers . length ) {
27682762 return ;
27692763 }
27702764 layersFromMapInfo . push ( {
27712765 ...layerInfo ,
27722766 id : targetLayerId ,
27732767 visible : targetLayerVisible ,
2774- renderLayers
2768+ renderLayers,
2769+ reused : matchLayers . some ( item => item . reused ) || void 0
27752770 } ) ;
27762771 }
27772772 } ) ;
27782773 this . _changeSourceListModel ( layersFromMapInfo ) ;
27792774 const appreciableLayers = this . getLayers ( ) ;
27802775 if ( this . addLayersSucceededLen && this . _cacheLayerId . size !== this . addLayersSucceededLen ) {
2781- const selfAppreciableLayers = this . getSelfAppreciableLayers ( appreciableLayers )
2776+ const selfAppreciableLayers = this . getSelfAppreciableLayers ( appreciableLayers ) ;
27822777 const topLayerBeforeId = this . _findTopLayerBeforeId ( selfAppreciableLayers ) ;
27832778 this . _rectifyLayersOrder ( selfAppreciableLayers , topLayerBeforeId ) ;
27842779 this . addLayersSucceededLen = this . _cacheLayerId . size ;
@@ -2788,7 +2783,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo }) {
27882783
27892784 _findTopLayerBeforeId ( selfAppreciableLayers ) {
27902785 // fix 追加图层,异步的图层回来排序错乱
2791- const selfLayerIds = selfAppreciableLayers . reduce ( ( ids , item ) => ids . concat ( item . renderLayers ) , [ ] ) ;
2786+ const selfLayerIds = selfAppreciableLayers . filter ( item => ! item . reused ) . reduce ( ( ids , item ) => ids . concat ( item . renderLayers ) , [ ] ) ;
27922787 const firstSelfLayerIdOnMap = selfLayerIds . find ( ( id ) => this . map . style . _layers [ id ] ) ;
27932788 if ( ! firstSelfLayerIdOnMap ) {
27942789 return ;
0 commit comments