(layer, styleSetting)
| 994 | } |
| 995 | |
| 996 | _createLayerLegendList(layer, styleSetting) { |
| 997 | const layerId = layer.id; |
| 998 | const layerTitle = layer.title; |
| 999 | const textFieldName = styleSetting.type === 'text' && styleSetting.textField && styleSetting.textField.value.replace(/^\{|\}$/g, ''); |
| 1000 | const commonStyleOptions = { |
| 1001 | themeField: layer.themeField || styleSetting.field, |
| 1002 | layerId, |
| 1003 | layerTitle |
| 1004 | }; |
| 1005 | const renderType = styleSetting.type || layer.type; |
| 1006 | const legendRenderType = this._getLegendRenderType(renderType); |
| 1007 | const shape = this._getLegendShape(renderType, styleSetting); |
| 1008 | if (['heat', 'heat3D'].includes(renderType)) { |
| 1009 | const colorKeyMap = { |
| 1010 | heat: 'heatmap-color', |
| 1011 | heat3D: 'heatmap-extrusion-color' |
| 1012 | }; |
| 1013 | const colors = this._heatColorToGradient((layer.paint || {})[colorKeyMap[renderType]]); |
| 1014 | return [ |
| 1015 | { |
| 1016 | ...commonStyleOptions, |
| 1017 | styleGroup: [ |
| 1018 | { |
| 1019 | style: { |
| 1020 | type: LEGEND_STYLE_TYPES.STYLE, |
| 1021 | shape, |
| 1022 | colors |
| 1023 | } |
| 1024 | } |
| 1025 | ] |
| 1026 | } |
| 1027 | ]; |
| 1028 | } |
| 1029 | const styleKeys = LEGEND_STYLE_KEYS[legendRenderType]; |
| 1030 | if (!styleKeys) { |
| 1031 | return; |
| 1032 | } |
| 1033 | const keys = this._transStyleKeys(renderType, styleKeys); |
| 1034 | this._transStyleSetting(renderType, styleSetting); |
| 1035 | const simpleStyle = this._getLegendSimpleStyle(styleSetting, keys); |
| 1036 | const simpleResData = this._parseLegendtyle({ legendRenderType, customValue: simpleStyle }); |
| 1037 | let dataKeys = this._getDataDrivenStyleKeys(legendRenderType, keys, styleSetting); |
| 1038 | // 3D线,动画线 |
| 1039 | if (legendRenderType === LEGEND_RENDER_TYPE.ANIMATELINE) { |
| 1040 | // isReplaceLineColor: 3D线,动画线:使用符号替换线颜色,图例中将不再显示线颜色 |
| 1041 | const isReplaceLineColor = styleSetting.textureBlend.value === 'replace'; |
| 1042 | const hasTexture = !!(styleSetting.symbolsContent.value && styleSetting.symbolsContent.value.symbolId); |
| 1043 | if (isReplaceLineColor && hasTexture) { |
| 1044 | dataKeys = dataKeys.filter((key) => key !== 'color') |
| 1045 | } |
| 1046 | } else { |
| 1047 | // 其他 |
| 1048 | // isAllPic: 如果符号为图片,图例中将不再显示颜色 |
| 1049 | const symbolTypes = MAP_LAYER_TYPE_2_SYMBOL_TYPE[layer.type]; |
| 1050 | const isAllPic = this._isAllPictureSymbolSaved(symbolTypes, styleSetting.symbolsContent, this._spriteDatas); |
| 1051 | if(isAllPic) { |
| 1052 | dataKeys = dataKeys.filter((key) => key !== 'color') |
| 1053 | } |
no test coverage detected