Class GeographicBoundingBoxImpl

    • Field Detail

      • WORLD

        public static final GeographicBoundingBox WORLD
        A bounding box ranging from 180°W to 180°E and 90°S to 90°N.
        Since:
        2.2
    • Constructor Detail

      • GeographicBoundingBoxImpl

        public GeographicBoundingBoxImpl()
        Constructs an initially empty geographic bounding box.
      • GeographicBoundingBoxImpl

        public GeographicBoundingBoxImpl​(GeographicBoundingBox box)
        Constructs a geographic bounding box initialized to the same values than the specified one.
        Parameters:
        box - The existing box to use for initializing this geographic bounding box.
        Since:
        2.2
      • GeographicBoundingBoxImpl

        public GeographicBoundingBoxImpl​(Bounds envelope)
                                  throws TransformException
        Constructs a geographic bounding box from the specified envelope. If the envelope contains a CRS, then the bounding box may be projected to a geographic one. Otherwise, the envelope is assumed already in appropriate CRS.

        When coordinate transformation is required, the target geographic CRS is not necessarly WGS84. This method preserves the same ellipsoid than in the envelope CRS when possible. This is because geographic bounding box are only approximative and the ISO specification do not mandates a particular CRS, so we avoid transformations that are not strictly necessary.

        Note: This constructor is available only if the referencing module is on the classpath.

        Parameters:
        envelope - The envelope to use for initializing this geographic bounding box.
        Throws:
        UnsupportedOperationException - if the referencing module is not on the classpath.
        TransformException - if the envelope can't be transformed.
        Since:
        2.2
      • GeographicBoundingBoxImpl

        public GeographicBoundingBoxImpl​(Rectangle2D bounds)
        Constructs a geographic bounding box from the specified rectangle. The rectangle is assumed in WGS 84 CRS.
        Parameters:
        bounds - The rectangle to use for initializing this geographic bounding box.
      • GeographicBoundingBoxImpl

        public GeographicBoundingBoxImpl​(double westBoundLongitude,
                                         double eastBoundLongitude,
                                         double southBoundLatitude,
                                         double northBoundLatitude)
        Creates a geographic bounding box initialized to the specified values.

        Caution: Arguments are expected in the same order than they appear in the ISO 19115 specification. This is different than the order commonly found in Java world, which is rather (xmin, ymin, xmax, ymax).

        Parameters:
        westBoundLongitude - The minimal x value.
        eastBoundLongitude - The maximal x value.
        southBoundLatitude - The minimal y value.
        northBoundLatitude - The maximal y value.
    • Method Detail

      • getWestBoundLongitude

        public double getWestBoundLongitude()
        Returns the western-most coordinate of the limit of the dataset extent. The value is expressed in longitude in decimal degrees (positive east).
        Specified by:
        getWestBoundLongitude in interface GeographicBoundingBox
        Returns:
        The western-most longitude between -180 and +180°.
      • setWestBoundLongitude

        public void setWestBoundLongitude​(double newValue)
        Set the western-most coordinate of the limit of the dataset extent. The value is expressed in longitude in decimal degrees (positive east).
        Parameters:
        newValue - The western-most longitude between -180 and +180°.
      • getEastBoundLongitude

        public double getEastBoundLongitude()
        Returns the eastern-most coordinate of the limit of the dataset extent. The value is expressed in longitude in decimal degrees (positive east).
        Specified by:
        getEastBoundLongitude in interface GeographicBoundingBox
        Returns:
        The eastern-most longitude between -180 and +180°.
      • setEastBoundLongitude

        public void setEastBoundLongitude​(double newValue)
        Set the eastern-most coordinate of the limit of the dataset extent. The value is expressed in longitude in decimal degrees (positive east).
        Parameters:
        newValue - The eastern-most longitude between -180 and +180°.
      • getSouthBoundLatitude

        public double getSouthBoundLatitude()
        Returns the southern-most coordinate of the limit of the dataset extent. The value is expressed in latitude in decimal degrees (positive north).
        Specified by:
        getSouthBoundLatitude in interface GeographicBoundingBox
        Returns:
        The southern-most latitude between -90 and +90°.
      • setSouthBoundLatitude

        public void setSouthBoundLatitude​(double newValue)
        Set the southern-most coordinate of the limit of the dataset extent. The value is expressed in latitude in decimal degrees (positive north).
        Parameters:
        newValue - The southern-most latitude between -90 and +90°.
      • getNorthBoundLatitude

        public double getNorthBoundLatitude()
        Returns the northern-most, coordinate of the limit of the dataset extent. The value is expressed in latitude in decimal degrees (positive north).
        Specified by:
        getNorthBoundLatitude in interface GeographicBoundingBox
        Returns:
        The northern-most latitude between -90 and +90°.
      • setNorthBoundLatitude

        public void setNorthBoundLatitude​(double newValue)
        Set the northern-most, coordinate of the limit of the dataset extent. The value is expressed in latitude in decimal degrees (positive north).
        Parameters:
        newValue - The northern-most latitude between -90 and +90°.
      • setBounds

        public void setBounds​(double westBoundLongitude,
                              double eastBoundLongitude,
                              double southBoundLatitude,
                              double northBoundLatitude)
        Sets the bounding box to the specified values.

        Caution: Arguments are expected in the same order than they appear in the ISO 19115 specification. This is different than the order commonly found in Java world, which is rather (xmin, ymin, xmax, ymax).

        Parameters:
        westBoundLongitude - The minimal x value.
        eastBoundLongitude - The maximal x value.
        southBoundLatitude - The minimal y value.
        northBoundLatitude - The maximal y value.
        Since:
        2.5
      • setBounds

        public void setBounds​(GeographicBoundingBox box)
        Sets the bounding box to the same values than the specified box.
        Parameters:
        box - The geographic bounding box to use for setting the values of this box.
        Since:
        2.5
      • add

        public void add​(GeographicBoundingBox box)
        Adds a geographic bounding box to this box. If the inclusion status is the same for this box and the box to be added, then the resulting bounding box is the union of the two boxes. If the inclusion status are opposite (exclusion), then this method attempt to exclude some area of specified box from this box. The resulting bounding box is smaller if the exclusion can be performed without ambiguity.
        Parameters:
        box - The geographic bounding box to add to this box.
        Since:
        2.2
      • intersect

        public void intersect​(GeographicBoundingBox box)
        Sets this bounding box to the intersection of this box with the specified one. The inclusion status must be the same for both boxes.
        Parameters:
        box - The geographic bounding box to intersect with this box.
        Since:
        2.5
      • isEmpty

        public boolean isEmpty()
        Returns true if this bounding box is empty.
        Returns:
        true if this box is empty.
        Since:
        2.5
      • equals

        public boolean equals​(Object object)
        Compares this geographic bounding box with the specified object for equality.
        Overrides:
        equals in class AbstractMetadata
        Parameters:
        object - The object to compare for equality.
        Returns:
        true if the given object is equals to this box.
      • hashCode

        public int hashCode()
        Returns a hash code value for this extent.
        Overrides:
        hashCode in class AbstractMetadata
      • toString

        public String toString()
        Returns a string representation of this extent using a default angle pattern.
        Overrides:
        toString in class AbstractMetadata
      • toString

        public static String toString​(GeographicBoundingBox box,
                                      String pattern,
                                      Locale locale)
        Returns a string representation of the specified extent using the specified angle pattern and locale. See AngleFormat for a description of angle patterns.
        Parameters:
        box - The bounding box to format.
        pattern - The angle pattern (e.g. DD°MM'SS.s".
        locale - The locale, or null for the default one.
        Returns:
        A string representation of the given box in the given locale.
        Since:
        2.2