@Deprecated public class GeneralEnvelope extends GeneralEnvelope implements Cloneable
This class is kept as a workaround for the "not yet working"
constructor in the Apache SIS class, and for some methods not yet ported to SIS (because of uncertain value).
Note that the
reorderCorners() method in Geotk has been renamed
simplify() in SIS,
reduceToDomain(false) has been renamed as
|Constructor and Description|
Constructs an empty envelope with the specified coordinate reference system.
Constructs a new envelope with the same data than the specified envelope.
Constructs a new envelope with the same data than the specified geographic bounding box.
Constructs a georeferenced envelope from a grid envelope transformed using the specified math transform.
Constructs two-dimensional envelope defined by a
|Modifier and Type||Method and Description|
Restricts this envelope to the CS or CRS domain of validity.
Fixes rounding errors up to a given tolerance level.
add, add, castOrCopy, clone, intersect, normalize, setCoordinateReferenceSystem, setEnvelope, setEnvelope, setRange, setToInfinite, setToNaN, simplify, subEnvelope
contains, contains, contains, equals, getLowerCorner, getMedian, getSpan, getUpperCorner, intersects, intersects, toSimpleEnvelopes
public GeneralEnvelope(CoordinateReferenceSystem crs)
crs- The coordinate reference system.
public GeneralEnvelope(Envelope envelope)
envelope- The envelope to copy.
public GeneralEnvelope(GeographicBoundingBox box)
box- The bounding box to copy.
public GeneralEnvelope(Rectangle2D rect)
Rectangle2D. The coordinate reference system is initially undefined.
rect- The rectangle to copy.
public GeneralEnvelope(GridEnvelope gridEnvelope, PixelInCell anchor, MathTransform gridToCRS, CoordinateReferenceSystem crs) throws IllegalArgumentException
anchorvalue. This constructor creates an envelope containing entirely all pixels on a best effort basis - usually accurate for affine transforms.
Note: The convention is specified as a
PixelInCell code instead than
the more detailed
PixelOrientation, because the later is restricted to the
two-dimensional case while the former can be used for any number of dimensions.
gridEnvelope- The grid envelope in integer coordinates.
anchor- Whatever grid coordinates map to pixel center or pixel corner.
gridToCRS- The transform (usually affine) from grid envelope to the CRS.
crs- The CRS for the envelope to be created, or
MismatchedDimensionException- If one of the supplied object doesn't have a dimension compatible with the other objects.
IllegalArgumentException- if an argument is illegal for some other raisons, including failure to use the provided math transform.
public boolean reduceToDomain(boolean useDomainOfCRS)
RangeMeaning.WRAPAROUND (typically longitudes ordinates),
then a multiple of the range (e.g. 360° for longitudes) is added or subtracted.
true, then the envelope from the previous step
is intersected with the CRS domain of validity, if any.
Spanning the anti-meridian of a Geographic CRS
Note that if the envelope is spanning the anti-meridian, then some lower ordinate values may become greater than the upper ordinate values even if it was not the case before this method call. If this is not acceptable, consider invoking
#reorderCorners() after this method call.
Choosing the range of longitude values
Geographic CRS typically have longitude values in the [-180 … +180]° range, but the [0 … 360]° range is also occasionally used. Callers need to ensure that this envelope CRS is associated to axes having the desired minimum and maximum value. The
AxisRangeType enumeration can be used
for shifting a geographic CRS to the desired range.
This method is sometime useful before to compute the union or intersection of envelopes, in order to ensure that both envelopes are defined in the same domain. This method may also be invoked before to project an envelope, since some projections produce
Double.NaN numbers when
given an ordinate value out of bounds.
trueif the envelope should be restricted to the CRS domain of validity in addition to the CS domain.
trueif this envelope has been modified as a result of this method call, or
falseif no change was done.
public void roundIfAlmostInteger(double factor, int maxULP)
ordinates[i]at dimension i, this method multiplies the ordinate value by the given factor, then round the result only if the product is close to an integer value. The threshold is defined by the
maxULPargument in ULP units (Unit in the Last Place). If and only if the product has been rounded, it is divided by the factor and stored in this envelope in place of the original ordinate.
This method is useful after envelope calculations subject to rounding errors, like the
GeneralEnvelope(GridEnvelope, PixelInCell, MathTransform, CoordinateReferenceSystem)
factor- The factor by which to multiply ordinates before rounding and divide after rounding. A recommended value is 360.
maxULP- The maximal change allowed in ULPs (Unit in the Last Place).
public Rectangle2D toRectangle2D() throws IllegalStateException
Rectangle2Dwith the minimum and maximum values of this
Envelope. This envelope must be two-dimensional before this method is invoked.
Spanning the anti-meridian of a Geographic CRS
If this envelope spans the anti-meridian, then the longitude dimension will be extended to full range of its coordinate system axis (typically [-180 … 180]°).
IllegalStateException- if this envelope is not two-dimensional.
Copyright © 2009–2014 Geotoolkit.org. All rights reserved.