Class ShapeAsGeoJSONSerializer
java.lang.Object
com.fasterxml.jackson.databind.JsonSerializer<Shape>
org.locationtech.spatial4j.io.jackson.ShapeAsGeoJSONSerializer
- All Implemented Interfaces:
com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable
-
Nested Class Summary
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonSerializer
com.fasterxml.jackson.databind.JsonSerializer.None -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final String(package private) static final String(package private) final GeometryAsGeoJSONSerializer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleround(double v) voidserialize(Shape shape, com.fasterxml.jackson.core.JsonGenerator gen, com.fasterxml.jackson.databind.SerializerProvider serializers) protected voidwrite(com.fasterxml.jackson.core.JsonGenerator gen, double... coords) void(package private) voidwriteDistance(com.fasterxml.jackson.core.JsonGenerator gen, double dist, boolean isGeo, String distProperty, String distUnitsProperty) Helper method to encode a distance property (with optional unit).Methods inherited from class com.fasterxml.jackson.databind.JsonSerializer
acceptJsonFormatVisitor, getDelegatee, handledType, isEmpty, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, serializeWithType, unwrappingSerializer, usesObjectId, withFilterId, withIgnoredProperties
-
Field Details
-
BUFFER
- See Also:
-
BUFFER_UNITS
- See Also:
-
forJTS
-
-
Constructor Details
-
ShapeAsGeoJSONSerializer
public ShapeAsGeoJSONSerializer()
-
-
Method Details
-
write
protected void write(com.fasterxml.jackson.core.JsonGenerator gen, double... coords) throws IOException - Throws:
IOException
-
round
public static double round(double v) -
writeDistance
void writeDistance(com.fasterxml.jackson.core.JsonGenerator gen, double dist, boolean isGeo, String distProperty, String distUnitsProperty) throws IOException Helper method to encode a distance property (with optional unit).The distance unit is only encoded when isGeo is true, and it is converted to km.
The distance unit is encoded within a properties object.
- Parameters:
dist- The distance value to encode.isGeo- The flag determiningdistProperty- The distance property name.distUnitsProperty- The distance unit property name.output- The writer.nf- The number format.- Throws:
IOException
-
write
- Throws:
IOException
-
serialize
public void serialize(Shape shape, com.fasterxml.jackson.core.JsonGenerator gen, com.fasterxml.jackson.databind.SerializerProvider serializers) throws IOException, com.fasterxml.jackson.core.JsonProcessingException - Specified by:
serializein classcom.fasterxml.jackson.databind.JsonSerializer<Shape>- Throws:
IOExceptioncom.fasterxml.jackson.core.JsonProcessingException
-