Class SimpleGridEnvelope

  • All Implemented Interfaces:
    Serializable, GridEnvelope

    public class SimpleGridEnvelope
    extends Object
    implements GridEnvelope, Serializable
    A GridEnvelope implementation which store values in a int[] array. This class defines a range of grid coverage coordinates.

    CAUTION: ISO 19123 defines high coordinates as inclusive. We follow this specification for all getters methods, but keep in mind that this is the opposite of Java2D usage where Rectangle maximal values are exclusive.

    Since:
    3.1
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      SimpleGridEnvelope​(long[] low, long[] high)
      Constructs a new grid envelope.
      SimpleGridEnvelope​(GridEnvelope envelope)
      Creates a new grid envelope as a copy of the given one.
    • Method Summary

      Modifier and Type Method Description
      boolean equals​(Object object)
      Compares the specified object with this grid envelope for equality.
      int getDimension()
      Returns the number of dimensions.
      GridCoordinates getHigh()
      Returns the valid maximum inclusive grid coordinates.
      long getHigh​(int dimension)
      Returns the valid maximum inclusive grid coordinate along the specified dimension.
      GridCoordinates getLow()
      Returns the valid minimum inclusive grid coordinates.
      long getLow​(int dimension)
      Returns the valid minimum inclusive grid coordinate along the specified dimension.
      long getSize​(int dimension)
      Returns the number of integer grid coordinates along the specified dimension.
      int hashCode()
      Returns a hash value for this grid envelope.
      String toString()
      Returns a string representation of this grid envelope.
    • Constructor Detail

      • SimpleGridEnvelope

        public SimpleGridEnvelope​(GridEnvelope envelope)
        Creates a new grid envelope as a copy of the given one.
        Parameters:
        envelope - the grid envelope to copy.
      • SimpleGridEnvelope

        public SimpleGridEnvelope​(long[] low,
                                  long[] high)
        Constructs a new grid envelope.
        Parameters:
        low - the valid minimum inclusive grid coordinate. The array contains a minimum value (inclusive) for each dimension of the grid coverage. The lowest valid grid coordinate is often zero, but this is not mandatory.
        high - the valid maximum grid coordinate, inclusive. The array contains a maximum value for each dimension of the grid coverage.
        See Also:
        getLow(), getHigh()
    • Method Detail

      • getDimension

        public int getDimension()
        Returns the number of dimensions.
        Specified by:
        getDimension in interface GridEnvelope
      • getLow

        public GridCoordinates getLow()
        Returns the valid minimum inclusive grid coordinates. The sequence contains a minimum value for each dimension of the grid coverage.
        Specified by:
        getLow in interface GridEnvelope
      • getHigh

        public GridCoordinates getHigh()
        Returns the valid maximum inclusive grid coordinates. The sequence contains a maximum value for each dimension of the grid coverage.
        Specified by:
        getHigh in interface GridEnvelope
      • getLow

        public long getLow​(int dimension)
        Returns the valid minimum inclusive grid coordinate along the specified dimension.
        Specified by:
        getLow in interface GridEnvelope
        See Also:
        getLow()
      • getHigh

        public long getHigh​(int dimension)
        Returns the valid maximum inclusive grid coordinate along the specified dimension.
        Specified by:
        getHigh in interface GridEnvelope
        See Also:
        getHigh()
      • getSize

        public long getSize​(int dimension)
        Returns the number of integer grid coordinates along the specified dimension. This is equal to getHigh(dimension) - getLow(dimension) + 1.
        Specified by:
        getSize in interface GridEnvelope
      • hashCode

        public int hashCode()
        Returns a hash value for this grid envelope. This value need not remain consistent between different implementations of the same class.
        Overrides:
        hashCode in class Object
      • equals

        public boolean equals​(Object object)
        Compares the specified object with this grid envelope for equality.
        Overrides:
        equals in class Object
        Parameters:
        object - the object to compare with this grid envelope for equality.
        Returns:
        true if the given object is equal to this grid envelope.
      • toString

        public String toString()
        Returns a string representation of this grid envelope. The returned string is implementation dependent. It is usually provided for debugging purposes.
        Overrides:
        toString in class Object