@@ -145,6 +145,11 @@ const MAP_LAYER_TYPE_2_SYMBOL_TYPE = {
145145 circle : 'point' ,
146146 line : 'line' ,
147147 symbol : 'point' ,
148+ // 聚合点图层渲染为 symbol,符号是图标而不是颜色
149+ 'point-cluster' : 'point' ,
150+ pointCluster : 'point' ,
151+ point : 'point' ,
152+ 'point-3d' : 'point' ,
148153 fill : 'polygon' ,
149154 'fill-extrusion' : 'polygon' ,
150155 heatmap : 'point' ,
@@ -922,9 +927,14 @@ export function createWebMapV3Extending(SuperClass, { MapManager, mapRepo, crsMa
922927 switch ( renderType ) {
923928 case 'text' :
924929 return LEGEND_RENDER_TYPE . TEXT ;
930+ // 聚合点图层(矢量和图片符号都可能)按点图例处理
925931 case 'circle' :
926932 case 'symbol' :
927933 case 'column' :
934+ case 'point' :
935+ case 'point-cluster' :
936+ case 'pointCluster' :
937+ case 'point-3d' :
928938 return LEGEND_RENDER_TYPE . POINT ;
929939 case 'heatGrid' :
930940 case 'heatHexagon' :
@@ -952,8 +962,13 @@ export function createWebMapV3Extending(SuperClass, { MapManager, mapRepo, crsMa
952962 switch ( renderType ) {
953963 case 'text' :
954964 return LEGEND_SHAPE_TYPE . TEXT ;
965+ // 聚合点图层(矢量和图片符号都可能)按点图例处理
955966 case 'circle' :
956967 case 'symbol' :
968+ case 'point' :
969+ case 'point-cluster' :
970+ case 'pointCluster' :
971+ case 'point-3d' :
957972 return LEGEND_SHAPE_TYPE . POINT ;
958973 case 'column' : {
959974 const symbolIds = {
@@ -962,7 +977,8 @@ export function createWebMapV3Extending(SuperClass, { MapManager, mapRepo, crsMa
962977 squareColumn : LEGEND_SHAPE_TYPE . RECTANGLE ,
963978 hexagonColumn : LEGEND_SHAPE_TYPE . HEXAGON
964979 } ;
965- return symbolIds [ styleSetting . shape . value ] || LEGEND_SHAPE_TYPE . POINT ;
980+ const columnShape = ( styleSetting . shape || { } ) . value ;
981+ return symbolIds [ columnShape ] || LEGEND_SHAPE_TYPE . POINT ;
966982 }
967983 case 'heatHexagon' :
968984 case 'heat3DHexagon' :
@@ -1077,8 +1093,10 @@ export function createWebMapV3Extending(SuperClass, { MapManager, mapRepo, crsMa
10771093 layerTitle
10781094 } ;
10791095 const renderType = styleSetting . type || layer . type ;
1080- const legendRenderType = this . _getLegendRenderType ( renderType ) ;
1081- const shape = this . _getLegendShape ( renderType , styleSetting ) ;
1096+ // renderer 的 type 可能比地图图层类型更细(如聚合点 point-cluster),
1097+ // 未匹配到时回退到图层类型,避免整层图例被丢弃
1098+ const legendRenderType = this . _getLegendRenderType ( renderType ) || this . _getLegendRenderType ( layer . type ) ;
1099+ const shape = this . _getLegendShape ( renderType , styleSetting ) || this . _getLegendShape ( layer . type , styleSetting ) ;
10821100 if ( [ 'heat' , 'heat3D' ] . includes ( renderType ) ) {
10831101 const colorKeyMap = {
10841102 heat : 'heatmap-color' ,
@@ -1171,9 +1189,11 @@ export function createWebMapV3Extending(SuperClass, { MapManager, mapRepo, crsMa
11711189 styleGroup = this . _parseUniqueStyle ( params ) ;
11721190 break ;
11731191 }
1192+ const settingField = subStyleSetting . field ;
11741193 const legendItem = {
11751194 ...commonStyleOptions ,
1176- themeField : ( subStyleSetting . field || [ ] ) [ 0 ] ,
1195+ // field 可能是字符串(如线性 size 专题图)也可能是数组,字符串时不能取首字符
1196+ themeField : ( Array . isArray ( settingField ) ? settingField [ 0 ] : settingField ) || commonStyleOptions . themeField ,
11771197 styleField : styleField ,
11781198 styleGroup
11791199 } ;
@@ -1325,7 +1345,12 @@ export function createWebMapV3Extending(SuperClass, { MapManager, mapRepo, crsMa
13251345 ...cssStyle
13261346 } ;
13271347 }
1328- return this . _getSpriteStyle ( symbolId , cssStyle ) ;
1348+ // 雪碧图未加载完成或符号不在雪碧图中时退化为矢量圆点,
1349+ // 否则样式为空对象,图例项会整块空白
1350+ return this . _getSpriteStyle ( symbolId , cssStyle ) || {
1351+ type : LEGEND_STYLE_TYPES . STYLE ,
1352+ ...cssStyle
1353+ } ;
13291354 }
13301355 case LEGEND_RENDER_TYPE . BUILTINSYMBOL : {
13311356 return {
0 commit comments