public class GeometryCoordinateSequenceTransformer extends Object
MathTransform to the coordinates it
contains, creating a new geometry as the transformed output.
The standard usage pattern is to supply a MathTransform and @link
CoordinateReferenceSystem} explicitly. The transform(Geometry) method can then be used
to construct transformed geometries using the GeometryFactory and CoordinateSequenceFactory of the input geometry.
| Constructor and Description |
|---|
GeometryCoordinateSequenceTransformer()
Creates a transformer which uses the
CoordinateSequenceFactory of the source
geometries. |
GeometryCoordinateSequenceTransformer(CoordinateSequenceTransformer transformer)
Creates a transformer which uses a client-specified
CoordinateSequenceTransformer. |
| Modifier and Type | Method and Description |
|---|---|
void |
setCoordinateReferenceSystem(CoordinateReferenceSystem crs)
Sets the target coordinate reference system.
|
void |
setMathTransform(MathTransform transform)
Sets the math transform to be used for transformation
|
Geometry |
transform(Geometry g)
Applies the transform to the provided geometry, creating a new transformed geometry.
|
LineString |
transformLineString(LineString ls,
GeometryFactory gf) |
Point |
transformPoint(Point point,
GeometryFactory gf) |
Polygon |
transformPolygon(Polygon polygon,
GeometryFactory gf) |
public GeometryCoordinateSequenceTransformer()
CoordinateSequenceFactory of the source
geometries.public GeometryCoordinateSequenceTransformer(CoordinateSequenceTransformer transformer)
CoordinateSequenceTransformer.
WARNING: The CoordinateSequenceTransformer must use the same CoordinateSequenceFactory as the output GeometryFactory, so that geometries are constructed
consistently.
transformer - public void setMathTransform(MathTransform transform)
transform - public void setCoordinateReferenceSystem(CoordinateReferenceSystem crs)
This value is used to set the coordinate reference system of geometries after they have been transformed.
crs - The target coordinate reference system.public Geometry transform(Geometry g)
throws TransformException
g - the geometry to transformTransformExceptionpublic LineString transformLineString(LineString ls,
GeometryFactory gf)
throws TransformException
TransformExceptionpublic Point transformPoint(Point point,
GeometryFactory gf)
throws TransformException
point - TransformExceptionpublic Polygon transformPolygon(Polygon polygon,
GeometryFactory gf)
throws TransformException
polygon - TransformExceptionCopyright © 1996–2019 Geotools. All rights reserved.