@Override public boolean validCheckForObject(final AtlasObject object) { return (object instanceof Area || (object instanceof Relation && ((Relation) object).isMultiPolygon())) && this.isBuildingOrPart(object); }
/** * Gets all of the polygons contained in this object, if this object has any. * * @param object * any atlas object * @return A singleton stream if object is an Area, a stream if object is a Multipolygon, or an * empty stream if object is neither */ private Stream<Polygon> getPolygons(final AtlasObject object) { if (object instanceof Area) { return Stream.of(((Area) object).asPolygon()); } else if (((Relation) object).isMultiPolygon()) { return ((Relation) object).members().stream().map(this::toPolygon) .flatMap(optPoly -> optPoly.map(Stream::of).orElse(Stream.empty())); } return Stream.empty(); }
public boolean hasMultiPolygonMembers(final Ring ring) { if (isMultiPolygon()) { for (final RelationMember member : members()) { switch (ring) { case OUTER: if (RelationTypeTag.MULTIPOLYGON_ROLE_OUTER.equals(member.getRole())) { return true; } break; case INNER: if (RelationTypeTag.MULTIPOLYGON_ROLE_INNER.equals(member.getRole())) { return true; } break; default: throw new CoreException("Unknown ring type: {}", ring); } } } return false; }
@Override public Iterable<AtlasEntity> convert(final Relation relation) if (!relation.isMultiPolygon())
atlas.relations(relation -> relation.isMultiPolygon() && BuildingTag.isBuilding(relation)) .forEach(index::add); return index;
if (!relation.isMultiPolygon())
/** * This function will validate if the supplied atlas object is valid for the check. * * @param object * the atlas object supplied by the Atlas-Checks framework for evaluation * @return {@code true} if this object should be checked */ @Override public boolean validCheckForObject(final AtlasObject object) { return !this.isFlagged(object.getIdentifier()) && (object instanceof Area || (object instanceof Relation && ((Relation) object).isMultiPolygon())) && this.hasMinKey(object) && (this.isBuildingOrPart(object) || this.isBuildingRelationMember(object)); }
@Override public Iterable<ComplexIsland> find(final Atlas atlas) { /* * Right now we handle only islands in Lakes, Rivers and Reservoirs. This might need to * handle other water bodies too */ final Iterable<Relation> relations = atlas.relations( relation -> relation.isMultiPolygon() && relation.hasMultiPolygonMembers(Ring.INNER) && (isLake(relation) || isRiver(relation) || isReservoir(relation))); return Iterables.translate(relations, ComplexIsland::new); } }
if (item instanceof Relation && ((Relation) item).isMultiPolygon() || item instanceof Area)
@Override protected Optional<CheckFlag> flag(final AtlasObject object) { final Relation relation = (Relation) object; final RelationMemberList members = relation.members(); // If the number of members in the relation is 1 if (members.size() == 1) { if (members.get(0).getEntity().getType().equals(ItemType.RELATION)) { return Optional.of(createFlag(getRelationMembers((Relation) object), this.getLocalizedInstruction(2, relation.getOsmIdentifier(), members.get(0).getEntity().getOsmIdentifier()))); } // If the relation is a multi-polygon, if (relation.isMultiPolygon()) { return Optional.of(createFlag(getRelationMembers((Relation) object), this.getLocalizedInstruction(1, relation.getOsmIdentifier()))); } return Optional.of(createFlag(getRelationMembers((Relation) object), this.getLocalizedInstruction(0, relation.getOsmIdentifier()))); } return Optional.empty(); }
relation -> (Validators.isOfType(relation, LandUseTag.class, LandUseTag.MILITARY) || Validators.hasValuesFor(relation, MilitaryTag.class)) && relation.isMultiPolygon()))
if (relation.isMultiPolygon())