new fengmap.FMNavigation(options)
| Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
json |
|
Members
-
endMarker
-
结束点所使用的FMImageMarker对象
Properties:
Name Type Description endMarkerfengmap.FMImageMarker -
locationMarker
-
导航所用到的FMLocationMarker对象
Properties:
Name Type Description locationMarkerfengmap.FMLocationMarker -
readonlynaviDescriptions
-
得到此本次导航路径的文字描述字符串集合。
Properties:
Name Type Description naviDescriptionsarray -
readonlynaviDescriptionsData
-
路径描述的json数组, 用户可以根据里面的数据, 自己组织描述语言。
Properties:
Name Type Description naviDescriptionsDatanaviDescriptionsData[].distancenumber 当前路段的距离。
naviDescriptionsData[].startDirectionnumber 起点的地理方向。
naviDescriptionsData[].startGIDnumber 起点的楼层。
naviDescriptionsData[].startIndexnumber 起点路线节点索引。
naviDescriptionsData[].startPointjson 起点坐标。
naviDescriptionsData[].endDirectionnumber 终点行进方向。
naviDescriptionsData[].endGIDnumber 终点楼层。
naviDescriptionsData[].endIndexnumber 终点路线节点索引。
naviDescriptionsData[].endPointjson 终点坐标。
-
readonlynaviDistance
-
得到此导航路径的总距离
Properties:
Name Type Description naviDistancenumber -
readonlynaviGroupsDistance
-
路径所经过层对应在各楼层的距离, 按照起终点路径顺序存储。
Properties:
Name Type Description naviGroupsDistancejson数组。
naviDescriptionDatas[].groupIDnumber 楼层ID。
naviDescriptionDatas[].distancenumber 路线距离。
-
naviToDoor
-
导航是否到达门点停止
Properties:
Name Type Description naviToDoorboolean -
startMarker
-
起始点所使用的FMImageMarker对象
Properties:
Name Type Description startMarkerfengmap.FMImageMarker
Methods
-
AdaptiveLineOverview()
-
自适应路线全览
-
clearAll()
-
清空导航类中的起始点标注, 定位标注及当前路线标注。
-
clearLocationMarker()
-
清除定位标注。
-
clearMarkers()
-
清空导航类中的起始点标注。
-
clearNaviLine()
-
清除上次调用drawNaviLine绘制的导航线。
-
dispose()
-
释放fengmap.Map对象引用和内存占用。
-
drawNaviLine(){fengmap.FMLineMarker}
-
设置完起始点后, 如果路径规划成功, 调用此方法画出导航线。autoRoute为false时, 需要在画线之前主动调用route方法。autoClearNaviLine为true, 清除上次绘制的导航线。
Returns:
Type Description fengmap.FMLineMarker 返回当前绘制的线对象 -
focusNaviLineSegment(index, options)
-
地图显示范围聚焦到索引为值等于index的路段, 路段信息来至于naviDescriptionsData。
Name Type Description indexint 路段下标
optionsjson 聚焦参数
Name Type Description durationnumber 聚焦时的过渡动画效果设置
extendScalenumber 聚焦范围的比例尺放大缩小比例, 默认为1.3, 当数字大于1时比例尺变大, 聚焦后地图显示会缩小。小于1地图则会看起来更大。
callbackfunction 聚焦完成后的事件回调
-
getRouteDescriptions(navResults, params){json}
-
得到路径规划后的文字描述
Name Type Description navResults路径计算结果FMNaviResult数组, 可以不传入该参数。如果未传入该参数, 则使用上次analyzeNavi计算结果进行计算。
paramsjson 路径描述信息计算参数。
Name Type Description directionAssertnumber 正方向的断定阀值, 默认为10。表示路段前行方向的方位角如果落在八个地理方向中某个的左右10度范围内, 则路段的正方向为这个方向。方向有: "东"、"西"、"南"、"北"、"东南"、"东北"、"西南"、"西北"。
combineAssetnumber 相邻路段是否存在拐角的判断阈值, 默认值为5。表示如果相邻路段的夹角小于5度, 那么不认为存在拐角, 会合并为一段路段。
naviLanguagefengmap.FMLanguageType 文字描述内容的语言类型参数, 默认为中文。 目前支持中英文。
Returns:
Type Description json { naviDescriptions: // 路径的文字描述数组 [str, str , ...] naviDescriptionsData: // 路径的描述数据,用户可以用此数据自己组织描述文字 [json, json, ...] naviDistance: // 路径总长度, 单位米。 naviGroupsDistance: // 每一层的路径长度。 } -
locate(coord, angle)
-
用于真实导航, 设置定位系统所返回的真实定位坐标, 内部自动路径约束, 同时触发walking事件, walking事件中返回如下结果: {remain: 到终点的剩余距离, walk: 已经走过的距离, distanceToNext: 是下一个转角处的距离, angle: 当前路线与正北方向的角度, index: 当前路段的索引, point: 路径约束后的点, groupID, 当前的楼层id}
Name Type Description coordjson 定位系统返回并经过坐标转换后的地图坐标点如:{x:,y:,groupID:1}
anglenumber optional 角度值, 如:45,可选
-
locateNoConstraint(coord, angle)
-
用于真实导航, 设置定位系统所返回的真实定位坐标, 内部无路径约束, 同时触发walking事件, walking事件中返回如下结果: {remain: 到终点的剩余距离, walk: 已经走过的距离, distanceToNext: 是下一个转角处的距离, angle: 当前路线与正北方向的角度, index: 当前路段的索引, point: 路径约束后的点, groupID, 当前的楼层id} 此方法与locate的区别为使用未约束的定位原始坐标显示定位位置, 内部仍会进行约束计算。
Name Type Description coordjson 定位系统返回并经过坐标转换后的地图坐标点如:{x:,y:,groupID:1}
anglenumber optional 角度值, 如: 45,可选参数。
-
naviConstraint(coord){json}
-
在路径规划完成后,得到当前实际的定位点与路径上的最近点及与这个点之间的距离
Name Type Description coordjson {x: ,y: , groupID: }
Returns:
Type Description json {coord: , distance:, index:, remain, angle} coord: 垂点的坐标 {x:, y:, groupID}, distance: 指定点与垂点的距离, index: 当前的点所在的线段索引,返回-1时表示约束失败,位置点无法正确到达规划路线。 remain: 导航的剩余距离, angle: 所在路段与正北方向的角度值 -
off(type, callback)
-
导航事件销毁
Name Type Description typestring 支持'walking'、'crossGroup'、'complete'。
callbackfunction 事件回调函数
-
on(type, callback)
-
导航事件注册 同一事件支持多次绑定
Name Type Description typestring 支持'walking'、'crossGroup'、'complete'。
callbackfunction 事件回调函数
-
pathConstraint(coord, roadRanks){json}
-
全路网路径约束
Name Type Description coordjson {x: ,y: , groupID: }
roadRanksarray [number]
Returns:
Type Description json {coord: , distance:, road:, angle} coord: 垂点的坐标 {x:, y:, groupID}, distance: 指定点与垂点的距离, road: 当前的点所在路段, angle: 所在路段与正北方向的角度值 -
pause()
-
暂停模拟导航
-
resume()
-
恢复模拟导航
-
route(mode, priority)
-
路径规划计算方法, 在autoRoute为false时, 设置起终点后需要调用该方法进行路径规划计算。
Name Type Description modefengmap.FMNaviMode 导航中路径规划模式, 支持最短路径、最优路径两种。默认为MODULE_SHORTEST, 最短路径。
priorityfengmap.FMNaviPriority 导航中的路线规划梯类优先级, 默认为PRIORITY_DEFAULT, 详情参考FMNaviPriority。
-
setEndPoint(data, noMarker){fengmap.FMImageMarker}
-
设置终点
Name Type Description datajson 导航终点参数对象。
Name Type Description xnumber 终点地图坐标X。
ynumber 终点地图坐标Y。
groupIDnumber 终点楼层groupID。
heightnumber 终点地图坐标距离楼层地面的高度. 如果不设置该属性, 使用FMNavigaiton的属性imageMarkerHeight。
urlstring 终点标注图片路径, 如不设置, 且使用之前设置的图片, 只是设置其位置。
sizenumber 终点标注图片大小。
callbackfunction 终点图片标注添加成功回调。
noMarkerbool 标记是否生成Marker对象, true:不生成图片标注, false:生成图片标注,默认false
Returns:
Type Description fengmap.FMImageMarker 返回添加成功的FMImageMarker对象, noMarker为true, 返回null。 -
setLineStyle(路径线线型设置,)
-
设置当前绘制的导航线样式
Name Type Description 路径线线型设置,json 详细内容参照 fengmap.FMMap#drawLineMark 参数lineStyle 说明。
-
setNaviLanguage(lan)
-
设置当前导航中的文字描述语言类型。
Name Type Description lanfengmap.FMLanguageType 目前支持中英文。如果路径规划成功, 会自动更新naviDescriptions和naviDescriptionDatas数据。
-
setStartPoint(data, noMarker){fengmap.FMImageMarker}
-
设置起点
Name Type Description datajson 导航起点参数对象。
Name Type Description xnumber 起点地图坐标X。
ynumber 起点地图坐标Y。
groupIDnumber 起点楼层groupID。
heightnumber 起点地图坐标距离楼层地面的高度. 如果不设置该属性, 使用FMNavigaiton的属性imageMarkerHeight。
urlstring 起点标注图片路径, 如不设置, 且使用之前设置的图片, 只是设置其位置。
sizenumber 起点标注图片大小。
callbackfunction 起点图片标注添加成功回调。
noMarkerbool 标记是否生成Marker对象, true:不生成图片标注, false:生成图片标注,默认false
Returns:
Type Description fengmap.FMImageMarker 返回添加成功的FMImageMarker对象, noMarker为true, 返回null。 -
simulate()
-
设置完起始点后, 开始模拟导航, 调用此方法会自动画线, 不需要在调用drawNaviLine方法。
-
stop()
-
停止模拟导航
Events
-
complete
-
模拟导航结束事件, 真实导航不会触发该事件。需要开发者根据waliking事件的返回内容, 进行业务处理。
Type:
- void
-
crossGroup
-
模拟导航中的跨层事件
Type:
- number
Properties:
Name Type Description groupIdnumber 当前楼层goupID.
-
walking
-
导航过程中位置发生变化时触发的事件, 模拟导航与真实导航调用locate后都都会触发。
Type:
- json
Properties:
Name Type Description walknumber 已经走过的距离。
remainnumber 到终点的剩余距离。
distancenumber 定位点的路线偏移距离。
distanceToNextnumber 到下一个转角处的距离。
anglenumber 当前路线与正北方向的角度。
pointjson 导航约束后的点。
groupIDnumber 当前的楼层id。
indexnumber 当前路段的索引。