* _processMergeQueue * Call this sometimes to merge features across tile edges
(source)
| 463 | * Call this sometimes to merge features across tile edges |
| 464 | */ |
| 465 | _processMergeQueue(source) { |
| 466 | for (const cache of source.zoomCache.values()) { |
| 467 | for (const [edgeID, mergemap] of cache.toMerge) { // for each edge |
| 468 | |
| 469 | // Are both tiles loaded? |
| 470 | const [lowID, highID] = edgeID.split('-'); |
| 471 | const lowTile = source.loaded.get(lowID); |
| 472 | const highTile = source.loaded.get(highID); |
| 473 | if (!lowTile || !highTile) continue; |
| 474 | |
| 475 | cache.didMerge.add(edgeID); |
| 476 | |
| 477 | // All the features that share this prophash along this edge can be merged |
| 478 | for (const [prophash, featureIDs] of mergemap) { |
| 479 | // Determine geometry type from the first available feature |
| 480 | const firstFeature = Array.from(featureIDs) |
| 481 | .map(id => cache.features.get(id)) |
| 482 | .find(Boolean); |
| 483 | |
| 484 | if (firstFeature?.geojson?.geometry?.type === 'LineString') { |
| 485 | this._mergeLineStrings(cache, prophash, featureIDs, lowTile, highTile); |
| 486 | } else { |
| 487 | this._mergePolygons(cache, prophash, featureIDs, lowTile, highTile); |
| 488 | } |
| 489 | mergemap.delete(prophash); // done this prophash |
| 490 | } |
| 491 | cache.toMerge.delete(edgeID); |
| 492 | } |
| 493 | } |
| 494 | } |
| 495 | |
| 496 | |
| 497 | /** |
no test coverage detected