Class Geom

All Implemented Interfaces:
TypeIO, TypeIOConstructor, Type, TypeConstructor

public class Geom extends SimpleType

Riskscape Type that represents geometry, e.g. points lines and polygons. Accepts either Geometry instances or strings in well known text format (WKT)

  • Field Details

    • READER

      public static final org.locationtech.jts.io.WKTReader READER
  • Constructor Details

    • Geom

      public Geom()
  • Method Details

    • fromJavaType

      public static Type fromJavaType(Class<? extends org.locationtech.jts.geom.Geometry> javaType)

      Finds the most specific RiskScape geometry Type that can represent javaType.

      Parameters:
      javaType - class of the geometry
      Returns:
      most specific RiskScape geometry type
    • coerce

      public Object coerce(Object value) throws CoercionException
      Description copied from interface: Type

      Attempt to convert the given value in to one represented by this type.

      Parameters:
      value - The value to coerce
      Returns:
      A value that conforms to this type
      Throws:
      CoercionException - if the given object can not be converted to something represented by this type
    • internalType

      public Class<?> internalType()
      Description copied from interface: Type

      The underlying java class used to represent this type.

    • estimateSize

      public int estimateSize(Object entry)
      Description copied from interface: Type

      Estimate the number of bytes used to serialize the given value to an output stream.

      Parameters:
      entry - the value of this type to measure. Must be of Type.internalType() or a ClassCastException is going to happen
      Returns:
      the estimated number of bytes, or zero if no estimation was possible.
    • toBytes

      public void toBytes(DataOutputStream os, Object toWrite) throws IOException
      Throws:
      IOException
    • fromBytes

      public Object fromBytes(DataInputStream in) throws IOException
      Throws:
      IOException
    • toString

      public String toString(Object value)
      Description copied from interface: Type

      A Riskscape specific toString of the given value, as an alternative to the java type's native toString representation.

    • read

      public Object read(ByteBuffer buffer)
      Description copied from interface: TypeIO

      Read a value from the given byte buffer

    • write

      public void write(ByteBuffer buffer, Object value)
      Description copied from interface: TypeIO

      Write a value out to the given byte buffer

    • getTypeInformationId

      protected String getTypeInformationId()
      Overrides:
      getTypeInformationId in class SimpleType
      Returns:
      an identifier for this SimpleTypes TypeInformation object.