Return an indirect u-turn restriction for an only restriction

This commit is contained in:
Bryan Housel
2018-02-23 11:59:44 -05:00
parent 46cc6cc262
commit 7fa27217b6
2 changed files with 5 additions and 6 deletions
+1 -1
View File
@@ -490,7 +490,7 @@ export function osmIntersection(graph, startVertexId, maxDistance) {
// an indirect restriction - only include the partial path (starting at FROM)
if (matchedRestriction && matchedRestriction.direct === false) {
for (i = 0; i < turnPath.length; i++) {
if (i > 0 && turnPath[i] === matchedRestriction.from) {
if (turnPath[i] === matchedRestriction.from) {
turnPath = turnPath.slice(i);
break;
}
+4 -5
View File
@@ -340,7 +340,6 @@ describe('iD.osmIntersection', function() {
expect(turns[1].u).to.be.not.ok;
expect(turns[1].restrictionID).to.eql('r');
expect(turns[1].direct).to.be.true;
expect(turns[1].indirect).to.be.not.ok;
expect(turns[1].only).to.be.not.ok;
});
@@ -369,21 +368,21 @@ describe('iD.osmIntersection', function() {
expect(turns[0]).to.be.an.instanceOf(iD.osmTurn);
expect(turns[0].key).to.eql('=_*_=');
expect(turns[0].u).to.be.true;
expect(turns[1].direct).to.be.false;
expect(turns[1].only).to.be.not.ok;
expect(turns[1]).to.be.an.instanceOf(iD.osmTurn);
expect(turns[1].key).to.eql('=_*_~');
expect(turns[1].restrictionID).to.eql('r');
expect(turns[1].u).to.be.not.ok;
expect(turns[1].direct).to.be.not.ok;
expect(turns[1].indirect).to.be.true;
expect(turns[1].direct).to.be.false;
expect(turns[1].only).to.be.not.ok;
expect(turns[2]).to.be.an.instanceOf(iD.osmTurn);
expect(turns[2].key).to.eql('=_*_-');
expect(turns[2].restrictionID).to.eql('r');
expect(turns[2].u).to.be.not.ok;
expect(turns[2].direct).to.be.not.ok;
expect(turns[2].indirect).to.be.not.ok;
expect(turns[2].direct).to.be.true;
expect(turns[2].only).to.be.true;
});