Package org.apache.sis.geometry
Class SubEnvelope
java.lang.Object
org.apache.sis.io.wkt.FormattableObject
org.apache.sis.geometry.AbstractEnvelope
org.apache.sis.geometry.ArrayEnvelope
org.apache.sis.geometry.GeneralEnvelope
org.apache.sis.geometry.SubEnvelope
- All Implemented Interfaces:
Serializable
,Cloneable
,Emptiable
,org.opengis.geometry.Envelope
A view over a sub-set of the dimensions of a
GeneralEnvelope
.
This class doesn't keep any reference to the original envelope;
only the internal array is shared.- Since:
- 0.3
- Version:
- 0.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
The index of the first valid coordinate value of the lower corner in theArrayEnvelope.coordinates
array.private final int
The index after the last valid coordinate value of the lower corner in theArrayEnvelope.coordinates
array.private static final long
For cross-version compatibility.Fields inherited from class org.apache.sis.geometry.ArrayEnvelope
coordinates, crs
-
Constructor Summary
ConstructorsConstructorDescriptionSubEnvelope
(double[] coordinates, int beginIndex, int endIndex) Creates a new envelope over a portion of the given array. -
Method Summary
Modifier and TypeMethodDescription(package private) final int
Returns the index of the first valid coordinate value of the lower corner in the coordinates array.clone()
If the user wants a clone, copy only the relevant part of the coordinates array.(package private) final int
endIndex()
Returns the index after the last valid coordinate value of the lower corner in the coordinates array.boolean
Must be overridden, since the super-class method processes the full array as a whole.int
Returns the number of dimensions in the portion of the array used by thisSubEnvelope
.double
getLower
(int dimension) Must be overridden, since the super-class method does not handle the index range for performance reasons.double
getUpper
(int dimension) Must be overridden, since the super-class method does not handle the index range for performance reasons.int
hashCode()
Must be overridden, since the super-class method processes the full array as a whole.boolean
isAllNaN()
Must be overridden, since the super-class method processes the full array as a whole.void
setEnvelope
(double... corners) Must be overridden, since the super-class method processes the full array as a whole.void
setRange
(int dimension, double lower, double upper) Must be overridden, since the super-class method processes the full array as a whole.void
setToNaN()
Must be overridden, since the super-class method processes the full array as a whole.subEnvelope
(int b, int e) Must be overridden, since the super-class method does not handle the index range for performance reasons.Methods inherited from class org.apache.sis.geometry.GeneralEnvelope
add, add, addSimple, castOrCopy, horizontal, intersect, normalize, normalize, setCoordinateReferenceSystem, setEnvelope, setTimeRange, setToInfinite, simplify, translate, verifyArrayLength, wraparound
Methods inherited from class org.apache.sis.geometry.ArrayEnvelope
ensureSameDimension, equalsByAPI, getCoordinateReferenceSystem, getMaximum, getMedian, getMinimum, getSpan, hashCodeByAPI, illegalRange, 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 serialVersionUIDFor cross-version compatibility.- See Also:
-
beginIndex
private final int beginIndexThe index of the first valid coordinate value of the lower corner in theArrayEnvelope.coordinates
array.- See Also:
-
endIndex
private final int endIndexThe index after the last valid coordinate value of the lower corner in theArrayEnvelope.coordinates
array.- See Also:
-
-
Constructor Details
-
SubEnvelope
SubEnvelope(double[] coordinates, int beginIndex, int endIndex) Creates a new envelope over a portion of the given array. This constructor stores the given reference directly; it does not clone the given array. This is the desired behavior for allowing theSubEnvelope
view to be "live".- Parameters:
coordinates
- the array of coordinate values to store directly (not cloned).beginIndex
- the index of the first valid coordinate value of the lower corner in the coordinates array.endIndex
- the index after the last valid coordinate value of the lower corner in the coordinates array.
-
-
Method Details
-
beginIndex
final int beginIndex()Returns the index of the first valid coordinate value of the lower corner in the coordinates array. This information is used by super-class methods.- Overrides:
beginIndex
in classArrayEnvelope
-
endIndex
final int endIndex()Returns the index after the last valid coordinate value of the lower corner in the coordinates array. This information is used by super-class methods.- Overrides:
endIndex
in classArrayEnvelope
-
getDimension
public int getDimension()Returns the number of dimensions in the portion of the array used by thisSubEnvelope
.- Specified by:
getDimension
in interfaceorg.opengis.geometry.Envelope
- Overrides:
getDimension
in classArrayEnvelope
- Returns:
- the dimensionality of this envelope.
-
getLower
Must be overridden, since the super-class method does not handle the index range for performance reasons.- Overrides:
getLower
in classArrayEnvelope
- Parameters:
dimension
- the dimension for which to obtain the coordinate value.- Returns:
- the starting coordinate value at the given dimension.
- Throws:
IndexOutOfBoundsException
- if the given index is negative or is equal or greater than the envelope dimension.- See Also:
-
getUpper
Must be overridden, since the super-class method does not handle the index range for performance reasons.- Overrides:
getUpper
in classArrayEnvelope
- Parameters:
dimension
- the dimension for which to obtain the coordinate value.- Returns:
- the starting coordinate value at the given dimension.
- Throws:
IndexOutOfBoundsException
- if the given index is negative or is equal or greater than the envelope dimension.- See Also:
-
setRange
Must be overridden, since the super-class method processes the full array as a whole.- Overrides:
setRange
in classGeneralEnvelope
- 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.
-
setEnvelope
public void setEnvelope(double... corners) Must be overridden, since the super-class method processes the full array as a whole.- Overrides:
setEnvelope
in classGeneralEnvelope
- Parameters:
corners
- coordinates of the new lower corner followed by the new upper corner.
-
isAllNaN
public boolean isAllNaN()Must be overridden, since the super-class method processes the full array as a whole.- Overrides:
isAllNaN
in classArrayEnvelope
- Returns:
true
if this envelope has NaN values.- See Also:
-
setToNaN
public void setToNaN()Must be overridden, since the super-class method processes the full array as a whole.- Overrides:
setToNaN
in classGeneralEnvelope
- See Also:
-
hashCode
public int hashCode()Must be overridden, since the super-class method processes the full array as a whole.- Overrides:
hashCode
in classArrayEnvelope
-
equals
Must be overridden, since the super-class method processes the full array as a whole.- Overrides:
equals
in classArrayEnvelope
- Parameters:
object
- the object to compare with this envelope.- Returns:
true
if the given object is equal to this envelope.
-
subEnvelope
Must be overridden, since the super-class method does not handle the index range for performance reasons.- Overrides:
subEnvelope
in classGeneralEnvelope
- Parameters:
b
- the index of the first valid coordinate value of the corners.e
- 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
If the user wants a clone, copy only the relevant part of the coordinates array.- Overrides:
clone
in classGeneralEnvelope
- Returns:
- a clone of this envelope.
-