Top Description Inners Constructors Methods
org.h2.util.geometry

public final Class JTSUtils

extends Object
Class Inheritance
Static Imports
org.h2.util.geometry.GeometryUtils.DIMENSION_SYSTEM_XY, .GeometryUtils.DIMENSION_SYSTEM_XYM, .GeometryUtils.DIMENSION_SYSTEM_XYZ, .GeometryUtils.DIMENSION_SYSTEM_XYZM, .GeometryUtils.GEOMETRY_COLLECTION, .GeometryUtils.LINE_STRING, .GeometryUtils.M, .GeometryUtils.MULTI_LINE_STRING, .GeometryUtils.MULTI_POINT, .GeometryUtils.MULTI_POLYGON, .GeometryUtils.POINT, .GeometryUtils.POLYGON, .GeometryUtils.X, .GeometryUtils.Y, .GeometryUtils.Z, .GeometryUtils.checkFinite, .GeometryUtils.toCanonicalDouble

Utilities for Geometry data type from JTS library.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
JTSUtils.GeometryTarget

Converter output target that creates a JTS Geometry.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static void
addCoordinate(org.locationtech.jts.geom.CoordinateSequence sequence, GeometryUtils.Target target, int index, int total)

private static void
addCoordinate(org.locationtech.jts.geom.CoordinateSequence sequence, GeometryUtils.Target target, int index, int total, double x, double y)

private static void
addRing(org.locationtech.jts.geom.CoordinateSequence sequence, GeometryUtils.Target target, int size)

public static org.locationtech.jts.geom.Geometry

Returns:

JTS geometry object
ewkb2geometry
(byte[]
source EWKB
ewkb
)

Converts EWKB to a JTS geometry object.

public static org.locationtech.jts.geom.Geometry

Returns:

JTS geometry object
ewkb2geometry
(byte[]
source EWKB
ewkb
,
int
dimension system
dimensionSystem
)

Converts EWKB to a JTS geometry object.

public static byte[]

Returns:

EWKB representation
geometry2ewkb
(org.locationtech.jts.geom.Geometry
source geometry
geometry
)

Converts Geometry to EWKB.

public static byte[]

Returns:

EWKB representation
geometry2ewkb
(org.locationtech.jts.geom.Geometry
source geometry
geometry
,
int
dimension system
dimensionSystem
)

Converts Geometry to EWKB.

public static int

Returns:

the dimension system
getDimensionSystem
(org.locationtech.jts.geom.Geometry
geometry to parse
geometry
)

Determines a dimension system of a JTS Geometry object.

private static int
getDimensionSystem1(org.locationtech.jts.geom.Geometry geometry)

private static int
getDimensionSystemFromCoordinate(org.locationtech.jts.geom.CoordinateSequence sequence, int index)

private static int
getDimensionSystemFromSequence(org.locationtech.jts.geom.CoordinateSequence sequence)

public static void
parseGeometry(org.locationtech.jts.geom.Geometry
geometry to parse
geometry
,
GeometryUtils.Target
output target
target
)

Parses a JTS Geometry object.

private static void
parseGeometry(org.locationtech.jts.geom.Geometry
geometry to parse
geometry
,
GeometryUtils.Target
output target
target
,
int
type of parent geometry collection, or 0 for the root geometry
parentType
)

Parses a JTS Geometry object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

JTSUtilsback to summary
private JTSUtils()

Method Detail

addCoordinateback to summary
private static void addCoordinate(org.locationtech.jts.geom.CoordinateSequence sequence, GeometryUtils.Target target, int index, int total)
addCoordinateback to summary
private static void addCoordinate(org.locationtech.jts.geom.CoordinateSequence sequence, GeometryUtils.Target target, int index, int total, double x, double y)
addRingback to summary
private static void addRing(org.locationtech.jts.geom.CoordinateSequence sequence, GeometryUtils.Target target, int size)
ewkb2geometryback to summary
public static org.locationtech.jts.geom.Geometry ewkb2geometry(byte[] ewkb)

Converts EWKB to a JTS geometry object.

Parameters
ewkb:byte[]

source EWKB

Returns:org.locationtech.jts.geom.Geometry

JTS geometry object

ewkb2geometryback to summary
public static org.locationtech.jts.geom.Geometry ewkb2geometry(byte[] ewkb, int dimensionSystem)

Converts EWKB to a JTS geometry object.

Parameters
ewkb:byte[]

source EWKB

dimensionSystem:int

dimension system

Returns:org.locationtech.jts.geom.Geometry

JTS geometry object

geometry2ewkbback to summary
public static byte[] geometry2ewkb(org.locationtech.jts.geom.Geometry geometry)

Converts Geometry to EWKB.

Parameters
geometry:org.locationtech.jts.geom.Geometry

source geometry

Returns:byte[]

EWKB representation

geometry2ewkbback to summary
public static byte[] geometry2ewkb(org.locationtech.jts.geom.Geometry geometry, int dimensionSystem)

