mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-14 05:12:13 +02:00
Remove duplicate intersection function
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
@@ -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],
|
||||
|
||||
Reference in New Issue
Block a user