AI-generated Key Takeaways
-
LatLngBounds.Builderhelps create a minimum geographical boundary based on a set of LatLng points. -
It provides methods to include points and build the final
LatLngBoundsobject. -
The
build()method creates theLatLngBoundsbut throws an exception if no points were included. -
The
include()method expands the bounds to encompass the given LatLng point, optimizing for the smallest possible boundary.
This is a builder that is able to create a minimum bound based on a set of LatLng points.
Public Constructor Summary
|
Builder()
|
Public Method Summary
| LatLngBounds |
build()
Creates the LatLng bounds.
|
| LatLngBounds.Builder |
Inherited Method Summary
Public Constructors
public Builder ()
Public Methods
public LatLngBounds build ()
Creates the LatLng bounds.
Throws
| IllegalStateException | if no points have been included. |
|---|
public LatLngBounds.Builder include (LatLng point)
Includes this point for building of the bounds. The bounds will be extended in a minimum way to include this point.
More precisely, it will consider extending the bounds both in the eastward and westward directions (one of which may cross the antimeridian) and choose the smaller of the two. In the case that both directions result in a LatLngBounds of the same size, this will extend it in the eastward direction. For example, adding points (0, -179) and (1, 179) will create a bound crossing the 180 longitude.
Parameters
| point | A LatLng to be included in the bounds. |
|---|
Returns
- This builder object with a new point added.