Converts Geometry to EWKB.

Parameters
geometry:org.locationtech.jts.geom.Geometry

source geometry

dimensionSystem:int

dimension system

Returns:byte[]

EWKB representation

getDimensionSystemback to summary
public static int getDimensionSystem(org.locationtech.jts.geom.Geometry geometry)

Determines a dimension system of a JTS Geometry object.

Parameters
geometry:org.locationtech.jts.geom.Geometry

geometry to parse

Returns:int

the dimension system

getDimensionSystem1back to summary
private static int getDimensionSystem1(org.locationtech.jts.geom.Geometry geometry)
getDimensionSystemFromCoordinateback to summary
private static int getDimensionSystemFromCoordinate(org.locationtech.jts.geom.CoordinateSequence sequence, int index)
getDimensionSystemFromSequenceback to summary
private static int getDimensionSystemFromSequence(org.locationtech.jts.geom.CoordinateSequence sequence)
parseGeometryback to summary
public static void parseGeometry(org.locationtech.jts.geom.Geometry geometry, GeometryUtils.Target target)

Parses a JTS Geometry object.

Parameters
geometry:org.locationtech.jts.geom.Geometry

geometry to parse

target:GeometryUtils.Target

output target

parseGeometryback to summary
private static void parseGeometry(org.locationtech.jts.geom.Geometry geometry, GeometryUtils.Target target, int parentType)

Parses a JTS Geometry object.

Parameters
geometry:org.locationtech.jts.geom.Geometry

geometry to parse

target:GeometryUtils.Target

output target

parentType:int

type of parent geometry collection, or 0 for the root geometry

org.h2.util.geometry back to summary

public final Class JTSUtils.GeometryTarget

extends Target
Class Inheritance

Converter output target that creates a JTS Geometry.

Field Summary

Modifier and TypeField and Description
private org.locationtech.jts.geom.CoordinateSequence
private final int
private org.locationtech.jts.geom.GeometryFactory
private org.locationtech.jts.geom.CoordinateSequence[]
private int
private org.locationtech.jts.geom.Geometry[]
private int

Constructor Summary

AccessConstructor and Description
public
GeometryTarget(int
dimension system to use
dimensionSystem
)

Creates a new instance of JTS Geometry target.

private
GeometryTarget(int dimensionSystem, org.locationtech.jts.geom.GeometryFactory factory)

Method Summary

Modifier and TypeMethod and Description
protected void
addCoordinate(double
X coordinate
x
,
double
Y coordinate
y
,
double
Z coordinate (NaN if not used)
z
,
double
M coordinate (NaN if not used)
m
,
int
0-based index of coordinate in the current sequence
index
,
int
total number of coordinates in the current sequence
total
)

Implements abstract org.h2.util.geometry.GeometryUtils.Target.addCoordinate.

Invoked to add a coordinate to a geometry.

private org.locationtech.jts.geom.CoordinateSequence
createCoordinates(int numPoints)

protected void
endCollectionItem(GeometryUtils.Target target, int
type of collection
type
,
int
0-based index of this item in the collection
index
,
int
total number of items in the collection
total
)

Overrides org.h2.util.geometry.GeometryUtils.Target.endCollectionItem.

Invoked after writing of a collection item.

pack-priv org.locationtech.jts.geom.Geometry
protected void
init(int
SRID
srid
)

Overrides org.h2.util.geometry.GeometryUtils.Target.init.

Initializes top-level target.

private void
initCoordinates(int numPoints)

protected void
startCollection(int type, int
number of items in this collection
numItems
)

Overrides org.h2.util.geometry.GeometryUtils.Target.startCollection.

Invoked before writing of a collection.

protected GeometryUtils.Target
startCollectionItem(int
0-based index of this item in the collection
index
,
int
total number of items in the collection
total
)

Overrides org.h2.util.geometry.GeometryUtils.Target.startCollectionItem.

Invoked before writing of a collection item.

protected void
startLineString(int
number of points in line string
numPoints
)

Overrides org.h2.util.geometry.GeometryUtils.Target.startLineString.

Invoked before writing a LINESTRING.

protected void
startPoint()

Overrides org.h2.util.geometry.GeometryUtils.Target.startPoint.

Invoked before writing a POINT.

protected void
startPolygon(int
number of inner polygons
numInner
,
int
number of points in outer polygon
numPoints
)

Overrides org.h2.util.geometry.GeometryUtils.Target.startPolygon.

Invoked before writing a POLYGON.

protected void
startPolygonInner(int
number of points in inner polygon
numInner
)

Overrides org.h2.util.geometry.GeometryUtils.Target.startPolygonInner.

Invoked before writing an inner polygon in POLYGON.

Inherited from org.h2.util.geometry.GeometryUtils.Target:
dimensionSystemendNonEmptyPolygonendObject

Field Detail

