|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.geometry.jts.JTS
public final class JTS
JTS Geometry utility methods, bringing Geotools to JTS.
Offers geotools based services such as reprojection.
Responsibilities:
Method Summary | |
---|---|
static void |
checkCoordinatesRange(com.vividsolutions.jts.geom.Geometry geom,
org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Checks a Geometry coordinates are within the area of validity of the specified reference system. |
static void |
copy(com.vividsolutions.jts.geom.Coordinate point,
double[] ordinates)
Copies the ordinates values from the specified JTS coordinates to the specified array. |
static Envelope2D |
getEnvelope2D(com.vividsolutions.jts.geom.Envelope envelope,
org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Converts a JTS 2D envelope in an Envelope2D for interoperability with the
referencing package. |
static double |
orthodromicDistance(com.vividsolutions.jts.geom.Coordinate p1,
com.vividsolutions.jts.geom.Coordinate p2,
org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Computes the orthodromic distance between two points. |
static com.vividsolutions.jts.geom.Geometry |
shapeToGeometry(java.awt.Shape shape,
com.vividsolutions.jts.geom.GeometryFactory factory)
Converts an arbitrary Java2D shape into a JTS geometry. |
static ReferencedEnvelope |
toEnvelope(com.vividsolutions.jts.geom.Geometry geom)
Create a ReferencedEnvelope from the provided geometry, we will do our best to guess the CoordinateReferenceSystem making use of getUserData() and getSRID() as needed. |
static com.vividsolutions.jts.geom.Envelope |
toGeographic(com.vividsolutions.jts.geom.Envelope envelope,
org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Transforms the envelope from its current crs to WGS84 coordinate reference system. |
static com.vividsolutions.jts.geom.Polygon |
toGeometry(org.opengis.geometry.BoundingBox e)
Converts a BoundingBox to a polygon. |
static com.vividsolutions.jts.geom.Polygon |
toGeometry(com.vividsolutions.jts.geom.Envelope e)
Converts an envelope to a polygon. |
static com.vividsolutions.jts.geom.Coordinate |
transform(com.vividsolutions.jts.geom.Coordinate source,
com.vividsolutions.jts.geom.Coordinate dest,
org.opengis.referencing.operation.MathTransform transform)
Transforms the coordinate using the provided math transform. |
static com.vividsolutions.jts.geom.Envelope |
transform(com.vividsolutions.jts.geom.Envelope sourceEnvelope,
com.vividsolutions.jts.geom.Envelope targetEnvelope,
org.opengis.referencing.operation.MathTransform transform,
int npoints)
Transforms the densified envelope using the specified math transform. |
static com.vividsolutions.jts.geom.Envelope |
transform(com.vividsolutions.jts.geom.Envelope envelope,
org.opengis.referencing.operation.MathTransform transform)
Transforms the envelope using the specified math transform. |
static com.vividsolutions.jts.geom.Geometry |
transform(com.vividsolutions.jts.geom.Geometry geom,
org.opengis.referencing.operation.MathTransform transform)
Transforms the geometry using the default transformer. |
static void |
xform(org.opengis.referencing.operation.MathTransform transform,
double[] src,
double[] dest)
Like a transform but eXtreme! Transforms an array of coordinates using the provided math transform. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static com.vividsolutions.jts.geom.Envelope transform(com.vividsolutions.jts.geom.Envelope envelope, org.opengis.referencing.operation.MathTransform transform) throws org.opengis.referencing.operation.TransformException
ReferencedEnvelope.transform(CoordinateReferenceSystem,
boolean)
instead.
envelope
- The envelope to transform.transform
- The transform to use.
org.opengis.referencing.operation.TransformException
- if at least one coordinate can't be transformed.public static com.vividsolutions.jts.geom.Envelope transform(com.vividsolutions.jts.geom.Envelope sourceEnvelope, com.vividsolutions.jts.geom.Envelope targetEnvelope, org.opengis.referencing.operation.MathTransform transform, int npoints) throws org.opengis.referencing.operation.TransformException
If an optional target envelope is provided, this envelope will be expanded with the transformation result. It will not be nullified before the expansion.
Note that this method can not handle the case where the envelope contains the North or
South pole, or when it cross the ±180� longitude, because math transforms do not carry suffisient informations. For a more robust envelope
transformation, use ReferencedEnvelope.transform(CoordinateReferenceSystem,
boolean, int)
instead.
sourceEnvelope
- The envelope to transform.targetEnvelope
- An envelope to expand with the transformation result, or null
for returning an new envelope.transform
- The transform to use.npoints
- Densification of each side of the rectange.
targetEnvelope
if it was non-null, or a new envelope otherwise.
In all case, the returned envelope fully contains the transformed envelope.
org.opengis.referencing.operation.TransformException
- if a coordinate can't be transformed.public static com.vividsolutions.jts.geom.Geometry transform(com.vividsolutions.jts.geom.Geometry geom, org.opengis.referencing.operation.MathTransform transform) throws org.opengis.geometry.MismatchedDimensionException, org.opengis.referencing.operation.TransformException
geom
- The geom to transformtransform
- the transform to use during the transformation.
org.opengis.geometry.MismatchedDimensionException
- if the geometry doesn't have the expected dimension
for the specified transform.
org.opengis.referencing.operation.TransformException
- if a point can't be transformed.public static com.vividsolutions.jts.geom.Coordinate transform(com.vividsolutions.jts.geom.Coordinate source, com.vividsolutions.jts.geom.Coordinate dest, org.opengis.referencing.operation.MathTransform transform) throws org.opengis.referencing.operation.TransformException
source
- the source coordinate that will be transformeddest
- the coordinate that will be set. May be null or the source coordinate
(or new coordinate of course).
org.opengis.referencing.operation.TransformException
- if the coordinate can't be transformed.public static com.vividsolutions.jts.geom.Envelope toGeographic(com.vividsolutions.jts.geom.Envelope envelope, org.opengis.referencing.crs.CoordinateReferenceSystem crs) throws org.opengis.referencing.operation.TransformException
envelope
- The envelope to transform.crs
- The CRS the envelope is currently in.
org.opengis.referencing.operation.TransformException
- If at least one coordinate can't be transformed.public static void xform(org.opengis.referencing.operation.MathTransform transform, double[] src, double[] dest) throws org.opengis.referencing.operation.TransformException
transform
- The math transform to apply.src
- The source coordinates.dest
- The destination array for transformed coordinates.
org.opengis.referencing.operation.TransformException
- if this method failed to transform any of the points.public static double orthodromicDistance(com.vividsolutions.jts.geom.Coordinate p1, com.vividsolutions.jts.geom.Coordinate p2, org.opengis.referencing.crs.CoordinateReferenceSystem crs) throws org.opengis.referencing.operation.TransformException
The real work is performed by GeodeticCalculator
. This convenience method simply
manages a pool of pre-defined geodetic calculators for the given coordinate reference system
in order to avoid repetitive object creation. If a large amount of orthodromic distances
need to be computed, direct use of GeodeticCalculator
provides better performance
than this convenience method.
p1
- First pointp2
- Second pointcrs
- Reference system the two points are in.
org.opengis.referencing.operation.TransformException
- if the coordinates can't be transformed from the specified
CRS to a geographic CRS.public static void copy(com.vividsolutions.jts.geom.Coordinate point, double[] ordinates)
NaN
.
point
- The source coordinate.ordinates
- The destination array.public static com.vividsolutions.jts.geom.Geometry shapeToGeometry(java.awt.Shape shape, com.vividsolutions.jts.geom.GeometryFactory factory)
LineString
, LinearRing
or MultiLineString
.
shape
- The Java2D shape to create.factory
- The JTS factory to use for creating geometry.
public static Envelope2D getEnvelope2D(com.vividsolutions.jts.geom.Envelope envelope, org.opengis.referencing.crs.CoordinateReferenceSystem crs) throws org.opengis.geometry.MismatchedDimensionException
Envelope2D
for interoperability with the
referencing package.
If the provided envelope is a ReferencedEnvelope
we check
that the provided CRS and the implicit CRS are similar.
envelope
- The JTS envelope to convert.crs
- The coordinate reference system for the specified envelope.
org.opengis.geometry.MismatchedDimensionException
- if a two-dimensional envelope can't be created
from an envelope with the specified CRS.public static com.vividsolutions.jts.geom.Polygon toGeometry(com.vividsolutions.jts.geom.Envelope e)
The resulting polygon contains an outer ring with verticies: (x1,y1),(x2,y1),(x2,y2),(x1,y2),(x1,y1)
envelope
- The original envelope.
public static ReferencedEnvelope toEnvelope(com.vividsolutions.jts.geom.Geometry geom)
geom
- Provided Geometry
public static com.vividsolutions.jts.geom.Polygon toGeometry(org.opengis.geometry.BoundingBox e)
BoundingBox
to a polygon.
The resulting polygon contains an outer ring with verticies: (x1,y1),(x2,y1),(x2,y2),(x1,y2),(x1,y1)
envelope
- The original envelope.
public static void checkCoordinatesRange(com.vividsolutions.jts.geom.Geometry geom, org.opengis.referencing.crs.CoordinateReferenceSystem crs) throws PointOutsideEnvelopeException
PointOutsideEnvelopeException
is thrown
geom
- the geometry to checkthe
- crs that defines the are of validity (must not be null)
PointOutsideEnvelopeException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |