Skip to content

Commit

Permalink
Fix disappearing fill extrusions in zoom happening with conflation (i…
Browse files Browse the repository at this point in the history
…nternal-1872)

There was incorrect reconcile replacements when having two different features, as if the count of features on borders was 1, the code was not checking both parts laying in the borders were the same feature
  • Loading branch information
jtorresfabra authored and mourner committed Sep 26, 2024
1 parent ee0df04 commit 17cb96d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/render/draw_fill_extrusion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ function updateBorders(context: Context, source: SourceCache, coord: OverscaledT
const saveIb = ib;
let count = 0;
while (true) {
// Collect all parts overlapping parta on the edge, to make sure it is only one.
// Collect all parts overlapping parts on the edge, to make sure it is only one.
assert(partB.borders);
const partBBorderRange = (partB.borders)[j];
if (partBBorderRange[0] > partABorderRange[1] - error) {
Expand All @@ -743,14 +743,18 @@ function updateBorders(context: Context, source: SourceCache, coord: OverscaledT
partB = nBucket.featuresOnBorder[b[ib]];
}
partB = nBucket.featuresOnBorder[b[saveIb]];
if (count > 1) {
let doReconcile = false;
if (count >= 1) {
// if it can be concluded that it is the piece of the same feature,
// use it, even following features (inner details) overlap on border edge.
assert(partB.borders);
const partBBorderRange = (partB.borders)[j];
if (Math.abs(partABorderRange[0] - partBBorderRange[0]) < error &&
Math.abs(partABorderRange[1] - partBBorderRange[1]) < error) {
count = 1;
// In some cases count could be 1 but a different feature, here we make sure
// we are reconciling the same feature
doReconcile = true;
ib = saveIb + 1;
}
} else if (count === 0) {
Expand All @@ -760,7 +764,7 @@ function updateBorders(context: Context, source: SourceCache, coord: OverscaledT
}

const centroidB = nBucket.centroidData[partB.centroidDataIndex];
if (reconcileReplacementState && count === 1) {
if (reconcileReplacementState && doReconcile) {
reconcileReplacement(centroidA, centroidB);
}

Expand Down

0 comments on commit 17cb96d

Please sign in to comment.