Class ImmutableEnvelope

All Implemented Interfaces:
Serializable, Emptiable, Printable, Envelope

public final class ImmutableEnvelope extends AbstractEnvelope implements Serializable
An immutable Envelope (a minimum bounding box or rectangle) of arbitrary dimension. This class is final in order to ensure that the immutability contract cannot be broken (assuming not using Java Native Interface or reflections).

Immutability and thread safety

This final class is immutable and thus inherently thread-safe if the Coordinate­Reference­System instance given to the constructor is immutable. This is usually the case in Apache SIS.
Since:
0.3
See Also:
  • Constructor Details

    • ImmutableEnvelope

      public ImmutableEnvelope(DirectPosition lowerCorner, DirectPosition upperCorner) throws MismatchedDimensionException, MismatchedReferenceSystemException
      Constructs an envelope defined by two corners given as direct positions. The envelope CRS will be the CRS of the given positions.
      Parameters:
      lower­Corner - the limits in the direction of decreasing coordinate values for each dimension.
      upper­Corner - the limits in the direction of increasing coordinate values for each dimension.
      Throws:
      Mismatched­Dimension­Exception - if the two positions do not have the same dimension.
      Mismatched­Reference­System­Exception - if the CRS of the two position are not equal.
    • ImmutableEnvelope

      public ImmutableEnvelope(double[] lowerCorner, double[] upperCorner, CoordinateReferenceSystem crs) throws MismatchedDimensionException
      Constructs an envelope defined by two corners given as sequences of coordinate values.
      Parameters:
      lower­Corner - the limits in the direction of decreasing coordinate values for each dimension.
      upper­Corner - the limits in the direction of increasing coordinate values for each dimension.
      crs - the CRS to assign to this envelope, or null.
      Throws:
      Mismatched­Dimension­Exception - if the two sequences do not have the same length, or if the dimension of the given CRS is not equals to the dimension of the given corners.
    • ImmutableEnvelope

      public ImmutableEnvelope(GeographicBoundingBox box)
      Constructs a new envelope with the same data as the specified geographic bounding box. The coordinate reference system is set to the default geographic CRS. Axis order is (longitude, latitude).
      Parameters:
      box - the bounding box to copy.
    • ImmutableEnvelope

      public ImmutableEnvelope(Envelope envelope)
      Creates an immutable envelope with the values of the given envelope. This constructor can be used when the given envelope is known to not be an instance of Immutable­Envelope. In case of doubt, consider using cast­Or­Copy(Envelope) instead.
      Parameters:
      envelope - the envelope to copy.
      See Also:
    • ImmutableEnvelope

      public ImmutableEnvelope(CoordinateReferenceSystem crs, Envelope envelope) throws MismatchedDimensionException
      Creates an immutable envelope with the coordinate values of the given envelope but a different CRS. This method does not reproject the given envelope. It just assign the given CRS to this envelope without any check, except for the CRS dimension.

      The main purpose of this method is to assign a non-null CRS when the envelope to copy has a null CRS.

      Parameters:
      crs - the CRS to assign to this envelope, or null.
      envelope - the envelope from which to copy coordinate values.
      Throws:
      Mismatched­Dimension­Exception - if the dimension of the given CRS is not equals to the dimension of the given envelope.
    • ImmutableEnvelope

      Constructs a new envelope initialized to the values parsed from the given string in BOX or Well Known Text (WKT) format. The given string is typically a BOX element like below:
      BOX(-180 -90, 180 90)
      
      However, this constructor is lenient to other geometry types like POLYGON. See the javadoc of the General­Envelope constructor for more information.
      Parameters:
      crs - the coordinate reference system, or null if none.
      wkt - the BOX, POLYGON or other kind of element to parse.
      Throws:
      Illegal­Argument­Exception - if the given string cannot be parsed.
      Mismatched­Dimension­Exception - if the dimension of the given CRS is not equals to the dimension of the parsed envelope.
  • Method Details