Remove duplicate intersection function

This commit is contained in:
John Firebaugh
2012-12-06 14:22:33 -05:00
parent 0e2889d5d6
commit 4ee6e3ac1a
3 changed files with 2 additions and 22 deletions
+1 -1
View File
@@ -134,7 +134,7 @@ iD.Map = function() {
else ways.push(a);
} else if (a._poi) {
points.push(a);
} else if (!a._poi && a.type === 'node' && iD.util.geo.nodeIntersect(a, extent)) {
} else if (!a._poi && a.type === 'node' && a.intersects(extent)) {
waynodes.push(a);
}
}
-7
View File
@@ -90,13 +90,6 @@ iD.util.geo.dist = function(a, b) {
Math.pow(a[1] - b[1], 2));
};
iD.util.geo.nodeIntersect = function(entity, extent) {
return entity.loc[0] > extent[0][0] &&
entity.loc[0] < extent[1][0] &&
entity.loc[1] < extent[0][1] &&
entity.loc[1] > extent[1][1];
};
iD.util.geo.chooseIndex = function(way, point, map) {
var dist = iD.util.geo.dist;
var projNodes = way.nodes.map(function(n) {
+1 -14
View File
@@ -35,20 +35,7 @@ describe('Util', function() {
expect(iD.util.geo.interp(a, b, 0)).to.eql([0, 0]);
});
});
describe('#nodeIntersect', function() {
it('correctly says that a node is in an extent', function() {
expect(iD.util.geo.nodeIntersect({
loc: [0, 0]
}, [[-180, 90],
[180, -90]])).to.be.true;
});
it('correctly says that a node is outside of an extent', function() {
expect(iD.util.geo.nodeIntersect({
loc: [0, 0]
}, [[100, 90],
[180, -90]])).to.be.false;
});
});
describe('#dist', function() {
it('distance between two same points is zero', function() {
var a = [0, 0],