Packagecom.google.maps
Classpublic class LatLngBounds

A rectangular bounds on the Earth. The 2D interval is directed, i.e. it extends from the SW corner to the NE corner, even if the longitude interval from NE to SW (the other way round the earth) would be smaller. The bounds can be extended to contain new points with the extend() method.



Public Methods
 MethodDefined by
  
LatLngBounds(opt_sw:LatLng = null, opt_ne:LatLng = null)
Constructs a LatLngBounds from two LatLng instances, holding the SW extent and NE extent, respectively.
LatLngBounds
  
Creates a clone of this instance.
LatLngBounds
  
Returns true if this bounds completely contains the given bounds.
LatLngBounds
  
containsLatLng(point:LatLng):Boolean
Returns true if the given lat/lng is in this bounds.
LatLngBounds
  
equals(other:LatLngBounds):Boolean
Returns true if this bounds equals the given bound, allowing for numerical rounding errors.
LatLngBounds
  
extend(point:LatLng):void
Extends this bounds to contain the given point.
LatLngBounds
  
Computes the center of this LatLngBounds
LatLngBounds
  
getEast():Number
Returns the east longitude of this bounds.
LatLngBounds
  
getNorth():Number
Returns the north latitude of this bounds.
LatLngBounds
  
Returns the north-east corner of this bounds.
LatLngBounds
  
Returns the north-west corner of this bounds.
LatLngBounds
  
getSouth():Number
Returns the south latitude of this bounds.
LatLngBounds
  
Returns the south-east corner of this bounds.
LatLngBounds
  
Returns the south-west corner of this bounds.
LatLngBounds
  
getWest():Number
Returns the west longitude of this bounds.
LatLngBounds
  
intersects(other:LatLngBounds):Boolean
Returns true if this bounds shares any points with this bounds.
LatLngBounds
  
isEmpty():Boolean
Returns true if the bounds are empty.
LatLngBounds
  
isFullLat():Boolean
Returns true if the bounds cover all latitudes.
LatLngBounds
  
isFullLng():Boolean
Returns true if the bounds cover all longitudes.
LatLngBounds
  
isLargerThan(other:LatLngBounds):Boolean
Returns true if this bounds is larger than (could contain) the other.
LatLngBounds
  
Converts the given map bounds to a lat/lng span.
LatLngBounds
  
toString():String
Converts this LatLngBounds to a string.
LatLngBounds
  
union(other:LatLngBounds):void
Extends this bounds to contain the union of this and the given bounds.
LatLngBounds
Constructor detail
LatLngBounds()constructor
public function LatLngBounds(opt_sw:LatLng = null, opt_ne:LatLng = null)

Constructs a LatLngBounds from two LatLng instances, holding the SW extent and NE extent, respectively. A LatLngBounds instance represents a rectangle in geographical coordinates, including one that crosses the 180 degrees meridian.

Parameters
opt_sw:LatLng (default = null) — South-west corner (optional).
 
opt_ne:LatLng (default = null) — North-east corner (optional).

Example
   var bounds:LatLngBounds = new LatLngBounds(
       new LatLng(10, 50),   // spans 1 degree latitude
       new LatLng(11, 52));  // and 2 degrees longitude

Method detail
clone()method
public function clone():LatLngBounds

Creates a clone of this instance.

Returns
LatLngBounds — Clone of this instance.
containsBounds()method 
public function containsBounds(other:LatLngBounds):Boolean

Returns true if this bounds completely contains the given bounds.

Parameters
other:LatLngBounds — Contained LatLngBounds.

Returns
Boolean — true if this contains other.

