* @private * @function WebMap.prototype.changeWeight * @description 改变当前权重字段 * @param {Array} features - feature的集合 * @param {string} weightFeild - 权重字段
(features, weightFeild)
| 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 |
no test coverage detected