@Override protected Long compress(final M item) { return item.getIdentifier(); }
@Override public long getIdentifier() { return getSource().getIdentifier(); }
@Override public int hashCode() { return new HashCodeBuilder().append(getIdentifier()).append(getClass()).hashCode(); }
public long getIdentifier() { return getReference().getIdentifier(); }
@Override public String toString() { return MoreObjects.toStringHelper(this).add("osm", getSource().getOsmIdentifier()) .add("atlas", getSource().getIdentifier()).add("boundary", this.boundary) .toString(); }
private boolean isSameRoadViaAndTo(final Relation relation) { final Set<Long> fromIdentifiers = new TreeSet<>(); final Set<Long> toIdentifiers = new TreeSet<>(); relation.members().stream().filter(member -> "to".equals(member.getRole())) .forEach(member -> toIdentifiers.add(member.getEntity().getIdentifier())); relation.members().stream().filter(member -> "from".equals(member.getRole())) .forEach(member -> fromIdentifiers.add(member.getEntity().getIdentifier())); return fromIdentifiers.equals(toIdentifiers); }
@Override protected void handle(final Atlas atlas, final CommandMap command) { if (StreamSupport.stream(atlas.entities(i -> i.getIdentifier() > 0).spliterator(), true) .filter(entity -> Validators.isOfType(entity, RouteTag.class, RouteTag.FERRY)) .findFirst().isPresent()) { atlas.metaData().getCountry().ifPresent(this.countries::add); } }
static boolean basicEqual(final AtlasEntity left, final AtlasEntity right) { return left.getIdentifier() == right.getIdentifier() && Objects.equals(left.getTags(), right.getTags()) && Objects.equals(left.relations(), right.relations()); }
@Override public String toString() { return "FeatureChange [changeType=" + this.changeType + ", reference={" + this.reference.getType() + "," + this.reference.getIdentifier() + "}, bounds=" + bounds() + "]"; }
@Override public long getOsmIdentifier() { return new ReverseIdentifierFactory().getOsmIdentifier(this.getIdentifier()); }
@Override public boolean equals(final Object other) { if (other instanceof RelationMember) { final RelationMember that = (RelationMember) other; return StringUtils.equals(this.getRole(), that.getRole()) && this.getRelationIdentifier() == that.getRelationIdentifier() && this.entity.getIdentifier() == that.getEntity().getIdentifier(); } return false; }
protected String formatAtlasObject(final String type, final Atlas atlas, final AtlasEntity entity) { final String shardName = atlas.metaData().getShardName().orElse("UNKNOWN"); return String.format("[%10s] [%d] [%d] --> [%s:%s] Tags: [%s]\n", type, entity.getOsmIdentifier(), entity.getIdentifier(), shardName, atlas.getName(), entity.getTags()); }
public LocationIterableProperties asGeoJsonBigNode() { final List<Location> locations = new ArrayList<>(); nodes().stream().forEach(node -> locations .addAll(Rectangle.forLocated(node.getLocation()).expand(Distance.meters(2)))); return new LocationIterableProperties(new Polygon(locations), Maps.hashMap("BigNode", String.valueOf(getSource().getIdentifier()))); }
protected void validateTagsPresent() { for (final AtlasEntity entity : this.atlas.entities()) { final Map<String, String> tags = entity.getTags(); if (tags == null) { throw new CoreException("Entity {} {} is missing tags.", entity.getType(), entity.getIdentifier()); } } } }
public RelationBean asBean() { final RelationBean result = new RelationBean(); for (final RelationMember member : this.members) { result.addItem(member.getEntity().getIdentifier(), member.getRole(), member.getEntity().getType()); } this.explicitlyExcluded.forEach(result::addItemExplicitlyExcluded); return result; }
public CompleteRelation withExtraMember(final AtlasEntity newMember, final String role) { this.members.addItem( new RelationBeanItem(newMember.getIdentifier(), role, newMember.getType())); this.updateBounds(newMember.bounds()); return this; }
/** * @return the {@link RelationBean} representation of the Relation */ public RelationBean getBean() { final RelationBean bean = new RelationBean(); for (final RelationMember member : this) { final AtlasEntity entity = member.getEntity(); bean.addItem(entity.getIdentifier(), member.getRole(), entity.getType()); } return bean; }
@Test public void lowestIdentifier() { final ComplexHighwayArea highwayArea = this.setup.invalidHighwayArea(); Assert.assertEquals(highwayArea.getVisitedEdgeIdentifiers().first().longValue(), highwayArea.getSource().getIdentifier()); } }
private void addRelation(final PackedAtlasBuilder builder, final Relation relation) { final RelationBean bean = new RelationBean(); relation.members().forEach(member -> bean.addItem(member.getEntity().getIdentifier(), member.getRole(), member.getEntity().getType())); builder.addRelation(relation.getIdentifier(), relation.osmRelationIdentifier(), bean, relation.getTags()); } }
private AtlasPrimitiveRelation convert(final Relation relation) { final RelationBean bean = new RelationBean(); for (final RelationMember member : relation.members()) { bean.addItem(member.getEntity().getIdentifier(), member.getRole(), member.getEntity().getType()); } return new AtlasPrimitiveRelation(relation.getIdentifier(), relation.getIdentifier(), bean, relation.getTags(), relation.bounds()); }