@@ -50,6 +50,13 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo }) {
5050 this . _getMapInfo ( mapInfo , this . _taskID ) ;
5151 }
5252
53+ cleanLayers ( layers ) {
54+ super . cleanLayers ( layers ) ;
55+ this . echartslayer . forEach ( echartLayer => {
56+ echartLayer . remove ( ) ;
57+ } ) ;
58+ }
59+
5360 clean ( removeMap = true ) {
5461 if ( this . map ) {
5562 if ( this . _sourceListModel ) {
@@ -320,7 +327,6 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo }) {
320327 } ,
321328 fadeDuration : 0
322329 } ) ;
323- window . map = this . map ;
324330 this . fire ( 'mapinitialized' , { map : this . map } ) ;
325331 }
326332
@@ -522,7 +528,8 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo }) {
522528 this . map . addLayer ( graticuleLayer ) ;
523529 this . _setCacheLayer ( {
524530 parentLayerId : graticuleLayer . id ,
525- subRenderLayers : [ { layerId : graticuleLayer . id } , { layerId : graticuleLayer . sourceId } ]
531+ subRenderLayers : [ { layerId : graticuleLayer . id } , { layerId : graticuleLayer . sourceId } ] ,
532+ metadata : { SM_Layer_Order : 'Top' }
526533 } ) ;
527534 this . _addLayerSucceeded ( ) ;
528535 }
@@ -1072,7 +1079,8 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo }) {
10721079 echartslayer . chart . _dom . style . display = 'none' ;
10731080 }
10741081 }
1075- }
1082+ } ,
1083+ metadata : { SM_Layer_Order : 'top' }
10761084 } ) ;
10771085 this . _addLayerSucceeded ( { layerInfo, features } ) ;
10781086 }
@@ -2755,23 +2763,25 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo }) {
27552763 this . _updateLayer ( layerInfo ) ;
27562764 return ;
27572765 }
2758- const nextLayerInfo = Object . assign ( layerInfo , { metadata : { parentLayerId } } ) ;
2766+ const nextLayerInfo = Object . assign ( { } , layerInfo ) ;
2767+ nextLayerInfo . metadata = Object . assign ( { } , nextLayerInfo . metadata , { SM_Layer_Id : parentLayerId } )
27592768 this . map . addLayer ( nextLayerInfo ) ;
27602769 this . _setCacheLayer ( { layerInfo, parentLayerId, id, beforeId } ) ;
27612770 }
27622771
2763- _setCacheLayer ( { parentLayerId, layerInfo, reused = false , beforeId, subRenderLayers } ) {
2772+ _setCacheLayer ( { parentLayerId, layerInfo, reused = false , beforeId, subRenderLayers, metadata } ) {
27642773 const renderLayers = subRenderLayers || [ { layerId : layerInfo . id , reused } ] ;
27652774 if ( ! this . _cacheLayerId . has ( parentLayerId ) ) {
2766- this . _cacheLayerId . set ( parentLayerId , renderLayers ) ;
2775+ const metadataInfo = Object . assign ( { } , metadata || layerInfo && layerInfo . metadata , { SM_Layer_Id : parentLayerId } ) ;
2776+ this . _cacheLayerId . set ( parentLayerId , { renderLayers, metadata : metadataInfo } ) ;
27672777 } else {
2768- const renderLayerList = this . _cacheLayerId . get ( parentLayerId ) ;
2778+ const layerCacheData = this . _cacheLayerId . get ( parentLayerId ) ;
27692779 let matchIndex = - 1 ;
27702780 if ( beforeId ) {
2771- matchIndex = renderLayerList . findIndex ( ( item ) => item . layerId === beforeId ) ;
2781+ matchIndex = layerCacheData . renderLayers . findIndex ( ( item ) => item . layerId === beforeId ) ;
27722782 }
2773- const matchInsertIndex = matchIndex < 0 ? renderLayerList . length : matchIndex ;
2774- renderLayerList . splice ( matchInsertIndex , 0 , ...renderLayers ) ;
2783+ const matchInsertIndex = matchIndex < 0 ? layerCacheData . renderLayers . length : matchIndex ;
2784+ layerCacheData . renderLayers . splice ( matchInsertIndex , 0 , ...renderLayers ) ;
27752785 }
27762786 if ( this . addLayersSucceededLen && this . _cacheLayerId . size <= this . expectLayerLen ) {
27772787 this . _changeSourceListModel ( ) ;
@@ -2817,18 +2827,19 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo }) {
28172827 const targetLayerId = layerInfo . layerID || layerInfo . name ;
28182828 const targetLayerVisible =
28192829 layerInfo . visible === void 0 || layerInfo . visible === 'visible' || layerInfo . visible === true ;
2820- const matchLayers = this . _cacheLayerId . get ( targetLayerId ) ;
2821- if ( matchLayers ) {
2822- const renderLayers = matchLayers . map ( ( item ) => item . layerId ) ;
2830+ const matchCacheData = this . _cacheLayerId . get ( targetLayerId ) ;
2831+ if ( matchCacheData ) {
2832+ const renderLayers = matchCacheData . renderLayers . map ( ( item ) => item . layerId ) ;
28232833 if ( ! renderLayers . length ) {
28242834 return ;
28252835 }
28262836 layersFromMapInfo . push ( {
28272837 ...layerInfo ,
2838+ ...matchCacheData ,
28282839 id : targetLayerId ,
28292840 visible : targetLayerVisible ,
28302841 renderLayers,
2831- reused : matchLayers . some ( ( item ) => item . reused )
2842+ reused : matchCacheData . renderLayers . some ( ( item ) => item . reused )
28322843 } ) ;
28332844 }
28342845 } ) ;
@@ -2845,7 +2856,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo }) {
28452856 } ) ;
28462857 return ;
28472858 }
2848- this . _sourceListModel . setSelfLayers ( layersFromMapInfo ) ;
2859+ this . _sourceListModel . setLayers ( layersFromMapInfo ) ;
28492860 }
28502861
28512862 _getSelfAppreciableLayers ( appreciableLayers ) {
0 commit comments