Fix areaKeys whitelist/blacklist and blacklist junction=roundabout

(closes #2484)
This commit is contained in:
Bryan Housel
2015-02-24 12:25:51 -05:00
parent 781db91fbc
commit 2c860785f6
6 changed files with 53 additions and 11 deletions
+3
View File
@@ -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>"
+11
View File
@@ -6804,6 +6804,17 @@
"relation"
]
},
"roundabout": {
"geometry": [
"vertex",
"line"
],
"tags": {
"junction": "roundabout"
},
"name": "Roundabout",
"searchable": false
},
"route/ferry": {
"icon": "ferry",
"geometry": [
+11
View File
@@ -0,0 +1,11 @@
{
"geometry": [
"vertex",
"line"
],
"tags": {
"junction": "roundabout"
},
"name": "Roundabout",
"searchable": false
}
+4
View File
@@ -1629,6 +1629,10 @@
"key": "railway",
"value": "tram"
},
{
"key": "junction",
"value": "roundabout"
},
{
"key": "route",
"value": "ferry"
+4
View File
@@ -2960,6 +2960,10 @@
"name": "Relation",
"terms": ""
},
"roundabout": {
"name": "Roundabout",
"terms": ""
},
"route/ferry": {
"name": "Ferry Route",
"terms": ""
+20 -11
View File
@@ -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 = {};
all.collection.forEach(function(d) {
if (d.suggestion) return;
var areaKeys = {},
ignore = ['highway', 'footway', 'railway', 'type'],
presets = _.reject(all.collection, 'suggestion');
// whitelist
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;
}
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;
if (ignore.indexOf(key) !== -1) return;
var value = d.tags[key];
if (d.geometry.indexOf('area') === -1 && key in areaKeys && value !== '*') {
areaKeys[key][value] = true;
}
});