@Override public void serialize(Shape value, JsonGenerator gen, SerializerProvider serializers) throws IOException, JsonProcessingException { StringWriter str = new StringWriter(); value.getContext().getFormats().getWktWriter().write(str, value); gen.writeString(str.toString()); } }
gen.writeEndArray(); if (v.getBuf() > 0) { writeDistance(gen, v.getBuf(), shape.getContext().isGeo(), BUFFER, BUFFER_UNITS); writeDistance(gen, v.getBuf(), shape.getContext().isGeo(), BUFFER, BUFFER_UNITS); gen.writeString("Unknown"); gen.writeFieldName("wkt"); gen.writeString(shape.getContext().getFormats().getWktWriter().toString(shape)); gen.writeEndObject();
@Override public SpatialContext getContext() { return s.getContext(); } }
writeDistance(output, nf, v.getBuf(), shape.getContext().isGeo(), BUFFER, BUFFER_UNITS);
/** * Returns a buffered representation (TRIP_BUFFER_METERS) of a GTFS trip shape from shapes.txt for the given tripId, * or null if a shape doesn't exist for the given tripId. * <p> * * @param tripId the GTFS trip_id to retrieve a buffered trip shape for * @return a buffered representation (TRIP_BUFFER_METERS) of a GTFS trip shape from shapes.txt for the given tripId, * or null if a shape doesn't exist for the given trip. */ public Shape getBufferedTripShape(String tripId) { if (mTripShapes == null) { // No shapes at all return null; } Shape s = mTripShapes.get(tripId); if (s == null) { // No shape for this trip_id return null; } // Create the buffered version of the trip shape if it doesn't yet exist return mTripShapesBuffered.computeIfAbsent(tripId, k -> s.getBuffered(TRIP_BUFFER_DEGREES, s.getContext())); }