TencentLBSGeofencePolygonRegion Class Reference
| Inherits from | TencentLBSGeofenceRegion : NSObject |
|---|---|
| Declared in | TencentLBSGeofenceRegion.h |
Overview
多边形地理围栏区域,由一组或多组顶点坐标定义。 顶点按顺序连接形成闭合多边形,每个子多边形最少需要 3 个顶点。 支持多多边形区域(如行政区划中的飞地),通过 polygons 属性访问所有子多边形。
polygons
所有子多边形的坐标数组。
数组中每个元素为一个子多边形的顶点数组(NSArray
@property (nonatomic, copy, readonly) NSArray<NSArray<NSValue*> *> *polygonsDiscussion
所有子多边形的坐标数组。
数组中每个元素为一个子多边形的顶点数组(NSArray
Note: containsCoordinate: 和 distanceToBoundaryFromCoordinate: 会同时考虑所有子多边形。 当两个 polygon 重叠时,重叠区域不属于本区域(飞地语义)。
Declared In
TencentLBSGeofenceRegion.h
– initWithCoordinates:identifier:
创建单多边形围栏区域
- (nullable instancetype)initWithCoordinates:(NSArray<NSValue*> *)coordinates identifier:(NSString *)identifierParameters
coordinates |
多边形顶点坐标数组,数组中的元素为 NSValue 包装的 CLLocationCoordinate2D。最少需要 3 个顶点,且各顶点坐标须为有效经纬度 |
|---|---|
identifier |
围栏的唯一标识符,不能为 nil 或空字符串 |
Return Value
多边形围栏实例,参数无效时返回 nil
Discussion
创建单多边形围栏区域
Declared In
TencentLBSGeofenceRegion.h
– initWithPolygons:identifier:
创建多多边形围栏区域(支持飞地等复合区域)
- (nullable instancetype)initWithPolygons:(NSArray<NSArray<NSValue*> *> *)polygons identifier:(NSString *)identifierParameters
polygons |
多边形数组,每个元素为一个子多边形的顶点坐标数组(NSArray |
|---|---|
identifier |
围栏的唯一标识符,不能为 nil 或空字符串 |
Return Value
多边形围栏实例,参数无效时返回 nil
Discussion
创建多多边形围栏区域(支持飞地等复合区域)
Declared In
TencentLBSGeofenceRegion.h
– initWithCCoordinates:count:identifier:
创建单多边形围栏区域(C 数组方式)
- (nullable instancetype)initWithCCoordinates:(const CLLocationCoordinate2D *)coordinates count:(NSUInteger)count identifier:(NSString *)identifierParameters
coordinates |
多边形顶点坐标 C 数组 |
|---|---|
count |
顶点数量,最少需要 3 个顶点 |
identifier |
围栏的唯一标识符,不能为 nil 或空字符串 |
Return Value
多边形围栏实例,参数无效时返回 nil
Discussion
创建单多边形围栏区域(C 数组方式)
Declared In
TencentLBSGeofenceRegion.h