VisibleRegion

  • VisibleRegion contains the four points defining the four-sided polygon that is visible in a map's camera, which can be a trapezoid if the camera is tilted.

  • It includes LatLng objects for the farLeft, farRight, nearLeft, and nearRight corners of the visible region, and a LatLngBounds object representing the smallest bounding box containing the region.

  • A VisibleRegion can be created by providing the LatLng coordinates for its four corners and the corresponding bounding box.

  • The VisibleRegion class provides methods for comparing two VisibleRegion objects for equality and writing the object's state to a Parcel.

public final classVisibleRegion extendsObject
implementsParcelable

Contains the four points defining the four-sided polygon that is visible in a map's camera. This polygon can be a trapezoid instead of a rectangle, because a camera can have tilt. If the camera is directly over the center of the camera, the shape is rectangular, but if the camera is tilted, the shape will appear to be a trapezoid whose smallest side is closest to the point of view.

Inherited Constant Summary

From interface android.os.Parcelable
intCONTENTS_FILE_DESCRIPTOR
intPARCELABLE_WRITE_RETURN_VALUE

Field Summary

public finalLatLngfarLeftLatLng object that defines the far left corner of the camera.
public finalLatLngfarRightLatLng object that defines the far right corner of the camera.
public finalLatLngBounds latLngBoundsThe smallest bounding box that includes the visible region defined in this class.
public finalLatLngnearLeftLatLng object that defines the bottom left corner of the camera.
public finalLatLng nearRightLatLng object that defines the bottom right corner of the camera.

Public Constructor Summary

VisibleRegion(LatLng nearLeft,LatLng nearRight,LatLng farLeft,LatLng farRight,LatLngBounds latLngBounds)
Creates a new VisibleRegion given the four corners of the camera.

Public Method Summary

boolean
equals(Object o)
Compares thisVisibleRegion to another object.
int
String
void
writeToParcel(Parcel out, int flags)

Inherited Method Summary

From class java.lang.Object
Object
clone()
boolean
equals(Object arg0)
void
finalize()
finalClass<?>
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()
From interface android.os.Parcelable
abstract int
describeContents()
abstract void
writeToParcel(Parcel arg0, int arg1)

Fields

public finalLatLngfarLeft

LatLng object that defines the far left corner of the camera.

public finalLatLngfarRight

LatLng object that defines the far right corner of the camera.

public finalLatLngBoundslatLngBounds

The smallest bounding box that includes the visible region defined in this class.

If this box crosses the 180° meridian (the vertical line from north to south), the longitude infarRight will be negative and the longitude infarLeft will be positive. This rule also applies tonearRight andnearLeft.

public finalLatLngnearLeft

LatLng object that defines the bottom left corner of the camera.

public finalLatLngnearRight

LatLng object that defines the bottom right corner of the camera.

Public Constructors

publicVisibleRegion(LatLng nearLeft,LatLng nearRight,LatLng farLeft,LatLng farRight,LatLngBounds latLngBounds)

Creates a new VisibleRegion given the four corners of the camera. The LatLng parameters must define a convex shape (the edges of the resulting shape mustn't cross). No bounds checking is performed at runtime.

Parameters
nearLeftaLatLng object containing the latitude and longitude of the near left corner of the region.
nearRightaLatLng object containing the latitude and longitude of the near right corner of the region.
farLeftaLatLng object containing the latitude and longitude of the far left corner of the region.
farRightaLatLng object containing the latitude and longitude of the far right corner of the region.
latLngBoundsthe smallest bounding box that includes the visible region defined in this class. If this box crosses the 180° meridian (the vertical line from north to south), the longitude infarRight will be negative and the longitude infarLeft will be positive. Same applies tonearRight andnearLeft.

Public Methods

public booleanequals(Object o)

Compares thisVisibleRegion to another object. If the other object is actually a pointer to this object, or if all four corners and the bounds of the two objects are the same, this method returns true. Otherwise, this method returns false.

Parameters
oanObject. Return true if both objects are the same object, or if all four corners and the bounds of the two objects are the same. Return false otherwise.

public inthashCode()

publicStringtoString()

public voidwriteToParcel(Parcel out, int flags)

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-10-31 UTC.