类 GeometryDataCodec

java.lang.Object
gu.sql2java.geometry.GeometryDataCodec
所有已实现的接口:
com.vividsolutions.jts.io.WKBConstants
直接已知子类:
MysqlGeometryDataCodec

public class GeometryDataCodec extends Object implements com.vividsolutions.jts.io.WKBConstants
存储格式WKB,WKT与Geometry对象之间的互相转换实现基类, 对于不同的数据库,应该继承此类根据数据库存储WKB方式的不同提供合适的实现
子类必须实现toWKB(Object),fromWKB(byte[]),getGeomtyColumnTypes()方法, 否则toWKB(Object),fromWKB(byte[])总是返回null, getGeomtyColumnTypes()方法总是返回空
从以下版本开始:
3.18.0
作者:
guyadong
  • 字段概要

    字段
    修饰符和类型
    字段
    说明
    static final GeometryDataCodec
    默认实例

    从接口继承的字段 com.vividsolutions.jts.io.WKBConstants

    wkbGeometryCollection, wkbLineString, wkbMultiLineString, wkbMultiPoint, wkbMultiPolygon, wkbNDR, wkbPoint, wkbPolygon, wkbXDR
  • 方法概要

    修饰符和类型
    方法
    说明
    com.vividsolutions.jts.geom.Geometry
    fromWKB(byte[] binary)
    将WKB格式的二进制数据解析为Geometry对象
    final <T extends com.vividsolutions.jts.geom.Geometry>
    T
    fromWKB(byte[] binary, Class<T> targetType)
     
    final com.vividsolutions.jts.geom.Geometry
    fromWKB(Object input)
     
    final <T extends com.vividsolutions.jts.geom.Geometry>
    T
    fromWKB(Object input, Class<T> targetType)
     
    final com.vividsolutions.jts.geom.Geometry
    fromWKT(String input)
     
    final <T extends com.vividsolutions.jts.geom.Geometry>
    T
    fromWKT(String input, Class<T> targetType)
     
    final <T extends com.vividsolutions.jts.geom.Geometry>
    T
    fromWKTUnchecked(String input, Class<T> targetType)
     
    返回数据库支持的所有空间(几何)数据字段类型,默认返回空集合
    final boolean
     
    final boolean
    isGeometryDataType(ResultSet rs, int columnIndex)
     
    readGeometryData(ResultSet rs, int columnIndex)
    读取数据记录指定字段的值转为空间数据对象,子类需要重写此方法
    final byte[]
    toWKB(Object value)
     
    <T extends com.vividsolutions.jts.geom.Geometry>
    byte[]
    toWKB(T input)
    Geometry类型转为适合数据库存储的二进制格式
    final String
    toWKT(Object input)
     
    final <T extends com.vividsolutions.jts.geom.Geometry>
    String
    toWKT(T input)
     

    从类继承的方法 java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 字段详细资料

    • DEFAULT_INSTANCE

      public static final GeometryDataCodec DEFAULT_INSTANCE
      默认实例
  • 方法详细资料

    • toWKB

      public <T extends com.vividsolutions.jts.geom.Geometry> byte[] toWKB(T input)
      Geometry类型转为适合数据库存储的二进制格式
      类型参数:
      T -
      参数:
      input -
    • fromWKB

      public com.vividsolutions.jts.geom.Geometry fromWKB(byte[] binary) throws com.vividsolutions.jts.io.ParseException
      将WKB格式的二进制数据解析为Geometry对象
      参数:
      binary -
      抛出:
      com.vividsolutions.jts.io.ParseException
    • fromWKB

      public final <T extends com.vividsolutions.jts.geom.Geometry> T fromWKB(byte[] binary, Class<T> targetType) throws com.vividsolutions.jts.io.ParseException
      抛出:
      com.vividsolutions.jts.io.ParseException
    • fromWKB

      public final com.vividsolutions.jts.geom.Geometry fromWKB(Object input) throws com.vividsolutions.jts.io.ParseException
      抛出:
      com.vividsolutions.jts.io.ParseException
    • fromWKB

      public final <T extends com.vividsolutions.jts.geom.Geometry> T fromWKB(Object input, Class<T> targetType) throws com.vividsolutions.jts.io.ParseException
      抛出:
      com.vividsolutions.jts.io.ParseException
    • fromWKT

      public final com.vividsolutions.jts.geom.Geometry fromWKT(String input) throws com.vividsolutions.jts.io.ParseException
      抛出:
      com.vividsolutions.jts.io.ParseException
    • fromWKT

      public final <T extends com.vividsolutions.jts.geom.Geometry> T fromWKT(String input, Class<T> targetType) throws com.vividsolutions.jts.io.ParseException
      抛出:
      com.vividsolutions.jts.io.ParseException
    • fromWKTUnchecked

      public final <T extends com.vividsolutions.jts.geom.Geometry> T fromWKTUnchecked(String input, Class<T> targetType)
    • toWKT

      public final <T extends com.vividsolutions.jts.geom.Geometry> String toWKT(T input)
    • toWKT

      public final String toWKT(Object input) throws com.vividsolutions.jts.io.ParseException
      抛出:
      com.vividsolutions.jts.io.ParseException
    • toWKB

      public final byte[] toWKB(Object value)
    • getGeomtyColumnTypes

      public Set<String> getGeomtyColumnTypes()
      返回数据库支持的所有空间(几何)数据字段类型,默认返回空集合
    • isGeometryDataType

      public final boolean isGeometryDataType(String typeName) throws SQLException
      抛出:
      SQLException
    • isGeometryDataType

      public final boolean isGeometryDataType(ResultSet rs, int columnIndex) throws SQLException
      抛出:
      SQLException
    • readGeometryData

      public Object readGeometryData(ResultSet rs, int columnIndex) throws SQLException
      读取数据记录指定字段的值转为空间数据对象,子类需要重写此方法
      参数:
      rs -
      columnIndex -
      抛出:
      SQLException