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 intThe index of the first valid coordinate value of the lower corner in theArrayEnvelope.coordinatesarray.private final intThe index after the last valid coordinate value of the lower corner in theArrayEnvelope.coordinatesarray.private static final longFor 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 intReturns 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 intendIndex()Returns the index after the last valid coordinate value of the lower corner in the coordinates array.booleanMust be overridden, since the super-class method processes the full array as a whole.intReturns the number of dimensions in the portion of the array used by thisSubEnvelope.doublegetLower(int dimension) Must be overridden, since the super-class method does not handle the index range for performance reasons.doublegetUpper(int dimension) Must be overridden, since the super-class method does not handle the index range for performance reasons.inthashCode()Must be overridden, since the super-class method processes the full array as a whole.booleanisAllNaN()Must be overridden, since the super-class method processes the full array as a whole.voidsetEnvelope(double... corners) Must be overridden, since the super-class method processes the full array as a whole.voidsetRange(int dimension, double lower, double upper) Must be overridden, since the super-class method processes the full array as a whole.voidsetToNaN()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, wraparoundMethods inherited from class org.apache.sis.geometry.ArrayEnvelope
ensureSameDimension, equalsByAPI, getCoordinateReferenceSystem, getMaximum, getMedian, getMinimum, getSpan, hashCodeByAPI, illegalRange, isEmpty, toString, verifyRangesMethods 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, toStringMethods 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.coordinatesarray.- See Also:
-
endIndex
private final int endIndexThe index after the last valid coordinate value of the lower corner in theArrayEnvelope.coordinatesarray.- 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 theSubEnvelopeview 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:
beginIndexin 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:
endIndexin classArrayEnvelope
-
getDimension
public int getDimension()Returns the number of dimensions in the portion of the array used by thisSubEnvelope.- Specified by:
getDimensionin interfaceorg.opengis.geometry.Envelope- Overrides:
getDimensionin 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:
getLowerin 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:
getUpperin 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:
setRangein 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:
setEnvelopein 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:
isAllNaNin classArrayEnvelope- Returns:
trueif 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:
setToNaNin classGeneralEnvelope- See Also:
-
hashCode
public int hashCode()Must be overridden, since the super-class method processes the full array as a whole.- Overrides:
hashCodein classArrayEnvelope
-
equals
Must be overridden, since the super-class method processes the full array as a whole.- Overrides:
equalsin classArrayEnvelope- Parameters:
object- the object to compare with this envelope.- Returns:
trueif 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:
subEnvelopein 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:
clonein classGeneralEnvelope- Returns:
- a clone of this envelope.
-