Class BoundingBox

java.lang.Object
com.cercalia.sdk.model.common.BoundingBox

public final class BoundingBox extends Object
Represents a geographic bounding box defined by minimum and maximum coordinates.

Used for defining map extents, spatial filters, and search boundaries.

  • Constructor Details

    • BoundingBox

      public BoundingBox(double minLat, double minLng, double maxLat, double maxLng)
      Creates a new BoundingBox.
      Parameters:
      minLat - minimum latitude (south)
      minLng - minimum longitude (west)
      maxLat - maximum latitude (north)
      maxLng - maximum longitude (east)
  • Method Details

    • fromCorners

      @NotNull public static @NotNull BoundingBox fromCorners(@NotNull @NotNull Coordinate southwest, @NotNull @NotNull Coordinate northeast)
      Creates a BoundingBox from two corner coordinates.
      Parameters:
      southwest - the southwest corner
      northeast - the northeast corner
      Returns:
      a new BoundingBox
    • getMinLat

      public double getMinLat()
      Returns the minimum latitude (south).
      Returns:
      the minimum latitude
    • getMinLng

      public double getMinLng()
      Returns the minimum longitude (west).
      Returns:
      the minimum longitude
    • getMaxLat

      public double getMaxLat()
      Returns the maximum latitude (north).
      Returns:
      the maximum latitude
    • getMaxLng

      public double getMaxLng()
      Returns the maximum longitude (east).
      Returns:
      the maximum longitude
    • getSouthwest

      @NotNull public @NotNull Coordinate getSouthwest()
      Returns the southwest corner coordinate.
      Returns:
      the southwest corner
    • getNortheast

      @NotNull public @NotNull Coordinate getNortheast()
      Returns the northeast corner coordinate.
      Returns:
      the northeast corner
    • getCenter

      @NotNull public @NotNull Coordinate getCenter()
      Returns the center coordinate of the bounding box.
      Returns:
      the center coordinate
    • toCercaliaString

      @NotNull public @NotNull String toCercaliaString()
      Returns the bounding box as a Cercalia format string "minLng,minLat,maxLng,maxLat".
      Returns:
      the bounding box string
    • contains

      public boolean contains(@NotNull @NotNull Coordinate coord)
      Checks if a coordinate is within this bounding box.
      Parameters:
      coord - the coordinate to check
      Returns:
      true if the coordinate is within the bounding box
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object