public class DefaultGeographicBoundingBox extends AbstractGeographicExtent implements GeographicBoundingBox
In addition to the standard properties, SIS provides the following methods:
setBounds(double, double, double, double)
for setting the extent from (λ,φ) values.setBounds(Envelope)
for setting the extent from the given envelope.setBounds(GeographicBoundingBox)
for setting the extent from an other bounding box.add(GeographicBoundingBox)
for expanding this extent to include an other bounding box.intersect(GeographicBoundingBox)
for the intersection between the two bounding boxes.Defined in the sis-metadata module
identifiers, LOGGER
Constructor and Description |
---|
DefaultGeographicBoundingBox()
Constructs an initially empty geographic bounding box.
|
DefaultGeographicBoundingBox(double westBoundLongitude,
double eastBoundLongitude,
double southBoundLatitude,
double northBoundLatitude)
Creates a geographic bounding box initialized to the specified values.
|
DefaultGeographicBoundingBox(GeographicBoundingBox object)
Constructs a new instance initialized with the values from the specified metadata object.
|
Modifier and Type | Method and Description |
---|---|
void |
add(GeographicBoundingBox box)
Adds a geographic bounding box to this box.
|
static DefaultGeographicBoundingBox |
castOrCopy(GeographicBoundingBox object)
Returns a SIS metadata implementation with the values of the given arbitrary implementation.
|
boolean |
equals(Object object,
ComparisonMode mode)
Compares this geographic bounding box with the specified object for equality.
|
double |
getEastBoundLongitude()
Returns the eastern-most coordinate of the limit of the dataset extent.
|
double |
getNorthBoundLatitude()
Returns the northern-most, coordinate of the limit of the dataset extent.
|
double |
getSouthBoundLatitude()
Returns the southern-most coordinate of the limit of the dataset extent.
|
double |
getWestBoundLongitude()
Returns the western-most coordinate of the limit of the dataset extent.
|
void |
intersect(GeographicBoundingBox box)
Sets this bounding box to the intersection of this box with the specified one.
|
boolean |
isEmpty()
Returns
true if this metadata is empty. |
void |
setBounds(double westBoundLongitude,
double eastBoundLongitude,
double southBoundLatitude,
double northBoundLatitude)
Sets the bounding box to the specified values.
|
void |
setBounds(Envelope envelope)
Constructs a geographic bounding box from the specified envelope.
|
void |
setBounds(GeographicBoundingBox box)
Sets the bounding box to the same values than the specified box.
|
void |
setEastBoundLongitude(double newValue)
Sets the eastern-most coordinate of the limit of the dataset extent.
|
void |
setNorthBoundLatitude(double newValue)
Sets the northern-most, coordinate of the limit of the dataset extent.
|
void |
setSouthBoundLatitude(double newValue)
Sets the southern-most coordinate of the limit of the dataset extent.
|
void |
setWestBoundLongitude(double newValue)
Sets the western-most coordinate of the limit of the dataset extent.
|
castOrCopy, getInclusion, setInclusion
getIdentifierMap, getIdentifiers, getStandard
checkWritePermission, clone, collectionType, copyCollection, copyList, copySet, freeze, isModifiable, nonNullCollection, nonNullList, nonNullSet, singleton, unmodifiable, writeCollection, writeList, writeSet
asMap, asTreeTable, equals, getInterface, hashCode, prune, toString
getInclusion
public DefaultGeographicBoundingBox()
Double.NaN
.public DefaultGeographicBoundingBox(double westBoundLongitude, double eastBoundLongitude, double southBoundLatitude, double northBoundLatitude) throws IllegalArgumentException
true
.
Caution: Arguments are expected in the same order than they appear in the ISO 19115 specification. This is different than the order commonly found in the Java2D world, which is rather (xmin, ymin, xmax, ymax).
westBoundLongitude
- The minimal λ value.eastBoundLongitude
- The maximal λ value.southBoundLatitude
- The minimal φ value.northBoundLatitude
- The maximal φ value.IllegalArgumentException
- If (west bound > east bound)
or (south bound > north bound).
Note that NaN values are allowed.setBounds(double, double, double, double)
public DefaultGeographicBoundingBox(GeographicBoundingBox object)
object
- The metadata to copy values from, or null
if none.castOrCopy(GeographicBoundingBox)
public static DefaultGeographicBoundingBox castOrCopy(GeographicBoundingBox object)
null
, then this method returns null
.DefaultGeographicBoundingBox
, then it is returned unchanged.DefaultGeographicBoundingBox
instance is created using the
copy constructor
and returned. Note that this is a shallow copy operation, since the other
metadata contained in the given object are not recursively copied.object
- The object to get as a SIS implementation, or null
if none.null
if the argument was null.@ValueRange(minimum=-180.0, maximum=180.0) public double getWestBoundLongitude()
getWestBoundLongitude
in interface GeographicBoundingBox
public void setWestBoundLongitude(double newValue)
newValue
- The western-most longitude between -180 and +180°,
or NaN to undefine.@ValueRange(minimum=-180.0, maximum=180.0) public double getEastBoundLongitude()
getEastBoundLongitude
in interface GeographicBoundingBox
public void setEastBoundLongitude(double newValue)
newValue
- The eastern-most longitude between -180 and +180°,
or NaN to undefine.@ValueRange(minimum=-90.0, maximum=90.0) public double getSouthBoundLatitude()
getSouthBoundLatitude
in interface GeographicBoundingBox
public void setSouthBoundLatitude(double newValue)
newValue
- The southern-most latitude between -90 and +90°,
or NaN to undefine.@ValueRange(minimum=-90.0, maximum=90.0) public double getNorthBoundLatitude()
getNorthBoundLatitude
in interface GeographicBoundingBox
public void setNorthBoundLatitude(double newValue)
newValue
- The northern-most latitude between -90 and +90°,
or NaN to undefine.public void setBounds(double westBoundLongitude, double eastBoundLongitude, double southBoundLatitude, double northBoundLatitude) throws IllegalArgumentException
Caution: Arguments are expected in the same order than they appear in the ISO 19115 specification. This is different than the order commonly found in the Java2D world, which is rather (xmin, ymin, xmax, ymax).
westBoundLongitude
- The minimal λ value.eastBoundLongitude
- The maximal λ value.southBoundLatitude
- The minimal φ value.northBoundLatitude
- The maximal φ value.IllegalArgumentException
- If (west bound > east bound)
or (south bound > north bound).
Note that NaN values are allowed.public void setBounds(Envelope envelope) throws TransformException
When coordinate transformation is required, the target geographic CRS is not necessarily WGS84. This method preserves the same ellipsoid than in the envelope CRS when possible. This is because geographic bounding box are only approximative and the ISO specification do not mandates a particular CRS, so we avoid transformations that are not strictly necessary.
Note: This method is available only if the referencing module is on the classpath.
envelope
- The envelope to use for setting this geographic bounding box.UnsupportedOperationException
- if the referencing module is not on the classpath.TransformException
- if the envelope can not be transformed to a geographic extent.DefaultExtent.addElements(Envelope)
,
DefaultVerticalExtent.setBounds(Envelope)
,
DefaultTemporalExtent.setBounds(Envelope)
public void setBounds(GeographicBoundingBox box)
box
- The geographic bounding box to use for setting the values of this box.public void add(GeographicBoundingBox box)
box
- The geographic bounding box to add to this box.public void intersect(GeographicBoundingBox box)
box
- The geographic bounding box to intersect with this box.public boolean isEmpty()
true
if this metadata is empty. This metadata is considered empty if
every bound values are NaN. Note that this is different than
the Java2D or envelope definition of "emptiness", since we
don't test if the area is greater than zero - this method is a metadata test, not a
geometric test.isEmpty
in class AbstractMetadata
true
if this metadata does not define any bound value.AbstractEnvelope.isAllNaN()
public boolean equals(Object object, ComparisonMode mode)
equals
in interface LenientComparable
equals
in class AbstractMetadata
object
- The object to compare for equality.mode
- The strictness level of the comparison.true
if the given object is equal to this box.Utilities.deepEquals(Object, Object, ComparisonMode)
Copyright © 2010–2013 The Apache Software Foundation. All rights reserved.