public SnappedLocation(final Location origin, final Location snapped, final PolyLine target) { super(snapped.asConcatenation()); this.origin = origin; this.target = target; }
protected void addPoint(final long pointIdentifier, final Location location, final Map<String, String> tags) { synchronized (this.pointIdentifiers) { if (this.pointIdentifierToPointArrayIndex.containsKey(pointIdentifier)) { throw new AtlasIntegrityException( "Point with identifier " + pointIdentifier + " already exists."); } final long index = this.pointIdentifiers.size(); this.pointIdentifiers.add(pointIdentifier); this.pointIdentifierToPointArrayIndex.put(pointIdentifier, index); this.pointLocations.add(location.asConcatenation()); this.getAsNewPointSpatialIndex().add(new PackedPoint(this, index)); // Tags for (final String key : tags.keySet()) { final String value = tags.get(key); this.pointTags.add(index, key, value); } if (tags.keySet().isEmpty()) { this.pointTags.add(index, null, null); } } }
protected void addNode(final long nodeIdentifier, final Location location, final Map<String, String> tags) { synchronized (this.nodeIdentifiers) { if (this.nodeIdentifierToNodeArrayIndex.containsKey(nodeIdentifier)) { throw new AtlasIntegrityException( "Node with identifier " + nodeIdentifier + " already exists."); } final long index = this.nodeIdentifiers.size(); this.nodeIdentifiers.add(nodeIdentifier); this.nodeIdentifierToNodeArrayIndex.put(nodeIdentifier, index); this.nodeLocations.add(location.asConcatenation()); // Fill the in/out edges arrays for later this.nodeInEdgesIndices.add(new long[0]); this.nodeOutEdgesIndices.add(new long[0]); this.getAsNewNodeSpatialIndex().add(new PackedNode(this, index)); // Tags for (final String key : tags.keySet()) { final String value = tags.get(key); this.nodeTags.add(index, key, value); } if (tags.keySet().isEmpty()) { this.nodeTags.add(index, null, null); } } }
@Override public List<WayNode> convert(final Iterable<? extends Location> object) { return Iterables.stream(object).map(location -> new WayNode(location.asConcatenation())) .collectToList(); } }
@Override public Node convert(final Location object) { return new Node(new CommonEntityData(object.asConcatenation(), 0, new Date(), new OsmUser(0, "osm"), 0), object.getLatitude().asDegrees(), object.getLongitude().asDegrees()); } }
@Override public Node convert(final AtlasPrimitiveLocationItem object) { return new Node( new CommonEntityData(object.getLocation().asConcatenation(), 0, new Date(), new OsmUser(0, "osm"), 0, TAG_MAP_TO_TAG_COLLECTION_CONVERTER.convert(object.getTags())), object.getLocation().getLatitude().asDegrees(), object.getLocation().getLongitude().asDegrees()); } }