public final class Extents extends Static
Extent
objects.
This class provides methods for:
getGeographicBoundingBox(Extent)
, getVerticalRange(Extent)
and getDate(Extent, double)
for fetching geographic or temporal components in a convenient form.Envelopes
Defined in the sis-metadata
module
Modifier and Type | Field and Description |
---|---|
static Extent |
WORLD
A geographic extent ranging from 180°W to 180°E and 90°S to 90°N.
|
Modifier and Type | Method and Description |
---|---|
static double |
area(GeographicBoundingBox box)
Returns an estimation of the area (in square metres) of the given bounding box.
|
static Date |
getDate(Extent extent,
double location)
Returns an instant in the temporal elements of the given extent,
or
null if none. |
static GeographicBoundingBox |
getGeographicBoundingBox(Extent extent)
Returns a single geographic bounding box from the specified extent.
|
static Range<Date> |
getTimeRange(Extent extent)
Returns the union of all time ranges found in the given extent, or
null if none. |
static MeasurementRange<Double> |
getVerticalRange(Extent extent)
Returns the union of all vertical ranges found in the given extent, or
null if none. |
static GeographicBoundingBox |
intersection(GeographicBoundingBox b1,
GeographicBoundingBox b2)
Returns the intersection of the given geographic bounding boxes.
|
public static final Extent WORLD
public static GeographicBoundingBox getGeographicBoundingBox(Extent extent)
null
.
If a single bounding box is found, then that box is returned directly.
If more than one box is found, then all those boxes are
added together.extent
- The extent to convert to a geographic bounding box, or null
.null
in none.public static MeasurementRange<Double> getVerticalRange(Extent extent)
null
if none.
Depths have negative height values: if the axis direction
is toward down, then this method reverses the sign of minimum and maximum values.
Extent
object contains more than one vertical extent, then this method
performs the following choices:
Extent
could contain two vertical elements: one with the height measurements in hPa,
and the other element with heights transformed to metres using an empirical formula.
In such case this method will select the first vertical element on the assumption that it is
the "main" one that the metadata producer intended to show. Next, this method will search for
other vertical elements using pressure unit. In our example there is none, but if such elements
were found, this method would compute their union.extent
- The extent to convert to a vertical measurement range, or null
.null
if none.public static Range<Date> getTimeRange(Extent extent)
null
if none.extent
- The extent to convert to a time range, or null
.null
if none.public static Date getDate(Extent extent, double location)
null
if none. First, this method computes the union of all temporal elements. Then this method
computes the linear interpolation between the start and end time as in the following pseudo-code:
Special cases:return new Date(startTime + (endTime - startTime) * location);
location
is 0, then this method returns the start time.location
is 1, then this method returns the end time.location
is 0.5, then this method returns the average of start time and end time.location
is outside the [0 … 1] range, then the result will be outside the temporal extent.extent
- The extent from which to get an instant, or null
.location
- 0 for the start time, 1 for the end time, 0.5 for the average time, or the
coefficient (usually in the [0 … 1] range) for interpolating an instant.null
if none.public static GeographicBoundingBox intersection(GeographicBoundingBox b1, GeographicBoundingBox b2)
null
,
then this method returns the other argument (which may be null). Otherwise this method returns a box which
is the intersection of the two given boxes.
This method never modify the given boxes, but may return directly one of the given arguments if it already represents the intersection result.
b1
- The first bounding box, or null
.b2
- The second bounding box, or null
.b1
or b2
argument if unchanged),
or null
if the two given boxes are null.IllegalArgumentException
- If the inclusion status
is not the same for both boxes.DefaultGeographicBoundingBox.intersect(GeographicBoundingBox)
public static double area(GeographicBoundingBox box)
GeographicBoundingBox
provides only approximative information (for example
it does not specify the datum), the value returned by this method is also approximative.
The current implementation performs its computation on the GRS 1980 Authalic Sphere. However this may change in any future SIS version.
box
- The geographic bounding box for which to compute the area, or null
.Copyright © 2010–2015 The Apache Software Foundation. All rights reserved.