Class BoundingBox

java.lang.Object
com.codename1.maps.BoundingBox

public class BoundingBox extends java.lang.Object
This class declares a bounding box of coordinates on the map.
  • Constructor Summary

    Constructors
    Constructor
    Description
    BoundingBox(Coord c, double rLat, double rLng)
    Creates a bounding box around a coordinate with a given radius.
    BoundingBox(Coord southWest, Coord northEast)
    Constructor with 2 coordinates for south west and north east
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    indicates if the given coordinate is inside the counding box
    create(Coord[] coords)
    create a smallest bounding box that contains all of the given coordinates
    create(Vector coords)
    /** create a smallest bounding box that contains all of the given coordinates
    boolean
    equals(java.lang.Object other)
    create a new bounding box that extends this bounding box with the given bounding box
    Gets the north east coordinate
    Gets the /south west coordinate
    int
    double
    Returns
    double
    Returns
    boolean
    Indicates if this bounding box is isProjected

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • BoundingBox

      public BoundingBox(Coord c, double rLat, double rLng)

      Creates a bounding box around a coordinate with a given radius.

      Parameters
      • c: The coordinate at the center of the bounding box.

      • rLat: The latitude radius of the box (in degrees).

      • rLng: The longitude radius of the box (in degrees).

    • BoundingBox

      public BoundingBox(Coord southWest, Coord northEast)

      Constructor with 2 coordinates for south west and north east

      Parameters
      • southWest: coordinate

      • northEast: coordinate

  • Method Details

    • create

      public static BoundingBox create(Coord[] coords)

      create a smallest bounding box that contains all of the given coordinates

      Parameters
      • coords: given coordinates to create a wrapping bounding box.
      Returns

      a bounding box that contains all of the coordinates

    • create

      public static BoundingBox create(Vector coords)

      /** create a smallest bounding box that contains all of the given coordinates

      Parameters
      • coords: given coordinates to create a wrapping bounding box.
      Returns

      a bounding box that contains all of the coordinates

    • getSouthWest

      public Coord getSouthWest()
      Gets the /south west coordinate
    • getNorthEast

      public Coord getNorthEast()
      Gets the north east coordinate
    • toString

      public String toString()
      Overrides:
      toString in class java.lang.Object
    • latitudeDifference

      public double latitudeDifference()
      Returns

      The difference between SE and NW getLongitude in degrees.

    • longitudeDifference

      public double longitudeDifference()
      Returns

      The difference between SE and NW latitudes in degrees.

    • contains

      public boolean contains(Coord cur)

      indicates if the given coordinate is inside the counding box

      Parameters
      • cur: coordinate to check
      Returns

      true if the given coordinate is contained in the bounding box

    • equals

      public boolean equals(java.lang.Object other)
      Overrides:
      equals in class java.lang.Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • extend

      public BoundingBox extend(BoundingBox other)

      create a new bounding box that extends this bounding box with the given bounding box

      Parameters
      • other: a bounding box that needs to extends the current bounding box
      Returns

      a new bounding box that was extended from the current and the other

    • projected

      public boolean projected()

      Indicates if this bounding box is isProjected

      Returns

      true if it's a isProjected bounding box