@Override protected Set<String> getKeys(final Edge edge) { final Set<String> result = new HashSet<>(); result.add(edge.highwayTag().getTagValue()); return result; }
/** * @param edge * The {@link Edge} to look at * @return The most significant {@link HighwayTag} directly connected to this {@link Edge} * (including itself) */ private HighwayTag mostSignificantConnectedHighwayType(final Edge edge) { HighwayTag edgeTag = edge.highwayTag(); for (final Edge connected : edge.connectedEdges()) { final HighwayTag connectedTag = connected.highwayTag(); if (connectedTag.isMoreImportantThan(edgeTag)) { edgeTag = connectedTag; } } return edgeTag; }
@Override protected Set<String> getKeys(final Edge edge) { final Optional<Time> lastEditOption = edge.lastEdit(); if (!lastEditOption.isPresent()) { return new HashSet<>(); } final Time lastEdit = lastEditOption.get(); final String year = String.valueOf(lastEdit.year()); final String month = String.valueOf(lastEdit.month()); final Set<String> result = new HashSet<>(); result.add(edge.highwayTag().getTagValue() + "_" + year + "-" + month); return result; }
/** * 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(); }
/** * 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); }
else if (nextEdge.highwayTag().isIdenticalClassification(finalEdge.highwayTag()) && finalEdge.getMasterEdgeIdentifier() != nextEdge .getMasterEdgeIdentifier())
@Override public boolean validCheckForObject(final AtlasObject object) { return this.validEdge(object) && !this.isFlagged(object.getIdentifier()) && ((Edge) object) .highwayTag().isMoreImportantThanOrEqualTo(this.minimumHighwayType); }
if (edge.highwayTag().isLessImportantThan(HighwayTag.TERTIARY))
/** * 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); }
if (inEdge.highwayTag().isLessImportantThan(HighwayTag.RESIDENTIAL) || this.edgeDirectionComparator.isSameDirection(candidateRoute.start(), inEdge, false) if (outEdge.highwayTag().isMoreImportantThanOrEqualTo(HighwayTag.RESIDENTIAL) && this.edgeDirectionComparator.isOppositeDirection(inEdge, outEdge, false)
if (!sourceHighwayTag.isIdenticalClassification(connectedEdge.highwayTag()))
final HighwayTag highwayTag = edge.highwayTag(); final CheckFlag flag = new CheckFlag(this.getTaskIdentifier(object));
Assert.assertEquals(HighwayTag.PRIMARY, edge9.highwayTag()); Assert.assertEquals(SurfaceTag.CONCRETE, SurfaceTag.get(edge9).orElseThrow(CoreException.supplier("No tag"))); .orElseThrow(CoreException.supplier("Should have 3 lanes!"))); Assert.assertEquals(HighwayTag.PRIMARY, edgeMinus9.highwayTag()); Assert.assertEquals(SurfaceTag.FINE_GRAVEL, SurfaceTag.get(edgeMinus9).orElseThrow(CoreException.supplier("No tag"))); Assert.assertFalse(LanesTag.numberOfLanes(edgeMinus9).isPresent()); Assert.assertEquals(HighwayTag.SECONDARY, edge98.highwayTag()); Assert.assertFalse(SurfaceTag.get(edge98).isPresent()); Assert.assertTrue(BridgeTag.isBridge(edge98)); .orElseThrow(CoreException.supplier("Should have maxspeed"))); Assert.assertEquals(HighwayTag.RESIDENTIAL, edge987.highwayTag()); Assert.assertFalse(SurfaceTag.get(edge987).isPresent()); Assert.assertFalse(BridgeTag.isBridge(edge987));