@@ -3174,7 +3174,9 @@ export class WebMap extends Observable {
3174
3174
segmentCount = themeSetting . segmentCount || this . defaultParameters . themeSetting . segmentCount ,
3175
3175
customSettings = themeSetting . customSettings ,
3176
3176
minR = parameters . themeSetting . minRadius ,
3177
- maxR = parameters . themeSetting . maxRadius ;
3177
+ maxR = parameters . themeSetting . maxRadius ,
3178
+ fillColor = style . fillColor ,
3179
+ colors = parameters . themeSetting . colors ;
3178
3180
features . forEach ( feature => {
3179
3181
let attributes = feature . get ( 'attributes' ) ,
3180
3182
value = attributes [ themeField ] ;
@@ -3206,19 +3208,22 @@ export class WebMap extends Observable {
3206
3208
let len = segements . length ,
3207
3209
incrementR = ( maxR - minR ) / ( len - 1 ) , // 半径增量
3208
3210
start , end , radius = Number ( ( ( maxR + minR ) / 2 ) . toFixed ( 2 ) ) ;
3209
- for ( let i = 0 ; i < len - 1 ; i ++ ) {
3210
- start = Number ( segements [ i ] . toFixed ( 2 ) ) ;
3211
- end = Number ( segements [ i + 1 ] . toFixed ( 2 ) ) ;
3211
+ // 获取颜色
3212
+ let rangeColors = colors ? ColorsPickerUtil . getGradientColors ( colors , len , 'RANGE' ) : [ ] ;
3213
+ for ( let j = 0 ; j < len - 1 ; j ++ ) {
3214
+ start = Number ( segements [ j ] . toFixed ( 2 ) ) ;
3215
+ end = Number ( segements [ j + 1 ] . toFixed ( 2 ) ) ;
3212
3216
// 这里特殊处理以下分段值相同的情况(即所有字段值相同)
3213
- radius = start === end ? radius : minR + Math . round ( incrementR * i ) ;
3217
+ radius = start === end ? radius : minR + Math . round ( incrementR * j ) ;
3214
3218
// 最后一个分段时将end+0.01,避免取不到最大值
3215
- end = i === len - 2 ? end + 0.01 : end ;
3219
+ end = j === len - 2 ? end + 0.01 : end ;
3216
3220
// 处理自定义 半径
3217
- radius = customSettings [ i ] && customSettings [ i ] . radius ? customSettings [ i ] . radius : radius ;
3221
+ radius = customSettings [ j ] && customSettings [ j ] . radius ? customSettings [ j ] . radius : radius ;
3218
3222
// 转化成 ol 样式
3219
3223
style . radius = radius ;
3224
+ style . fillColor = customSettings [ j ] && customSettings [ j ] . color ? customSettings [ j ] . color : rangeColors [ j ] || fillColor ;
3220
3225
let olStyle = StyleUtils . getOpenlayersStyle ( style , featureType , true ) ;
3221
- styleGroup . push ( { olStyle : olStyle , radius, start, end } ) ;
3226
+ styleGroup . push ( { olStyle : olStyle , radius, start, end, fillColor : style . fillColor } ) ;
3222
3227
}
3223
3228
return styleGroup ;
3224
3229
} else {
0 commit comments