Class Bounds

java.lang.Object
io.jenetics.jpx.Bounds
All Implemented Interfaces:
Serializable

public final class Bounds extends Object implements Serializable
Two lat/lon pairs defining the extent of an element.
Since:
1.0
Version:
1.6
See Also:
  • Method Details

    • getMinLatitude

      Return the minimum latitude.
      Returns:
      the minimum latitude
    • getMinLongitude

      Return the minimum longitude.
      Returns:
      the minimum longitude
    • getMaxLatitude

      Return the maximum latitude.
      Returns:
      the maximum latitude
    • getMaxLongitude

      Return the maximum longitude
      Returns:
      the maximum longitude
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toBounds

      public static <P extends Point> Collector<P,?,Bounds> toBounds()
      Return a collector which calculates the bounds of a given way-point stream. The following example shows how to calculate the bounds of all track-points of a given GPX object.
      final Bounds bounds = gpx.tracks() .flatMap(Track::segments) .flatMap(TrackSegment::points) .collect(Bounds.toBounds());
      If the collecting way-point stream is empty, the collected Bounds object is null.
      Type Parameters:
      P - The actual point type
      Returns:
      a new bounds collector
      Since:
      1.6
    • of

      public static Bounds of(Latitude minLatitude, Longitude minLongitude, Latitude maxLatitude, Longitude maxLongitude)
      Create a new Bounds object with the given extent.
      Parameters:
      minLatitude - the minimum latitude
      minLongitude - the minimum longitude
      maxLatitude - the maximum latitude
      maxLongitude - the maximum longitude
      Returns:
      a new Bounds object with the given extent
      Throws:
      NullPointerException - if one of the arguments is null
    • of

      public static Bounds of(double minLatitudeDegree, double minLongitudeDegree, double maxLatitudeDegree, double maxLongitudeDegree)
      Create a new Bounds object with the given extent.
      Parameters:
      minLatitudeDegree - the minimum latitude
      minLongitudeDegree - the minimum longitude
      maxLatitudeDegree - the maximum latitude
      maxLongitudeDegree - the maximum longitude
      Returns:
      a new Bounds object with the given extent
      Throws:
      IllegalArgumentException - if the latitude values are not within the range of [-90..90]
      IllegalArgumentException - if the longitudes value are not within the range of [-180..180]