Class BoundingBox

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

public class BoundingBox extends Object
This class declares a bounding box of coordinates on the map.
  • 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 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(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class 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