/** * Checks whether given {@link AtlasObject} is a form of roundabout * http://wiki.openstreetmap.org/wiki/Tag:junction%3Droundabout#Possible_misinterpretations * * @param object * entity to check * @return {@code true} if the given {@link AtlasObject} is a roundabout */ private static boolean isAFormOfRoundabout(final AtlasObject object) { final Optional<HighwayTag> highwayTag = Validators.from(HighwayTag.class, object); return JunctionTag.isRoundabout(object) || (highwayTag.isPresent() && HIGHWAY_TAGS_FOR_ROUNDABOUTS.contains(highwayTag.get())); }
HighwayTag.MOTORWAY_LINK.name().toLowerCase()); final Taggable roundabout = Taggable.with(JunctionTag.KEY, JunctionTag.ROUNDABOUT.name().toLowerCase()); final Taggable explicitlyTwoWay = Taggable.with(HighwayTag.KEY, HighwayTag.PRIMARY.name().toLowerCase(), OneWayTag.KEY,
/** * Function for {@link SimpleEdgeWalker} that gathers connected edges that are part of a * roundabout. * * @return {@link Function} for {@link SimpleEdgeWalker} */ private Function<Edge, Stream<Edge>> isRoundaboutEdge() { return edge -> edge.connectedEdges().stream() .filter(connected -> JunctionTag.isRoundabout(connected) && !this.isExcludedHighway(connected)); }
/** * Function for {@link SimpleEdgeWalker} that gathers connected edges that are part of a * roundabout. * * @return {@link Function} for {@link SimpleEdgeWalker} */ private Function<Edge, Stream<Edge>> isRoundaboutEdge() { return edge -> edge.connectedEdges().stream() .filter(connected -> JunctionTag.isRoundabout(connected) && HighwayTag.isCarNavigableHighway(connected)); } }
/** * Test if an {@link Edge} is a candidate for expanding a {@link BigNode}, potentially becoming * a Junction Edge in the process. This filters off all the {@link Edge}s that are less * important than {@link HighwayTag#RESIDENTIAL}. It also filters off all the edges that are * likely roundabouts and link Roads. * * @param edge * The candidate {@link Edge} * @return {@code true} if the {@link Edge} is a candidate for expanding a {@link BigNode} */ private boolean isCandidateJunctionEdge(final Edge edge) { final HighwayTag highwayTag = edge.highwayTag(); return isShortEnough(edge) && highwayTag.isMoreImportantThanOrEqualTo(HighwayTag.RESIDENTIAL) && !JunctionTag.isRoundabout(edge); }
@Override public boolean validCheckForObject(final AtlasObject object) { // We check that the object is an instance of Edge return object instanceof Edge // Make sure that the edges are instances of roundabout && JunctionTag.isRoundabout(object) // And that the Edge has not already been marked as flagged && !this.isFlagged(object.getIdentifier()) // Make sure that we are only looking at master edges && ((Edge) object).isMasterEdge() // Check for excluded highway types && HighwayTag.isCarNavigableHighway(object); }
@Override public boolean validCheckForObject(final AtlasObject object) { // We check that the object is an instance of Edge return object instanceof Edge // Make sure that the object has an iso_country_code && object.getTag(ISOCountryTag.KEY).isPresent() // Make sure that the edges are instances of roundabout && JunctionTag.isRoundabout(object) // And that the Edge has not already been marked as flagged && !this.isFlagged(object.getIdentifier()) // Make sure that we are only looking at master edges && ((Edge) object).isMasterEdge() // Check for excluded highway types && !this.isExcludedHighway(object); }
&& currentEdge.isMasterEdge() && !JunctionTag.isRoundabout(currentEdge) && !roundaboutEdges.contains(currentEdge)) .collect(Collectors.toSet()).size();
if (JunctionTag.isRoundabout(object) && isTagValueValid && layerTagValue.get() != 0L && !(TunnelTag.isTunnel(object) || BridgeTag.isBridge(object)))
/** * Checks for roads that should not be inside a roundabout. Such roads are car navigable, not a * roundabout, bridge, or tunnel, don't have a layer tag, and have geometry inside the * roundabout. * * @param roundabout * A roundabout as a {@link Route} * @return true if there is a road that is crossing and has geometry enclosed by the roundabout */ private boolean roundaboutEnclosesRoads(final Route roundabout) { final Polygon roundaboutPoly = new Polygon(roundabout.asPolyLine()); return roundabout.start().getAtlas().edgesIntersecting(roundaboutPoly, edge -> HighwayTag.isCarNavigableHighway(edge) && !JunctionTag.isRoundabout(edge) && !this.ignoreBridgeTunnelCrossings(edge) && this.intersectsWithEnclosedGeometry(roundaboutPoly, edge)) .iterator().hasNext(); }
/** * Validates whether a given {@link Edge} should be considered as a candidate to be part of a * snake road. The criteria used: * <ul> * <li>1) {@link HighwayTag} is equal to or more significant than Residential * <li>2) {@link HighwayTag}} is less important than trunk_link * <li>3) {@link Edge} is not a roundabout * <li>4) {@link Edge} is not an Open Highway Area * <li>5) {@link Edge} is way-sectioned * <li>6) {@link Edge} is the master edge * </ul> * * @param candidate * {@link Edge} to test * @return {@code true} if given {@link Edge} can be part of a snake road */ private static boolean isValidEdgeToConsider(final Edge candidate) { return candidate.isMasterEdge() && candidate.highwayTag().isMoreImportantThanOrEqualTo(HighwayTag.RESIDENTIAL) && candidate.highwayTag().isLessImportantThan(HighwayTag.TRUNK_LINK) && !JunctionTag.isRoundabout(candidate) && !TagPredicates.IS_HIGHWAY_AREA.test(candidate) && candidate.isWaySectioned(); }
if (JunctionTag.isRoundabout(taggable) || Validators.isOfType(taggable, HighwayTag.class, HighwayTag.MOTORWAY))