private boolean isBuilding(final Area area) { return BuildingTag.isBuilding(area); }
@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))); }
@Override public boolean validCheckForObject(final AtlasObject object) { return object instanceof Area && BuildingTag.isBuilding(object); }
public static boolean isBuilding(final String value) { return isBuilding(taggable -> Optional.of(value)); }
/** * Given an object, returns true if that object has a building tag or building part tag * indicating that it is either a building or a building part. * * @param object * any AtlasObject * @return true if object is a building or a building part, false otherwise */ private boolean isBuildingOrPart(final AtlasObject object) { return BuildingTag.isBuilding(object) || Validators.isNotOfType(object, BuildingPartTag.class, BuildingPartTag.NO); }
private boolean isBuilding(final Relation relation) { final String type = relation.tag(RelationTypeTag.KEY); /* * If we have a multipolygon relation, then it can be a building if it has the building tag * itself, or if one outer member of the relation has a building tag (this one is not * recommended in OSM, but many occurrences happen) */ return BuildingTag.KEY.equals(type) || RelationTypeTag.MULTIPOLYGON_TYPE.equals(type) && (BuildingTag.isBuilding(relation) || hasChildAreaAsBuilding(relation)); }
/** * Checks if an {@link AtlasObject} is a building or building:part that is valid for this check. * * @param object * {@link AtlasObject} to check * @return true if {@code object} has a {@code building:part=yes} tag */ private boolean isBuildingOrPart(final AtlasObject object) { return (BuildingTag.isBuilding(object) // Ignore roofs, as the are often used for items that have supports that are too // small to effectively map (such as a carport) && Validators.isNotOfType(object, BuildingTag.class, BuildingTag.ROOF)) || Validators.isNotOfType(object, BuildingPartTag.class, BuildingPartTag.NO); }
@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 testIsNotBuilding() { Assert.assertFalse(BuildingTag.isBuilding("Pyramids")); } }
atlas.relations(relation -> relation.isMultiPolygon() && BuildingTag.isBuilding(relation)) .forEach(index::add); return index;
@Test public void testIsBuilding() { Assert.assertTrue(BuildingTag.isBuilding("ComMERcial")); }
area -> BuildingTag.isBuilding(area) && building.getIdentifier() != area.getIdentifier() && area.intersects(buildingPolygon));