/** * 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)); } }
/** * This function will validate if the supplied atlas object is valid for the check. * * @param object * the atlas object supplied by the Atlas-Checks framework for evaluation * @return {@code true} if this object should be checked */ @Override public boolean validCheckForObject(final AtlasObject object) { final Map<String, String> osmTags = object.getOsmTags(); return object instanceof Edge && ((Edge) object).isMasterEdge() && HighwayTag.isCarNavigableHighway(object) && this.nameKeys.stream().anyMatch(osmTags::containsKey); }
/** * This function will check various elements of the edge to make sure that we should be looking * at it. * * @param object * the edge to check whether we want to continue looking at it * @return {@code true} if is a valid object to look at */ private boolean validEdge(final AtlasObject object) { return object instanceof Edge // Ignore any airport taxiways and runways, as these often create a sink island && !Validators.isOfType(object, AerowayTag.class, AerowayTag.TAXIWAY, AerowayTag.RUNWAY) // Only allow car navigable highways and ignore ferries && HighwayTag.isCarNavigableHighway(object) && !RouteTag.isFerry(object) // Ignore any highways tagged as areas && !TagPredicates.IS_AREA.test(object); }
/** * Checks if the supplied object is of {@link ItemType} {@link Edge} and that it is the * MasterEdge and whether a car can navigate on the edge. So we would ignore any pedestrian * paths in this particular check. An {@link Edge} contains a master edge and a reserve edge, * unless it is a oneway edge in which case it will only contain the master edge. Either way we * want to ignore the reverse edge so that we don't produce duplicate flags for what is * essentially the same feature. * * @param object * the {@link AtlasObject} you are checking * @return {@code true} if matches the restrictions described above */ @Override public boolean validCheckForObject(final AtlasObject object) { // Consider navigable master edges return TypePredicates.IS_EDGE.test(object) && ((Edge) object).isMasterEdge() && HighwayTag.isCarNavigableHighway(object) && isMinimumHighwayType(object); }
&& HighwayTag.isCarNavigableHighway(edge) && !this.lanesFilter.test(edge))
/** * Validate if given {@link AtlasObject} is actually an {@link Edge} and make sure the edge has * one of the following tags: tunnel, bridge, layer */ @Override public boolean validCheckForObject(final AtlasObject object) { return object instanceof Edge // must be highway navigable && HighwayTag.isCarNavigableHighway(object) // and one of the following && ALLOWED_TAGS.test(object) // removes one of two bi-directional edge candidates && ((Edge) object).isMasterEdge() // remove way sectioned duplicates && !this.isFlagged(object.getOsmIdentifier()); }
@Override public boolean validCheckForObject(final AtlasObject object) { return object instanceof Edge // Check to see that the Edge is a master Edge && Edge.isMasterEdgeIdentifier(object.getIdentifier()) // Check to see that the edge has not already been seen && !this.isFlagged(object.getIdentifier()) // Check to see that the edge is car navigable && HighwayTag.isCarNavigableHighway(object) // The edge is not part of an area && !object.getTag(AreaTag.KEY).isPresent(); }
@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); }
.filter(currentEdge -> HighwayTag.isCarNavigableHighway(currentEdge) && currentEdge.isMasterEdge() && !JunctionTag.isRoundabout(currentEdge) && !roundaboutEdges.contains(currentEdge))
private Predicate<Edge> intersectsCoreWayInvalidly(final Area building) { // An invalid intersection is determined by checking that its highway tag is car navigable // or core way based on the configuration value return edge -> (this.carNavigableEdgesOnly ? HighwayTag.isCarNavigableHighway(edge) : HighwayTag.isCoreWay(edge)) // And if the edge intersects the building polygon && edge.asPolyLine().intersects(building.asPolygon()) // And ignore intersections where edge has highway=service and building has // Amenity=fuel && !(HIGHWAY_SERVICE_TAG.test(edge) && Validators.isOfType(building, AmenityTag.class, AmenityTag.FUEL)) // And if the layers have the same layer value && LayerTag.getTaggedValue(edge).orElse(0L) .equals(LayerTag.getTaggedValue(building).orElse(0L)) // And if the building/edge intersection is not valid && !isValidIntersection(building, edge) // And if the edge has no Access = Private tag && !Validators.isOfType(edge, AccessTag.class, AccessTag.PRIVATE); }
/** * Validates given {@link AtlasObject} (assumed to be an {@link Edge}) whether it is a valid * crossing edge or not * * @param object * {@link AtlasObject} to test * @return {@code true} if given {@link AtlasObject} object is a valid crossing edge */ private boolean isValidCrossingEdge(final AtlasObject object) { if (Edge.isMasterEdgeIdentifier(object.getIdentifier()) && !TagPredicates.IS_AREA.test(object) && !this.isFlagged(object.getIdentifier())) { final Optional<HighwayTag> highway = HighwayTag.highwayTag(object); if (highway.isPresent()) { final HighwayTag highwayTag = highway.get(); return HighwayTag.isCarNavigableHighway(highwayTag) && !HighwayTag.CROSSING.equals(highwayTag) && highwayTag.isMoreImportantThanOrEqualTo(this.minimumHighwayType); } } return false; }
/** * 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(); }
@Test public void testIsCarNavigableHighway() { for (final String test : Arrays.asList("MOTOrWAY", "TRUNK", "PRIMARY", "SECONDARY", "TERTIARY", "UNCLASSIFIED", "RESIDENTIAL", "SERVICE", "MOTORWAY_LINK", "TRUNK_LINK", "PRIMARY_LINK", "SECONDARY_LINK", "TERTIARY_LINK", "LIvING_STREET", "TRACK", "ROAD")) { Assert.assertTrue( HighwayTag.isCarNavigableHighway(new TestTaggable(HighwayTag.KEY, test))); } }
/** * This function will validate if the supplied atlas object is valid for the check. * * @param object * the atlas object supplied by the Atlas-Checks framework for evaluation * @return {@code true} if this object should be checked */ @Override public boolean validCheckForObject(final AtlasObject object) { return Validators.hasValuesFor(object, LanesTag.class) && HighwayTag.isCarNavigableHighway(object) && object instanceof Edge && ((Edge) object).isMasterEdge() && !this.lanesFilter.test(object) && !this.isFlagged(object.getOsmIdentifier()); }
.anyMatch(roundaboutEdge -> !HighwayTag.isCarNavigableHighway(roundaboutEdge) || !roundaboutEdge.isMasterEdge()) || !roundaboutEdges.start().inEdges().contains(roundaboutEdges.end()))
@Test public void testIsCarNotNavigableHighway() { Assert.assertFalse( HighwayTag.isCarNavigableHighway(new TestTaggable(HighwayTag.KEY, "dog"))); }