@Override public JsonElement serialize(final T polyLine, final Type typeOfSrc, final JsonSerializationContext context) { final JsonObject result = new JsonObject(); result.add("type", new JsonPrimitive(getType())); polyLine.forEach(location -> { }); result.add("coordinates", new PolyLineCoordinateConverter().convert(polyLine)); return result; }
@Override public PolyLine asPolyLine() { final PolyLine one = this.upstream.asPolyLine(); final PolyLine two = this.downstream.asPolyLine(); final List<Location> points = new ArrayList<>(); one.forEach(points::add); for (int i = 1; i < two.size(); i++) { points.add(two.get(i)); } return new PolyLine(points); }
public String toCompactString() { final StringList stringList = new StringList(); this.forEach(location -> { stringList.add(location.toCompactString()); }); return stringList.join(SEPARATOR); }
/** * Marks a line for deletion, if that line is being removed as a relation member. This is safe * to do when the line member was merged with another member to maintain a valid relation and * the merged line is not part of any other relation. * * @param line * The relation member {@link Line} * @param relationIdentifier * The parent {@link Relation} identifier */ private void markRemovedMemberLineForDeletion(final Line line, final long relationIdentifier) { // Only mark this line for deletion if this line isn't part of any other relations final boolean isPartOfOtherRelations = line.relations().stream() .anyMatch(partOf -> partOf.getIdentifier() != relationIdentifier); if (!isPartOfOtherRelations) { // Delete Line and all of its points this.slicedRelationChanges.deleteLine(line.getIdentifier()); this.partiallySlicedRawAtlas.line(line.getIdentifier()).asPolyLine() .forEach(location -> this.partiallySlicedRawAtlas.pointsAt(location).forEach( point -> this.pointCandidatesForRemoval.add(point.getIdentifier()))); } }