Changeset 15461 in josm
- Timestamp:
- 2019-10-17T08:43:25+02:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java
r15458 r15461 32 32 import org.openstreetmap.josm.data.preferences.sources.ValidatorPrefHelper; 33 33 import org.openstreetmap.josm.data.projection.Ellipsoid; 34 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 34 35 import org.openstreetmap.josm.data.validation.Severity; 35 36 import org.openstreetmap.josm.data.validation.Test; … … 411 412 412 413 private class MyWaySegment { 414 /** the way */ 413 415 public final Way w; 414 416 private final Node n1; … … 429 431 */ 430 432 boolean isConnectedTo(Node startNode) { 431 return isConnectedTo(startNode, n ull, new HashSet<>(), 0);433 return isConnectedTo(startNode, new HashSet<>(), 0); 432 434 } 433 435 … … 435 437 * Check if the given node is connected to this segment using a reasonable short way. 436 438 * @param node the given node 437 * @param startWay previously visited way or null if first438 439 * @param visited set of visited nodes 439 440 * @param len length of the travelled route 440 441 * @return true if a reasonable connection was found 441 442 */ 442 boolean isConnectedTo(Node node, Way startWay, Set<Node> visited, double len) {443 private boolean isConnectedTo(Node node, Set<Node> visited, double len) { 443 444 if (n1 == node || n2 == node) { 444 445 return true; … … 462 463 final boolean containsN = visited.contains(next); 463 464 visited.add(next); 464 if (!containsN && isConnectedTo(next, way,visited,465 if (!containsN && isConnectedTo(next, visited, 465 466 len + node.getCoor().greatCircleDistance(next.getCoor()))) { 466 467 return true; … … 478 479 return Double.NaN; 479 480 EastNorth closest = Geometry.closestPointToSegment(n1.getEastNorth(), n2.getEastNorth(), coord); 480 Node x = new Node(); 481 x.setEastNorth(closest); 482 return x.getCoor().greatCircleDistance(n.getCoor()); 483 484 } 485 486 boolean nearby(Node n, double dist) { 481 return n.getCoor().greatCircleDistance(ProjectionRegistry.getProjection().eastNorth2latlon(closest)); 482 } 483 484 private boolean nearby(Node n, double dist) { 487 485 if (w.containsNode(n)) 488 486 return false; … … 491 489 } 492 490 493 BBox getBounds(double fudge) {491 private BBox getBounds(double fudge) { 494 492 double x1 = n1.getCoor().lon(); 495 493 double x2 = n2.getCoor().lon(); … … 539 537 EastNorth en = endnode.getEastNorth(); 540 538 EastNorth closest = Geometry.closestPointToSegment(n1.getEastNorth(), n2.getEastNorth(), en); 541 Node x = new Node(closest); 542 BBox bbox = new BBox(endnode.getCoor(), x.getCoor()); 539 BBox bbox = new BBox(endnode.getCoor(), ProjectionRegistry.getProjection().eastNorth2latlon(closest)); 543 540 for (Way nearbyWay : ds.searchWays(bbox)) { 544 541 if (nearbyWay != w && nearbyWay.isUsable() && nearbyWay.hasTag("barrier") … … 558 555 return false; 559 556 } 560 561 557 } 562 558
Note:
See TracChangeset
for help on using the changeset viewer.