GMSCoordinateBounds Class Reference

GMSCoordinateBounds Class Reference

Overview

GMSCoordinateBounds represents a rectangular bounding box on the Earth's surface.

GMSCoordinateBounds is immutable and can't be modified after construction.

Public Member Functions

(id) - initWithCoordinate:coordinate:
 Inits the northEast and southWest bounds corresponding to the rectangular region defined by the two corners.
(GMSCoordinateBounds *) - includingCoordinate:
 Returns a GMSCoordinateBounds representing the current bounds extended to include the passed-in coordinate.
(GMSCoordinateBounds *) - includingBounds:
 Returns a GMSCoordinateBounds representing the current bounds extended to include the entire other bounds.
(BOOL) - containsCoordinate:
 Returns YES if coordinate is contained within this bounds.
(BOOL) - intersectsBounds:
 Returns YES if other overlaps with this bounds.
(id) - initWithRegion:
 Inits with bounds that encompass region.
(id) - initWithPath:
 Inits with bounds that encompass path.
(GMSCoordinateBounds *) - includingPath:
 Returns a GMSCoordinateBounds representing the current bounds extended to include path.

Properties

CLLocationCoordinate2D northEast
 The North-East corner of these bounds.
CLLocationCoordinate2D southWest
 The South-West corner of these bounds.
BOOL valid
 Returns NO if this bounds does not contain any points.

Member Function Documentation

- (id) initWithCoordinate: (CLLocationCoordinate2D)  coord1
coordinate: (CLLocationCoordinate2D)  coord2 

Inits the northEast and southWest bounds corresponding to the rectangular region defined by the two corners.

It is ambiguous whether the longitude of the box extends from coord1 to coord2 or vice-versa; the box is constructed as the smaller of the two variants, eliminating the ambiguity.

- (GMSCoordinateBounds *) includingCoordinate: (CLLocationCoordinate2D)  coordinate

Returns a GMSCoordinateBounds representing the current bounds extended to include the passed-in coordinate.

If the current bounds is invalid, the result is a valid bounds containing only coordinate.

Returns a GMSCoordinateBounds representing the current bounds extended to include the entire other bounds.

If the current bounds is invalid, the result is a valid bounds equal to other.

- (BOOL) containsCoordinate: (CLLocationCoordinate2D)  coordinate

Returns YES if coordinate is contained within this bounds.

This includes points that lie exactly on the edge of the bounds.

- (BOOL) intersectsBounds: (GMSCoordinateBounds *)  other

Returns YES if other overlaps with this bounds.

Two bounds are overlapping if there is at least one coordinate point contained by both.

- (id) initWithRegion: (GMSVisibleRegion region

Inits with bounds that encompass region.

- (id) initWithPath: (GMSPath *)  path

Inits with bounds that encompass path.

Returns a GMSCoordinateBounds representing the current bounds extended to include path.


Property Documentation

- (CLLocationCoordinate2D) northEast [read, assign]

The North-East corner of these bounds.

- (CLLocationCoordinate2D) southWest [read, assign]

The South-West corner of these bounds.

- (BOOL) valid [read, assign]

Returns NO if this bounds does not contain any points.

For example, [[GMSCoordinateBounds alloc] init].valid == NO.

When an invalid bounds is expanded with valid coordinates via includingCoordinate: or includingBounds:, the resulting bounds will be valid but contain only the new coordinates.