/** * Checks if an {@link AtlasObject} is of an equal or greater priority than the minimum. The * minimum is supplied as a configuration parameter, the default is {@code "tertiary"}. * * @param object * an {@link AtlasObject} * @return {@code true} if this object is >= the minimum */ private boolean isMinimumHighway(final AtlasObject object) { final Optional<HighwayTag> result = HighwayTag.highwayTag(object); return result.isPresent() && result.get().isMoreImportantThanOrEqualTo(this.minimumHighwayType); }
/** * Checks if highway tag of given {@link AtlasObject} is of greater or equal priority than the * minimum highway type given in the configurable. If no value is given in configurable, the * default highway type of "SERVICE" will be set as minimum. * * @param object * an {@link AtlasObject} * @return {@code true} if the highway tag of this object is greater than or equal to the * minimum type */ private boolean isMinimumHighwayType(final AtlasObject object) { final Optional<HighwayTag> highwayTagOfObject = HighwayTag.highwayTag(object); return highwayTagOfObject.isPresent() && highwayTagOfObject.get().isMoreImportantThanOrEqualTo(this.highwayMinimum); } }
/** * 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) { return this.validEdge(object) && !this.isFlagged(object.getIdentifier()) && ((Edge) object) .highwayTag().isMoreImportantThanOrEqualTo(this.minimumHighwayType); }
/** * 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; }
.orElse(HighwayTag.NO).isMoreImportantThanOrEqualTo(arterialMinimum))
/** * Checks to see whether the atlas object has the prerequisites to be evaluated. It uses a * function {@link BaseCheck#isFlagged(Object)} that looks through a list of elements that have * been flagged by the check algorithm, and if the check has already looked at a specific * feature it can skip it here. This is useful if you are walking the graph in your check * algorithm and then can flag each feature that you visit while walking the graph. * * @param object * the {@link AtlasObject} you are checking * @return {@code true} if object should be checked */ @Override public boolean validCheckForObject(final AtlasObject object) { // Master edges with building tags or with eligible highway tags return object instanceof Edge && ((Edge) object).isMasterEdge() && (Validators.hasValuesFor(object, BuildingTag.class) || ((Edge) object) .highwayTag().isMoreImportantThanOrEqualTo(this.minimumHighwayType)) // Areas || object instanceof Area // Lines excluding ineligible highway tags || object instanceof Line // Exclude waterway tags && !Validators.hasValuesFor(object, WaterwayTag.class); }
/** * 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 (outEdge.highwayTag().isMoreImportantThanOrEqualTo(HighwayTag.RESIDENTIAL) && this.edgeDirectionComparator.isOppositeDirection(inEdge, outEdge, false)
@Test public void testMoreImportant() { Assert.assertTrue(HighwayTag.MOTORWAY.isMoreImportantThan(HighwayTag.TERTIARY)); Assert.assertTrue(HighwayTag.PRIMARY.isMoreImportantThan(HighwayTag.SECONDARY)); // Testing equivalence Assert.assertTrue(HighwayTag.PRIMARY.isMoreImportantThanOrEqualTo(HighwayTag.PRIMARY)); } }