Skip to content

Commit

Permalink
Add unsearchable preset for demolished:building=yes (close #7098)
Browse files Browse the repository at this point in the history
Render features with a status prefix in the provisional styles (e.g. dashed outline)
  • Loading branch information
quincylvania committed Dec 9, 2019
1 parent 89e340a commit 231e2c7
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 1 deletion.
3 changes: 3 additions & 0 deletions data/presets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4562,6 +4562,9 @@ en:
name: Advanced Stop Line
# 'terms: advanced stop box,asl,bicycle box,bike box,bikebox,cycle box,cycle stop marking'
terms: '<translate with synonyms or related terms for ''Advanced Stop Line'', separated by commas>'
demolished/building:
# 'demolished:building=*'
name: Recently Demolished Building
embankment:
# embankment=yes
name: Embankment
Expand Down
1 change: 1 addition & 0 deletions data/presets/presets.json
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@
"craft/window_construction": {"icon": "temaki-window", "geometry": ["point", "area"], "terms": ["glass"], "tags": {"craft": "window_construction"}, "name": "Window Construction"},
"craft/winery": {"icon": "maki-alcohol-shop", "moreFields": ["{craft}", "min_age"], "geometry": ["point", "area"], "tags": {"craft": "winery"}, "name": "Winery"},
"cycleway/asl": {"icon": "maki-bicycle", "fields": ["ref", "direction_vertex", "width"], "geometry": ["vertex"], "tags": {"cycleway": "asl"}, "terms": ["advanced stop box", "asl", "bicycle box", "bike box", "bikebox", "cycle box", "cycle stop marking"], "name": "Advanced Stop Line"},
"demolished/building": {"fields": ["name", "address"], "geometry": ["area"], "tags": {"demolished:building": "*"}, "name": "Recently Demolished Building", "searchable": false},
"emergency/designated": {"fields": ["emergency_combo"], "geometry": ["line"], "tags": {"emergency": "designated"}, "name": "Emergency Access Designated", "searchable": false, "matchScore": 0.01},
"emergency/destination": {"fields": ["emergency_combo"], "geometry": ["line"], "tags": {"emergency": "destination"}, "name": "Emergency Access Destination", "searchable": false, "matchScore": 0.01},
"emergency/no": {"fields": ["emergency_combo"], "geometry": ["line"], "tags": {"emergency": "no"}, "name": "Emergency Access No", "searchable": false, "matchScore": 0.01},
Expand Down
14 changes: 14 additions & 0 deletions data/presets/presets/demolished/building.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"fields": [
"name",
"address"
],
"geometry": [
"area"
],
"tags": {
"demolished:building": "*"
},
"name": "Recently Demolished Building",
"searchable": false
}
1 change: 1 addition & 0 deletions data/taginfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@
{"key": "craft", "value": "window_construction", "description": "🄿 Window Construction", "object_types": ["node", "area"], "icon_url": "https://cdn.jsdelivr.net/gh/ideditor/temaki/icons/window.svg"},
{"key": "craft", "value": "winery", "description": "🄿 Winery", "object_types": ["node", "area"], "icon_url": "https://cdn.jsdelivr.net/gh/mapbox/maki/icons/alcohol-shop-15.svg"},
{"key": "cycleway", "value": "asl", "description": "🄿 Advanced Stop Line", "object_types": ["node"], "icon_url": "https://cdn.jsdelivr.net/gh/mapbox/maki/icons/bicycle-15.svg"},
{"key": "demolished:building", "description": "🄿 Recently Demolished Building (unsearchable)", "object_types": ["area"]},
{"key": "emergency", "value": "designated", "description": "🄿 Emergency Access Designated (unsearchable)", "object_types": ["way"]},
{"key": "emergency", "value": "destination", "description": "🄿 Emergency Access Destination (unsearchable)", "object_types": ["way"]},
{"key": "emergency", "value": "no", "description": "🄿 Emergency Access No (unsearchable)", "object_types": ["way"]},
Expand Down
3 changes: 3 additions & 0 deletions dist/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -6453,6 +6453,9 @@
"name": "Advanced Stop Line",
"terms": "advanced stop box,asl,bicycle box,bike box,bikebox,cycle box,cycle stop marking"
},
"demolished/building": {
"name": "Recently Demolished Building"
},
"emergency/designated": {
"name": "Emergency Access Designated"
},
Expand Down
15 changes: 14 additions & 1 deletion modules/svg/tag_classes.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function svgTagClasses() {

tagClasses.getClassesString = function(t, value, entity) {
var primary, status;
var i, k, v;
var i, j, k, v;

// in some situations we want to render perimeter strokes a certain way
var overrideGeometry;
Expand Down Expand Up @@ -88,6 +88,19 @@ export function svgTagClasses() {
break;
}

if (!primary) {
for (i = 0; i < statuses.length; i++) {
for (j = 0; j < primaries.length; j++) {
k = statuses[i] + ':' + primaries[j]; // e.g. `demolished:building=yes`
v = t[k];
if (!v || v === 'no') continue;

status = statuses[i];
break;
}
}
}

// add at most one status tag, only if relates to primary tag..
if (!status) {
for (i = 0; i < statuses.length; i++) {
Expand Down

0 comments on commit 231e2c7

Please sign in to comment.