Class DefaultVerticalExtent
java.lang.Object
org.apache.sis.metadata.AbstractMetadata
org.apache.sis.metadata.ModifiableMetadata
org.apache.sis.metadata.iso.ISOMetadata
org.apache.sis.metadata.iso.extent.DefaultVerticalExtent
- All Implemented Interfaces:
Serializable,Emptiable,LenientComparable,IdentifiedObject,org.opengis.metadata.extent.VerticalExtent
public class DefaultVerticalExtent
extends ISOMetadata
implements org.opengis.metadata.extent.VerticalExtent
Vertical domain of dataset.
The following properties are mandatory in a well-formed metadata according ISO 19115:
In addition to the standard properties, SIS provides the following methods:
EX_VerticalExtent
├─minimumValue…… The lowest vertical extent contained in the dataset.
├─maximumValue…… The highest vertical extent contained in the dataset.
└─verticalCRS……… Information about the vertical coordinate reference system to which the maximum and minimum elevation values are measured. The CRS identification includes unit of measure.setBounds(Envelope)for setting the extent from the given envelope.
Limitations
- Instances of this class are not synchronized for multi-threading. Synchronization, if needed, is caller's responsibility.
- Serialized objects of this class are not guaranteed to be compatible with future Apache SIS releases.
Serialization support is appropriate for short term storage or RMI between applications running the
same version of Apache SIS. For long term storage, use
XMLinstead. - Coordinate Reference System cannot be specified by identifier only; they have to be specified in full. See SIS-397.
- Since:
- 0.3
- Version:
- 1.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.sis.metadata.ModifiableMetadata
ModifiableMetadata.State -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate DoubleThe highest vertical extent contained in the dataset.private DoubleThe lowest vertical extent contained in the dataset.private static final longSerial number for inter-operability with different versions.private org.opengis.referencing.crs.VerticalCRSProvides information about the vertical coordinate reference system to which the maximum and minimum elevation values are measured.Fields inherited from class org.apache.sis.metadata.iso.ISOMetadata
identifiers -
Constructor Summary
ConstructorsConstructorDescriptionConstructs an initially empty vertical extent.DefaultVerticalExtent(double minimumValue, double maximumValue, org.opengis.referencing.crs.VerticalCRS verticalCRS) Creates a vertical extent initialized to the specified values.DefaultVerticalExtent(org.opengis.metadata.extent.VerticalExtent object) Constructs a new instance initialized with the values from the specified metadata object. -
Method Summary
Modifier and TypeMethodDescriptionstatic DefaultVerticalExtentcastOrCopy(org.opengis.metadata.extent.VerticalExtent object) Returns a SIS metadata implementation with the values of the given arbitrary implementation.private static DoubleConverts the given value with the given transform if non-null.private org.opengis.referencing.operation.MathTransform1DgetConversionFrom(org.opengis.referencing.crs.VerticalCRS source) Returns the conversion from the given CRS to the CRS of this extent, ornullif none or unknown.Returns the highest vertical extent contained in the dataset.Returns the lowest vertical extent contained in the dataset.org.opengis.referencing.crs.VerticalCRSProvides information about the vertical coordinate reference system to which the maximum and minimum elevation values are measured.voidintersect(org.opengis.metadata.extent.VerticalExtent other) Sets this vertical extent to the intersection of this extent with the specified one.private static booleanisReversing(org.opengis.referencing.operation.MathTransform1D cv, Double sample, Double other) Returnstrueif the given conversion seems to change the axis direction.voidsetBounds(org.opengis.geometry.Envelope envelope) Sets this vertical extent to values inferred from the specified envelope.voidsetMaximumValue(Double newValue) Sets the highest vertical extent contained in the dataset.voidsetMinimumValue(Double newValue) Sets the lowest vertical extent contained in the dataset.voidsetVerticalCRS(org.opengis.referencing.crs.VerticalCRS newValue) Sets the information about the vertical coordinate reference system to which the maximum and minimum elevation values are measured.private Doublevalue()Returns an arbitrary value, ornullif both minimum and maximum are null.Methods inherited from class org.apache.sis.metadata.iso.ISOMetadata
getIdentifier, getIdentifierMap, getIdentifiers, getStandard, setIdentifier, transitionToMethods inherited from class org.apache.sis.metadata.ModifiableMetadata
checkWritePermission, collectionType, copyCollection, copyList, copyMap, copySet, deepCopy, nonNullCollection, nonNullList, nonNullMap, nonNullSet, singleton, state, writeCollection, writeList, writeMap, writeSetMethods inherited from class org.apache.sis.metadata.AbstractMetadata
asMap, asTreeTable, equals, equals, getInterface, hashCode, isEmpty, prune, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerial number for inter-operability with different versions.- See Also:
-
minimumValue
The lowest vertical extent contained in the dataset. -
maximumValue
The highest vertical extent contained in the dataset. -
verticalCRS
private org.opengis.referencing.crs.VerticalCRS verticalCRSProvides information about the vertical coordinate reference system to which the maximum and minimum elevation values are measured. The CRS identification includes unit of measure.
-
-
Constructor Details
-
DefaultVerticalExtent
public DefaultVerticalExtent()Constructs an initially empty vertical extent. -
DefaultVerticalExtent
public DefaultVerticalExtent(double minimumValue, double maximumValue, org.opengis.referencing.crs.VerticalCRS verticalCRS) Creates a vertical extent initialized to the specified values.- Parameters:
minimumValue- the lowest vertical extent contained in the dataset, orDouble.NaNif none.maximumValue- the highest vertical extent contained in the dataset, orDouble.NaNif none.verticalCRS- the information about the vertical coordinate reference system, ornull.
-
DefaultVerticalExtent
public DefaultVerticalExtent(org.opengis.metadata.extent.VerticalExtent object) Constructs a new instance initialized with the values from the specified metadata object. This is a shallow copy constructor, because the other metadata contained in the given object are not recursively copied.- Parameters:
object- the metadata to copy values from, ornullif none.- See Also:
-
-
Method Details
-
castOrCopy
Returns a SIS metadata implementation with the values of the given arbitrary implementation. This method performs the first applicable action in the following choices:- If the given object is
null, then this method returnsnull. - Otherwise if the given object is already an instance of
DefaultVerticalExtent, then it is returned unchanged. - Otherwise a new
DefaultVerticalExtentinstance is created using the copy constructor and returned. Note that this is a shallow copy operation, because the other metadata contained in the given object are not recursively copied.
- Parameters:
object- the object to get as a SIS implementation, ornullif none.- Returns:
- a SIS implementation containing the values of the given object (may be the
given object itself), or
nullif the argument was null.
- If the given object is
-
getMinimumValue
Returns the lowest vertical extent contained in the dataset.- Specified by:
getMinimumValuein interfaceorg.opengis.metadata.extent.VerticalExtent- Returns:
- the lowest vertical extent, or
null.
-
setMinimumValue
Sets the lowest vertical extent contained in the dataset.- Parameters:
newValue- the new minimum value.
-
getMaximumValue
Returns the highest vertical extent contained in the dataset.- Specified by:
getMaximumValuein interfaceorg.opengis.metadata.extent.VerticalExtent- Returns:
- the highest vertical extent, or
null.
-
setMaximumValue
Sets the highest vertical extent contained in the dataset.- Parameters:
newValue- the new maximum value.
-
getVerticalCRS
public org.opengis.referencing.crs.VerticalCRS getVerticalCRS()Provides information about the vertical coordinate reference system to which the maximum and minimum elevation values are measured. The CRS identification includes unit of measure.- Specified by:
getVerticalCRSin interfaceorg.opengis.metadata.extent.VerticalExtent- Returns:
- the vertical CRS, or
null. - See Also:
-
setVerticalCRS
public void setVerticalCRS(org.opengis.referencing.crs.VerticalCRS newValue) Sets the information about the vertical coordinate reference system to which the maximum and minimum elevation values are measured.- Parameters:
newValue- the new vertical CRS.
-
value
Returns an arbitrary value, ornullif both minimum and maximum are null. This is used for verifying if the bounds are already set or partially set. -
setBounds
public void setBounds(org.opengis.geometry.Envelope envelope) throws org.opengis.referencing.operation.TransformException Sets this vertical extent to values inferred from the specified envelope. The envelope can be multi-dimensional, in which case the envelope CRS must have a vertical component.Note: this method is available only if the referencing module is on the classpath.
- Parameters:
envelope- the envelope to use for setting this vertical extent.- Throws:
UnsupportedOperationException- if the referencing module is not on the classpath.org.opengis.referencing.operation.TransformException- if the envelope cannot be transformed to a vertical extent.- See Also:
-
intersect
public void intersect(org.opengis.metadata.extent.VerticalExtent other) throws IllegalArgumentException Sets this vertical extent to the intersection of this extent with the specified one. The vertical datum must be the same (ignoring metadata) for both extents; this method does not perform datum shift. However, this method can perform unit conversions.If there is no intersection between the two extents, then this method sets both minimum and maximum values to Double.NaN. If either this extent or the specified extent has NaN bounds, then the corresponding bounds of the intersection result will also be NaN.
- Parameters:
other- the vertical extent to intersect with this extent.- Throws:
IllegalArgumentException- if the two extents do not use the same datum, ignoring metadata.- Since:
- 0.8
- See Also:
-
getConversionFrom
private org.opengis.referencing.operation.MathTransform1D getConversionFrom(org.opengis.referencing.crs.VerticalCRS source) throws org.opengis.util.FactoryException Returns the conversion from the given CRS to the CRS of this extent, ornullif none or unknown. The returnedMathTransform1Dmay apply unit conversions or axis direction reversal, but usually not datum shift.- Parameters:
source- the CRS from which to perform the conversions, ornullif unknown.- Returns:
- the conversion from
source, ornullif none or unknown. - Throws:
UnsupportedOperationException- if thesis-referencingmodule is not on the classpath.org.opengis.util.FactoryException- if the coordinate operation factory is not available.ClassCastException- if the conversion is not an instance ofMathTransform1D.
-
isReversing
private static boolean isReversing(org.opengis.referencing.operation.MathTransform1D cv, Double sample, Double other) throws org.opengis.referencing.operation.TransformException Returnstrueif the given conversion seems to change the axis direction. This happen for example with conversions from "Elevation" axis to "Depth" axis. In case of doubt, this method returnsfalse.Note about alternatives: we could compare axis directions instead, but it would not work with user-defined directions or user-defined unit conversions with negative scale factor (should never happen, but we are paranoiac). We could compare the minimum and maximum values after conversions, but it would not work if one or both values arenullorNaN. Since we want to preserveNilReason, we still need to know if axes are reversed in order to put the nil reason in the right location.- Parameters:
cv- the conversion computed bygetConversionFrom(VerticalCRS)(may benull).sample- the minimum or the maximum value.other- the minimum or maximum value at the opposite bound.- Returns:
trueif the axis direction is reversed at the given value.- Throws:
org.opengis.referencing.operation.TransformException
-
convert
private static Double convert(org.opengis.referencing.operation.MathTransform1D tr, Double value) throws org.opengis.referencing.operation.TransformException Converts the given value with the given transform if non-null. This converter can generally not perform datum shift; the operation is merely unit conversion and change of axis direction.- Throws:
org.opengis.referencing.operation.TransformException
-