|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectStatic
Envelopes
public final class Envelopes
Utility methods for envelopes. This utility class is made up of static functions working with arbitrary implementations of GeoAPI interfaces.
CRS
| referencing/geotk-referencing (download) | View source code for this class |
| Method Summary | |
|---|---|
static Envelope |
getDomainOfValidity(CoordinateReferenceSystem crs)
Returns the domain of validity for the specified coordinate reference system, or null if unknown. |
static Envelope |
parseWKT(String wkt)
Returns an envelope from the given Well Known Text (WKT). |
static String |
toPolygonWKT(Envelope envelope)
Formats a POLYGON element from an envelope. |
static String |
toWKT(Envelope envelope)
Formats a BOX element from an envelope. |
static GeneralEnvelope |
transform(CoordinateOperation operation,
Envelope envelope)
Transforms an envelope using the given coordinate operation. |
static Rectangle2D |
transform(CoordinateOperation operation,
Rectangle2D envelope,
Rectangle2D destination)
Transforms a rectangular envelope using the given coordinate operation. |
static Envelope |
transform(Envelope envelope,
CoordinateReferenceSystem targetCRS)
Transforms the given envelope to the specified CRS. |
static Rectangle2D |
transform(MathTransform2D transform,
Rectangle2D envelope,
Rectangle2D destination)
Transforms a rectangular envelope using the given math transform. |
static GeneralEnvelope |
transform(MathTransform transform,
Envelope envelope)
Transforms an envelope using the given math transform. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static Envelope getDomainOfValidity(CoordinateReferenceSystem crs)
null if unknown. The returned envelope is expressed in terms of the
specified CRS.
This method performs the work documented in the
CRS.getEnvelope(CoordinateReferenceSystem) method.
It is defined in this class for convenience.
crs - The coordinate reference system, or null.
null if none.CRS.getEnvelope(CoordinateReferenceSystem),
GeneralEnvelope.reduceToDomain(boolean)
public static Envelope transform(Envelope envelope,
CoordinateReferenceSystem targetCRS)
throws TransformException
Performance tip
If there is many envelopes to transform with the same source and target CRS, then it
is more efficient to get the coordinate operation or
math transform once for ever and invoke one of the methods
below.
envelope - The envelope to transform (may be null).targetCRS - The target CRS (may be null).
envelope
if no transformation was required.
TransformException - If a transformation was required and failed.
public static GeneralEnvelope transform(MathTransform transform,
Envelope envelope)
throws TransformException
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 does not carry sufficient informations. For a more robust envelope
transformation, use transform(CoordinateOperation, Envelope) instead.
transform - The transform to use.envelope - Envelope to transform, or null. This envelope will not be modified.
null if envelope was null.
TransformException - if a transform failed.transform(CoordinateOperation, Envelope)
public static GeneralEnvelope transform(CoordinateOperation operation,
Envelope envelope)
throws TransformException
This method can handle the case where the envelope contains the North or South pole, or when it cross the ±180° longitude.
Note:
If the envelope CRS is non-null, then the caller should ensure that the operation
source CRS is the same than the envelope CRS. In case of mismatch, this method transforms
the envelope to the operation source CRS before to apply the operation. This extra step
may cause a lost of accuracy. In order to prevent this method from performing such
pre-transformation (if not desired), callers can ensure that the envelope CRS is
null before to call this method.
operation - The operation to use.envelope - Envelope to transform, or null. This envelope will not be modified.
null if envelope was null.
TransformException - if a transform failed.transform(MathTransform, Envelope)
public static Rectangle2D transform(MathTransform2D transform,
Rectangle2D envelope,
Rectangle2D destination)
throws TransformException
Invoking this method is equivalent to invoking the following:
Note that this method can not handle the case where the rectangle contains the North or South pole, or when it cross the ±180° longitude, because math transforms do not carry sufficient informations. For a more robust rectangle transformation, usetransform(transform, new GeneralEnvelope(envelope)).toRectangle2D()
transform(CoordinateOperation, Rectangle2D, Rectangle2D)
instead.
transform - The transform to use. Source and target dimension must be 2.envelope - The rectangle to transform (may be null).destination - The destination rectangle (may be envelope).
If null, a new rectangle will be created and returned.
destination, or a new rectangle if destination was non-null
and envelope was null.
TransformException - if a transform failed.transform(CoordinateOperation, Rectangle2D, Rectangle2D),
XAffineTransform.transform(AffineTransform, Rectangle2D, Rectangle2D)
public static Rectangle2D transform(CoordinateOperation operation,
Rectangle2D envelope,
Rectangle2D destination)
throws TransformException
Invoking this method is equivalent to invoking the following:
This method can handle the case where the rectangle contains the North or South pole, or when it cross the ±180° longitude.transform(operation, new GeneralEnvelope(envelope)).toRectangle2D()
operation - The operation to use. Source and target dimension must be 2.envelope - The rectangle to transform (may be null).destination - The destination rectangle (may be envelope).
If null, a new rectangle will be created and returned.
destination, or a new rectangle if destination was non-null
and envelope was null.
TransformException - if a transform failed.transform(MathTransform2D, Rectangle2D, Rectangle2D),
XAffineTransform.transform(AffineTransform, Rectangle2D, Rectangle2D)
public static Envelope parseWKT(String wkt)
throws FactoryException
BOX(-180 -90, 180 90)POINT(6 10)MULTIPOLYGON(((1 1, 5 1, 1 5, 1 1),(2 2, 3 2, 3 3, 2 2)))GEOMETRYCOLLECTION(POINT(4 6),LINESTRING(3 8,7 10))
See GeneralEnvelope.GeneralEnvelope(String) for more information about the
parsing rules.
wkt - The BOX, POLYGON or other kind of element to parse.
FactoryException - If the given WKT can not be parsed.CRS.parseWKT(String),
toWKT(Envelope),
CoordinateFormat,
org.geotoolkit.io.wktpublic static String toWKT(Envelope envelope)
BOX element from an envelope. This method formats the given envelope in
the Well Known Text (WKT) format. The output is like below, where n
is the number of dimensions:
The output of this method can be parsed by theBOXnD(lower corner,upper corner)
GeneralEnvelope constructor.
envelope - The envelope to format.
BOX2D or BOX3D in WKT format.parseWKT(String),
CoordinateFormat,
org.geotoolkit.io.wktpublic static String toPolygonWKT(Envelope envelope)
POLYGON element from an envelope. This method formats the given envelope
as a geometry in the Well Known Text (WKT) format. This is provided as an
alternative to the BOX element formatted by the above toWKT(Envelope)
method, because the BOX element is usually not considered a geometry while
POLYGON is.
The output of this method can be parsed
by the GeneralEnvelope constructor.
envelope - The envelope to format.
POLYGON in WKT format.org.geotoolkit.io.wkt
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||