/** * A {@link SyntheticBoundaryNodeTag} is a special tag that is placed on any tag that has been * cut on the border of the particular Atlas file or shard that you are processing. The cutting * process has the potential to create floating edges at the border that are in reality not * floating edges. * * @param edge * the edge that is currently be processed * @return {@code true} if the edge contains a synthetic boundary tag */ private boolean isNotOnSyntheticBoundary(final Edge edge) { return !(SyntheticBoundaryNodeTag.isBoundaryNode(edge.start()) || SyntheticBoundaryNodeTag.isBoundaryNode(edge.end())); }
pointTags.put(SyntheticBoundaryNodeTag.KEY, SyntheticBoundaryNodeTag.YES.toString());
/** * This function checks an edge to determine whether it has certain characteristics that signify * to us that we do not want to keep examining this component of the network. * * @param edge * An Edge we're examining * @return {@code true} if the edge is already flagged, has an amenity type we want to exclude, * or ends in a boundary node {@code false} otherwise */ private boolean edgeCharacteristicsToIgnore(final Edge edge) { // If the edge has already been flagged by another process then we can break out of the // loop and assume that whether the check was a flag or not was handled by the other process return this.isFlagged(edge.getIdentifier()) // We don't want to handle certain types of parking amenities || this.endNodeHasAmenityTypeToExclude(edge) // Ignore edges that have been way sectioned at the border, as has high probability // of creating a false positive due to the sectioning of the way || SyntheticBoundaryNodeTag.isBoundaryNode(edge.end()) || SyntheticBoundaryNodeTag.isBoundaryNode(edge.start()); } }
scaledLocation, false); pointTags.put(SyntheticBoundaryNodeTag.KEY, SyntheticBoundaryNodeTag.YES.toString()); final TemporaryPoint newPoint = createNewPoint( getCoordinateToPointMapping().getScaledCoordinate(
false); newPointTags.put(SyntheticBoundaryNodeTag.KEY, SyntheticBoundaryNodeTag.YES.toString()); final long newPointIdentifier = createNewPointIdentifier( pointIdentifierGenerator, pointCoordinate);
@Test public void testLineTouchingBoundary() { final Atlas rawAtlas = this.setup.getRoadTouchingBoundaryAtlas(); final Atlas slicedAtlas = new RawAtlasCountrySlicer(COUNTRIES, COUNTRY_BOUNDARY_MAP) .slice(rawAtlas); // Check Line correctness Assert.assertEquals("A single line exists in the raw Atlas", 1, rawAtlas.numberOfLines()); Assert.assertEquals("The line was untouched after cutting", 1, slicedAtlas.numberOfLines()); Assert.assertEquals("Expect the line to have Ivory Coast country code", "CIV", slicedAtlas.line(1).getTag(ISOCountryTag.KEY).get()); // Check Point correctness Assert.assertEquals("Two points exist in the raw Atlas", 2, rawAtlas.numberOfPoints()); Assert.assertEquals("Two points exist in the sliced Atlas", 2, slicedAtlas.numberOfPoints()); final Point fullyInIvoryCoast = slicedAtlas.point(1); Assert.assertEquals("Expect point to be fully inside Ivory Coast border", "CIV", fullyInIvoryCoast.getTag(ISOCountryTag.KEY).get()); Assert.assertFalse("Point should not have a synthetic boundary tag", fullyInIvoryCoast.getTag(SyntheticBoundaryNodeTag.KEY).isPresent()); final Point exactlyOnBorder = slicedAtlas.point(2); Assert.assertEquals("Expect point on border to have two country codes", "CIV,LBR", exactlyOnBorder.getTag(ISOCountryTag.KEY).get()); Assert.assertEquals("Point should have an existing synthetic boundary tag", SyntheticBoundaryNodeTag.EXISTING.toString(), exactlyOnBorder.getTag(SyntheticBoundaryNodeTag.KEY).get()); }
Assert.assertEquals( "Expect the Point to have the synethetic boundary node tag value of existing", SyntheticBoundaryNodeTag.EXISTING.toString(), point.getTag(SyntheticBoundaryNodeTag.KEY).get());
"CIV,LBR", point.getTag(ISOCountryTag.KEY).get()); Assert.assertEquals("All new points are non-existing synthetic boundary nodes", SyntheticBoundaryNodeTag.YES.toString(), point.getTag(SyntheticBoundaryNodeTag.KEY).get());
Assert.assertEquals( "Expect the new Point to have the synethetic boundary node tag value of yes", SyntheticBoundaryNodeTag.YES.toString(), point.getTag(SyntheticBoundaryNodeTag.KEY).get());
"CIV,LBR", point.getTag(ISOCountryTag.KEY).get()); Assert.assertEquals("All new points are non-existing synthetic boundary nodes", SyntheticBoundaryNodeTag.YES.toString(), point.getTag(SyntheticBoundaryNodeTag.KEY).get()); newPointIdentifier = pointIdentifierFactory.nextIdentifier();