Check single source for implied onewayness #2220

This commit is contained in:
Bryan Housel
2014-05-23 17:07:11 -04:00
parent 40810dab04
commit 10bd86cb45
5 changed files with 49 additions and 9 deletions
+1
View File
@@ -204,6 +204,7 @@
<script src='js/id/core/way.js'></script>
<script src='js/id/core/tree.js'></script>
<script src='js/id/core/area_keys.js'></script>
<script src='js/id/core/oneway_tags.js'></script>
<script src='js/id/presets.js'></script>
<script src='js/id/presets/preset.js'></script>
+32
View File
@@ -0,0 +1,32 @@
iD.oneWayTags = {
'aerialway': {
'chair_lift': true,
'mixed_lift': true,
't-bar': true,
'j-bar': true,
'platter': true,
'rope_tow': true,
'magic_carpet': true,
'yes': true
},
'highway': {
'motorway': true,
'motorway_link': true
},
'junction': {
'roundabout': true
},
'man_made': {
'piste:halfpipe': true,
'pipeline': true
},
'piste:type': {
'downhill': true,
'sled': true,
'yes': true
},
'waterway': {
'river': true,
'stream': true
}
};
+5 -5
View File
@@ -48,11 +48,11 @@ _.extend(iD.Way.prototype, {
if (['no', '0'].indexOf(this.tags.oneway) !== -1) { return false; }
// implied oneway tag..
return this.tags.waterway === 'river' ||
this.tags.waterway === 'stream' ||
this.tags.highway === 'motorway' ||
this.tags.highway === 'motorway_link' ||
this.tags.junction === 'roundabout';
for (var key in this.tags) {
if (key in iD.oneWayTags && (this.tags[key] in iD.oneWayTags[key]))
return true;
}
return false;
},
isClosed: function() {
+10 -4
View File
@@ -21,10 +21,16 @@ iD.ui.preset.defaultcheck = function(field) {
}
var check = function(selection) {
// hack: pretend oneway field is a oneway_yes field if `junction=roundabout` is set. #2220, #1841
if (field.id === 'oneway' && entity.tags.junction === 'roundabout') {
texts.shift();
texts.unshift(t('presets.fields.oneway_yes.check.undefined', { 'default': 'Assumed to be Yes' }));
// hack: pretend oneway field is a oneway_yes field
// where implied oneway tag exists (e.g. `junction=roundabout`) #2220, #1841
if (field.id === 'oneway') {
for (var key in entity.tags) {
if (key in iD.oneWayTags && (entity.tags[key] in iD.oneWayTags[key])) {
texts.shift();
texts.unshift(t('presets.fields.oneway_yes.check.undefined', { 'default': 'Assumed to be Yes' }));
break;
}
}
}
selection.classed('checkselect', 'true');
+1
View File
@@ -185,6 +185,7 @@
<script src='../js/id/core/way.js'></script>
<script src='../js/id/core/tree.js'></script>
<script src='../js/id/core/area_keys.js'></script>
<script src='../js/id/core/oneway_tags.js'></script>
<script src='../js/id/presets.js'></script>
<script src='../js/id/presets/preset.js'></script>