public final class

LatLngBounds

extends Object
java.lang.Object
   ↳ com.amazon.geo.mapsv2.model.LatLngBounds

Class Overview

Immutable class representing a rectangle defined by LatLng objects at its northeast and southwest points.

Summary

Nested Classes
class LatLngBounds.Builder Class for building LatLngBounds objects. 
Fields
public final LatLng northeast Northeast corner of the rectangle.
public final LatLng southwest Southwest corner of the rectangle.
Public Constructors
LatLngBounds(LatLng southwest, LatLng northeast)
Creates a new LatLngBounds object with the specified southwest and northeast corners.
Public Methods
static LatLngBounds.Builder builder()
Returns a new LatLngBounds.Builder object.
boolean contains(LatLng point)
Retrieves a boolean value indicating whether the specified geographic point (LatLng) is within the rectangle defined by the LatLngBounds.
int describeContents()
boolean equals(Object obj)
LatLng getCenter()
Returns a LatLng representing the approximate geographical center of the LatLngBounds.
int hashCode()
LatLngBounds including(LatLng point)
Adds a specified geographic point (LatLng) to the LatLngBounds and returns a new LatLngBounds instance.
String toString()
void writeToParcel(Parcel out, int flags)
[Expand]
Inherited Methods
From class java.lang.Object

Fields

public final LatLng northeast

Northeast corner of the rectangle.

public final LatLng southwest

Southwest corner of the rectangle.

Public Constructors

public LatLngBounds (LatLng southwest, LatLng northeast)

Creates a new LatLngBounds object with the specified southwest and northeast corners.

The rectangle returned by the constructor encloses all points where:

  • latitude is in the range [northeast.latitude, southwest.latitude];
  • longitude is in the range [southwest.longtitude, northeast.longitude] if southwest.longtitude is less than or equal to northeast.longitude; and
  • longitude is in the range [southwest.longitude, 180) U [-180, northeast.longitude] if southwest.longtitude is greater than northeast.longitude.

Parameters
southwest southwest corner of the bound.
northeast northeast corner of the bound.

Public Methods

public static LatLngBounds.Builder builder ()

Returns a new LatLngBounds.Builder object.

public boolean contains (LatLng point)

Retrieves a boolean value indicating whether the specified geographic point (LatLng) is within the rectangle defined by the LatLngBounds.

Parameters
point A LatLng representing the geographic point to verify.
Returns
  • true if the specified point is enclosed by the Bounds, false otherwise.

public int describeContents ()

public boolean equals (Object obj)

public LatLng getCenter ()

Returns a LatLng representing the approximate geographical center of the LatLngBounds.

Note that the center is the average of the coordinates. The calculation takes into account whether the bounds crosses the anti-meridian or not. Due to the Mercator projection, this is not necessarily the center of a rectangle as drawn on the map.

Returns
  • A LatLng representing the approximate center of the bounds.

public int hashCode ()

public LatLngBounds including (LatLng point)

Adds a specified geographic point (LatLng) to the LatLngBounds and returns a new LatLngBounds instance.

This method attempts to increase the bounds in a minimal way. That is, the method tries to increase the bounds both in eastward and westward directions and chooses the smaller of the two. If both directions result in bounds of same size, the bound is increased in the eastward direction. The bounds may cross the anti-meridian in the process.

Parameters
point A LatLng representing the geographic point to add to the bounds.
Returns
  • A new LatLngBounds object incorporating the specified point.

public String toString ()

public void writeToParcel (Parcel out, int flags)