BoundingBox class
Immutable rectangular geographic boundary defined by latitude and longitude coordinates.
A BoundingBox represents a rectangular area on Earth's surface using four coordinates: minimum/maximum latitude and minimum/maximum longitude. It provides efficient spatial operations for containment testing, intersection detection, and boundary calculations commonly used in mapping applications.
Key features:
- Immutable design for thread safety
- Efficient containment and intersection testing
- Boundary expansion with margin or meter-based calculations
- Corner point access methods
- Line and area intersection detection
- Geographic coordinate validation
Constructors
- BoundingBox(double minLatitude, double minLongitude, double maxLatitude, double maxLongitude)
-
Creates a BoundingBox with the specified coordinate boundaries.
const
- BoundingBox.from2(ILatLong first, ILatLong second)
-
factory
-
BoundingBox.fromLatLongs(List<
ILatLong> latLongs) -
Creates a BoundingBox that encompasses all the given coordinates.
factory
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- maxLatitude → double
-
The maximum latitude coordinate of this BoundingBox in degrees.
final
- maxLongitude → double
-
The maximum longitude coordinate of this BoundingBox in degrees.
final
- minLatitude → double
-
The minimum latitude coordinate of this BoundingBox in degrees.
final
- minLongitude → double
-
The minimum longitude coordinate of this BoundingBox in degrees.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
contains(
double latitude, double longitude) → bool - Tests if the given coordinates are within this bounding box.
-
containsBoundingBox(
BoundingBox box) → bool - Tests if this bounding box completely contains another bounding box.
-
containsLatLong(
ILatLong latLong) → bool - Tests if the given LatLong point is within this bounding box.
-
extendBoundingBox(
BoundingBox boundingBox) → BoundingBox - Creates a new BoundingBox that encompasses both this and another bounding box.
-
extendMargin(
double margin) → BoundingBox - Creates a BoundingBox that is a fixed margin factor larger on all sides (but does not cross date line/poles).
-
extendMeters(
int meters) → BoundingBox - Creates a BoundingBox that is a fixed meter amount larger on all sides (but does not cross date line/poles).
-
getBottomCenter(
) → ILatLong -
getCenterPoint(
) → LatLong - @return a new LatLong at the horizontal and vertical center of this BoundingBox.
-
getLatitudeSpan(
) → double - @return the latitude span of this BoundingBox in degrees.
-
getLeftCenter(
) → ILatLong -
getLeftLower(
) → ILatLong -
getLeftLowerRotate(
int steps) → ILatLong -
getLeftUpper(
) → ILatLong -
getLeftUpperRotate(
int steps) → ILatLong -
getLongitudeSpan(
) → double - @return the longitude span of this BoundingBox in degrees.
-
getRightCenter(
) → ILatLong -
getRightLower(
) → ILatLong -
getRightLowerRotate(
int steps) → ILatLong -
getRightUpper(
) → ILatLong -
getRightUpperRotate(
int steps) → ILatLong -
getTopCenter(
) → ILatLong -
intersects(
BoundingBox boundingBox) → bool - Returns true if the rectange overlaps with the given rectangle. The rectangles intersect if their four edges overlap at least at one point. To determine an intersection, all four conditions must be met. @param boundingBox the BoundingBox which should be checked for intersection with this BoundingBox. @return true if this BoundingBox intersects with the given BoundingBox, false otherwise.
-
intersectsArea(
List< List< latLongs) → boolILatLong> > - Returns if an area built from the latLongs intersects with a bias towards returning true. The method returns fast if any of the points lie within the bbox. If none of the points lie inside the box, it constructs the outer bbox for all the points and tests for intersection (so it is possible that the area defined by the points does not actually intersect)
-
intersectsLine(
ILatLong lineStart, ILatLong lineEnd) → bool - Checks if a line intersects with the rectangle.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override