com.google.gwt.maps.client.geom
Class LatLngBounds

java.lang.Object
  extended by com.google.gwt.core.client.JavaScriptObject
      extended by com.google.gwt.maps.client.geom.LatLngBounds

public class LatLngBounds
extends com.google.gwt.core.client.JavaScriptObject

Represents a rectangle in geographical coordinates, including one that crosses the 180 degrees meridian.


Constructor Summary
protected LatLngBounds()
           
 
Method Summary
 boolean contains(LatLng coordinate)
          Deprecated. See containsLatLng(LatLng)
 boolean containsBounds(LatLngBounds other)
          Returns true if the passed rectangle is contained within this rectangle.
 boolean containsLatLng(LatLng coordinate)
          Returns true iff the geographical coordinates of the point lie within this rectangle.
 void extend(LatLng coordinate)
          Returns a new rectangle such that it contains the given point.
 LatLng getCenter()
          Returns the point at the center of the rectangle.
 LatLng getNorthEast()
          Returns the point at the north-east corner of the rectangle.
 LatLng getSouthWest()
          Returns the point at the south-west corner of the rectangle.
 boolean intersects(LatLngBounds other)
          Returns true if the specified rectangle intersects this rectangle.
 boolean isEmpty()
          Returns true if this rectangle is empty.
 boolean isFullLatitude()
          Returns true if this rectangle extends from the south pole to the north pole.
 boolean isFullLongitude()
          Returns true if this rectangle extends fully around the earth in the longitude direction.
static LatLngBounds newInstance()
          Construct a new LatLngBounds object.
static LatLngBounds newInstance(LatLng southWest, LatLng northEast)
          Construct a new LatLngBounds object by specifying two opposite corners.
 LatLng toSpan()
          Returns a LatLng whose coordinates represent the size of this rectangle.
 
Methods inherited from class com.google.gwt.core.client.JavaScriptObject
cast, createArray, createFunction, createObject, equals, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LatLngBounds

protected LatLngBounds()
Method Detail

newInstance

public static LatLngBounds newInstance()
Construct a new LatLngBounds object. The bounds will be the maximum for the map.


newInstance

public static LatLngBounds newInstance(LatLng southWest,
                                       LatLng northEast)
Construct a new LatLngBounds object by specifying two opposite corners.

Parameters:
southWest - the south-west corner of the bounds to create.
northEast - the north-east corner of the bounds to create.

contains

@Deprecated
public final boolean contains(LatLng coordinate)
Deprecated. See containsLatLng(LatLng)

Tests the specified point to see if it is contained within the range of this bounds object.

Parameters:
coordinate - point to compare.
Returns:
true if the specified point is contained within the range of this bounds object.

containsBounds

public final boolean containsBounds(LatLngBounds other)
Returns true if the passed rectangle is contained within this rectangle.

Parameters:
other - bounds to compare.
Returns:
true if the geographical coordinates of the bounds lie within this rectangle.

containsLatLng

public final boolean containsLatLng(LatLng coordinate)
Returns true iff the geographical coordinates of the point lie within this rectangle.

Parameters:
coordinate - point to compare
Returns:
true if the geographical coordinates of the point lie within this rectangle.

extend

public final void extend(LatLng coordinate)
Returns a new rectangle such that it contains the given point. In longitude direction, it is created in the smaller of the two possible ways. If both are equal, it is created at the eastern boundary.

Parameters:
coordinate - coordinate to use in creating the new LatLngBounds object.

getCenter

public final LatLng getCenter()
Returns the point at the center of the rectangle.

Returns:
the point at the center of the rectangle.

getNorthEast

public final LatLng getNorthEast()
Returns the point at the north-east corner of the rectangle.

Returns:
the point at the north-east corner of the rectangle.

getSouthWest

public final LatLng getSouthWest()
Returns the point at the south-west corner of the rectangle.

Returns:
the point at the south-west corner of the rectangle.

intersects

public final boolean intersects(LatLngBounds other)
Returns true if the specified rectangle intersects this rectangle.

Parameters:
other - the rectangle to compare.
Returns:
true if the specified rectangle intersects this rectangle.

isEmpty

public final boolean isEmpty()
Returns true if this rectangle is empty.

Returns:
true if this rectangle is empty.

isFullLatitude

public final boolean isFullLatitude()
Returns true if this rectangle extends from the south pole to the north pole.

Returns:
true if this rectangle extends from the south pole to the north pole.

isFullLongitude

public final boolean isFullLongitude()
Returns true if this rectangle extends fully around the earth in the longitude direction.

Returns:
true if this rectangle extends fully around the earth in the longitude direction.

toSpan

public final LatLng toSpan()
Returns a LatLng whose coordinates represent the size of this rectangle.

Returns:
a LatLng whose coordinates represent the size of this rectangle.