Skip to content

Commit

Permalink
Fix areaKeys whitelist/blacklist and blacklist junction=roundabout
Browse files Browse the repository at this point in the history
(closes #2484)
  • Loading branch information
bhousel committed Feb 24, 2015
1 parent 781db91 commit 2c86078
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 10 deletions.
3 changes: 3 additions & 0 deletions data/presets.yaml
Expand Up @@ -1829,6 +1829,9 @@ en:
relation:
name: Relation
terms: "<translate with synonyms or related terms for 'Relation', separated by commas>"
roundabout:
name: Roundabout
terms: "<translate with synonyms or related terms for 'Roundabout', separated by commas>"
route/ferry:
name: Ferry Route
terms: "<translate with synonyms or related terms for 'Ferry Route', separated by commas>"
Expand Down
11 changes: 11 additions & 0 deletions data/presets/presets.json
Expand Up @@ -6804,6 +6804,17 @@
"relation"
]
},
"roundabout": {
"geometry": [
"vertex",
"line"
],
"tags": {
"junction": "roundabout"
},
"name": "Roundabout",
"searchable": false
},
"route/ferry": {
"icon": "ferry",
"geometry": [
Expand Down
11 changes: 11 additions & 0 deletions data/presets/presets/roundabout.json
@@ -0,0 +1,11 @@
{
"geometry": [
"vertex",
"line"
],
"tags": {
"junction": "roundabout"
},
"name": "Roundabout",
"searchable": false
}
4 changes: 4 additions & 0 deletions data/taginfo.json
Expand Up @@ -1629,6 +1629,10 @@
"key": "railway",
"value": "tram"
},
{
"key": "junction",
"value": "roundabout"
},
{
"key": "route",
"value": "ferry"
Expand Down
4 changes: 4 additions & 0 deletions dist/locales/en.json
Expand Up @@ -2960,6 +2960,10 @@
"name": "Relation",
"terms": ""
},
"roundabout": {
"name": "Roundabout",
"terms": ""
},
"route/ferry": {
"name": "Ferry Route",
"terms": ""
Expand Down
29 changes: 19 additions & 10 deletions js/id/presets.js
Expand Up @@ -52,21 +52,30 @@ iD.presets = function() {
// (see `iD.Way#isArea()`). In other words, the keys of L form the whitelist,
// and the subkeys form the blacklist.
all.areaKeys = function() {
var areaKeys = {};
var areaKeys = {},
ignore = ['highway', 'footway', 'railway', 'type'],
presets = _.reject(all.collection, 'suggestion');

all.collection.forEach(function(d) {
if (d.suggestion) return;
// whitelist
presets.forEach(function(d) {
for (var key in d.tags) break;
if (!key) return;
if (ignore.indexOf(key) !== -1) return;

if (d.geometry.indexOf('area') !== -1) {
areaKeys[key] = areaKeys[key] || {};
}
});

// blacklist
presets.forEach(function(d) {
for (var key in d.tags) break;
if (!key) return;
var value = d.tags[key];
if (ignore.indexOf(key) !== -1) return;

if (['highway', 'footway', 'railway', 'type'].indexOf(key) === -1) {
if (d.geometry.indexOf('area') >= 0) {
areaKeys[key] = areaKeys[key] || {};
} else if (key in areaKeys && value !== '*') {
areaKeys[key][value] = true;
}
var value = d.tags[key];
if (d.geometry.indexOf('area') === -1 && key in areaKeys && value !== '*') {
areaKeys[key][value] = true;
}
});

Expand Down

0 comments on commit 2c86078

Please sign in to comment.