Package org.h2.util.geometry
Class JTSUtils.GeometryTarget
java.lang.Object
org.h2.util.geometry.GeometryUtils.Target
org.h2.util.geometry.JTSUtils.GeometryTarget
- Enclosing class:
JTSUtils
Converter output target that creates a JTS Geometry.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate 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
ConstructorsModifierConstructorDescriptionGeometryTarget
(int dimensionSystem) Creates a new instance of JTS Geometry target.private
GeometryTarget
(int dimensionSystem, org.locationtech.jts.geom.GeometryFactory factory) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addCoordinate
(double x, double y, double z, double m, int index, int total) 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, int index, int total) Invoked after writing of a collection item.(package private) org.locationtech.jts.geom.Geometry
protected void
init
(int srid) Initializes top-level target.private void
initCoordinates
(int numPoints) protected void
startCollection
(int type, int numItems) Invoked before writing of a collection.protected GeometryUtils.Target
startCollectionItem
(int index, int total) Invoked before writing of a collection item.protected void
startLineString
(int numPoints) Invoked before writing a LINESTRING.protected void
Invoked before writing a POINT.protected void
startPolygon
(int numInner, int numPoints) Invoked before writing a POLYGON.protected void
startPolygonInner
(int numInner) Invoked before writing an inner polygon in POLYGON.Methods inherited from class org.h2.util.geometry.GeometryUtils.Target
dimensionSystem, endNonEmptyPolygon, endObject
-
Field Details
-
dimensionSystem
private final int dimensionSystem -
factory
private org.locationtech.jts.geom.GeometryFactory factory -
type
private int type -
coordinates
private org.locationtech.jts.geom.CoordinateSequence coordinates -
innerCoordinates
private org.locationtech.jts.geom.CoordinateSequence[] innerCoordinates -
innerOffset
private int innerOffset -
subgeometries
private org.locationtech.jts.geom.Geometry[] subgeometries
-
-
Constructor Details
-
GeometryTarget
public GeometryTarget(int dimensionSystem) Creates a new instance of JTS Geometry target.- Parameters:
dimensionSystem
- dimension system to use
-
GeometryTarget
private GeometryTarget(int dimensionSystem, org.locationtech.jts.geom.GeometryFactory factory)
-
-
Method Details
-
init
protected void init(int srid) Description copied from class:GeometryUtils.Target
Initializes top-level target.- Overrides:
init
in classGeometryUtils.Target
- Parameters:
srid
- SRID
-
startPoint
protected void startPoint()Description copied from class:GeometryUtils.Target
Invoked before writing a POINT.- Overrides:
startPoint
in classGeometryUtils.Target
-
startLineString
protected void startLineString(int numPoints) Description copied from class:GeometryUtils.Target
Invoked before writing a LINESTRING.- Overrides:
startLineString
in classGeometryUtils.Target
- Parameters:
numPoints
- number of points in line string
-
startPolygon
protected void startPolygon(int numInner, int numPoints) Description copied from class:GeometryUtils.Target
Invoked before writing a POLYGON. If polygon is empty, both parameters are 0.- Overrides:
startPolygon
in classGeometryUtils.Target
- Parameters:
numInner
- number of inner polygonsnumPoints
- number of points in outer polygon
-
startPolygonInner
protected void startPolygonInner(int numInner) Description copied from class:GeometryUtils.Target
Invoked before writing an inner polygon in POLYGON.- Overrides:
startPolygonInner
in classGeometryUtils.Target
- Parameters:
numInner
- number of points in inner polygon
-
startCollection
protected void startCollection(int type, int numItems) Description copied from class:GeometryUtils.Target
Invoked before writing of a collection.- Overrides:
startCollection
in classGeometryUtils.Target
- Parameters:
type
- type of collection, one ofGeometryUtils.MULTI_POINT
,GeometryUtils.MULTI_LINE_STRING
,GeometryUtils.MULTI_POLYGON
,GeometryUtils.GEOMETRY_COLLECTION
numItems
- number of items in this collection
-
startCollectionItem
Description copied from class:GeometryUtils.Target
Invoked before writing of a collection item.- Overrides:
startCollectionItem
in classGeometryUtils.Target
- Parameters:
index
- 0-based index of this item in the collectiontotal
- total number of items in the collection- Returns:
- output target that should be used for processing of this collection item. May return this target or an custom sub-target.
-
endCollectionItem
Description copied from class:GeometryUtils.Target
Invoked after writing of a collection item. This method is invoked on the same target that was used forGeometryUtils.Target.startCollectionItem(int, int)
.- Overrides:
endCollectionItem
in classGeometryUtils.Target
- Parameters:
target
- the result ofGeometryUtils.Target.startCollectionItem(int, int)
type
- type of collectionindex
- 0-based index of this item in the collectiontotal
- total number of items in the collection
-
initCoordinates
private void initCoordinates(int numPoints) -
createCoordinates
private org.locationtech.jts.geom.CoordinateSequence createCoordinates(int numPoints) -
addCoordinate
protected void addCoordinate(double x, double y, double z, double m, int index, int total) Description copied from class:GeometryUtils.Target
Invoked to add a coordinate to a geometry.- Specified by:
addCoordinate
in classGeometryUtils.Target
- Parameters:
x
- X coordinatey
- Y coordinatez
- Z coordinate (NaN if not used)m
- M coordinate (NaN if not used)index
- 0-based index of coordinate in the current sequencetotal
- total number of coordinates in the current sequence
-
getGeometry
org.locationtech.jts.geom.Geometry getGeometry()
-