Overview
GMSMutablePath is a dynamic (resizable) array of CLLocationCoordinate2D.
All coordinates must be valid. GMSMutablePath is the mutable counterpart to the immutable GMSPath.
Inherits GMSPath.
Public Member Functions | |
(void) | - addCoordinate: |
Adds coord at the end of the path. | |
(void) | - addLatitude:longitude: |
Adds a new CLLocationCoordinate2D instance with the given lat/lng. | |
(void) | - insertCoordinate:atIndex: |
Inserts coord at index . | |
(void) | - replaceCoordinateAtIndex:withCoordinate: |
Replace the coordinate at index with coord . | |
(void) | - removeCoordinateAtIndex: |
Remove entry at index . | |
(void) | - removeLastCoordinate |
Removes the last coordinate of the path. | |
(void) | - removeAllCoordinates |
Removes all coordinates in this path. | |
(id) | - initWithPath: |
Initializes a newly allocated path with the contents of another GMSPath. | |
(NSUInteger) | - count |
Get size of path. | |
(CLLocationCoordinate2D) | - coordinateAtIndex: |
Returns kCLLocationCoordinate2DInvalid if index >= count. | |
(NSString *) | - encodedPath |
Returns an encoded string of the path in the format described above. | |
(instancetype) | - pathOffsetByLatitude:longitude: |
Returns a new path obtained by adding deltaLatitude and deltaLongitude to each coordinate of the current path. | |
(double) | - segmentsForLength:kind: |
Returns the fractional number of segments along the path that correspond to length , interpreted according to kind . | |
(CLLocationDistance) | - lengthOfKind: |
Returns the length of the path, according to kind . | |
Static Public Member Functions | |
(instancetype) | + path |
Convenience constructor for an empty path. | |
(nullable instancetype) | + pathFromEncodedPath: |
Initializes a newly allocated path from encodedPath . |
Member Function Documentation
- (void) addCoordinate: | (CLLocationCoordinate2D) | coord |
Adds coord
at the end of the path.
- (void) addLatitude: | (CLLocationDegrees) | latitude | |
longitude: | (CLLocationDegrees) | longitude | |
Adds a new CLLocationCoordinate2D instance with the given lat/lng.
- (void) insertCoordinate: | (CLLocationCoordinate2D) | coord | |
atIndex: | (NSUInteger) | index | |
Inserts coord
at index
.
If this is smaller than the size of the path, shifts all coordinates forward by one. Otherwise, behaves as replaceCoordinateAtIndex:withCoordinate:.
- (void) replaceCoordinateAtIndex: | (NSUInteger) | index | |
withCoordinate: | (CLLocationCoordinate2D) | coord | |
Replace the coordinate at index
with coord
.
If index
is after the end, grows the array with an undefined coordinate.
- (void) removeCoordinateAtIndex: | (NSUInteger) | index |
Remove entry at index
.
If index
< count decrements size. If index
>= count this is a silent no-op.
- (void) removeLastCoordinate |
Removes the last coordinate of the path.
If the array is non-empty decrements size. If the array is empty, this is a silent no-op.
- (void) removeAllCoordinates |
Removes all coordinates in this path.
+ (instancetype) path |
Convenience constructor for an empty path.
- (id) initWithPath: | (GMSPath *) | path |
Initializes a newly allocated path with the contents of another GMSPath.
- (NSUInteger) count |
Get size of path.
- (CLLocationCoordinate2D) coordinateAtIndex: | (NSUInteger) | index |
Returns kCLLocationCoordinate2DInvalid if index
>= count.
+ (nullable instancetype) pathFromEncodedPath: | (NSString *) | encodedPath |
Initializes a newly allocated path from encodedPath
.
This format is described at: https://developers.google.com/maps/documentation/utilities/polylinealgorithm
- (NSString *) encodedPath |
Returns an encoded string of the path in the format described above.
- (instancetype) pathOffsetByLatitude: | (CLLocationDegrees) | deltaLatitude | |
longitude: | (CLLocationDegrees) | deltaLongitude | |
Returns a new path obtained by adding deltaLatitude
and deltaLongitude
to each coordinate of the current path.
Does not modify the current path.
- (double) segmentsForLength: | (CLLocationDistance) | length | |
kind: | (GMSLengthKind) | kind | |
Returns the fractional number of segments along the path that correspond to length
, interpreted according to kind
.
See GMSLengthKind.
- (CLLocationDistance) lengthOfKind: | (GMSLengthKind) | kind |
Returns the length of the path, according to kind
.
See GMSLengthKind.