Skip to content

Commit

Permalink
Avoid matching more kinds of things if a lifecycle tag is present
Browse files Browse the repository at this point in the history
(closes #1580)

This was reported as "Razed railways remain visible if historical objects
are hidden".  The reason this was happening was because for a thing to be
hidden, _all_ of its matches must be hidden (not _any_ of its matches).

That meant that to hide the razed railways, a user would need to enable
both the "railways" and "past_future" filters.

To make this work more the way people expect, we need to consider the
`this._isPastFuture(tags)` check in more places - any kind of physical
thing that might be razed or demolished.  That means that razed railways
won't match as "railways" anymore, they match only as "past_future".
  • Loading branch information
bhousel committed Nov 14, 2024
1 parent 955f699 commit fce5616
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions modules/core/FilterSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,9 @@ export class FilterSystem extends AbstractSystem {
}
}

if (entity.id === 'w513179099') {
console.log('hi');
}
let matches = new Set();
for (const [filterID, filter] of this._filters) {
if (filterID === 'others') { // 'others' matches last
Expand Down Expand Up @@ -739,7 +742,7 @@ export class FilterSystem extends AbstractSystem {
tags.parking === 'sheds' ||
tags.parking === 'carports' ||
tags.parking === 'garage_boxes'
);
) && !this._isPastFuture(tags);
}

_isBuildingPart(tags) {
Expand Down Expand Up @@ -785,7 +788,7 @@ export class FilterSystem extends AbstractSystem {
tags.landuse === 'basin' ||
tags.landuse === 'reservoir' ||
tags.landuse === 'salt_pond'
);
) && !this._isPastFuture(tags);
}

_isRail(tags) {
Expand All @@ -795,7 +798,7 @@ export class FilterSystem extends AbstractSystem {
traffic_roads[tags.highway] ||
service_roads[tags.highway] ||
paths[tags.highway]
);
) && !this._isPastFuture(tags);
}

_isPiste(tags) {
Expand All @@ -809,7 +812,7 @@ export class FilterSystem extends AbstractSystem {
}

_isPower(tags) {
return !!tags.power;
return !!tags.power && !this._isPastFuture(tags);
}

// contains a past/future tag, but not in active use as a road/path/cycleway/etc..
Expand All @@ -818,8 +821,8 @@ export class FilterSystem extends AbstractSystem {
return false;
}

for (const k of Object.keys(tags)) {
if (osmLifecyclePrefixes[k] || osmLifecyclePrefixes[tags[k]]) return true;
for (const [k, v] of Object.entries(tags)) {
if (osmLifecyclePrefixes[k] || osmLifecyclePrefixes[v]) return true;
}
return false;
}
Expand Down

0 comments on commit fce5616

Please sign in to comment.