mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-25 17:37:49 +02:00
iD.geo.edgeEqual
This commit is contained in:
@@ -8,10 +8,7 @@ iD.actions.AddMidpoint = function(midpoint, node) {
|
||||
|
||||
parents.forEach(function(way) {
|
||||
for (var i = 0; i < way.nodes.length - 1; i++) {
|
||||
if ((way.nodes[i] === midpoint.edge[0] &&
|
||||
way.nodes[i + 1] === midpoint.edge[1]) ||
|
||||
(way.nodes[i] === midpoint.edge[1] &&
|
||||
way.nodes[i + 1] === midpoint.edge[0])) {
|
||||
if (iD.geo.edgeEqual([way.nodes[i], way.nodes[i + 1]], midpoint.edge)) {
|
||||
graph = graph.replace(graph.entity(way.id).addNode(node.id, i + 1));
|
||||
|
||||
// Add only one midpoint on doubled-back segments,
|
||||
|
||||
@@ -21,6 +21,11 @@ iD.geo.sphericalDistance = function(a, b) {
|
||||
return 6.3710E6 * Math.sqrt((x * x) + (y * y)) * Math.PI/180;
|
||||
};
|
||||
|
||||
iD.geo.edgeEqual = function(a, b) {
|
||||
return (a[0] === b[0] && a[1] === b[1]) ||
|
||||
(a[0] === b[1] && a[1] === b[0]);
|
||||
};
|
||||
|
||||
// Choose the edge with the minimal distance from `point` to its orthogonal
|
||||
// projection onto that edge, if such a projection exists, or the distance to
|
||||
// the closest vertex on that edge. Returns an object with the `index` of the
|
||||
|
||||
Reference in New Issue
Block a user