@Override public boolean validCheckForObject(final AtlasObject object) { // We could go about this a couple of ways. Either check all buildings, all roads, or both. // Since intersections will be flagged for any feature, it makes sense to loop over the // smallest of the three sets - buildings (for most countries). This may change over time. return object instanceof Area && BuildingTag.isBuilding(object) && !HighwayTag.isHighwayArea(object) && !Validators.isOfType(object, AmenityTag.class, AmenityTag.PARKING) && !Validators.isOfType(object, BuildingTag.class, BuildingTag.ROOF) // Ignore buildings that have points withing it with Ameniity=Fuel && !object.getAtlas().pointsWithin(((Area) object).asPolygon(), point -> Validators.isOfType(point, AmenityTag.class, AmenityTag.FUEL)) .iterator().hasNext(); }
@Test public void testIsHighwayArea() { final Map<String, String> tags = new HashMap<>(); tags.put(HighwayTag.KEY, HighwayTag.PEDESTRIAN.getTagValue()); tags.put(BuildingTag.KEY, BuildingTag.YES.name().toLowerCase()); Assert.assertTrue(HighwayTag.isHighwayArea(new TestTaggable(tags))); tags.put(HighwayTag.KEY, HighwayTag.FOOTWAY.getTagValue()); Assert.assertTrue(HighwayTag.isHighwayArea(new TestTaggable(tags))); tags.remove(BuildingTag.KEY); Assert.assertFalse(HighwayTag.isHighwayArea(new TestTaggable(tags))); tags.put(AreaTag.KEY, AreaTag.YES.name().toLowerCase()); Assert.assertTrue(HighwayTag.isHighwayArea(new TestTaggable(tags))); tags.put(HighwayTag.KEY, HighwayTag.TRACK.getTagValue()); Assert.assertFalse(HighwayTag.isHighwayArea(new TestTaggable(tags))); }