@@ -70,7 +70,8 @@ const LEGEND_CSS_DEFAULT = {
7070 marginLeft : '1px' ,
7171 outlineStyle : 'none' ,
7272 outlineColor : '#FFFFFF' ,
73- outlineWidth : '0.5px'
73+ outlineWidth : '0.5px' ,
74+ outlineOpacity : 1
7475 } ,
7576 [ LEGEND_RENDER_TYPE . FILLEXTRUSION ] : {
7677 width : '20px' ,
@@ -110,7 +111,7 @@ const LEGEND_STYLE_KEYS = {
110111 [ LEGEND_RENDER_TYPE . POINT ] : [ 'symbolsContent' , 'size' , 'color' , 'opacity' ] ,
111112 [ LEGEND_RENDER_TYPE . BUILTINSYMBOL ] : [ 'symbolsContent' , 'size' , 'color' , 'opacity' ] ,
112113 [ LEGEND_RENDER_TYPE . LINE ] : [ 'width' , 'color' , 'opacity' , 'lineDasharray' , 'symbolsContent' ] ,
113- [ LEGEND_RENDER_TYPE . FILL ] : [ 'color' , 'opacity' , 'antialias' , 'outline' , 'outlineColor' , 'outlineWidth' , 'symbolsContent' ] ,
114+ [ LEGEND_RENDER_TYPE . FILL ] : [ 'color' , 'opacity' , 'antialias' , 'outline' , 'outlineColor' , 'outlineWidth' , 'outlineOpacity' , 'outlineSymbolsContent ', 'symbolsContent' ] ,
114115 [ LEGEND_RENDER_TYPE . FILLEXTRUSION ] : [ 'color' , 'opacity' , 'symbolsContent' ] ,
115116 [ LEGEND_RENDER_TYPE . ANIMATEPOINT ] : [ 'color' , 'opacity' , 'size' , 'speed' , 'rings' ] ,
116117 [ LEGEND_RENDER_TYPE . ANIMATELINE ] : [ 'color' , 'opacity' , 'width' , 'textureBlend' , 'symbolsContent' , 'iconStep' ] ,
@@ -868,7 +869,7 @@ export function createWebMapV3Extending(SuperClass, { MapManager, mapRepo, crsMa
868869 if ( keys ) {
869870 const simpleKeys = keys . filter ( ( k ) => styleSetting [ k ] && styleSetting [ k ] . type === 'simple' ) ;
870871 simpleKeys . forEach ( ( k ) => {
871- const isOutlineKey = k === 'outlineColor' || k === 'outlineWidth' ;
872+ const isOutlineKey = [ 'outlineColor' , 'outlineWidth' , 'outlineOpacity' , 'outlineSymbolsContent' ] . includes ( k ) ;
872873 const hasOutline =
873874 styleSetting &&
874875 (
@@ -1359,13 +1360,36 @@ export function createWebMapV3Extending(SuperClass, { MapManager, mapRepo, crsMa
13591360 }
13601361 } ) ;
13611362 Object . assign ( cssStyle , { outlineStyle : ( customValue . antialias || customValue . outline ) ? 'solid' : 'none' } ) ;
1363+ // 轮廓线符号与轮廓线宽平级,交由图例组件渲染
1364+ if ( customValue . outlineSymbolsContent ) {
1365+ cssStyle . outlineSymbolsContent = customValue . outlineSymbolsContent ;
1366+ // 轮廓图片符号(line-pattern 连续纹理 / icon-image 图标点)的雪碧图信息,
1367+ // 按图片 id 附带在样式上,供图例组件直接裁剪轮廓图块
1368+ const outlineSprites = { } ;
1369+ [ ] . concat ( customValue . outlineSymbolsContent . style || [ ] ) . forEach ( ( outlineSymbol ) => {
1370+ const outlinePaint = ( outlineSymbol && outlineSymbol . paint ) || { } ;
1371+ const outlineLayout = ( outlineSymbol && outlineSymbol . layout ) || { } ;
1372+ const outlineImageId = outlinePaint [ 'line-pattern' ] || outlineLayout [ 'icon-image' ] ;
1373+ if ( outlineImageId && this . _spriteDatas [ outlineImageId ] ) {
1374+ outlineSprites [ outlineImageId ] = this . _spriteDatas [ outlineImageId ] ;
1375+ }
1376+ } ) ;
1377+ if ( Object . keys ( outlineSprites ) . length ) {
1378+ cssStyle . outlineSprites = outlineSprites ;
1379+ }
1380+ }
13621381 if ( this . _spriteDatas [ symbolId ] ) {
13631382 return this . _getSpriteStyle ( symbolId , { ...cssStyle , backgroundColor : 'transparent' } ) ;
13641383 }
1365- return {
1384+ // 纯色面填充 + 图片轮廓符号:样式仍走矢量渲染,附上雪碧图地址供图例组件加载并裁剪轮廓图块
1385+ const legendStyle = {
13661386 type : LEGEND_STYLE_TYPES . STYLE ,
13671387 ...cssStyle
13681388 } ;
1389+ if ( customValue . outlineSymbolsContent && typeof this . _sprite === 'string' ) {
1390+ legendStyle . url = `${ this . _sprite } .png` ;
1391+ }
1392+ return legendStyle ;
13691393 }
13701394 }
13711395 }
0 commit comments