Changeset 15458 in josm for trunk/src/org
- Timestamp:
- 2019-10-16T09:32:07+02:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java
r15407 r15458 13 13 import java.util.HashMap; 14 14 import java.util.HashSet; 15 import java.util.Iterator; 15 16 import java.util.List; 16 17 import java.util.Map; … … 536 537 537 538 private boolean barrierBetween(Node endnode) { 538 EastNorth closest = Geometry.closestPointToSegment(n1.getEastNorth(), n2.getEastNorth(), endnode.getEastNorth());539 Node x = new Node();540 x.setEastNorth(closest);539 EastNorth en = endnode.getEastNorth(); 540 EastNorth closest = Geometry.closestPointToSegment(n1.getEastNorth(), n2.getEastNorth(), en); 541 Node x = new Node(closest); 541 542 BBox bbox = new BBox(endnode.getCoor(), x.getCoor()); 542 for (Way nearbyWay: ds.searchWays(bbox)) { 543 if (nearbyWay != w && nearbyWay.isUsable() && nearbyWay.hasTag("barrier") && !endnode.getParentWays().contains(nearbyWay)) { 544 //make sure that the barrier is really between the two nodes, not just close to them 545 Way directWay = new Way(); 546 directWay.addNode(endnode); 547 directWay.addNode(x); 548 if (!Geometry.addIntersections(Arrays.asList(nearbyWay, directWay), true, new ArrayList<>()).isEmpty()) 549 return true; 543 for (Way nearbyWay : ds.searchWays(bbox)) { 544 if (nearbyWay != w && nearbyWay.isUsable() && nearbyWay.hasTag("barrier") 545 && !endnode.getParentWays().contains(nearbyWay)) { 546 //make sure that the barrier is really between endnode and the highway segment, not just close to or around them 547 Iterator<Node> iter = nearbyWay.getNodes().iterator(); 548 EastNorth prev = iter.next().getEastNorth(); 549 while (iter.hasNext()) { 550 EastNorth curr = iter.next().getEastNorth(); 551 if (Geometry.getSegmentSegmentIntersection(closest, en, prev, curr) != null) { 552 return true; 553 } 554 prev = curr; 555 } 550 556 } 551 557 }
Note:
See TracChangeset
for help on using the changeset viewer.