(layerInfo, style)
| 2679 | } |
| 2680 | |
| 2681 | _initLegendConfigInfo(layerInfo, style) { |
| 2682 | const legendItem = { |
| 2683 | layerId: layerInfo.layerID, |
| 2684 | layerTitle: layerInfo.layerID, |
| 2685 | themeField: this._getThemeField(layerInfo), |
| 2686 | styleGroup: style |
| 2687 | }; |
| 2688 | |
| 2689 | const commonStyleGroupMapping = (styleGroup, layerInfo) => { |
| 2690 | let newStyleGroup = { |
| 2691 | style: { |
| 2692 | shape: this._getShape(layerInfo.featureType), |
| 2693 | type: this._getType(styleGroup.style.type) |
| 2694 | } |
| 2695 | }; |
| 2696 | this._addProps(newStyleGroup, styleGroup); |
| 2697 | return newStyleGroup; |
| 2698 | }; |
| 2699 | |
| 2700 | switch (layerInfo.layerType) { |
| 2701 | case 'UNIQUE': |
| 2702 | case 'VECTOR': |
| 2703 | legendItem.styleGroup = legendItem.styleGroup.map((styleGroup) => { |
| 2704 | return { |
| 2705 | fieldValue: styleGroup.value, |
| 2706 | ...commonStyleGroupMapping(styleGroup, layerInfo) |
| 2707 | }; |
| 2708 | }); |
| 2709 | break; |
| 2710 | case 'RANGE': |
| 2711 | case 'RANK_SYMBOL': |
| 2712 | legendItem.styleGroup = legendItem.styleGroup.map((styleGroup) => { |
| 2713 | const newStyleGroup = { |
| 2714 | start: styleGroup.start, |
| 2715 | end: styleGroup.end, |
| 2716 | ...commonStyleGroupMapping(styleGroup, layerInfo) |
| 2717 | }; |
| 2718 | return newStyleGroup; |
| 2719 | }); |
| 2720 | break; |
| 2721 | case 'HEAT': |
| 2722 | legendItem.styleGroup = [ |
| 2723 | { |
| 2724 | style: { |
| 2725 | shape: 'POINT', |
| 2726 | type: 'style', |
| 2727 | colors: this._heatColorToGradient(legendItem.styleGroup) |
| 2728 | } |
| 2729 | } |
| 2730 | ]; |
| 2731 | break; |
| 2732 | default: |
| 2733 | break; |
| 2734 | } |
| 2735 | const matchIndex = this._legendList.findIndex((item) => item.layerId === layerInfo.layerID); |
| 2736 | if (matchIndex > -1) { |
| 2737 | this._legendList.splice(matchIndex, 1, legendItem); |
| 2738 | return; |
no test coverage detected