PolyLineTrouble(final AtlasItem item) { this.osmId = item.getOsmIdentifier(); this.polyline = new PolyLine(item.getRawGeometry()); }
@Override public JsonObject asGeoJsonFeature(final String flagIdentifier) { final JsonObject feature = atlasItem.asGeoJsonGeometry(); final JsonObject properties = feature.getAsJsonObject("properties"); properties.addProperty("flag:id", flagIdentifier); properties.addProperty("flag:type", FlaggedPolyline.class.getSimpleName()); return feature; }
@Override public Rectangle bounds() { return atlasItem.bounds(); }
private static void output(final AtlasItem item) { System.out.printf("[%25s] [%9d] %s\n", item.getAtlas().getName(), item.getOsmIdentifier(), item); }
if (this.changeSet.contains(item.getIdentifier(), item.getType(), ChangeAction.DELETE)) final Optional<ChangeItem> optionalItem = this.changeSet.get(item.getIdentifier(), item.getType(), ChangeAction.UPDATE); if (optionalItem.isPresent()) addItem(changeItem.getIdentifier(), item.getType(), changeItem.getGeometry(), changeItem.getTags()); addItem(item.getIdentifier(), item.getType(), item.getRawGeometry(), item.getTags()); final ItemType type = iterator.next().getType(); this.changeSet.iterator(type, ChangeAction.CREATE).forEachRemaining(changeItem ->
@Override public Iterator<Location> iterator() { return getRawGeometry().iterator(); }
private static List<LocationIterableProperties> processRelationForGeoJson( final Relation relation, final Map<String, String> parentTags) { final Map<String, String> relationTags = relation.getTags(); final Map<String, String> modifiedRelationTags = new HashMap<>(parentTags); for (final String key : relationTags.keySet()) { modifiedRelationTags.put("[REL_ID:" + relation.getIdentifier() + "]" + key, relationTags.get(key)); } final List<LocationIterableProperties> result = new ArrayList<>(); for (final RelationMember member : relation.members()) { if (member.getEntity() instanceof Relation) { final Relation subRelation = (Relation) member.getEntity(); result.addAll(processRelationForGeoJson(subRelation, modifiedRelationTags)); } else { final AtlasItem item = (AtlasItem) member.getEntity(); final Map<String, String> modifiedTags = item.getTags(); modifiedTags.putAll(modifiedRelationTags); result.add(new LocationIterableProperties(item.getRawGeometry(), modifiedTags)); } } return result; }
private static void processDiffEntity(final Diff diff, final AtlasEntity entity, final List<LocationIterableProperties> items, final String diffStage) { // Depending on if it is a before or after for a given diff type, an entity may be null. if (entity != null) { final Map<String, String> tags = entity.getTags(); tags.put("diff", diffStage); tags.put("diff:type", diff.getDiffType().name()); tags.put("diff:reason", diff.getDiffReason().name()); if (diff.getItemType() == ItemType.RELATION) { items.addAll(processRelationForGeoJson((Relation) entity, tags)); } else { items.add(new LocationIterableProperties(((AtlasItem) entity).getRawGeometry(), tags)); } } }
private void log(final AtlasItem item) { this.counter.incrementAndGet(); logger.error(String.format("[item] [%25s] [%9d]", item.getAtlas().getName(), item.getOsmIdentifier())); } }
/** * Default constructor * * @param atlasItem * the {@link AtlasItem} to flag */ public FlaggedPolyline(final AtlasItem atlasItem) { this.atlasItem = atlasItem; if (atlasItem instanceof Area) { // We should actually have a FlaggedPolygon class with a polygon in it instead of just // making polygons be PolyLines. I am not sure why FlaggedPolygon was not implemented. this.polyLine = new PolyLine(((Area) atlasItem).asPolygon().closedLoop()); } else { this.polyLine = new PolyLine(atlasItem.getRawGeometry()); } this.properties = initProperties(atlasItem); this.country = initCountry(atlasItem); }