mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-21 15:56:56 +02:00
Make sure all nodes have an actual loc property
- This is to make difference comparisons easier - The only nodes that didn't have a `loc` were fake nodes we made for testing - So this commit also fixes the `osmIntersection` code and tests.
This commit is contained in:
@@ -92,8 +92,7 @@ export function osmIntersection(graph, startVertexId, maxDistance) {
|
||||
node = nodes[j];
|
||||
if (node === vertex) continue; // same thing
|
||||
if (vertices.indexOf(node) !== -1) continue; // seen it already
|
||||
if (node.loc && startNode.loc &&
|
||||
geoSphericalDistance(node.loc, startNode.loc) > maxDistance) continue; // too far from start
|
||||
if (geoSphericalDistance(node.loc, startNode.loc) > maxDistance) continue; // too far from start
|
||||
|
||||
// a key vertex will have parents that are also roads
|
||||
var hasParents = false;
|
||||
@@ -485,7 +484,7 @@ export function osmIntersection(graph, startVertexId, maxDistance) {
|
||||
// which nodes can we step into?
|
||||
var n1 = vgraph.entity(entity.first());
|
||||
var n2 = vgraph.entity(entity.last());
|
||||
var dist = n1.loc && n2.loc && geoSphericalDistance(n1.loc, n2.loc);
|
||||
var dist = geoSphericalDistance(n1.loc, n2.loc);
|
||||
var nextNodes = [];
|
||||
|
||||
if (currPath.length > 1) {
|
||||
|
||||
+1
-2
@@ -16,9 +16,8 @@ osmEntity.node = osmNode;
|
||||
osmNode.prototype = Object.create(osmEntity.prototype);
|
||||
|
||||
Object.assign(osmNode.prototype, {
|
||||
|
||||
type: 'node',
|
||||
|
||||
loc: [NaN, NaN],
|
||||
|
||||
extent: function() {
|
||||
return new geoExtent(this.loc);
|
||||
|
||||
+324
-321
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user