MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / getStyleByData

Method getStyleByData

src/openlayers/overlay/Range.js:91–124  ·  view source on GitHub ↗

* @private * @function Range.prototype.getStyleByData * @description 通过数据获取 style。 * @param {Object} fea - 要素数据。

(fea)

Source from the content-addressed store, hash-verified

89 * @param {Object} fea - 要素数据。
90 */
91 getStyleByData(fea) {
92 var style = {};
93 var feature = fea;
94 style = CommonUtil.copyAttributesWithClip(style, this.style);
95 if (this.themeField && this.styleGroups && this.styleGroups.length > 0 && feature.attributes) {
96 var Sf = this.themeField;
97 var Attrs = feature.attributes;
98 var Gro = this.styleGroups;
99 var isSfInAttrs = false; //指定的 themeField 是否是 feature 的属性字段之一
100 var attr = null; //属性值
101
102 for (var property in Attrs) {
103 if (Sf === property) {
104 isSfInAttrs = true;
105 attr = Attrs[property];
106 break;
107 }
108 }
109 //判断属性值是否属于styleGroups的某一个范围,以便对获取分组 style
110 if (isSfInAttrs) {
111 for (var i = 0, len = Gro.length; i < len; i++) {
112 if ((attr >= Gro[i].start) && (attr < Gro[i].end)) {
113 //feature.style = Util.copyAttributes(feature.style, this.defaultStyle);
114 var sty1 = Gro[i].style;
115 style = CommonUtil.copyAttributesWithClip(style, sty1);
116 }
117 }
118 }
119 }
120 if (feature.style && this.isAllowFeatureStyle === true) {
121 style = CommonUtil.copyAttributesWithClip(feature.style);
122 }
123 return style;
124 }
125
126 canvasFunctionInternal_(extent, resolution, pixelRatio, size, projection) { // eslint-disable-line no-unused-vars
127 return GeoFeature.prototype.canvasFunctionInternal_.apply(this, arguments);

Callers 1

createThematicFeatureMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected