概览
GMSMutablePath是 CLLocationCoordinate2D 的动态(可调整大小)数组。
所有坐标都必须有效。GMSMutablePath是不可变GMSPath的可变项。
继承 GMSPath。
公开成员函数 | |
(void) | - addCoordinate: |
在路径末尾添加 coord 。 | |
(void) | - addLatitude:经度: |
添加具有指定纬度/经度的新 CLLocationCoordinate2D 实例。 | |
(void) | - insertCoordinate:atIndex: |
在 index 插入 coord 。 | |
(void) | - replaceCoordinateAtIndex:withCoordinate: |
将 index 中的坐标替换为 coord 。 | |
(void) | - removeCoordinateAtIndex: |
移除 index 中的条目。 | |
(void) | - removeLastCoordinate |
删除路径的最后一个坐标。 | |
(void) | - removeAllCoordinates |
移除此路径中的所有坐标。 | |
(ID) | - initWithPath: |
使用另一个 GMSPath 的内容初始化新分配的路径。 | |
(NSUInteger) | - count 个 |
获取路径大小。 | |
(CLLocationCoordinate2D) | - CoordinateAtIndex: |
如果 index >= count,则返回 kCLLocationCoordinate2DInvalid。 | |
(NSString *) | - encodedPath |
以上述格式返回路径的编码字符串。 | |
(实例类型) | - pathOffsetByLatitude:经度: |
返回将 deltaLatitude 和 deltaLongitude 添加到当前路径的每个坐标后获取的新路径。 | |
(双精度) | - segmentsForLength:kind:: |
返回路径中与 length 对应的分数(根据 kind 解释)。 | |
(CLLocationDistance) | - lengthOfKind: |
根据 kind 返回路径的长度。 | |
静态公共成员函数 | |
(实例类型) | + 路径 |
适用于空路径的便捷构造函数。 | |
(可为 null 的实例类型) | + pathFromEncodedPath: |
初始化 encodedPath 中新分配的路径。 |
成员函数文档
- (void) addCoordinate: | (CLLocationCoordinate2D) | 坐标 |
在路径末尾添加 coord
。
- (void) addLatitude: | (CLLocationDegrees) | latitude | |
经度: | (CLLocationDegrees) | 经度 | |
添加具有指定纬度/经度的新 CLLocationCoordinate2D 实例。
- (void) insertCoordinate: | (CLLocationCoordinate2D) | 坐标 | |
atIndex: | (NSUInteger) | 索引 | |
在 index
插入 coord
。
如果这小于路径大小,则会将所有坐标向前移动 1 个。否则,表现为 replaceCoordinateAtIndex:withCoordinate:。
- (void) replaceCoordinateAtIndex: | (NSUInteger) | 索引 | |
withCoordinate: | (CLLocationCoordinate2D) | 坐标 | |
将 index
中的坐标替换为 coord
。
如果 index
位于末尾,则使用未定义坐标来扩展数组。
-(无效)removeCoordinateAtIndex: | (NSUInteger) | 索引 |
移除 index
中的条目。
如果 index
< 则减小大小。如果 index
>= count,则该操作为静默空操作。
-(无效)removeLastCoordinate |
删除路径的最后一个坐标。
如果该数组的大小是非空的,并且大小为空。如果数组为空,则表示静默空操作。
-(无效)removeAllCoordinates |
移除此路径中的所有坐标。
+(实例类型)path |
适用于空路径的便捷构造函数。
- (id) initWithPath: | (GMSPath *) | path |
使用另一个 GMSPath 的内容初始化新分配的路径。
- (NSUInteger) count |
获取路径大小。
- (CLLocationCoordinate2D) CoordinateAtIndex: | (NSUInteger) | 索引 |
如果 index
>= count,则返回 kCLLocationCoordinate2DInvalid。
+(可为 null 的实例类型)pathFromEncodedPath: | (NSString *) | encodedPath |
初始化 encodedPath
中新分配的路径。
如需了解此格式,请访问:https://developers.google.com/maps/documentation/tools/polylinealgorithm
- (NSString *) encodedPath |
以上述格式返回路径的编码字符串。
- (instancetype) pathOffsetByLatitude: | (CLLocationDegrees) | deltaLatitude | |
经度: | (CLLocationDegrees) | deltaLongitude | |
返回将 deltaLatitude
和 deltaLongitude
添加到当前路径的每个坐标后获取的新路径。
不会修改当前路径。
- (double) segmentsForLength: | (CLLocationDistance) | 时长 | |
kind: | (GMSLengthKind) | 种类 | |
返回路径中与 length
对应的分数(根据 kind
解释)。
请参阅 GMSLengthKind。
- (CLLocationDistance) lengthOfKind: | (GMSLengthKind) | 种类 |
根据 kind
返回路径的长度。
请参阅 GMSLengthKind。