Adding test case for lanes().default

This commit is contained in:
Kushan Joshi
2016-06-13 15:55:47 +05:30
committed by Bryan Housel
parent 4083a0e29e
commit 07827e5a2d
2 changed files with 213 additions and 11 deletions
+11 -11
View File
@@ -101,16 +101,17 @@ _.extend(Way.prototype, {
},
lanes: function() {
function parseTurnLane(str) {
if (!str || str === '') return null;
return str.split('|').map(function(s) {
return s.split(';');
});
}
if (!this.tags.highway) return null;
var defaultLanes = {}, tagged = {};
switch (this.tags.highway) {
case 'service':
case 'track':
case 'path':
defaultLanes.count = this.isOneWay() ? 1 : 2;
break;
case 'trunk':
case 'motorway':
defaultLanes.count = this.isOneWay() ? 2 : 4;
@@ -120,11 +121,10 @@ _.extend(Way.prototype, {
break;
}
if (!this.isOneWay()) {
defaultLanes.forward = defaultLanes.count/2;
defaultLanes.backward = defaultLanes.count/2;
} else {
if (this.isOneWay()) {
tagged.oneway = 'yes';
} else {
tagged.oneway = 'no';
}
tagged.lanes = {};