Class GeneralEnvelope
- All Implemented Interfaces:
Serializable
,Cloneable
,Emptiable
,org.opengis.geometry.Envelope
- Direct Known Subclasses:
RTreeNode
,SubEnvelope
Envelope
(a minimum bounding box or rectangle) of arbitrary dimension.
Regardless of dimension, an Envelope
can be represented without ambiguity
as two direct positions (coordinate tuples).
To encode an Envelope
, it is sufficient to encode these two points.
Envelope
uses an arbitrary Coordinate Reference System, which does not need to be geographic.
This is different than the GeographicBoundingBox
class provided in the metadata package, which can be used
as a kind of envelope restricted to a Geographic CRS having Greenwich prime meridian.Envelope
is said "General" because it uses
coordinates of an arbitrary number of dimensions. This is in contrast with
Envelope2D
, which can use only two-dimensional coordinates.
A GeneralEnvelope
can be created in various ways:
- From a given number of dimension, with all coordinates initialized to 0.
- From two coordinate tuples.
- From a another envelope (copy constructor).
- From a geographic bounding box.
- From a character sequence
representing a
BBOX
or a Well Known Text (WKT) format.
Crossing the anti-meridian of a Geographic CRS
The Web Coverage Service (WCS) specification authorizes (with special treatment) cases where upper < lower at least in the longitude case. They are envelopes crossing the anti-meridian, like the red box below (the green box is the usual case). The default implementation of methods listed in the right column can handle such cases.
Envelope validation
If and only if this envelope is associated to a non-null CRS, then constructors and setter methods in this class perform the following checks:- The number of CRS dimensions must be equal to
this.ArrayEnvelope.getDimension()
. - For each dimension i,
getLower(i) > getUpper(i)
is allowed only if the coordinate system axis range meaning isWRAPAROUND
.
add(…)
, intersect(…)
, contains(…)
and similar methods.
This in contrast with the lower > upper
case, which cause the above-cited methods to behave in
an unexpected way if the axis does not have wraparound range meaning.- Since:
- 0.3
- Version:
- 1.1
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static Field
Used for setting theArrayEnvelope.coordinates
field during aclone()
operation only.private static final long
Serial number for inter-operability with different versions.Fields inherited from class org.apache.sis.geometry.ArrayEnvelope
coordinates, crs
-
Constructor Summary
ConstructorsConstructorDescriptionGeneralEnvelope
(double[] coordinates) Creates a new envelope using the given array of coordinate values.GeneralEnvelope
(double[] lowerCorner, double[] upperCorner) Constructs an envelope defined by two corners given as sequences of coordinate values.GeneralEnvelope
(int dimension) Constructs an empty envelope of the specified dimension.Constructs a new envelope initialized to the values parsed from the given string inBOX
or Well Known Text (WKT) format.GeneralEnvelope
(org.opengis.geometry.DirectPosition lowerCorner, org.opengis.geometry.DirectPosition upperCorner) Constructs an envelope defined by two corners given as direct positions.GeneralEnvelope
(org.opengis.geometry.Envelope envelope) Constructs a new envelope with the same data than the specified envelope.GeneralEnvelope
(org.opengis.metadata.extent.GeographicBoundingBox box) Constructs a new envelope with the same data than the specified geographic bounding box.GeneralEnvelope
(org.opengis.referencing.crs.CoordinateReferenceSystem crs) Constructs an empty envelope with the specified coordinate reference system. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(org.opengis.geometry.DirectPosition position) Adds a point to this envelope.void
add
(org.opengis.geometry.Envelope envelope) Adds an envelope object to this envelope.(package private) final void
addSimple
(double[] array, int offset) Adds to this envelope a point of the given array.private void
addToClosest
(int i, double value, double left, double right) Invoked when a point is added to a range crossing the anti-meridian.private boolean
apply
(WraparoundMethod method) Implementation ofsimplify()
andwraparound(WraparoundMethod)
.static GeneralEnvelope
castOrCopy
(org.opengis.geometry.Envelope envelope) Returns the given envelope as aGeneralEnvelope
instance.clone()
Returns a deep copy of this envelope.Returns a view over the two horizontal dimensions of this envelope.void
intersect
(org.opengis.geometry.Envelope envelope) Sets this envelope to the intersection of this envelope with the specified one.boolean
Ensures that the envelope is contained inside the coordinate system domain.(package private) final boolean
normalize
(org.opengis.referencing.cs.CoordinateSystem cs, int beginIndex, int count, Iterator<Integer> dimensions) Normalizes only the dimensions returned by the given iterator, or all dimensions if the iterator is null.void
setCoordinateReferenceSystem
(org.opengis.referencing.crs.CoordinateReferenceSystem crs) Sets the coordinate reference system in which the coordinate are given.void
setEnvelope
(double... corners) Sets the envelope to the specified values, which must be the lower corner coordinates followed by upper corner coordinates.void
setEnvelope
(org.opengis.geometry.Envelope envelope) Sets this envelope to the same coordinate values than the specified envelope.void
setRange
(int dimension, double lower, double upper) Sets the envelope range along the specified dimension.boolean
setTimeRange
(Instant startTime, Instant endTime) If this envelope has a temporal component, sets its temporal dimension to the given range.void
Sets the lower corner to negative infinity and the upper corner to positive infinity.void
setToNaN()
Sets all coordinate values to NaN.boolean
simplify()
Ensures that lower ≤ upper for every dimensions.subEnvelope
(int beginIndex, int endIndex) Returns a view over this envelope that encompass only some dimensions.void
translate
(double... vector) Translates the envelope by the given vector.(package private) static void
verifyArrayLength
(int dimension, double[] corners) Verifies that the given array of coordinate values has the expected length for the given number of dimensions.boolean
wraparound
(WraparoundMethod method) If this envelope is crossing the limit of a wraparound axis, modifies coordinates by application of the specified strategy.Methods inherited from class org.apache.sis.geometry.ArrayEnvelope
beginIndex, endIndex, ensureSameDimension, equals, equalsByAPI, getCoordinateReferenceSystem, getDimension, getLower, getMaximum, getMedian, getMinimum, getSpan, getUpper, hashCode, hashCodeByAPI, illegalRange, isAllNaN, isEmpty, toString, verifyRanges
Methods inherited from class org.apache.sis.geometry.AbstractEnvelope
assertEquals, contains, contains, contains, equals, fixMedian, fixSpan, formatTo, getAxis, getCommonCRS, getCycle, getLowerCorner, getMedian, getSpan, getTimeRange, getUpperCorner, hasNaN, hasNaN, intersects, intersects, isNegativeUnsafe, isWrapAround, isWrapAround, toSimpleEnvelopes, toString
Methods inherited from class org.apache.sis.io.wkt.FormattableObject
print, toString, toWKT
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerial number for inter-operability with different versions.- See Also:
-
coordinatesField
Used for setting theArrayEnvelope.coordinates
field during aclone()
operation only. Will be fetch when first needed.
-
-
Constructor Details
-
GeneralEnvelope
GeneralEnvelope(double[] coordinates) Creates a new envelope using the given array of coordinate values. This constructor stores the given reference directly; it does not clone the given array. This is the desired behavior for proper working ofSubEnvelope
.- Parameters:
coordinates
- the array of coordinate values to store directly (not cloned).
-
GeneralEnvelope
public GeneralEnvelope(org.opengis.geometry.DirectPosition lowerCorner, org.opengis.geometry.DirectPosition upperCorner) throws org.opengis.geometry.MismatchedDimensionException, MismatchedReferenceSystemException Constructs an envelope defined by two corners given as direct positions. If at least one corner is associated to a CRS, then the new envelope will also be associated to that CRS.- Parameters:
lowerCorner
- the limits in the direction of decreasing coordinate values for each dimension.upperCorner
- the limits in the direction of increasing coordinate values for each dimension.- Throws:
org.opengis.geometry.MismatchedDimensionException
- if the two positions do not have the same dimension.MismatchedReferenceSystemException
- if the CRS of the two position are not equal.
-
GeneralEnvelope
public GeneralEnvelope(double[] lowerCorner, double[] upperCorner) throws org.opengis.geometry.MismatchedDimensionException Constructs an envelope defined by two corners given as sequences of coordinate values. The Coordinate Reference System is initiallynull
.- Parameters:
lowerCorner
- the limits in the direction of decreasing coordinate values for each dimension.upperCorner
- the limits in the direction of increasing coordinate values for each dimension.- Throws:
org.opengis.geometry.MismatchedDimensionException
- if the two sequences do not have the same length.
-
GeneralEnvelope
public GeneralEnvelope(int dimension) Constructs an empty envelope of the specified dimension. All coordinates are initialized to 0 and the coordinate reference system is undefined.- Parameters:
dimension
- the envelope dimension.
-
GeneralEnvelope
public GeneralEnvelope(org.opengis.referencing.crs.CoordinateReferenceSystem crs) Constructs an empty envelope with the specified coordinate reference system. All coordinate values are initialized to 0.- Parameters:
crs
- the coordinate reference system.
-
GeneralEnvelope
public GeneralEnvelope(org.opengis.geometry.Envelope envelope) Constructs a new envelope with the same data than the specified envelope.- Parameters:
envelope
- the envelope to copy.- See Also:
-
GeneralEnvelope
public GeneralEnvelope(org.opengis.metadata.extent.GeographicBoundingBox box) Constructs a new envelope with the same data than the specified geographic bounding box. The coordinate reference system is set to the default geographic CRS. Axis order is (longitude, latitude).- Parameters:
box
- the bounding box to copy.
-
GeneralEnvelope
Constructs a new envelope initialized to the values parsed from the given string inBOX
or Well Known Text (WKT) format. The given string is typically aBOX
element like below: However, this constructor is lenient to other geometry types likePOLYGON
. Actually this constructor ignores the geometry type and just applies the following simple rules:- Character sequences complying to the rules of Java identifiers are skipped.
- Coordinates are separated by a coma (
,
) character. - The coordinates in a coordinate tuple are separated by a space.
- Coordinate numbers are assumed formatted in US locale.
- The coordinate having the highest dimension determines the dimension of this envelope.
LINESTRING
have the same dimension. However, this constructor ensures that the parenthesis are balanced, in order to catch some malformed WKT.Example: The following texts can be parsed by this constructor in addition of the usualBOX
element. This constructor creates the bounding box of those geometries: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))
- Parameters:
wkt
- theBOX
,POLYGON
or other kind of element to parse.- Throws:
IllegalArgumentException
- if the given string cannot be parsed.- See Also:
-
-
Method Details
-
castOrCopy
Returns the given envelope as aGeneralEnvelope
instance. If the given envelope is already an instance ofGeneralEnvelope
, then it is returned unchanged. Otherwise the coordinate values and the CRS of the given envelope are copied in a newGeneralEnvelope
.- Parameters:
envelope
- the envelope to cast, ornull
.- Returns:
- the values of the given envelope as a
GeneralEnvelope
instance. - See Also:
-
setCoordinateReferenceSystem
public void setCoordinateReferenceSystem(org.opengis.referencing.crs.CoordinateReferenceSystem crs) throws org.opengis.geometry.MismatchedDimensionException Sets the coordinate reference system in which the coordinate are given. This method does not reproject the envelope, and does not check if the envelope is contained in the new domain of validity.If the envelope coordinates need to be transformed to the new CRS, consider using
Envelopes.transform(Envelope, CoordinateReferenceSystem)
instead.- Parameters:
crs
- the new coordinate reference system, ornull
.- Throws:
org.opengis.geometry.MismatchedDimensionException
- if the specified CRS doesn't have the expected number of dimensions.IllegalStateException
- if a range of coordinate values in this envelope is compatible with the given CRS. See Envelope validation in class javadoc for more details.
-
setRange
Sets the envelope range along the specified dimension.- Overrides:
setRange
in classAbstractEnvelope
- Parameters:
dimension
- the dimension to set.lower
- the limit in the direction of decreasing coordinate values.upper
- the limit in the direction of increasing coordinate values.- Throws:
IndexOutOfBoundsException
- if the given index is out of bounds.IllegalArgumentException
- iflower > upper
and the axis range meaning at the given dimension is not "wraparound". See Envelope validation in class javadoc for more details.
-
setEnvelope
public void setEnvelope(double... corners) Sets the envelope to the specified values, which must be the lower corner coordinates followed by upper corner coordinates. The number of arguments provided shall be twice this envelope dimension, and minimum shall not be greater than maximum.Example: (xmin, ymin, zmin, xmax, ymax, zmax)- Parameters:
corners
- coordinates of the new lower corner followed by the new upper corner.
-
verifyArrayLength
static void verifyArrayLength(int dimension, double[] corners) Verifies that the given array of coordinate values has the expected length for the given number of dimensions.- Parameters:
dimension
- the dimension of the envelope.corners
- the user-provided array of coordinate values.
-
setEnvelope
public void setEnvelope(org.opengis.geometry.Envelope envelope) throws org.opengis.geometry.MismatchedDimensionException Sets this envelope to the same coordinate values than the specified envelope. If the given envelope has a non-null Coordinate Reference System (CRS), then the CRS of this envelope will be set to the CRS of the given envelope.- Parameters:
envelope
- the envelope to copy coordinates from.- Throws:
org.opengis.geometry.MismatchedDimensionException
- if the specified envelope does not have the expected number of dimensions.
-
setToInfinite
public void setToInfinite()Sets the lower corner to negative infinity and the upper corner to positive infinity. The coordinate reference system (if any) stay unchanged. -
setToNaN
public void setToNaN()Sets all coordinate values to NaN. The coordinate reference system (if any) stay unchanged.- See Also:
-
setTimeRange
If this envelope has a temporal component, sets its temporal dimension to the given range. Otherwise this method does nothing. This convenience method converts the given instants to floating point values usingDefaultTemporalCRS
, then delegates tosetRange(int, double, double)
.Null value means no time limit. More specifically null
startTime
is mapped to −∞ and nullendTime
is mapped to +∞. This rule makes easy to create is before or is after temporal filters, which can be combined with other envelopes using intersection for logical AND, or union for logical OR operations.- Parameters:
startTime
- the lower temporal value, ornull
if unbounded.endTime
- the upper temporal value, ornull
if unbounded.- Returns:
- whether the temporal component has been set, or
false
if no temporal dimension has been found in this envelope. - Since:
- 1.0
- See Also:
-
translate
public void translate(double... vector) Translates the envelope by the given vector. For every dimension i, the lower and upper values are increased byvector[i]
.This method does not check if the translation result is inside the coordinate system domain (e.g. [-180 … +180]° of longitude). Callers can normalize the envelope when desired by call to the
normalize()
method.- Parameters:
vector
- the translation vector. The length of this array shall be equal to this envelope dimension.- Since:
- 0.5
-
addSimple
final void addSimple(double[] array, int offset) Adds to this envelope a point of the given array. This method does not check for anti-meridian crossing. It is invoked only by theEnvelopes
transform methods, which build "normal" envelopes.- Parameters:
array
- the array which contains the coordinate values.offset
- index of the first valid coordinate value in the given array.
-
add
public void add(org.opengis.geometry.DirectPosition position) throws org.opengis.geometry.MismatchedDimensionException Adds a point to this envelope. The resulting envelope is the smallest envelope that contains both the original envelope and the specified point.After adding a point, a call to
contains(DirectPosition)
with the added point as an argument will returntrue
, except if one of the point coordinates wasDouble.NaN
in which case the corresponding coordinate has been ignored.Pre-conditions
This method assumes that the specified point uses a CRS equivalent to this envelope CRS. For performance reasons, it will no be verified unless Java assertions are enabled.Crossing the anti-meridian of a Geographic CRS
This method supports envelopes crossing the anti-meridian. In such cases it is possible to move both envelope borders in order to encompass the given point, as illustrated below (the new point is represented by the+
symbol): The default implementation moves only the border which is closest to the given point.- Parameters:
position
- the point to add.- Throws:
org.opengis.geometry.MismatchedDimensionException
- if the given point does not have the expected number of dimensions.AssertionError
- if assertions are enabled and the envelopes have mismatched CRS.
-
addToClosest
private void addToClosest(int i, double value, double left, double right) Invoked when a point is added to a range crossing the anti-meridian. In the example below, the new point is represented by the+
symbol. The point is added only on the closest side.- Parameters:
i
- the dimension of the coordinatevalue
- the coordinate value to add to this envelope.left
- the border on the left side, which is the max value (yes, this is confusing!)right
- the border on the right side, which is the min value (yes, this is confusing!)
-
add
public void add(org.opengis.geometry.Envelope envelope) throws org.opengis.geometry.MismatchedDimensionException Adds an envelope object to this envelope. The resulting envelope is the union of the twoEnvelope
objects.Pre-conditions
This method assumes that the specified envelope uses a CRS equivalent to this envelope CRS. For performance reasons, it will no be verified unless Java assertions are enabled.Crossing the anti-meridian of a Geographic CRS
This method supports envelopes crossing the anti-meridian. If one or both envelopes cross the anti-meridian, then the result of theadd
operation may be an envelope expanding to infinities. In such case, the coordinate range will be either [−∞…∞] or [0…−0] depending on whatever the original range crosses the anti-meridian or not.Handling of NaN values
Double.NaN
values may be present in any dimension, in the lower coordinate, upper coordinate or both. The behavior of this method in such case depends where theNaN
values appear and whether an envelope spans the anti-meridian:- If this envelope or the given envelope spans anti-meridian in the dimension containing
NaN
coordinates, then this method does not changes the coordinates in that dimension. The rational for such conservative approach is because union computation depends on whether the other envelope spans anti-meridian too, which is unknown because at least one envelope bounds isNaN
. Since anti-meridian crossing has been detected in an envelope, there is suspicion about whether the other envelope could cross anti-meridian too. - Otherwise since the envelope containing real values does not cross anti-meridian in that dimension,
this method assumes that the envelope containing
NaN
values does not cross anti-meridian neither. This assumption is not guaranteed to be true, but cover common cases. With this assumption in mind:- All
NaN
coordinates in the given envelope are ignored, i.e. this method does not replace finite coordinates in this envelope byNaN
values from the given envelope. Note that if only the lower or upper bound isNaN
, the other bound will still be used for computing union with the assumption described in above paragraph. - All
NaN
coordinates in this envelope are left unchanged, i.e. the union will still contain all theNaN
values that this envelope had beforeadd(Envelope)
invocation. Note that if only the lower or upper bound isNaN
, the other bound will still be used for computing union with the assumption described in above paragraph.
- All
- Parameters:
envelope
- theEnvelope
to add to this envelope.- Throws:
org.opengis.geometry.MismatchedDimensionException
- if the given envelope does not have the expected number of dimensions.AssertionError
- if assertions are enabled and the envelopes have mismatched CRS.- See Also:
- If this envelope or the given envelope spans anti-meridian in the dimension containing
-
intersect
public void intersect(org.opengis.geometry.Envelope envelope) throws org.opengis.geometry.MismatchedDimensionException Sets this envelope to the intersection of this envelope with the specified one.Pre-conditions
This method assumes that the specified envelope uses a CRS equivalent to this envelope CRS. For performance reasons, it will no be verified unless Java assertions are enabled.Crossing the anti-meridian of a Geographic CRS
This method supports envelopes crossing the anti-meridian.Handling of NaN values
Double.NaN
values may be present in any dimension, in the lower coordinate, upper coordinate or both. The behavior of this method in such case depends where theNaN
values appear and whether an envelope spans the anti-meridian:- If this envelope or the given envelope spans anti-meridian in the dimension containing
NaN
coordinates, then this method does not changes the coordinates in that dimension. The rational for such conservative approach is because intersection computation depends on whether the other envelope spans anti-meridian too, which is unknown because at least one envelope bounds isNaN
. Since anti-meridian crossing has been detected in an envelope, there is suspicion about whether the other envelope could cross anti-meridian too. - Otherwise since the envelope containing real values does not cross anti-meridian in that dimension,
this method assumes that the envelope containing
NaN
values does not cross anti-meridian neither. This assumption is not guaranteed to be true, but cover common cases. With this assumption in mind:- All
NaN
coordinates in the given envelope are ignored, i.e. this method does not replace finite coordinates in this envelope byNaN
values from the given envelope. Note that if only the lower or upper bound isNaN
, the other bound will still be used for computing intersection with the assumption described in above paragraph. - All
NaN
coordinates in this envelope are left unchanged, i.e. the intersection will still contain all theNaN
values that this envelope had beforeintersect(Envelope)
invocation. Note that if only the lower or upper bound isNaN
, the other bound will still be used for computing intersection with the assumption described in above paragraph.
- All
Double.NaN
coordinates may appear as a result of intersection, even if such values were not present in any source envelopes, if the two envelopes do not intersect in some dimensions.- Parameters:
envelope
- theEnvelope
to intersect to this envelope.- Throws:
org.opengis.geometry.MismatchedDimensionException
- if the given envelope does not have the expected number of dimensions.AssertionError
- if assertions are enabled and the envelopes have mismatched CRS.- See Also:
- If this envelope or the given envelope spans anti-meridian in the dimension containing
-
normalize
public boolean normalize()Ensures that the envelope is contained inside the coordinate system domain. For each dimension, this method compares the coordinate values against the limits of the coordinate system axis for that dimension. If some coordinates are out of range, then there is a choice depending on the axis range meaning:- If
RangeMeaning.EXACT
(typically latitudes coordinates), then values greater than the axis maximal value are replaced by the axis maximum, and values smaller than the axis minimal value are replaced by the axis minimum. - If
RangeMeaning.WRAPAROUND
(typically longitudes coordinates), then a multiple of the axis range (e.g. 360° for longitudes) is added or subtracted. Example:- the [190 … 200]° longitude range is converted to [-170 … -160]°,
- the [170 … 200]° longitude range is converted to [+170 … -160]°.
Crossing the anti-meridian of a Geographic CRS
If the envelope is crossing the anti-meridian, then some lower coordinate values may become greater than their upper counterpart as a result of this method call. If such effect is undesirable, then this method may be combined withsimplify()
as below: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.Usage
This method is sometimes 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 produceDouble.NaN
numbers when given an coordinate value out of bounds.- Returns:
true
if this envelope has been modified as a result of this method call, orfalse
if no change has been done.- See Also:
- If
-
normalize
final boolean normalize(org.opengis.referencing.cs.CoordinateSystem cs, int beginIndex, int count, Iterator<Integer> dimensions) Normalizes only the dimensions returned by the given iterator, or all dimensions if the iterator is null. This is used for normalizing the result of a coordinate operation where a wrap around axis does not necessarily means that the coordinates need to be normalized along that axis.- Parameters:
cs
- the coordinate system of this envelope CRS (as an argument because sometimes already known).beginIndex
- index of the first coordinate value inArrayEnvelope.coordinates
array. Non-zero for sub-envelopes.count
- number of coordinates, i.e. this envelope dimensions.dimensions
- the dimensions to check for normalization, ornull
for all dimensions.- Returns:
true
if this envelope has been modified as a result of this method call.
-
simplify
Ensures that lower ≤ upper for every dimensions. If a upper coordinate value is less than a lower coordinate value, then there is a choice:- If the axis has
RangeMeaning.WRAPAROUND
, then:- the lower coordinate value is set to the axis minimum value, and
- the upper coordinate value is set to the axis maximum value.
- Otherwise an
IllegalStateException
is thrown.
- Returns:
true
if this envelope has been modified as a result of this method call, orfalse
if no change has been done.- Throws:
IllegalStateException
- if a upper coordinate value is less than a lower coordinate value on an axis which does not have theWRAPAROUND
range meaning.- See Also:
- If the axis has
-
wraparound
If this envelope is crossing the limit of a wraparound axis, modifies coordinates by application of the specified strategy. This applies typically to longitude values crossing the anti-meridian, but other kinds of wraparound axes may also exist. Possible values are listed below.Legal argument values Value Action WraparoundMethod.NONE
:Do nothing and return false
.WraparoundMethod.NORMALIZE
:Delegate to normalize()
.WraparoundMethod.EXPAND
:Equivalent to simplify()
.WraparoundMethod.CONTIGUOUS
:See enumeration javadoc. WraparoundMethod.CONTIGUOUS_LOWER
:See enumeration javadoc. WraparoundMethod.CONTIGUOUS_UPPER
:See enumeration javadoc. WraparoundMethod.SPLIT
:Throw IllegalArgumentException
.- Parameters:
method
- the strategy to use for representing a region crossing the anti-meridian or other wraparound limit.- Returns:
true
if this envelope has been modified as a result of this method call, orfalse
if no change has been done.- Throws:
IllegalStateException
- if a upper coordinate value is less than a lower coordinate value on an axis which does not have theWRAPAROUND
range meaning.- Since:
- 1.1
-
apply
Implementation ofsimplify()
andwraparound(WraparoundMethod)
. Argument can be onlyWraparoundMethod.EXPAND
orCONTIGUOUS*
.- Throws:
IllegalStateException
-
horizontal
Returns a view over the two horizontal dimensions of this envelope. The horizontal dimensions are inferred from the CRS. If this method cannot infer the horizontal dimensions, then anIllegalStateException
is thrown.The returned envelope is a view: changes in the returned envelope are reflected in this envelope, and conversely. The returned envelope will have its CRS defined.
- Returns:
- a view over the horizontal components of this envelope. May be
this
. - Throws:
IllegalStateException
- if this method cannot infer the horizontal components of this envelope.- Since:
- 1.1
- See Also:
-
subEnvelope
Returns a view over this envelope that encompass only some dimensions. The returned object is "live": changes applied on the original envelope is reflected in the sub-envelope view, and conversely.This method is useful for querying and updating only some dimensions. For example, in order to expand only the horizontal component of a four dimensional (x,y,z,t) envelope, one can use:
If the sub-envelope needs to be independent from the original envelope, use the following idiom: The sub-envelope is initialized with anull
CRS. This method does not compute a sub-CRS because it may not be needed, or the sub-CRS may be already known by the caller.- Parameters:
beginIndex
- the index of the first valid coordinate value of the corners.endIndex
- the index after the last valid coordinate value of the corners.- Returns:
- the sub-envelope of dimension
endIndex - beginIndex
. - Throws:
IndexOutOfBoundsException
- if an index is out of bounds.- See Also:
-
clone
Returns a deep copy of this envelope.
-