* @private * @function WebMap.prototype.addPathFeature * @description 添加数据流图层中轨迹线的feature * @param {Object} source - 轨迹线图层的source * @param {Object} feature - 轨迹线feature * @param {string} identifyField - 标识feature的字段 * @param {Object} featureCache - 存储feature * @param {number} ma
(source, feature, identifyField, featureCache, maxPointCount)
| 3980 | * @param {number} maxPointCount - 轨迹线最多点个数数量 |
| 3981 | */ |
| 3982 | addPathFeature(source, feature, identifyField, featureCache, maxPointCount) { |
| 3983 | let coordinates = []; |
| 3984 | var geoID = feature.get(identifyField); |
| 3985 | if (featureCache[geoID]) { |
| 3986 | //加过feautre |
| 3987 | coordinates = featureCache[geoID].getGeometry().getCoordinates(); |
| 3988 | coordinates.push(feature.getGeometry().getCoordinates()); |
| 3989 | if (maxPointCount && coordinates.length > maxPointCount) { |
| 3990 | coordinates.splice(0, coordinates.length - maxPointCount); |
| 3991 | } |
| 3992 | featureCache[geoID].getGeometry().setCoordinates(coordinates); |
| 3993 | } else { |
| 3994 | coordinates.push(feature.getGeometry().getCoordinates()); |
| 3995 | featureCache[geoID] = new Feature({ |
| 3996 | geometry: new olGeometry.LineString(coordinates) |
| 3997 | }); |
| 3998 | source.addFeature(featureCache[geoID]); |
| 3999 | } |
| 4000 | } |
| 4001 | |
| 4002 | /** |
| 4003 | * @private |
no test coverage detected