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
public class ShapeAsGeoJSONSerializer extends com.fasterxml.jackson.databind.JsonSerializer<Shape>
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.String
BUFFER
(package private) static java.lang.String
BUFFER_UNITS
(package private) GeometryAsGeoJSONSerializer
forJTS
-
Constructor Summary
Constructors Constructor Description ShapeAsGeoJSONSerializer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static double
round(double v)
void
serialize(Shape shape, com.fasterxml.jackson.core.JsonGenerator gen, com.fasterxml.jackson.databind.SerializerProvider serializers)
protected void
write(com.fasterxml.jackson.core.JsonGenerator gen, double... coords)
void
write(com.fasterxml.jackson.core.JsonGenerator gen, Shape shape)
(package private) void
writeDistance(com.fasterxml.jackson.core.JsonGenerator gen, double dist, boolean isGeo, java.lang.String distProperty, java.lang.String distUnitsProperty)
Helper method to encode a distance property (with optional unit).
-
-
-
Field Detail
-
BUFFER
static final java.lang.String BUFFER
- See Also:
- Constant Field Values
-
BUFFER_UNITS
static final java.lang.String BUFFER_UNITS
- See Also:
- Constant Field Values
-
forJTS
final GeometryAsGeoJSONSerializer forJTS
-
-
Method Detail
-
write
protected void write(com.fasterxml.jackson.core.JsonGenerator gen, double... coords) throws java.io.IOException
- Throws:
java.io.IOException
-
round
public static double round(double v)
-
writeDistance
void writeDistance(com.fasterxml.jackson.core.JsonGenerator gen, double dist, boolean isGeo, java.lang.String distProperty, java.lang.String distUnitsProperty) throws java.io.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:
output
- The writer.nf
- The number format.dist
- The distance value to encode.isGeo
- The flag determiningdistProperty
- The distance property name.distUnitsProperty
- The distance unit property name.- Throws:
java.io.IOException
-
write
public void write(com.fasterxml.jackson.core.JsonGenerator gen, Shape shape) throws java.io.IOException
- Throws:
java.io.IOException
-
serialize
public void serialize(Shape shape, com.fasterxml.jackson.core.JsonGenerator gen, com.fasterxml.jackson.databind.SerializerProvider serializers) throws java.io.IOException, com.fasterxml.jackson.core.JsonProcessingException
- Specified by:
serialize
in classcom.fasterxml.jackson.databind.JsonSerializer<Shape>
- Throws:
java.io.IOException
com.fasterxml.jackson.core.JsonProcessingException
-
-