coordinatesback to summary
private org.locationtech.jts.geom.CoordinateSequence coordinates
dimensionSystemback to summary
private final int dimensionSystem
factoryback to summary
private org.locationtech.jts.geom.GeometryFactory factory
innerCoordinatesback to summary
private org.locationtech.jts.geom.CoordinateSequence[] innerCoordinates
innerOffsetback to summary
private int innerOffset
subgeometriesback to summary
private org.locationtech.jts.geom.Geometry[] subgeometries
typeback to summary
private int type

Constructor Detail

GeometryTargetback to summary
public GeometryTarget(int dimensionSystem)

Creates a new instance of JTS Geometry target.

Parameters
dimensionSystem:int

dimension system to use

GeometryTargetback to summary
private GeometryTarget(int dimensionSystem, org.locationtech.jts.geom.GeometryFactory factory)

Method Detail

addCoordinateback to summary
protected void addCoordinate(double x, double y, double z, double m, int index, int total)

Implements abstract org.h2.util.geometry.GeometryUtils.Target.addCoordinate.

Doc from org.h2.util.geometry.GeometryUtils.Target.addCoordinate.

Invoked to add a coordinate to a geometry.

Parameters
x:double

X coordinate

y:double

Y coordinate

z:double

Z coordinate (NaN if not used)

m:double

M coordinate (NaN if not used)

index:int

0-based index of coordinate in the current sequence

total:int

total number of coordinates in the current sequence

Annotations
@Override
createCoordinatesback to summary
private org.locationtech.jts.geom.CoordinateSequence createCoordinates(int numPoints)
endCollectionItemback to summary
protected void endCollectionItem(GeometryUtils.Target target, int type, int index, int total)

Overrides org.h2.util.geometry.GeometryUtils.Target.endCollectionItem.

Doc from org.h2.util.geometry.GeometryUtils.Target.endCollectionItem.

Invoked after writing of a collection item. This method is invoked on the same target that was used for startCollectionItem(int, int).

Parameters
target:GeometryUtils.Target

the result of startCollectionItem(int, int)

type:int

type of collection

index:int

0-based index of this item in the collection

total:int

total number of items in the collection

Annotations
@Override
getGeometryback to summary
pack-priv org.locationtech.jts.geom.Geometry getGeometry()
initback to summary
protected void init(int srid)

Overrides org.h2.util.geometry.GeometryUtils.Target.init.

Doc from org.h2.util.geometry.GeometryUtils.Target.init.

Initializes top-level target.

Parameters
srid:int

SRID

Annotations
@Override
initCoordinatesback to summary
private void initCoordinates(int numPoints)
startCollectionback to summary
protected void startCollection(int type, int numItems)

Overrides org.h2.util.geometry.GeometryUtils.Target.startCollection.

Doc from org.h2.util.geometry.GeometryUtils.Target.startCollection.

Invoked before writing of a collection.

Parameters
type:int

type of collection, one of GeometryUtils#MULTI_POINT, GeometryUtils#MULTI_LINE_STRING, GeometryUtils#MULTI_POLYGON, GeometryUtils#GEOMETRY_COLLECTION

numItems:int

number of items in this collection

Annotations
@Override
startCollectionItemback to summary
protected GeometryUtils.Target startCollectionItem(int index, int total)

Overrides org.h2.util.geometry.GeometryUtils.Target.startCollectionItem.

Doc from org.h2.util.geometry.GeometryUtils.Target.startCollectionItem.

Invoked before writing of a collection item.

Parameters
index:int

0-based index of this item in the collection

total:int

total number of items in the collection

Returns:GeometryUtils.Target

output target that should be used for processing of this collection item. May return this target or an custom sub-target.

Annotations
@Override
startLineStringback to summary
protected void startLineString(int numPoints)

Overrides org.h2.util.geometry.GeometryUtils.Target.startLineString.

Doc from org.h2.util.geometry.GeometryUtils.Target.startLineString.

Invoked before writing a LINESTRING.

Parameters
numPoints:int

number of points in line string

Annotations
@Override
startPointback to summary
protected void startPoint()

Overrides org.h2.util.geometry.GeometryUtils.Target.startPoint.

Doc from org.h2.util.geometry.GeometryUtils.Target.startPoint.

Invoked before writing a POINT.

Annotations
@Override
startPolygonback to summary
protected void startPolygon(int numInner, int numPoints)

Overrides org.h2.util.geometry.GeometryUtils.Target.startPolygon.

Doc from org.h2.util.geometry.GeometryUtils.Target.startPolygon.

Invoked before writing a POLYGON. If polygon is empty, both parameters are 0.

Parameters
numInner:int

number of inner polygons

numPoints:int

number of points in outer polygon

Annotations
@Override
startPolygonInnerback to summary
protected void startPolygonInner(int numInner)

Overrides org.h2.util.geometry.GeometryUtils.Target.startPolygonInner.

Doc from org.h2.util.geometry.GeometryUtils.Target.startPolygonInner.

Invoked before writing an inner polygon in POLYGON.

Parameters
numInner:int

number of points in inner polygon

Annotations
@Override