mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-30 03:39:36 +02:00
Only draw intersections for {high,water,rail,aero}way lines
Fixes #1471
This commit is contained in:
+5
-1
@@ -28,7 +28,11 @@ _.extend(iD.Node.prototype, {
|
|||||||
isIntersection: function(resolver) {
|
isIntersection: function(resolver) {
|
||||||
return resolver.transient(this, 'isIntersection', function() {
|
return resolver.transient(this, 'isIntersection', function() {
|
||||||
return resolver.parentWays(this).filter(function(parent) {
|
return resolver.parentWays(this).filter(function(parent) {
|
||||||
return parent.geometry(resolver) === 'line';
|
return (parent.tags.highway ||
|
||||||
|
parent.tags.waterway ||
|
||||||
|
parent.tags.railway ||
|
||||||
|
parent.tags.aeroway) &&
|
||||||
|
parent.geometry(resolver) === 'line';
|
||||||
}).length > 1;
|
}).length > 1;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -43,6 +43,24 @@ describe('iD.Node', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("#isIntersection", function () {
|
||||||
|
it("returns true for a node shared by more than one highway", function () {
|
||||||
|
var node = iD.Node(),
|
||||||
|
w1 = iD.Way({nodes: [node.id], tags: {highway: 'residential'}}),
|
||||||
|
w2 = iD.Way({nodes: [node.id], tags: {highway: 'residential'}}),
|
||||||
|
graph = iD.Graph([node, w1, w2]);
|
||||||
|
expect(node.isIntersection(graph)).to.equal(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("returns true for a node shared by more two non-highways", function () {
|
||||||
|
var node = iD.Node(),
|
||||||
|
w1 = iD.Way({nodes: [node.id]}),
|
||||||
|
w2 = iD.Way({nodes: [node.id]}),
|
||||||
|
graph = iD.Graph([node, w1, w2]);
|
||||||
|
expect(node.isIntersection(graph)).to.equal(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("#asJXON", function () {
|
describe("#asJXON", function () {
|
||||||
it('converts a node to jxon', function() {
|
it('converts a node to jxon', function() {
|
||||||
var node = iD.Node({id: 'n-1', loc: [-77, 38], tags: {amenity: 'cafe'}});
|
var node = iD.Node({id: 'n-1', loc: [-77, 38], tags: {amenity: 'cafe'}});
|
||||||
|
|||||||
Reference in New Issue
Block a user