* @function Util.getHighestMatchAdministration * @param {string} featureName 初始匹配的要素数组 * @param {string} fieldName 要匹配的地名 * @returns {boolean} 是否匹配 * @private
(features, fieldName)
| 377 | * @private |
| 378 | */ |
| 379 | getHighestMatchAdministration(features, fieldName) { |
| 380 | let filterFeatures = features.filter((item) => { |
| 381 | return isMatchAdministrativeName(item.properties.Name, fieldName); |
| 382 | }); |
| 383 | |
| 384 | let maxMatchPercent = 0, |
| 385 | maxMatchFeature = null; |
| 386 | filterFeatures.forEach((feature) => { |
| 387 | let count = 0; |
| 388 | Array.from(new Set(feature.properties.Name.split(''))).forEach((char) => { |
| 389 | if (fieldName.includes(char)) { |
| 390 | count++; |
| 391 | } |
| 392 | }); |
| 393 | if (count > maxMatchPercent) { |
| 394 | maxMatchPercent = count; |
| 395 | maxMatchFeature = feature; |
| 396 | } |
| 397 | }); |
| 398 | return maxMatchFeature; |
| 399 | }, |
| 400 | |
| 401 | /** |
| 402 | * @function Util.setMask |
nothing calls this directly
no test coverage detected