@@ -2948,8 +2948,7 @@ export class WebMap extends Observable {
29482948 let featureType = parameters . featureType ,
29492949 style = parameters . style ,
29502950 themeSetting = parameters . themeSetting ;
2951- let fieldName = themeSetting . themeField ,
2952- colors = themeSetting . colors ;
2951+ let fieldName = themeSetting . themeField ;
29532952
29542953 let names = [ ] ,
29552954 customSettings = themeSetting . customSettings ;
@@ -2968,37 +2967,57 @@ export class WebMap extends Observable {
29682967 }
29692968 }
29702969
2971- //获取一定量的颜色
2972- let curentColors = colors ;
2973- curentColors = ColorsPickerUtil . getGradientColors ( curentColors , names . length ) ;
29742970
29752971 //生成styleGroup
29762972 let styleGroup = [ ] ;
29772973 names . forEach ( function ( name , index ) {
29782974 //兼容之前自定义是用key,现在因为数据支持编辑,需要用属性值。
29792975 let key = this . webMapVersion === "1.0" ? index : name ;
2980- let color = curentColors [ key ] ;
2981- if ( key in customSettings ) {
2982- color = customSettings [ key ] ;
2983- }
2984-
2985- if ( featureType === "LINE" ) {
2986- style . strokeColor = color ;
2976+ let custom = customSettings [ key ] ;
2977+ if ( Util . isString ( custom ) ) {
2978+ //兼容之前自定义只存储一个color
2979+ custom = this . getCustomSetting ( style , custom , featureType ) ;
2980+ customSettings [ key ] = custom ;
2981+ }
2982+
2983+ // 转化成 ol 样式
2984+ let olStyle , type = custom . type ;
2985+ if ( type === 'SYMBOL_POINT' ) {
2986+ olStyle = StyleUtils . getSymbolStyle ( custom ) ;
2987+ } else if ( type === 'SVG_POINT' ) {
2988+ olStyle = StyleUtils . getSVGStyle ( custom ) ;
2989+ } else if ( type === 'IMAGE_POINT' ) {
2990+ olStyle = StyleUtils . getImageStyle ( custom ) ;
29872991 } else {
2988- style . fillColor = color ;
2992+ olStyle = StyleUtils . toOpenLayersStyle ( custom , featureType ) ;
29892993 }
2990- // 转化成 ol 样式
2991- let olStyle = StyleUtils . toOpenLayersStyle ( style , featureType ) ;
29922994 styleGroup . push ( {
29932995 olStyle : olStyle ,
2994- color : color ,
2996+ style : customSettings [ key ] ,
29952997 value : name
29962998 } ) ;
29972999 } , this ) ;
29983000
29993001 return styleGroup ;
30003002 }
30013003
3004+ /**
3005+ * 获取单值专题图自定义样式对象
3006+ * @param {* } style 图层上的样式
3007+ * @param {* } color 单值对应的颜色
3008+ * @param {* } featureType 要素类型
3009+ */
3010+ getCustomSetting ( style , color , featureType ) {
3011+ let newProps = { } ;
3012+ if ( featureType === "LINE" ) {
3013+ newProps . strokeColor = color ;
3014+ } else {
3015+ newProps . fillColor = color ;
3016+ }
3017+ let customSetting = Object . assign ( style , newProps )
3018+ return customSetting ;
3019+ }
3020+
30023021 /**
30033022 * @private
30043023 * @function ol.supermap.WebMap.prototype.createRangeLayer
0 commit comments