LatLngBounds.Builder
Stay organized with collections
Save and categorize content based on your preferences.
This is a builder that is able to create a minimum bound based on a set of LatLng
points.
Public Constructor Summary
Inherited Method Summary
From class java.lang.Object
Object
|
clone()
|
boolean |
|
void |
finalize()
|
final Class<?>
|
getClass()
|
int |
hashCode()
|
final void |
notify()
|
final void |
notifyAll()
|
String
|
toString()
|
final void |
wait(long arg0, int arg1)
|
final void |
wait(long arg0)
|
final void |
wait()
|
Public Methods
Creates the LatLng bounds.
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. Must not be null . |
Returns
- This builder object with a new point added.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[null,null,["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eLatLngBounds.Builder\u003c/code\u003e helps create a geographical boundary (LatLngBounds) based on a set of latitude and longitude points.\u003c/p\u003e\n"],["\u003cp\u003eYou can add points to the builder using the \u003ccode\u003einclude()\u003c/code\u003e method, expanding the boundary to encompass them.\u003c/p\u003e\n"],["\u003cp\u003eOnce all points are added, call \u003ccode\u003ebuild()\u003c/code\u003e to generate the final \u003ccode\u003eLatLngBounds\u003c/code\u003e object.\u003c/p\u003e\n"],["\u003cp\u003eThe builder automatically calculates the minimum bounds required to enclose all included points, even if they cross the 180° meridian.\u003c/p\u003e\n"]]],[],null,["# LatLngBounds.Builder\n\npublic static final class **LatLngBounds.Builder** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nThis is a builder that is able to create a minimum bound based on a set of LatLng\npoints. \n\n### Public Constructor Summary\n\n|---|--------------------------------------------------------------------------------------------------|\n| | [Builder](/android/reference/com/google/android/gms/maps/model/LatLngBounds.Builder#Builder())() |\n\n### Public Method Summary\n\n|---------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [LatLngBounds](/android/reference/com/google/android/gms/maps/model/LatLngBounds) | [build](/android/reference/com/google/android/gms/maps/model/LatLngBounds.Builder#build())() Creates the LatLng bounds. |\n| [LatLngBounds.Builder](/android/reference/com/google/android/gms/maps/model/LatLngBounds.Builder) | [include](/android/reference/com/google/android/gms/maps/model/LatLngBounds.Builder#include(com.google.android.gms.maps.model.LatLng))([LatLng](/android/reference/com/google/android/gms/maps/model/LatLng) point) Includes this point for building of the bounds. |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Constructors\n-------------------\n\n#### public **Builder** ()\n\nPublic Methods\n--------------\n\n#### public [LatLngBounds](/android/reference/com/google/android/gms/maps/model/LatLngBounds)\n**build** ()\n\nCreates the LatLng bounds. \n\n##### Throws\n\n| [IllegalStateException](//developer.android.com/reference/java/lang/IllegalStateException.html) | if no points have been included. |\n|-------------------------------------------------------------------------------------------------|----------------------------------|\n\n#### public [LatLngBounds.Builder](/android/reference/com/google/android/gms/maps/model/LatLngBounds.Builder)\n**include** ([LatLng](/android/reference/com/google/android/gms/maps/model/LatLng) point)\n\nIncludes this point for building of the bounds. The bounds will be extended in a\nminimum way to include this point.\n\nMore precisely, it will consider extending the bounds both in the eastward and\nwestward directions (one of which may cross the antimeridian) and choose the smaller of\nthe two. In the case that both directions result in a LatLngBounds of the same size,\nthis will extend it in the eastward direction. For example, adding points (0, -179) and\n(1, 179) will create a bound crossing the 180 longitude. \n\n##### Parameters\n\n| point | A [LatLng](/android/reference/com/google/android/gms/maps/model/LatLng) to be included in the bounds. Must not be `null`. |\n|-------|---------------------------------------------------------------------------------------------------------------------------|\n\n##### Returns\n\n- This builder object with a new point added."]]