Class 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:
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.
In addition to the standard properties, SIS provides the following methods:

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 XML instead.
  • 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:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Serial number for inter-operability with different versions.
      See Also:
    • minimumValue

      private Double minimumValue
      The lowest vertical extent contained in the dataset.
    • maximumValue

      private Double maximumValue
      The highest vertical extent contained in the dataset.
    • verticalCRS

      private org.opengis.referencing.crs.VerticalCRS verticalCRS
      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.
  • 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, or Double.NaN if none.
      maximumValue - the highest vertical extent contained in the dataset, or Double.NaN if none.
      verticalCRS - the information about the vertical coordinate reference system, or null.
    • 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, or null if none.
      See Also:
  • Method Details

    • castOrCopy

      public static DefaultVerticalExtent castOrCopy(org.opengis.metadata.extent.VerticalExtent object)
      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 returns null.
      • Otherwise if the given object is already an instance of DefaultVerticalExtent, then it is returned unchanged.
      • Otherwise a new DefaultVerticalExtent instance 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, or null if none.
      Returns:
      a SIS implementation containing the values of the given object (may be the given object itself), or null if the argument was null.
    • getMinimumValue

      public Double getMinimumValue()
      Returns the lowest vertical extent contained in the dataset.
      Specified by:
      getMinimumValue in interface org.opengis.metadata.extent.VerticalExtent
      Returns:
      the lowest vertical extent, or null.
    • setMinimumValue

      public void setMinimumValue(Double newValue)
      Sets the lowest vertical extent contained in the dataset.
      Parameters:
      newValue - the new minimum value.
    • getMaximumValue

      public Double getMaximumValue()
      Returns the highest vertical extent contained in the dataset.
      Specified by:
      getMaximumValue in interface org.opengis.metadata.extent.VerticalExtent
      Returns:
      the highest vertical extent, or null.
    • setMaximumValue

      public void setMaximumValue(Double newValue)
      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:
      getVerticalCRS in interface org.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

      private Double value()
      Returns an arbitrary value, or null if 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, or null if none or unknown. The returned MathTransform1D may apply unit conversions or axis direction reversal, but usually not datum shift.
      Parameters:
      source - the CRS from which to perform the conversions, or null if unknown.
      Returns:
      the conversion from source, or null if none or unknown.
      Throws:
      UnsupportedOperationException - if the sis-referencing module 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 of MathTransform1D.
    • isReversing

      private static boolean isReversing(org.opengis.referencing.operation.MathTransform1D cv, Double sample, Double other) throws org.opengis.referencing.operation.TransformException
      Returns true if 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 returns false.
      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 are null or NaN. Since we want to preserve NilReason, 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 by getConversionFrom(VerticalCRS) (may be null).
      sample - the minimum or the maximum value.
      other - the minimum or maximum value at the opposite bound.
      Returns:
      true if 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