Example
   var bounds:LatLngBounds = new LatLngBounds(
       new LatLng(10, 50), new LatLng(20, 70));
   trace(bounds.containsBounds(
       new LatLngBounds(
           new LatLng(11, 12), new LatLng(52, 68)));  // outputs true

containsLatLng()method 
public function containsLatLng(point:LatLng):Boolean

Returns true if the given lat/lng is in this bounds.

Parameters
point:LatLng — Test point.

Returns
Boolean — true if this contains point.

Example
   var bounds:LatLngBounds = new LatLngBounds(
       new LatLng(10, 50),
       new LatLng(20, 70));
   trace(bounds.containsLatLng(new LatLng(15, 51)));  // outputs true
   trace(bounds.containsLatLng(new LatLng(29, 51)));  // outputs false

equals()method 
public function equals(other:LatLngBounds):Boolean

Returns true if this bounds equals the given bound, allowing for numerical rounding errors.

Parameters
other:LatLngBounds — LatLngBounds against which to compare.

Returns
Boolean — true if this is equal to other.
extend()method 
public function extend(point:LatLng):void

Extends this bounds to contain the given point.

Parameters
point:LatLng — Point to add.

Example
   var bounds:LatLngBounds = new LatLngBounds(
       new LatLng(1, 5), new LatLng(2, 7));
   bounds.extend(new LatLng(0, 9));
   trace(bounds.toString());  // outputs "((0, 5), (2, 9))"

getCenter()method 
public function getCenter():LatLng

Computes the center of this LatLngBounds

Returns
LatLng — Center of bounds.

Example
   var bounds:LatLngBounds = new LatLngBounds(
       new LatLng(10, 50),
       new LatLng(20, 70));
   trace(bounds.getCenter());  // outputs "(15, 60)"

getEast()method 
public function getEast():Number

Returns the east longitude of this bounds.

Returns
Number — East longitude.
getNorth()method 
public function getNorth():Number

Returns the north latitude of this bounds.

Returns
Number — North latitude.
getNorthEast()method 
public function getNorthEast():LatLng

Returns the north-east corner of this bounds.

Returns
LatLng — North-east corner.
getNorthWest()method 
public function getNorthWest():LatLng

Returns the north-west corner of this bounds.

Returns
LatLng — North-west corner.
getSouth()method 
public function getSouth():Number

Returns the south latitude of this bounds.

Returns
Number — South latitude.
getSouthEast()method 
public function getSouthEast():LatLng

Returns the south-east corner of this bounds.

Returns
LatLng — South-east corner.
getSouthWest()method 
public function getSouthWest():LatLng

Returns the south-west corner of this bounds.

Returns
LatLng — South-west corner.
getWest()method 
public function getWest():Number

Returns the west longitude of this bounds.

Returns
Number — West longitude.
intersects()method 
public function intersects(other:LatLngBounds):Boolean

Returns true if this bounds shares any points with this bounds.

Parameters
other:LatLngBounds — Test LatLngBounds.

Returns
Boolean — true if this intersects other.
isEmpty()method 
public function isEmpty():Boolean

Returns true if the bounds are empty.

Returns
Boolean — true if this bounds is empty.
isFullLat()method 
public function isFullLat():Boolean

Returns true if the bounds cover all latitudes.

Returns
Boolean — true if this bounds covers all latitudes.
isFullLng()method 
public function isFullLng():Boolean

Returns true if the bounds cover all longitudes.

Returns
Boolean — true if this bounds covers all longitudes.
isLargerThan()method 
public function isLargerThan(other:LatLngBounds):Boolean

Returns true if this bounds is larger than (could contain) the other.

Parameters
other:LatLngBounds

Returns
Boolean — true if this is larger than other.
toSpan()method 
public function toSpan():LatLng

Converts the given map bounds to a lat/lng span.

Returns
LatLng — Span of this bound.

Example
   var bounds:LatLngBounds = new LatLngBounds(
       new LatLng(10, 50), new LatLng(20, 70));
   trace(bounds.toSpan());  // outputs "(10, 20)"

toString()method 
public function toString():String

Converts this LatLngBounds to a string.

Returns
String — This LatLngBounds as a string.

Example
   var bounds:LatLngBounds = new LatLngBounds(
       new LatLng(1, 5),
       new LatLng(2, 7));
   trace(bounds.toString());  // outputs "((1, 5), (2, 7))"

union()method 
public function union(other:LatLngBounds):void

Extends this bounds to contain the union of this and the given bounds.

Parameters
other:LatLngBounds — LatLngBounds to union with.

Example
   var bounds:LatLngBounds = new LatLngBounds(
       new LatLng(0, 0), new LatLng(1, 1));
   bounds.union(
       new LatLngBounds(
           new LatLng(10, 20), new LatLng(15, 22)));
   trace(bounds.toString());  // outputs "((0, 0), (15, 22))"