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>
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonSerializer

    com.fasterxml.jackson.databind.JsonSerializer.None
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) static final String
     
    (package private) static final String
     
    (package private) final GeometryAsGeoJSONSerializer
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    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, 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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • 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 determining
      distProperty - The distance property name.
      distUnitsProperty - The distance unit property name.
      output - The writer.
      nf - The number format.
      Throws:
      IOException
    • write

      public void write(com.fasterxml.jackson.core.JsonGenerator gen, Shape shape) throws IOException
      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:
      serialize in class com.fasterxml.jackson.databind.JsonSerializer<Shape>
      Throws:
      IOException
      com.fasterxml.jackson.core.JsonProcessingException