new GeofenceManager()
Geofence管理中心
方法列表
(static) add(region, options)
添加一个监控区域
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
region |
Region | 区域 | |||||||||||||||
options |
Object | 选项
Properties
|
Returns:
GGeofence.Geofence
Example
GGeofence.GeofenceManager.add(
new GGeofence.CircleRegion('la', [116.39, 39.9], 1e5),
{
dwellDelay:3600000
}
);
(static) all() → {Array}
获取所有监控区域
Returns:
- Type
- Array
Example
GGeofence.GeofenceManager.all();
(static) clear()
清除所有监控区域
Returns:
Example
GGeofence.GeofenceManager.clear();
(static) clearVisitors()
清除所有被监控对象
Returns:
Example
GGeofence.GeofenceManager.clearVisitors();
(static) get(id)
根据id获取某个监控区域
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | 监控区域的id |
Returns:
GGeofence.Geofence
Example
GGeofence.GeofenceManager.id(1);
(static) query(extent) → {Array}
根据范围查询监控区域
Parameters:
Name | Type | Description |
---|---|---|
extent |
Array | 矩形范围,格式为[xmin, ymin, xmax, ymax] |
Returns:
- Type
- Array
Example
GGeofence.GeofenceManager.query([116.3, 39.9, 116.4, 40]);
(static) removeVisitor(id)
移除被监控对象
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | String | 被监控对象的唯一标识 |
Returns:
Example
GGeofence.GeofenceManager.removeVisitor(1);
(static) updateVisitor(id, loc, tol可选)
更新被监控对象的位置
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
id |
Number | String | 被监控对象的唯一标识 | ||
loc |
Array | 被监控对象的位置 | ||
tol |
Number |
<optional> |
0 | 被监控对象的位置容差,单位米,如果设置容差5米,则对象位置变化小于5米的情况下不进行计算 |
Returns:
Example
GGeofence.GeofenceManager.updateVisitor(1, [116.39, 39.9]);
事件列表
geofenceDwell
停留事件
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
geofence |
Geofence | 事件相关的监控区域 |
visitor |
Visitor | 事件相关的被监控对象 |
geofenceEnter
进入事件
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
geofence |
Geofence | 事件相关的监控区域 |
visitor |
Visitor | 事件相关的被监控对象 |
geofenceLeave
离开事件
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
geofence |
Geofence | 事件相关的监控区域 |
visitor |
Visitor | 事件相关的被监控对象 |