MCPcopy Create free account
hub / github.com/SuperMap/iClient-JavaScript / changeWeight

Method changeWeight

src/openlayers/mapping/WebMap.js:3458–3472  ·  view source on GitHub ↗

* @private * @function WebMap.prototype.changeWeight * @description 改变当前权重字段 * @param {Array} features - feature的集合 * @param {string} weightFeild - 权重字段

(features, weightFeild)

Source from the content-addressed store, hash-verified

3456 * @param {string} weightFeild - 权重字段
3457 */
3458 changeWeight(features, weightFeild) {
3459 let that = this;
3460 this.fieldMaxValue = {};
3461 this.getMaxValue(features, weightFeild);
3462 let maxValue = this.fieldMaxValue[weightFeild];
3463 features.forEach(function (feature) {
3464 let attributes = feature.get('attributes');
3465 try {
3466 let value = attributes[weightFeild];
3467 feature.set('weight', value / maxValue);
3468 } catch (e) {
3469 that.errorCallback && that.errorCallback(e);
3470 }
3471 });
3472 }
3473
3474 /**
3475 * @private

Callers 3

createHeatLayerMethod · 0.95
WebMapSpec.jsFile · 0.80

Calls 4

getMaxValueMethod · 0.95
forEachMethod · 0.80
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected